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 testing headless process
Date Tue, 05 Feb 2019 08:30:42 GMT
Hi Brian,
Could you put together a simple example on GitHub that demonstrates the
problem do that we can debug into it?
Thx,
Dan

On Mon, 4 Feb 2019, 20:40 Brian K <harvestmoon299@gmail.com wrote:

> I have a headless quartz job that works fine when I test it from the webapp
> with jetty:run.  It subclasses HeadlessAbstract and gets user and group
> membership from the quartz configuration.  When I do a Cucumber test with
> it then it seems to function fine, but the code following the job execution
> - the steps that check if the result is good -- fails because the JDO
> session is closed.  The teardown code throws an error that says
> org.apache.isis.applib.NonRecoverableException: No IsisSession on current
> thread. [1]
>
> I tried having the job create a new thread and create authSession.  I get
> the same error in the test and the teardown code says
> javax.jdo.JDOFatalUserException: Persistence Manager has been closed [2]
>
> Would this be a bug in some code that is not thread-safe in
> HeadlessAbstract, or is there another way I can code tests for a headless
> process?   It seems to also sabotage all the tests that follow - they get
> marked as skipped.  I am using Isis version 2.0.0-M2.
>
> Thanks!
> Brian
>
> [1] Stack trace (same thread):
> java.lang.NullPointerException
>     at
>
> org.apache.isis.applib.services.jdosupport.IsisJdoSupportDN5.getPersistenceSession(IsisJdoSupportDN5.java:223)
>     at
>
> org.apache.isis.applib.services.jdosupport.IsisJdoSupportDN5.getJdoPersistenceManager(IsisJdoSupportDN5.java:233)
>     at
>
> org.apache.isis.applib.services.jdosupport.IsisJdoSupportDN5.newTypesafeQuery(IsisJdoSupportDN5.java:195)
>     at
>
> domainapp.modules.simple.dom.impl.J300eSessions.listAll(J300eSessions.java:54)
>     at
>
> domainapp.modules.simple.dom.impl.J300eSessions.listAll(J300eSessions.java:72)
>     at
>
> domainapp.modules.simple.specglue.PollingGlue.first_questionnaire_is_loaded_to_Onbase(PollingGlue.java:84)
>     at ✽.Then first questionnaire is loaded to
> Onbase(domainapp/application/bdd/specs/PollingSpec.feature:12)
>
> org.apache.isis.applib.NonRecoverableException: No IsisSession on current
> thread.
>     at
>
> org.apache.isis.core.runtime.services.persistsession.PersistenceSessionServiceInternalDefault.lambda$getPersistenceSession$0(PersistenceSessionServiceInternalDefault.java:213)
>     at java.util.Optional.orElseThrow(Optional.java:290)
>     at
>
> org.apache.isis.core.runtime.services.persistsession.PersistenceSessionServiceInternalDefault.getPersistenceSession(PersistenceSessionServiceInternalDefault.java:213)
>     at
>
> org.apache.isis.core.runtime.services.persistsession.PersistenceSessionServiceInternalDefault.getTransactionManager(PersistenceSessionServiceInternalDefault.java:222)
>     at
>
> org.apache.isis.core.runtime.services.persistsession.PersistenceSessionServiceInternalDefault.getTransactionState(PersistenceSessionServiceInternalDefault.java:202)
>     at
>
> org.apache.isis.core.runtime.services.xactn.TransactionServiceDefault.getTransactionState(TransactionServiceDefault.java:104)
>     at
>
> org.apache.isis.core.runtime.services.xactn.TransactionServiceDefault.nextTransaction(TransactionServiceDefault.java:63)
>     at
>
> org.apache.isis.core.runtime.services.xactn.TransactionServiceDefault.nextTransaction(TransactionServiceDefault.java:58)
>     at
>
> org.apache.isis.core.runtime.headless.HeadlessWithBootstrappingAbstract.tearDownAllModules(HeadlessWithBootstrappingAbstract.java:138)
>     at
>
> domainapp.application.bdd.specglue.BootstrappingGlue.afterScenario(BootstrappingGlue.java:32)
>     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 cucumber.runtime.Utils$1.call(Utils.java:37)
>     at cucumber.runtime.Timeout.timeout(Timeout.java:13)
>     at cucumber.runtime.Utils.invoke(Utils.java:31)
>     at
>
> cucumber.runtime.java.JavaHookDefinition.execute(JavaHookDefinition.java:60)
>     at cucumber.runtime.Runtime.runHookIfTagsMatch(Runtime.java:223)
>     at cucumber.runtime.Runtime.runHooks(Runtime.java:211)
>     at cucumber.runtime.Runtime.runAfterHooks(Runtime.java:205)
>     at
> cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:46)
>     at
> cucumber.runtime.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:91)
>     at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:63)
>     at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:18)
>     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
>     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
>     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
>     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
>     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
>     at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
>     at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:70)
>     at cucumber.api.junit.Cucumber.runChild(Cucumber.java:93)
>     at cucumber.api.junit.Cucumber.runChild(Cucumber.java:37)
>     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
>     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
>     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
>     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
>     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
>     at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
>     at cucumber.api.junit.Cucumber.run(Cucumber.java:98)
>     at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
>     at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
>     at
>
> org.junit.vintage.engine.execution.RunnerExecutor.execute(RunnerExecutor.java:39)
>     at
> java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
>     at
> java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
>     at java.util.Iterator.forEachRemaining(Iterator.java:116)
>     at
>
> java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
>     at
> java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
>     at
>
> java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
>     at
>
> java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
>     at
>
> java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
>     at
> java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
>     at
> java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
>     at
>
> org.junit.vintage.engine.VintageTestEngine.executeAllChildren(VintageTestEngine.java:79)
>     at
>
> org.junit.vintage.engine.VintageTestEngine.execute(VintageTestEngine.java:70)
>     at
>
> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:220)
>     at
>
> org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:188)
>     at
>
> org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:202)
>     at
>
> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:181)
>     at
>
> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
>     at
>
> org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:142)
>     at
>
> org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:117)
>     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.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:206)
>     at
>
> org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:161)
>     at
>
> org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:84)
>     at
>
> org.apache.maven.plugin.surefire.InPluginVMSurefireStarter.runSuitesInProcess(InPluginVMSurefireStarter.java:87)
>     at
>
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1166)
>     at
>
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1011)
>     at
>
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:857)
>     at
>
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
>     at
>
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
>     at
>
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
>     at
>
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
>     at
>
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
>     at
>
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
>     at
>
> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
>     at
>
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
>     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
>     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
>     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
>     at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
>     at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
>     at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
>     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.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
>     at
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
>     at
>
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
>     at
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
>
>
> [2] Stack trace (new thread):
> java.lang.NullPointerException
>     at
>
> org.datanucleus.api.jdo.query.JDOQLTypedQueryImpl.getInternalQuery(JDOQLTypedQueryImpl.java:1064)
>     at
>
> org.datanucleus.api.jdo.query.JDOQLTypedQueryImpl.executeList(JDOQLTypedQueryImpl.java:1036)
>     at
>
> domainapp.modules.simple.dom.impl.J300eSessions.listAll(J300eSessions.java:57)
>     at
>
> domainapp.modules.simple.dom.impl.J300eSessions.listAll(J300eSessions.java:72)
>     at
>
> domainapp.modules.simple.specglue.PollingGlue.first_questionnaire_is_loaded_to_Onbase(PollingGlue.java:84)
>     at ✽.Then first questionnaire is loaded to
> Onbase(domainapp/application/bdd/specs/PollingSpec.feature:12)
>
> javax.jdo.JDOFatalUserException: Persistence Manager has been closed
>     at
>
> org.datanucleus.api.jdo.JDOPersistenceManager.assertIsOpen(JDOPersistenceManager.java:2235)
>     at
>
> org.datanucleus.api.jdo.JDOPersistenceManager.currentTransaction(JDOPersistenceManager.java:386)
>     at
>
> org.apache.isis.core.runtime.system.persistence.PersistenceSessionBase.startTransaction(PersistenceSessionBase.java:222)
>     at
>
> org.apache.isis.core.runtime.system.persistence.PersistenceSession5.startTransaction(PersistenceSession5.java:104)
>     at
>
> org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.startTransaction(IsisTransactionManager.java:247)
>     at
>
> org.apache.isis.core.runtime.services.persistsession.PersistenceSessionServiceInternalDefault.beginTran(PersistenceSessionServiceInternalDefault.java:151)
>     at
>
> org.apache.isis.core.runtime.services.xactn.TransactionServiceDefault.nextTransaction(TransactionServiceDefault.java:89)
>     at
>
> org.apache.isis.core.runtime.services.xactn.TransactionServiceDefault.nextTransaction(TransactionServiceDefault.java:58)
>     at
>
> org.apache.isis.core.runtime.headless.HeadlessWithBootstrappingAbstract.tearDownAllModules(HeadlessWithBootstrappingAbstract.java:138)
>     at
>
> domainapp.application.bdd.specglue.BootstrappingGlue.afterScenario(BootstrappingGlue.java:32)
>     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 cucumber.runtime.Utils$1.call(Utils.java:37)
>     at cucumber.runtime.Timeout.timeout(Timeout.java:13)
>     at cucumber.runtime.Utils.invoke(Utils.java:31)
>     at
>
> cucumber.runtime.java.JavaHookDefinition.execute(JavaHookDefinition.java:60)
>     at cucumber.runtime.Runtime.runHookIfTagsMatch(Runtime.java:223)
>     at cucumber.runtime.Runtime.runHooks(Runtime.java:211)
>     at cucumber.runtime.Runtime.runAfterHooks(Runtime.java:205)
>     at
> cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:46)
>     at
> cucumber.runtime.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:91)
>     at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:63)
>     at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:18)
>     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
>     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
>     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
>     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
>     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
>     at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
>     at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:70)
>     at cucumber.api.junit.Cucumber.runChild(Cucumber.java:93)
>     at cucumber.api.junit.Cucumber.runChild(Cucumber.java:37)
>     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
>     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
>     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
>     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
>     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
>     at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
>     at cucumber.api.junit.Cucumber.run(Cucumber.java:98)
>     at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
>     at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
>     at
>
> org.junit.vintage.engine.execution.RunnerExecutor.execute(RunnerExecutor.java:39)
>     at
> java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
>     at
> java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
>     at java.util.Iterator.forEachRemaining(Iterator.java:116)
>     at
>
> java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
>     at
> java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
>     at
>
> java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
>     at
>
> java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
>     at
>
> java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
>     at
> java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
>     at
> java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
>     at
>
> org.junit.vintage.engine.VintageTestEngine.executeAllChildren(VintageTestEngine.java:79)
>     at
>
> org.junit.vintage.engine.VintageTestEngine.execute(VintageTestEngine.java:70)
>     at
>
> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:220)
>     at
>
> org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:188)
>     at
>
> org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:202)
>     at
>
> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:181)
>     at
>
> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
>     at
>
> org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:142)
>     at
>
> org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:117)
>     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.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:206)
>     at
>
> org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:161)
>     at
>
> org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:84)
>     at
>
> org.apache.maven.plugin.surefire.InPluginVMSurefireStarter.runSuitesInProcess(InPluginVMSurefireStarter.java:87)
>     at
>
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1166)
>     at
>
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1011)
>     at
>
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:857)
>     at
>
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
>     at
>
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
>     at
>
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
>     at
>
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
>     at
>
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
>     at
>
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
>     at
>
> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
>     at
>
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
>     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
>     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
>     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
>     at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
>     at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
>     at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
>     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.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
>     at
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
>     at
>
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
>     at
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
>

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