isis-users mailing list archives

Integration tests: Using different AppManifest + No dependency injection before PostConstruct

Date

Fri, 23 Feb 2018 09:41:34 GMT

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