[jboss-as7-dev] Arquillian + Embedded + Modular Surefire Plugin

Aslak Knutsen aknutsen at redhat.com
Tue Jan 18 05:25:24 EST 2011


> The trace looks like like it is being executed on the same thread as
> the client. For the JMX protocol the client calls the MBean server and
> then the MBean server executes the test runner MBean in the same
> thread. I will take a look at the JMX protocol later and see if I find
> anything there. 

> How to set IN_CONTAINER on the "server side", and what
> is the significance of the Thread? TCCL?

The setting of ContainerProfile.CONTAINER is done inside the TestRunner implementation, e.g. JUnitTestRunner. You shouldn't have to deal with that on the outside. 

The JUnit/TestNG integration rely on the use of a ThreadLocal variable to share the Arquillian core instance between TestClasses. So when the @Test is executed on the same Thread, Arquillian Core is never reinitialized as the CONTAINER profile(different handlers for the different lifecycles) and assumes then that this is just another CLIENT test case and goes through the same steps as before.

-aslak-

> On 17 Jan 2011, at 22:24, Aslak Knutsen wrote:
> 
> > It is not suppose to be called on the server side. It sounds like
> > the
> > TestRunner is not set to run IN_CONTAINER mode, or it's being re
> > executed on the same Thread as the client ?
> >
> > -aslak-
> >
> > On Mon, Jan 17, 2011 at 8:29 PM, Kabir Khan <kabir.khan at jboss.com>
> > wrote:
> >> I am trying to get the demos that I see working (sar,
> >> serviceloader, messaging, jms, jms.client) running again as part of
> >> the smoke tests using the forked surefire plugin which loads
> >> everything with modular classloading. On the client this works
> >> fine, but for IN_CONTAINER tests I am seeing the stack trace at the
> >> end.
> >>
> >> The basic problem seems to be that Arquillian calls
> >> MessagingTestCase.getDeployment() on the client as expected,
> >> however it then also calls it on the server once it is deployed
> >> which causes this error. Does this really need to happen on the
> >> server? Is there a way to disable this?
> >>
> >> This then causes ShrinkWrap's ContainerBase to use the TCCL, which
> >> is the classloader of the deployment, to search for
> >> rg.jboss.as.test.modular.utils.ShrinkWrapUtils which is part of the
> >> deployment. URLPackageScanner.scanPackage() finds the url:
> >> "vfs:/content/messaging-example.jar/org/jboss/as/test/modular/utils/"
> >> which becomes
> >> "/content/messaging-example.jar/org/jboss/as/test/modular/utils/"
> >> before it is added to the list passed in to handleArchiveByFile().
> >> Since
> >> "content/messaging-example.jar/org/jboss/as/test/modular/utils/"
> >> does not exist, it all falls over.
> >>
> >> org.jboss.arquillian.impl.event.FiredEventException:
> >> java.lang.RuntimeException: Could not get Deployment
> >>        at
> >>        org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:68)
> >>        at
> >>        org.jboss.arquillian.impl.context.AbstractEventContext.fire(AbstractEventContext.java:115)
> >>        at
> >>        org.jboss.arquillian.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:99)
> >>        at
> >>        org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:165)
> >>        at
> >>        org.jboss.arquillian.junit.Arquillian$3$1.evaluate(Arquillian.java:189)
> >>        at
> >>        org.jboss.arquillian.junit.Arquillian$MultiStatementExecutor.execute(Arquillian.java:300)
> >>        at
> >>        org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:185)
> >>        at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
> >>        at
> >>        org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:128)
> >>        at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
> >>        at org.junit.runner.JUnitCore.run(JUnitCore.java:136)
> >>        at
> >>        org.jboss.arquillian.junit.JUnitTestRunner.execute(JUnitTestRunner.java:69)
> >>        at
> >>        org.jboss.arquillian.protocol.jmx.JMXTestRunner.runTestMethodInternal(JMXTestRunner.java:145)
> >>        at
> >>        org.jboss.arquillian.protocol.jmx.JMXTestRunner.runTestMethodEmbedded(JMXTestRunner.java:114)
> >>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> >>        Method)
> >>        at
> >>        sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >>        at
> >>        sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >>        at java.lang.reflect.Method.invoke(Method.java:597)
> >>        at
> >>        com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:93)
> >>        at
> >>        com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:27)
> >>        at
> >>        com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:208)
> >>        at
> >>        com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:120)
> >>        at
> >>        com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:262)
> >>        at
> >>        javax.management.StandardMBean.invoke(StandardMBean.java:391)
> >>        at
> >>        com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
> >>        at
> >>        com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
> >>        at
> >>        javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:288)
> >>        at $Proxy18.runTestMethodEmbedded(Unknown Source)
> >>        at
> >>        org.jboss.arquillian.protocol.jmx.JMXMethodExecutor.invoke(JMXMethodExecutor.java:91)
> >>        at
> >>        org.jboss.arquillian.impl.handler.ContainerTestExecuter.callback(ContainerTestExecuter.java:50)
> >>        at
> >>        org.jboss.arquillian.impl.handler.ContainerTestExecuter.callback(ContainerTestExecuter.java:40)
> >>        at
> >>        org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:63)
> >>        at
> >>        org.jboss.arquillian.impl.context.AbstractEventContext.fire(AbstractEventContext.java:115)
> >>        at
> >>        org.jboss.arquillian.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:160)
> >>        at
> >>        org.jboss.arquillian.junit.Arquillian$6.evaluate(Arquillian.java:247)
> >>        at
> >>        org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
> >>        at
> >>        org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:210)
> >>        at
> >>        org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
> >>        at
> >>        org.jboss.arquillian.junit.Arquillian$5$1.evaluate(Arquillian.java:228)
> >>        at
> >>        org.jboss.arquillian.junit.Arquillian$MultiStatementExecutor.execute(Arquillian.java:300)
> >>        at
> >>        org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:224)
> >>        at
> >>        org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
> >>        at
> >>        org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
> >>        at
> >>        org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
> >>        at
> >>        org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
> >>        at
> >>        org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
> >>        at
> >>        org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
> >>        at
> >>        org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
> >>        at
> >>        org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:166)
> >>        at
> >>        org.jboss.arquillian.junit.Arquillian$3$1.evaluate(Arquillian.java:189)
> >>        at
> >>        org.jboss.arquillian.junit.Arquillian$MultiStatementExecutor.execute(Arquillian.java:300)
> >>        at
> >>        org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:185)
> >>        at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
> >>        at
> >>        org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:128)
> >>        at
> >>        org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:59)
> >>        at
> >>        org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:120)
> >>        at
> >>        org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:103)
> >>        at org.apache.maven.surefire.Surefire.run(Surefire.java:169)
> >>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> >>        Method)
> >>        at
> >>        sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >>        at
> >>        sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >>        at java.lang.reflect.Method.invoke(Method.java:597)
> >>        at
> >>        org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:339)
> >>        at
> >>        org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1011)
> >>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> >>        Method)
> >>        at
> >>        sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >>        at
> >>        sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >>        at java.lang.reflect.Method.invoke(Method.java:597)
> >>        at org.jboss.modules.Module.run(Module.java:244)
> >>        at org.jboss.modules.Main.main(Main.java:178)
> >> Caused by: java.lang.RuntimeException: Could not get Deployment
> >>        at
> >>        org.jboss.arquillian.impl.DeploymentAnnotationArchiveGenerator.generateApplicationArchive(DeploymentAnnotationArchiveGenerator.java:65)
> >>        at
> >>        org.jboss.arquillian.impl.ClientDeploymentGenerator.generate(ClientDeploymentGenerator.java:60)
> >>        at
> >>        org.jboss.arquillian.impl.handler.ArchiveGenerator.callback(ArchiveGenerator.java:52)
> >>        at
> >>        org.jboss.arquillian.impl.handler.ArchiveGenerator.callback(ArchiveGenerator.java:42)
> >>        at
> >>        org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:63)
> >>        ... 69 more
> >> Caused by: java.lang.reflect.InvocationTargetException
> >>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> >>        Method)
> >>        at
> >>        sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >>        at
> >>        sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >>        at java.lang.reflect.Method.invoke(Method.java:597)
> >>        at
> >>        org.jboss.arquillian.impl.DeploymentAnnotationArchiveGenerator.generateApplicationArchive(DeploymentAnnotationArchiveGenerator.java:57)
> >>        ... 73 more
> >> Caused by: java.lang.RuntimeException: Error handling file
> >> /content/messaging-example.jar/org/jboss/as/test/modular/utils
> >>        at
> >>        org.jboss.shrinkwrap.impl.base.URLPackageScanner.handleArchiveByFile(URLPackageScanner.java:165)
> >>        at
> >>        org.jboss.shrinkwrap.impl.base.URLPackageScanner.handle(URLPackageScanner.java:181)
> >>        at
> >>        org.jboss.shrinkwrap.impl.base.URLPackageScanner.scanPackage(URLPackageScanner.java:132)
> >>        at
> >>        org.jboss.shrinkwrap.impl.base.container.ContainerBase.addPackages(ContainerBase.java:1003)
> >>        at
> >>        org.jboss.shrinkwrap.impl.base.container.ContainerBase.addClasses(ContainerBase.java:914)
> >>        at
> >>        org.jboss.shrinkwrap.impl.base.container.ContainerBase.addClass(ContainerBase.java:855)
> >>        at
> >>        org.jboss.as.test.modular.utils.ShrinkWrapUtils.addClasses(ShrinkWrapUtils.java:147)
> >>        at
> >>        org.jboss.as.test.modular.utils.ShrinkWrapUtils.createJavaArchive(ShrinkWrapUtils.java:52)
> >>        at
> >>        org.jboss.as.test.embedded.demos.messaging.MessagingTestCase.createDeployment(MessagingTestCase.java:76)
> >>        ... 78 more
> >> Caused by: java.util.zip.ZipException: error in opening zip file
> >>        at java.util.zip.ZipFile.open(Native Method)
> >>        at java.util.zip.ZipFile.<init>(ZipFile.java:114)
> >>        at java.util.zip.ZipFile.<init>(ZipFile.java:131)
> >>        at
> >>        org.jboss.shrinkwrap.impl.base.URLPackageScanner.handleArchiveByFile(URLPackageScanner.java:149)
> >>        ... 86 more
> >>
> >>
> 
> 
> _______________________________________________
> jboss-as7-dev mailing list
> jboss-as7-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev



More information about the jboss-as7-dev mailing list