Test EAR deploys on AS7, but test config can't be found
benkirby Aug 24, 2011 5:14 AMHi,
We've been successfully writing Arquillian tsts for AS6 for a few weeks now, however we've just switched to AS7. I've made what I think are the necessary changes, but now we have some tests consistently running, and others not.
To clarify, all are deploying, but some don't seem to bundle the tests to run correctly - once deployed, no tests are found. Here's an example test that does this:
{code}
package uk.co.magus.jam.harvest.service;
import static org.junit.Assert.assertNotNull;
import java.io.FileNotFoundException;
import javax.inject.Inject;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
import uk.co.magus.jam.core.testutil.MavenArtifactResolver;
@RunWith(Arquillian.class)
public class TestNewService {
protected final static String[] libraries = new String[] {
"org.jboss.seam.persistence:seam-persistence:3.0.0.Final",
"org.jboss.seam.solder:seam-solder:3.0.0.Final"
};
@Inject private MyLittleService service;
@Deployment
public static Archive<?> createDeployment() throws FileNotFoundException {
EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "main-test.ear");
JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "inner-jar.jar")
.addClass(TestNewService.class)
.addClass(MyLittleService.class);
System.out.println( jar.toString(true) );
ear.addAsModule(jar);
ear.addAsModule(MavenArtifactResolver.resolve("org.jboss.seam.persistence:seam-persistence:3.0.0.Final"));
ear.addAsModule(MavenArtifactResolver.resolve("org.jboss.seam.solder:seam-solder:3.0.0.Final"));
ear.addAsLibraries(MavenArtifactResolver.resolve(libraries));
System.out.println( ear.toString(true) );
return ear;
}
@Test
public void testServiceCreation() {
assertNotNull(service);
}
}
{code}
It's got the @RunWith and an @Test. The inner-jar that is created has the test class in it. It deploys, and tries to find the tests:
{code}
09:00:17,142 INFO [org.jboss.as.server.deployment] (pool-1-thread-29) Content added at location C:\jboss-as-7.1.0.Alpha1-SNAPSHOT\standalone\data\content\36\a80967f42386ccd1fb2c6e59710df30e9f6073\content
09:00:17,143 INFO [org.jboss.as.server.deployment] (MSC service thread 1-17) Starting deployment of "arquillian-service"
09:00:17,193 INFO [org.jboss.as.jpa] (MSC service thread 1-7) added javax.persistence.api dependency to arquillian-service
09:00:17,199 DEBUG [org.jboss.as.arquillian] (MSC service thread 1-6) Starting Arquillian Test Runner
09:00:17,199 INFO [org.jboss.as.osgi] (MSC service thread 1-13) Register module: Module "deployment.arquillian-service:main" from Service Module Loader
09:00:17,226 INFO [org.jboss.osgi.framework.internal.BundleManager] (MSC service thread 1-13) Install bundle: arquillian-service:0.0.0
09:00:17,233 INFO [org.jboss.as.server.controller] (pool-1-thread-29) Deployed "arquillian-service"
09:00:17,448 INFO [org.jboss.as.server.deployment] (pool-1-thread-29) Content added at location C:\jboss-as-7.1.0.Alpha1-SNAPSHOT\standalone\data\content\c6\5ce035b3df5b2f8e0878d5330827d171a104b7\content
09:00:17,450 INFO [org.jboss.as.server.deployment] (MSC service thread 1-21) Starting deployment of "main-test.ear"
09:00:17,545 INFO [org.jboss.as.jpa] (MSC service thread 1-22) added javax.persistence.api dependency to main-test.ear
09:00:17,548 INFO [org.jboss.weld] (MSC service thread 1-16) Processing CDI deployment: main-test.ear
09:00:17,584 INFO [org.jboss.weld] (MSC service thread 1-11) Starting Services for CDI deployment: main-test.ear
09:00:17,587 INFO [org.jboss.weld] (MSC service thread 1-17) Starting weld service
09:00:17,616 INFO [org.jboss.seam.solder.Version] (MSC service thread 1-17) Seam Solder null (build id: null)
09:00:17,626 INFO [org.jboss.seam.solder.core.CoreExtension] (MSC service thread 1-17) Preventing class org.jboss.seam.transaction.UTTransaction from being installed as bean due to @Veto annotation
09:00:17,639 INFO [org.jboss.seam.solder.core.CoreExtension] (MSC service thread 1-17) Preventing class org.jboss.seam.transaction.SeSynchronizations from being installed as bean due to @Veto annotation
09:00:17,644 INFO [org.jboss.seam.solder.core.CoreExtension] (MSC service thread 1-17) Preventing class org.jboss.seam.transaction.CMTTransaction from being installed as bean due to @Veto annotation
09:00:17,646 INFO [org.jboss.seam.solder.core.CoreExtension] (MSC service thread 1-17) Preventing class org.jboss.seam.transaction.EntityTransaction from being installed as bean due to @Veto annotation
09:00:17,654 INFO [org.jboss.seam.solder.core.CoreExtension] (MSC service thread 1-17) Preventing class org.jboss.seam.persistence.hibernate.HibernateManagedSessionExtensionImpl from being installed as bean due to @Veto annotation
09:00:17,654 INFO [org.jboss.seam.solder.core.CoreExtension] (MSC service thread 1-17) Preventing class org.jboss.seam.transaction.NoTransaction from being installed as bean due to @Veto annotation
09:00:17,763 INFO [org.jboss.seam.solder.core.CoreExtension] (MSC service thread 1-17) Preventing class org.jboss.seam.solder.core.VersionLoggerUtil from being installed as bean due to @Veto annotation
09:00:17,815 INFO [org.jboss.seam.solder.core.CoreExtension] (MSC service thread 1-17) Preventing class org.jboss.seam.solder.resourceLoader.ResourceProvider from being installed as bean due to @Veto annotation
09:00:17,944 INFO [org.jboss.as.server.controller] (pool-1-thread-29) Deployed "main-test.ear"
09:00:17,982 DEBUG [org.jboss.as.arquillian] (RMI TCP Connection(57)-127.0.0.1) Getting Arquillian config for: uk.co.magus.jam.harvest.service.TestNewService
09:00:17,982 DEBUG [org.jboss.as.arquillian] (RMI TCP Connection(57)-127.0.0.1) Waiting on Arquillian config for: uk.co.magus.jam.harvest.service.TestNewService
09:00:47,985 DEBUG [org.jboss.as.arquillian] (RMI TCP Connection(57)-127.0.0.1) Getting Arquillian config for: uk.co.magus.jam.harvest.service.TestNewService
09:00:53,632 INFO [org.jboss.weld] (MSC service thread 1-13) Stopping weld service
09:00:53,659 INFO [org.jboss.as.server.controller] (pool-1-thread-29) Undeployed "main-test.ear"
09:00:53,667 INFO [org.jboss.as.server.deployment] (MSC service thread 1-9) Stopped deployment main-test.ear in 35ms
{code}
However it can't find them. I've debugged this section, and it's fair enough - in ArquillianService, the deployedTests set is empty. The logging and subsequent error when attempting to run the test is:
{code}
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running uk.co.magus.jam.harvest.service.TestNewService
log4j: Threshold ="null".
log4j: Retreiving an instance of org.apache.log4j.Logger.
log4j: Setting [uk.co.magus] additivity to [true].
log4j: Level value for uk.co.magus is [DEBUG].
log4j: uk.co.magus level set to DEBUG
log4j: Class name: [org.apache.log4j.ConsoleAppender]
log4j: Setting property [target] to [System.out].
log4j: Setting property [threshold] to [ALL].
log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
log4j: Setting property [conversionPattern] to [%d{ABSOLUTE} %-5p [%c{1}] %m%n].
log4j: Adding appender named [CONSOLE] to category [root].
24-Aug-2011 10:00:15 org.jboss.arquillian.container.impl.client.container.ContainerRegistryCreator getActivatedConfiguration
INFO: Could not read active container configuration: null
10:00:15,678 DEBUG [MBeanServerConnectionProvider] Connecting JMXConnector to: service:jmx:rmi:///jndi/rmi://127.0.0.1:1090/jmxrmi
inner-jar.jar:
/uk/
/uk/co/
/uk/co/magus/
/uk/co/magus/jam/
/uk/co/magus/jam/harvest/
/uk/co/magus/jam/harvest/service/
/uk/co/magus/jam/harvest/service/MyLittleService.class
/uk/co/magus/jam/harvest/service/TestNewService.class
main-test.ear:
/lib/
/lib/seam-persistence-3.0.0.Final.jar
/lib/seam-solder-3.0.0.Final.jar
/seam-persistence-3.0.0.Final.jar
/inner-jar.jar
/seam-solder-3.0.0.Final.jar
10:00:16,276 DEBUG [DelegatingApplicationArchiveProcessor] Process archive 'main-test.ear' with: org.jboss.as.arquillian.container.ModuleApplicationArchiveProcessor@2e257f1b
10:00:16,277 DEBUG [ModuleApplicationArchiveProcessor] Add dependencies: org.jboss.modules,deployment.arquillian-service,org.jboss.msc
10:00:16,279 DEBUG [DelegatingApplicationArchiveProcessor] Manifest for main-test.ear:
Manifest-Version: 1.0
Dependencies: org.jboss.modules,deployment.arquillian-service,org.jbos
s.msc
10:00:16,280 DEBUG [JMXProtocolPackager] Generating: arquillian-service
10:00:16,291 DEBUG [JMXProtocolPackager] Merging archive: arquillian-testenricher-cdi.jar: 13 assets
10:00:16,291 DEBUG [JMXProtocolPackager] Merging archive: arquillian-testenricher-osgi.jar: 9 assets
10:00:16,292 DEBUG [JMXProtocolPackager] Merging archive: arquillian-testenricher-ejb.jar: 8 assets
10:00:16,293 DEBUG [JMXProtocolPackager] Merging archive: arquillian-junit.jar: 252 assets
10:00:16,297 DEBUG [JMXProtocolPackager] Merging archive: arquillian-testenricher-resource.jar: 8 assets
10:00:16,298 DEBUG [JMXProtocolPackager] Merging archive: arquillian-testenricher-msc.jar: 7 assets
10:00:16,300 DEBUG [JMXProtocolPackager] Merging archive: arquillian-core.jar: 578 assets
10:00:16,310 DEBUG [JMXProtocolPackager] Merging archive: arquillian-testenricher-initialcontext.jar: 3 assets
10:00:16,313 DEBUG [JMXProtocolPackager] Loadable extensions: [org.jboss.arquillian.testenricher.ejb.container.EJBEnricherRemoteExtension, org.jboss.arquillian.testenricher.cdi.container.CDIEnricherRemoteExtension, org.jboss.arquillian
.testenricher.initialcontext.container.InitialContextRemoteExtension, org.jboss.arquillian.testenricher.resource.container.ResourceEnricherRemoteExtension, org.jboss.as.arquillian.service.JMXProtocolEndpointExtension, org.jboss.arquill
ian.container.test.impl.ContainerTestRemoteExtension, org.jboss.arquillian.testenricher.msc.MSCEnricherRemoteExtension, org.jboss.arquillian.testenricher.osgi.OSGiEnricherRemoteExtension]
10:00:16,385 INFO [remoting] JBoss Remoting version 3.2.0.Beta2
10:00:16,393 INFO [xnio] XNIO Version 3.0.0.Beta3
10:00:16,407 INFO [nio] XNIO NIO Implementation Version 3.0.0.Beta3
10:00:16,424 DEBUG [channel-thread] Started channel thread 'XNIO NIO Read 1', selector sun.nio.ch.WindowsSelectorImpl@44aea710
10:00:16,425 DEBUG [channel-thread] Started channel thread 'XNIO NIO Write 1', selector sun.nio.ch.WindowsSelectorImpl@2d397e5c
10:00:16,519 INFO [ArquillianServiceDeployer] Found already deployed arquillian service: "arquillian-service"
10:00:16,520 INFO [ArquillianServiceDeployer] Undeploying arquillian service with: {
"operation" => "composite",
"address" => [],
"steps" => [
{
"operation" => "undeploy",
"address" => ("deployment" => "arquillian-service")
},
{
"operation" => "remove",
"address" => ("deployment" => "arquillian-service")
}
]
}
10:00:16,523 DEBUG [channel-thread] Started channel thread 'XNIO NIO Read 2', selector sun.nio.ch.WindowsSelectorImpl@242da5a6
10:00:16,523 DEBUG [channel-thread] Started channel thread 'XNIO NIO Write 2', selector sun.nio.ch.WindowsSelectorImpl@3488b1e6
10:00:16,568 INFO [ArquillianServiceDeployer] Deploy arquillian service: arquillian-service: 903 assets
10:00:16,587 DEBUG [channel-thread] Started channel thread 'XNIO NIO Read 3', selector sun.nio.ch.WindowsSelectorImpl@106df95
10:00:16,588 DEBUG [channel-thread] Started channel thread 'XNIO NIO Write 3', selector sun.nio.ch.WindowsSelectorImpl@317b1d64
10:00:17,240 DEBUG [channel-thread] Started channel thread 'XNIO NIO Read 4', selector sun.nio.ch.WindowsSelectorImpl@694b081b
10:00:17,240 DEBUG [channel-thread] Started channel thread 'XNIO NIO Write 4', selector sun.nio.ch.WindowsSelectorImpl@6335605a
10:00:17,956 DEBUG [OSGiTestEnricher] System bundle context not available
10:00:17,981 DEBUG [JMXMethodExecutor] Invoke REMOTE: uk.co.magus.jam.harvest.service.TestNewService.testServiceCreation
10:00:53,600 DEBUG [JMXMethodExecutor] Result: TestResult[status=FAILED,time=0ms]
10:00:53,602 ERROR [JMXMethodExecutor] Failed: uk.co.magus.jam.harvest.service.TestNewService.testServiceCreation
java.lang.IllegalStateException: Cannot obtain Arquillian config for: uk.co.magus.jam.harvest.service.TestNewService
at org.jboss.as.arquillian.service.ArquillianService.getArquillianConfig(ArquillianService.java:180)
at org.jboss.as.arquillian.service.ArquillianService.getArquillianConfig(ArquillianService.java:190)
at org.jboss.as.arquillian.service.ArquillianService.access$300(ArquillianService.java:66)
at org.jboss.as.arquillian.service.ArquillianService$ExtendedJMXTestRunner.runTestMethodRemote(ArquillianService.java:201)
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 com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
at org.jboss.as.jmx.tcl.TcclMBeanServer.invoke(TcclMBeanServer.java:214)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1426)
at javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:72)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1264)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1359)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:788)
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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
10:00:53,623 DEBUG [channel-thread] Started channel thread 'XNIO NIO Read 5', selector sun.nio.ch.WindowsSelectorImpl@1ad5cabc
10:00:53,624 DEBUG [channel-thread] Started channel thread 'XNIO NIO Write 5', selector sun.nio.ch.WindowsSelectorImpl@5bf2af1c
10:00:53,669 ERROR [remote] JBREM00200: Remote connection failed: java.io.IOException: Message data for non-existent channel
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 38.311 sec <<< FAILURE!
Results :
Tests in error:
testServiceCreation(uk.co.magus.jam.harvest.service.TestNewService): Cannot obtain Arquillian config for: uk.co.magus.jam.harvest.service.TestNewService
{code}
However a different test with the same pom/jboss-as7 profile configuration DOES run.
Does anyone have any idea about what could be causing the deployedTests in the service to be empty?
The packaging of the EAR is printed in the logging above, but, again, I believe this has worked for other tests. Am I missing some new AS7 config? I'm using version 7.1.0.Alpha1-SNAPSHOT from 18/08/11.