Argument 2 for ArquillianServiceDeployer.undeploy is null. It won't be invoked.
wuhuaxu Feb 16, 2017 5:55 AMI run test in ear, and I get the following warning:
WARNING [org.jboss.arquillian.core.spi.ObserverMethod] (main) Argument 2 for ArquillianServiceDeployer.undeploy is null. It won't be invoked.
Some thing strange, the test result is No runnable methods, but actully there are some test methods.
I create the deployment as follows:
public static EnterpriseArchive createDeployment() {
EnterpriseArchive enterpriseArchive = ShrinkWrap.create(EnterpriseArchive.class, "test.ear");
enterpriseArchive.addAsLibraries(Maven.resolver().loadPomFromFile("pom.xml").resolve(
"com.renwey:renwey-core-account-domain-api"
).withTransitivity().asFile());
JavaArchive[] ejbJars = Maven.resolver().loadPomFromFile("pom.xml").resolve(
"com.renwey:renwey-core-account-domain-impl"
).withoutTransitivity().as(JavaArchive.class);
enterpriseArchive.addAsModules(ejbJars);
Set<JavaArchive> dependencies = new HashSet<>();
dependencies.addAll(Arrays.asList(Maven.resolver().loadPomFromFile("pom.xml").resolve(
"com.renwey:renwey-core-account-domain-impl"
).using(new AcceptScopesStrategy(ScopeType.COMPILE, ScopeType.RUNTIME)).as(JavaArchive.class)));
dependencies.removeAll(Arrays.asList(ejbJars));
enterpriseArchive.addAsLibraries(dependencies);
enterpriseArchive.addAsManifestResource("test-jboss-deployment-structure.xml", "jboss-deployment-structure.xml");
///////////////////////////////////////////////////////////////////////////////////
WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "test.war");
webArchive.addAsLibraries(Maven.resolver().loadPomFromFile("pom.xml").resolve(
"com.renwey:renwey-core-test-common",
"com.renwey:renwey-core-account-facade",
"org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-api-maven"
).withTransitivity().asFile());
webArchive.addClass(UserServiceImpl.class);
webArchive.addClass(UserServiceTest.class); // this is the Test class
webArchive.addAsWebInfResource("META-INF/beans.xml", "beans.xml");
enterpriseArchive.addAsModule(webArchive);
///////////////////////////////////////////////////////////////////////////////////
ApplicationDescriptor appDescriptor = Descriptors.create(ApplicationDescriptor.class);
appDescriptor.initializeInOrder(GenericBooleanType._TRUE);
Arrays.asList(ejbJars).forEach(e-> appDescriptor.createModule().ejb(e.getName()));
appDescriptor.createModule().getOrCreateWeb().webUri(webArchive.getName()).contextRoot("/test");
enterpriseArchive.setApplicationXML(new StringAsset(appDescriptor.exportAsString()));
enterpriseArchive.as(ZipExporter.class).exportTo(new File("target/UserServiceTest.ear"), true);
return enterpriseArchive;
}