Open awilhelmer opened 6 years ago
Hello awilhelmer, The extension expected a class annotated with @ArquillianSuiteDeployment. In this class should be a method annotated with @Deployment And SuiteExtension expeced only one such class in class path.
I hope that will help. Please Read doku first: https://github.com/ingwarsw/arquillian-suite-extension
best regards Robert
Hello hoeppy,
it doesn't change anything. I already read the doku:
Add arquillian-suite as dependency Check if its working (should work slow as before)
I've got a basic deployment class with only one EAR deployment, file based from local maven repo, the Test class is extending from it. Adding the annotation on the Deployment class doesn't change anything, the exception still appears. Without the dependency everything works as expected.
I ran into the same problem with JBoss EAP 6.4 (an early commercial version of Wildfly).
The problem is that you typically import one or more BOM (bill of material) dependencies in your Maven pom.xml to bring in all the relevant libraries that JBoss EAP/ Wildfly provides so that you can compile your code with that classpath.
These BOMs bring in an older version of guava (com.google.common.*) which does not (yet) have the SetView.iterator()
method that is required by org.reflections.Reflections
.
So this is an incompatibility problem. I ended up implementing my own extension which does not rely on classpath scanning and which also provides more flexibility. An early version can be found in issue #44.
Hello @famod ,
this seems to be working but now i've got problems to run all test classes. I have this construct:
public class Deployments {
@Deployment()
public static Archive createDeployment() {
return Deployments.getApplicationEar();
}
public static EnterpriseArchive getApplicationEar() {
System.out.println("DEPLOYMENT TRIGGERED!");
File file = new File(System.getProperty("user.home")
+ "\\.m2\\repository\\de\\conuti\\traceboard\\traceboard-backend\\traceboard-app\\traceboard-ear\\1.0.0-SNAPSHOT\\traceboard-ear-1.0.0-SNAPSHOT.ear");
EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "application-ear.ear")
.as(ZipImporter.class)
.importFrom(file)
.as(EnterpriseArchive.class);
//now add the testClass and any test util classes that are not in the archive
JavaArchive testLibraryHelper = ShrinkWrap
.create(JavaArchive.class)
// .addClass(Deployments.class)
.addClass(EjbTest.class)
.addClass(EjbTest2.class)
//now for CDI working in testLibraryHelper
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
ear.addAsLibrary(testLibraryHelper);
return ear;
}
}
@RunWith(Arquillian.class)
@ReuseDeployment(Deployments.class)
public class EjbTest extends Deployments {
@Test
public void test() {
}
}
@RunWith(Arquillian.class)
@ReuseDeployment(Deployments.class)
public class EjbTest2 extends Deployments {
@Test
public void test2() {
}
}
when i run mvn test -Parq-wildfly-remote
only EjbTest class is executed. The EjbTest2 is ignored. What is wrong? :(
@awilhelmer I never tested my implementation with the remote container adapter, only the "managed" one. But basically it should work with the remote one as well. I'll try and have a look later next week.
@famod Thanks for your info.
After some tests i'am able to run both tests. My problem was, dthat surefire or Junit scans only for files with the pattern *Test.java
, Test*.java
class files.
But it seems that your simple extension doesn't work for remote tests:
Feb 04, 2018 6:21:46 PM de.conuti.traceboard.service.basic.suite.ReuseDeploymentExtension$ReuseDeploymentHandler generateDeployment
INFO: Generating reusable deployment for de.conuti.traceboard.service.test.EjbOneTest: class de.conuti.traceboard.service.basic.Deployments
DEPLOYMENT TRIGGERED!
Feb 04, 2018 6:21:46 PM de.conuti.traceboard.service.basic.suite.ReuseDeploymentExtension$ReuseDeploymentHandler generateDeployment
INFO: Generating reusable deployment for de.conuti.traceboard.service.test.EjbTwoTest: class de.conuti.traceboard.service.basic.Deployments
DEPLOYMENT TRIGGERED!
Feb 04, 2018 6:21:46 PM org.xnio.Xnio <clinit>
It seems that surefire runs a VM for each test? I tried to make the attributes activeReusableDeploymentClass
and generatedReusableDeploymentScenarios
static but with the same result.
@awilhelmer First off: Sorry, didn't have the time to look at the problem.
It seems that surefire runs a VM for each test?
Well, with default settings Surefire should not run each test in a separate JVM. See: http://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html
Can you add -Darquillian.debug=true
(see http://lukas.fryc.eu/blog/2013/06/debugging-arquillian.html) and post the output here?
@famod Thanks four your help. Here the output: https://gist.github.com/awilhelmer/56ad3ec8a0d73aebb5560dc79cc8d07c
DEPLOYMENT TRIGGERED!
DEPLOYMENT TRIGGERED!
This is the output from the deployment method getApplicationEar()
, so its called twice...
I rerun the test with System outs on your loggings (windows doesnt pipe evertyhing in git bash ...)
(E) BeforeClass
(I) TestContextHandler.createSuiteContext
(I) TestContextHandler.createClassContext
(E) TestClass
(O) ContainerEventController.execute
(E) StartClassContainers
(O) ContainerLifecycleController.startClassContainers
(E) GenerateDeployment
(I) ReuseDeploymentHandler.generateDeployment
Generating reusable deployment for de.conuti.traceboard.service.test.EjbOneTest: class de.conuti.traceboard.service.basic.Deployments
(E) GenerateReusableDeployment
(I) ReuseDeploymentHandler.generateDeployment
(O) DeploymentGenerator.generateDeployment
DEPLOYMENT TRIGGERED!
Generating reusable deployment for de.conuti.traceboard.service.test.EjbTwoTest: class de.conuti.traceboard.service.basic.Deployments
(E) GenerateReusableDeployment
(I) ReuseDeploymentHandler.generateDeployment
(O) DeploymentGenerator.generateDeployment
DEPLOYMENT TRIGGERED!
@awilhelmer Hm, it really seems your Surefire is configured to run multiple tests concurrently, judging by the following output from your gist:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
(E) ManagerProcessing
(E) ManagerProcessing
(O) LoadableExtensionLoader.load
(O) LoadableExtensionLoader.load
(E) ServiceRegistryLoader
(E) ServiceRegistryLoader
(E) ManagerStarted
(O) ConfigurationRegistrar.loadConfiguration
(E) ManagerStarted
(O) ConfigurationRegistrar.loadConfiguration
Can you post an output with mvn -X ...
?
Which version of Arquillian are you using?
I am also getting the Guava error. Any ideas on how to resolve this? I am using the embedded Glassfish container.
java.lang.RuntimeException: Could not create new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:146) at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:89) at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(TestRunnerAdaptorBuilder.java:49) at org.jboss.arquillian.junit.AdaptorManager.initializeAdaptor(AdaptorManager.java:21) at org.jboss.arquillian.junit.AdaptorManagerWithNotifier.initializeAdaptor(AdaptorManagerWithNotifier.java:19) at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:109) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) Caused by: java.lang.reflect.InvocationTargetException: null at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:88) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:57) at java.lang.reflect.Constructor.newInstance(Constructor.java:436) at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:144) at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:89) at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(TestRunnerAdaptorBuilder.java:49) at org.jboss.arquillian.junit.AdaptorManager.initializeAdaptor(AdaptorManager.java:21) at org.jboss.arquillian.junit.AdaptorManagerWithNotifier.initializeAdaptor(AdaptorManagerWithNotifier.java:19) at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:109) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) Caused by: java.lang.NoSuchMethodError: com/google/common/collect/Sets$SetView.iterator()Lcom/google/common/collect/UnmodifiableIterator; at org.reflections.Reflections.expandSuperTypes(Reflections.java:380) at org.reflections.Reflections.<init>(Reflections.java:126) at org.reflections.Reflections.<init>(Reflections.java:168) at org.eu.ingwar.tools.arquillian.extension.suite.DeploymentClassFinder.getDeploymentClassFromAnnotation(DeploymentClassFinder.java:62) at org.eu.ingwar.tools.arquillian.extension.suite.DeploymentClassFinder.getDeploymentClass(DeploymentClassFinder.java:46) at org.eu.ingwar.tools.arquillian.extension.suite.SuiteDeployer.configure(SuiteDeployer.java:80) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55) at java.lang.reflect.Method.invoke(Method.java:507) at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86) at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103) at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:90) at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:133) at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:105) at org.jboss.arquillian.core.impl.ManagerImpl.bindAndFire(ManagerImpl.java:232) at org.jboss.arquillian.core.impl.InstanceImpl.set(InstanceImpl.java:67) at org.jboss.arquillian.config.impl.extension.ConfigurationRegistrar.loadConfiguration(ConfigurationRegistrar.java:72) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55) at java.lang.reflect.Method.invoke(Method.java:507) at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86) at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103) at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:90) at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:133) at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:105) at org.jboss.arquillian.core.impl.ManagerImpl.start(ManagerImpl.java:253) at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.<init>(EventTestRunnerAdaptor.java:61) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:88) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:57) at java.lang.reflect.Constructor.newInstance(Constructor.java:436) at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:144) at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:89) at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(TestRunnerAdaptorBuilder.java:49) at org.jboss.arquillian.junit.AdaptorManager.initializeAdaptor(AdaptorManager.java:21) at org.jboss.arquillian.junit.AdaptorManagerWithNotifier.initializeAdaptor(AdaptorManagerWithNotifier.java:19) at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:109) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
Hello,
i've got problems to get this extension to work. I have an EAR package based on this example https://github.com/wildfly/quickstart/tree/10.x/kitchensink-ear . I already have working test cases, but when I only add your dependency
i get this exception when running a test: