ingwarsw / arquillian-suite-extension

Arquillian extension that will force single deployment for all tests
Apache License 2.0
67 stars 20 forks source link

An existing connection was forcibly closed by the remote host #9

Closed huangdihu closed 10 years ago

huangdihu commented 10 years ago

I tried Arquillian Suite Extension, and when it came to deployment, it reported the following error in console. 2014-07-02 13:25:36,532 [Remoting "management-client" read-1] [ERROR] [org.jboss.remoting.remote.connection] JBREM000200: Remote connection failed: java.io.IOException: An existing connection was forcibly closed by the remote host

In server.log, there is no ERROR.

I tried to use the same version of JBoss and jboss-as-arquillian-container as arquillian-suite-extension git hub project, but it still had the problem as above.

More details about my project:

  1. I had a class DeploymentBeforeSuite which contains 13 @Deployment methods, and I marked DeploymentBeforeSuite as @ArquillianSuiteDeployment.
  2. All our test cases are TestNG cases, we developed 3 TestNG listeners for writing test report in html.
  3. Our test class extends Arquillian, and use Arquillian Drone for UI test.
  4. Our test methods are only annotated by @Test, no other annotation.

I debugged arquillian-suite-extension project, and seems it never reached the following code in ArquillianSuiteExtension#startup. I assumed that this is the main code to do deployment, right?

executeInClassScope(new Callable() { @Override public Void call() { generateDeploymentEvent.fire(new GenerateDeployment(new TestClass(deploymentClass))); suiteDeploymentScenario = classDeploymentScenario.get(); return null; } }); deployDeployments = true; extendedSuiteContext.get().activate(); suiteDeploymentScenarioInstanceProducer.set(suiteDeploymentScenario);

Do you have any idea how to solve the problem? Or could you give me some pointer so that I can debug the problem? Thank you~

ingwarsw commented 10 years ago

Could you post output of your test command but with additional flag -Darquillian.debug=true And also could you post your arquillian,xml file?

Do you have any code where I can check/test your changes?

huangdihu commented 10 years ago

@ingwarsw: Karol, thank you for your reply. I enabled -Darquillian.debug=true, I found more information, see the following log. It reported DescriptorImportException, which is defined in shrinkwrap-descriptors-api-base.jar (I am using 2.0.0-alpha-5 version).

I used shrinkwrap maven resolver (org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-depchain:2.0.2 pom) to download ear from nexus and deploy to JBoss. However, seems the resolving of maven artifact ear failed, so the deployment of ear never started.

Attached is my arquillian.xml. There is lots of company-sensitive code in my project, it will take me some time to exclude the sensitive information and upload my change. Before that, could you give me some clue to proceed and debug? Thank you~

Log details are as follows:

13:28:33,764 INFO [org.jboss.as](Controller Boot Thread) JBAS015874: JBoss EAP 6.1.1.GA (AS 7.2.1.Final-redhat-10) started in 7824ms - Started 172 of 353 services (180 services are passive or on-demand) (E) AfterStart (O) SuiteDeployer.startup Jul 03, 2014 1:28:34 PM org.eu.ingwar.tools.arquillian.extension.suite.ArquillianSuiteExtension$SuiteDeployer debug WARNING: Catching AfterStart event org.jboss.arquillian.container.spi.event.container.AfterStart@62e7e178 (E) Event (I) SuiteDeployer.blockGenerateDeploymentWhenNeeded Jul 03, 2014 1:28:34 PM org.eu.ingwar.tools.arquillian.extension.suite.ArquillianSuiteExtension$SuiteDeployer debug WARNING: NOT Blocking GenerateDeployment event {} (O) DeploymentGenerator.generateDeployment 2014-07-03 13:28:34,846 [main] [DEBUG] [XXDeployment] _Creating XX ear for test_ (E) DescriptorImportException (E) DescriptorImportException (E) RuntimeException (E) RuntimeException (E) RuntimeException (E) RuntimeException (E) RuntimeException (E) RuntimeException (E) RuntimeException (E) RuntimeException arquillian

ingwarsw commented 10 years ago

Your arquillian.xml looks good.

Log also looks good (it started creating deployments but creating failed)

Could you try creating test class with all that 13 @Deployment methods and try if it will deploy all without @ArquillianSuiteDeployment

And if it will work then try adding @ArquillianSuiteDeployment and see if it still will work...

Or try disabling @Deployment methods until you will find set witch works and then try finding what's wrong with ones not working.

huangdihu commented 10 years ago

@ingwarsw: I marked all 13 @Deployment as testable=false, then they were deployed successfully, and tests can run after that deployment, thank you~

huangdihu commented 10 years ago

@ingwarsw: I noticed that in arquillian-suite-extension project, all test classes extend the deployment class, is that required?

ingwarsw commented 10 years ago

Nope, its not needed but very helpful when testing suites.

If all my test classes extends class with all deployments and I remove @ArquillianSuiteDeployment annotation then all tests will still run without suite (because they will all have all deployments defined).

So now its working for you? And how its working if you have all your deployments marked as teststable=false? You dont need arquillian enriched deployments?

huangdihu commented 10 years ago

@ingwarsw : I know why you let test class extend the deployment class now. Thank you~

We're using Arquillian to do UI test, it does not need to go into container, so arquillian enriched deployments are not needed. In some situations, we do EJB in-container test, then we need to use "testable=true". :-)

ingwarsw commented 10 years ago

So now everything is working for you? I can close issue?

Could you describe briefly how many tests do you have and how much faster (if its true) they are running??

huangdihu commented 10 years ago

@ingwarsw : I didn't do the benchmark test. Here is my rough estimate, our full deployment will take 10 minutes to run, and we have 8 test classes right now, so at least arquillian-suite-extension saves us 7*10 minutes when it reuses the deployment for each test class. We will have more test classes in future, the improvement is dramatic, thank you very much for the contribution.

huangdihu commented 10 years ago

@ingwarsw: sure, you can close the ticket. thank you~

huangdihu commented 10 years ago

@ingwarsw : I have 2 containers, one is jboss_managed container, the other is jboss_remote container. For jboss_remote, I will start JBoss and deploy ear manually, and then run Arquillian tests against it, so I want to skip all deployments in @ArquillianSuiteDeployment class when I use jboss_remote container. I put @TargetsContainer("jboss_managed") before each @Deployment method, but Arquillian still triggers each @Deployment method, and when Arquillian tries to deploy the ear returned by each @Deployment method, it fails to find TargetsContainer("jboss_managed"). It can only find jboss_remote. Do you know any way to skip @Deployment in jboss_remote container mode? Thank you~

ingwarsw commented 10 years ago

Accually I dont know any method of skipping deployment.

Mayby you should try asking @aslakknutsen he is guru in Arquillian.

@huangdihu Thanks for using extension and if you will have some other issues just create new one.

huangdihu commented 10 years ago

@aslakknutsen : I have 2 containers, one is jboss_managed container, the other is jboss_remote container. For jboss_remote, I will start JBoss and deploy ear manually, and then run Arquillian tests against it, so I want to skip all deployments in @ArquillianSuiteDeployment class when I use jboss_remote container. I put @TargetsContainer("jboss_managed") before each @Deployment method, but Arquillian still triggers each @Deployment method, and when Arquillian tries to deploy the ear returned by each @Deployment method, it fails to find TargetsContainer("jboss_managed"). It can only find jboss_remote. Do you know any way to skip @Deployment in jboss_remote container mode? And is there other forum suitable for posting this question? Thank you~

huangdihu commented 10 years ago

@ingwarsw : thank you~