From users-return-5965-archive-asf-public=cust-asf.ponee.io@isis.apache.org Fri Feb 23 11:10:21 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id A3F16180652 for ; Fri, 23 Feb 2018 11:10:20 +0100 (CET) Received: (qmail 98448 invoked by uid 500); 23 Feb 2018 10:10:19 -0000 Mailing-List: contact users-help@isis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@isis.apache.org Delivered-To: mailing list users@isis.apache.org Received: (qmail 98432 invoked by uid 99); 23 Feb 2018 10:10:19 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Feb 2018 10:10:19 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 8EBA41A012C for ; Fri, 23 Feb 2018 10:10:18 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.848 X-Spam-Level: ** X-Spam-Status: No, score=2.848 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, KAM_COUK=0.85, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=haywood-associates-co-uk.20150623.gappssmtp.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 9IpQ8lRX43Of for ; Fri, 23 Feb 2018 10:10:14 +0000 (UTC) Received: from mail-io0-f172.google.com (mail-io0-f172.google.com [209.85.223.172]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id F3BAB5F2C2 for ; Fri, 23 Feb 2018 10:10:13 +0000 (UTC) Received: by mail-io0-f172.google.com with SMTP id t22so9289718iob.3 for ; Fri, 23 Feb 2018 02:10:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=haywood-associates-co-uk.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=d+Lq2lxhyuOSGrX5KA/MNGuyeI7IvyJCXDqDtiqxIko=; b=vy7upt0JpVEuv4WFoTT4RB3JLcr3YjrfHhquaV50u4q0Ya0fieoMYl3IWxSPyLWekt fMU6CZ8aqkPdrKVsyNvWDCHqTsxX1mJONjC28zK9RUwOaoGoXqQGFsWn8w+MOhQDqomi 3FPbWC0aQKGfc/SCt4gRXRJ4COU9gdJ6DQmW7M3t1tps0ZLNhxKaibhlreCRRx5aFRMd 6Abb+DSM8I+KOiqgj4KcphUSwVjEAgEa9/Knfwg0oa9t6JLz0dVe4r6qft8/CF9MP1n/ n+7Lwqkm79JS3H49/KSbOUnOakbobyTWLAs96C7hnRIbBT0TySjbAw8cgwxagcdGbXIy V9IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=d+Lq2lxhyuOSGrX5KA/MNGuyeI7IvyJCXDqDtiqxIko=; b=SPqT+6T0F9cqxdCP1cpxw2bvTM+1CLTGBenChIjwXfAwmOpzuB8EwLL5GMY1A7Q/o6 +jBUG7viGPxmKy+GgZlXDKtd5Ur9qdHLPt2V20miSzk8VdMsSk028/O5H5jJuyySOXvt E1559YBjN70mFJE67iFKCMq91L4gF+CGapSfyL1/oq/wZ53XNThP1tpWOwnelfXQ1+3D 1A9POgA9SMaxs+u7TwBCIyHkyxtMyO4Ett4k/Mn53+IHLpa8AsiGqlWiBITAP5zir8GP 1LAKhaUdpQINwy0fEwDZBLTaj35GBDG8txyNYmMZdnMJlTf5wXYt71shITCrWW6jKOpL r7hg== X-Gm-Message-State: APf1xPADnFCzp52Jm3SaaF6k9/W5fChOTwHdrHSRgPEAkS1xQq1AbJN3 /zc/SF3h16pN4GfGcUT0sfLRnbAKraFWzpXZLSrQF+Q2 X-Google-Smtp-Source: AG47ELsmNICSgr6tLSawGSM+phSIyMyfn5eqZqQ1gTLzW+rbsEtqnIlpp6eNpXXtKD+7hiZtGUVCoDdCsfynA5gnIW0= X-Received: by 10.107.200.69 with SMTP id y66mr1148013iof.116.1519380611956; Fri, 23 Feb 2018 02:10:11 -0800 (PST) MIME-Version: 1.0 References: <11b56515-4212-c75e-a71c-9baa07bfcfba@pocos.nl> In-Reply-To: From: Dan Haywood Date: Fri, 23 Feb 2018 10:10:01 +0000 Message-ID: Subject: Re: Integration tests: Using different AppManifest + No dependency injection before PostConstruct To: users@isis.apache.org Content-Type: multipart/alternative; boundary="94eb2c0b9acea793530565de5d16" --94eb2c0b9acea793530565de5d16 Content-Type: text/plain; charset="UTF-8" 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 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 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 >> > --94eb2c0b9acea793530565de5d16--