-
Bug
-
Resolution: Done
-
Critical
-
None
-
None
-
None
-
None
The JUnit 5 extension does not seem to work with manual mode tests. I've attached a reproducer which can also be ran with JUnit 4 and the test will pass.
java.lang.IllegalArgumentException: No deployment scenario in context
at org.jboss.arquillian.container.test.impl.client.container.ClientContainerController.start(ClientContainerController.java:63)
at org.wildfly.reproducer.web.rest.JUnit5GreetingTest.startAndDeploy(JUnit5GreetingTest.java:40)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.jboss.arquillian.junit5.ArquillianExtension.interceptBeforeEachMethod(ArquillianExtension.java:102)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
What appears to be the issue is when the InvocationInterceptor.interceptBeforeEachMethod is invoked, there are no active contexts except the ApplicationContext.
The following output is from the JUnit 4 run:
(E) ManagerStarted (O) ConfigurationRegistrar.loadConfiguration (E) ArquillianDescriptorImpl (O) ContainerRegistryCreator.createRegistry (E) LocalContainerRegistry (O) ProtocolRegistryCreator.createRegistry (E) ProtocolRegistry (E) BeforeSuite (I) TestContextHandler.createSuiteContext (O) ContainerEventController.execute (E) SetupContainers (O) ClientDeployerCreator.createClientSideDeployer (E) ClientDeployer (O) ClientWildFlyContainerControllerCreator.create (E) ClientWildFlyContainerController (O) ClientContainerControllerCreator.createClientSideContainerController (E) ClientContainerController (O) ContainerLifecycleController.setupContainers (E) SetupContainer (I) ContainerDeploymentContextHandler.createContainerContext (O) ContainerLifecycleController.setupContainer (E) BeforeSetup (E) ContainerImpl (E) ManagementClient (E) ArchiveDeployer (E) AfterSetup (E) StartSuiteContainers (O) ContainerLifecycleController.startSuiteContainers (E) BeforeClass (I) TestContextHandler.createSuiteContext (I) TestContextHandler.createClassContext (E) TestClass (O) ContainerRestarter.restart (O) ContainerEventController.execute (E) StartClassContainers (O) ContainerLifecycleController.startClassContainers (E) GenerateDeployment (O) DeploymentGenerator.generateDeployment (E) DeploymentScenario (E) DeployManagedDeployments (O) ContainerDeployController.deployManaged (O) ServerSetupObserver.handleBeforeClass (O) ClientBeforeAfterLifecycleEventExecuter.on (E) RulesEnrichment (I) TestContextHandler.createSuiteContext (I) TestContextHandler.createClassContext (E) TestClass (I) TestContextHandler.createTestContext (I) ContainerEventController.createBeforeContext (O) RulesEnricher.enrichRulesAndTestInstance (O) ClientBeforeAfterLifecycleEventExecuter.on (E) BeforeRules (I) TestContextHandler.createSuiteContext (I) TestContextHandler.createClassContext (E) TestClass (I) TestContextHandler.createTestContext (I) ContainerEventController.createBeforeContext (O) RulesEnricher.enrichStatement (E) BeforeEnrichment (E) AfterEnrichment (O) ClientBeforeAfterLifecycleEventExecuter.on (E) Before (I) TestContextHandler.createSuiteContext (I) TestContextHandler.createClassContext (E) TestClass (I) TestContextHandler.createTestContext (I) ContainerEventController.createBeforeContext (O) TestInstanceEnricher.enrich (E) BeforeEnrichment (E) AfterEnrichment (O) ClientBeforeAfterLifecycleEventExecuter.on (E) StartContainer (I) ContainerDeploymentContextHandler.createContainerContext (O) ContainerLifecycleController.startContainer (E) BeforeStart
(E) ManagerStarted (O) ConfigurationRegistrar.loadConfiguration (E) ArquillianDescriptorImpl (O) ContainerRegistryCreator.createRegistry (E) LocalContainerRegistry (O) ProtocolRegistryCreator.createRegistry (E) ProtocolRegistry (E) BeforeSuite (I) TestContextHandler.createSuiteContext (O) ContainerEventController.execute (E) SetupContainers (O) ContainerLifecycleController.setupContainers (E) SetupContainer (I) ContainerDeploymentContextHandler.createContainerContext (O) ContainerLifecycleController.setupContainer (E) BeforeSetup (E) ContainerImpl (E) ManagementClient (E) ArchiveDeployer (E) AfterSetup (O) ClientDeployerCreator.createClientSideDeployer (E) ClientDeployer (O) ClientWildFlyContainerControllerCreator.create (E) ClientWildFlyContainerController (O) ClientContainerControllerCreator.createClientSideContainerController (E) ClientContainerController (E) StartSuiteContainers (O) ContainerLifecycleController.startSuiteContainers (E) BeforeClass (I) TestContextHandler.createSuiteContext (I) TestContextHandler.createClassContext (E) TestClass (O) ServerSetupObserver.handleBeforeClass (O) ContainerRestarter.restart (O) ContainerEventController.execute (E) StartClassContainers (O) ContainerLifecycleController.startClassContainers (E) GenerateDeployment (O) DeploymentGenerator.generateDeployment (E) DeploymentScenario (E) DeployManagedDeployments (O) ContainerDeployController.deployManaged (O) ClientBeforeAfterLifecycleEventExecuter.on (E) Before (I) TestContextHandler.createSuiteContext (I) TestContextHandler.createClassContext (E) TestClass (I) TestContextHandler.createTestContext (I) ContainerEventController.createBeforeContext (O) TestInstanceEnricher.enrich (E) BeforeEnrichment (E) AfterEnrichment (O) ClientBeforeAfterLifecycleEventExecuter.on (E) RunModeEvent (I) TestContextHandler.createSuiteContext (I) TestContextHandler.createClassContext (E) TestClass (I) TestContextHandler.createTestContext (I) ContainerEventController.createBeforeContext (O) RunModeEventHandler.handleEvent (O) ClientBeforeAfterLifecycleEventExecuter.on
Note that I don't know exactly how the debug logger works, but notice the indentations on JUnit 4 where the Before event is ran after the BeforeRules. This makes me think that it's running with other contexts activated. However, I'm not too familiar with how all this works. Debugging I can see the contexts being activated, but they are deactivated, most of them in a finally block after activation, before the InvocationInterceptor.interceptBeforeEachMethod is invoked.
Note that if you move controller invocations to a @Test it works fine.
- causes
-
RESTEASY-3451 junit5 migration: Fix manual mode tests
- Resolved