isis-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Haywood <...@haywood-associates.co.uk>
Subject Re: Integration tests: Using different AppManifest + No dependency injection before PostConstruct
Date Fri, 23 Feb 2018 09:50:18 GMT
Hi Erik,

All of the Estatio tests use IntegrationTestAbstract3.  A very simple one
is:

https://github.com/estatio/estatio/blob/master/estatioapp/app/src/test/java/org/estatio/module/currency/integtests/CurrencyRepository_IntegTest.java

So does the simpleapp archetype, eg:

https://github.com/apache/isis/blob/master/example/application/simpleapp/module-simple/src/test/java/domainapp/modules/simple/integtests/tests/SimpleObject_IntegTest.java

I'll see if I can reproduce what you're seeing with the dependency
injection issue.

Thx
Dan

On Fri, 23 Feb 2018 at 09:41 Erik de Hair <e.dehair@pocos.nl> wrote:

> Hi,
>
> I can't figure out how to use another AppManifest for integration tests.
> We have to override the HSQLDB-settings because we need to add
> ';sql.syntax_mys=true' to the connection URL for views to be created.
> For now I've just copied IsisSystemBootstrapper to the integtest module
> and changed the connection URL on [1]. The tables and views are created
> correctly but now the PostConstruct methods are executed before the
> dependency injection is processed.
>
> 10:02:17,631  [ServiceInitializer   main       ERROR] @PostConstruct on
> nl.pocos.dom.order.export.OrderConfirmationService#init: failed
> java.lang.NullPointerException
>      at
>
> nl.pocos.dom.order.export.OrderConfirmationService.init(OrderConfirmationService.java:70)
>      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>      at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>      at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>      at java.lang.reflect.Method.invoke(Method.java:498)
>      at
>
> org.apache.isis.core.commons.lang.MethodExtensions.invoke(MethodExtensions.java:53)
>      at
>
> org.apache.isis.core.commons.lang.MethodExtensions.invoke(MethodExtensions.java:47)
>      at
>
> org.apache.isis.core.metamodel.specloader.ServiceInitializer.postConstruct(ServiceInitializer.java:130)
>      at
>
> org.apache.isis.core.runtime.system.session.IsisSessionFactory.constructServices(IsisSessionFactory.java:132)
>      at
>
> org.apache.isis.core.runtime.system.session.IsisSessionFactoryBuilder.buildSessionFactory(IsisSessionFactoryBuilder.java:208)
>      at
>
> org.apache.isis.core.runtime.headless.IsisSystem.initIfRequiredThenOpenSession(IsisSystem.java:237)
>      at
>
> org.apache.isis.core.runtime.headless.IsisSystem.setUpSystem(IsisSystem.java:205)
>      at
>
> org.apache.isis.core.runtime.headless.IsisSystemBootstrapper.setupSystem(IsisSystemBootstrapper.java:159)
>      at
>
> org.apache.isis.core.runtime.headless.IsisSystemBootstrapper.bootstrapUsing(IsisSystemBootstrapper.java:116)
>      at
>
> org.apache.isis.core.runtime.headless.IsisSystemBootstrapper.bootstrapIfRequired(IsisSystemBootstrapper.java:82)
>      at
>
> org.apache.isis.core.runtime.headless.HeadlessWithBootstrappingAbstract.bootstrapAndSetupIfRequired(HeadlessWithBootstrappingAbstract.java:107)
>      at
>
> org.apache.isis.core.integtestsupport.IntegrationTestAbstract3.bootstrapAndSetupIfRequired(IntegrationTestAbstract3.java:167)
>     ...
>
> We're using the IntegrationTestAbstract3 class like this:
>
> public abstract class AbstractPortalIntegTest extends
> IntegrationTestAbstract3 {
>
>      public AbstractPortalIntegTest() {
>          super(new PortalDomainModule());
>      }
>      ...
> }
>
> Is there any example of integtests using IntegrationTestAbstract3? I've
> found one in incode-quickstart-appdefn but that is using an in memory DB
> by default and doesn't override the AppManifest nor
> IsisConfigurationForJdoIntegTests.
>
> Thanks,
> Erik
>
>
> [1]
>
> https://github.com/apache/isis/blob/master/core/runtime/src/main/java/org/apache/isis/core/runtime/headless/IsisSystemBootstrapper.java#L153
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message