Hmm, can't reproduce.

Using simpleapp from 1.16.1, I updated the SimpleObjects domain service
(menu/repository) with:

public class SimpleObjects {

    @PostConstruct
    public void init() {
        if(isisJdoSupport == null) {
            throw new
IllegalStateException("SimpleObjects#isisJdoSupport is null !");
        }
    }
    ...

    @javax.inject.Inject
    IsisJdoSupport isisJdoSupport;

}


This seems to run fine both as a webapp and its integration tests pass.

My *guess *is that the module that contains the domain service is not part
of the app manifest.  Make sure that the module you pass specifies the
other modules using either getDependencies() (if they implement Module) or
getModules() (if they don't).

If I'm wrong, perhaps you could create a demo app that shows the problem?


Thx
Dan


On Fri, 23 Feb 2018 at 09:50 Dan Haywood <d...@haywood-associates.co.uk>
wrote:

> 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.deh...@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
>>
>

Reply via email to