-
1. Re: Accessing the test class if a, e.g., a BeforeSetup event is fired
g.hohl Nov 30, 2016 4:19 AM (in response to g.hohl)Seems that I got one step further in my research. In meantime I arrived at the org.jboss.arquillian.junit.Arquillian class which is the JUnit runner of the Arquillian framework.
I have to admit that I wasn't aware of the fact that for every test suite a JUnit runner is instantiated. The JUnit framework passes the test class to the constructor of the runner.
But that means that it should be possible to have the test class the whole time which makes me wondering why I don't get it.
Within the run(RunNotifier) method of the Arquillian runner I at least see why: They don't take it for the calls there which also includes the BeforeSetup event.
At this point it looks like I have to overwrite the Arquillian runner somehow...
If anyone has a better solution, please, comment.
-
2. Re: Accessing the test class if a, e.g., a BeforeSetup event is fired
g.hohl Nov 30, 2016 4:49 AM (in response to g.hohl)Seems I have to overwrite the following classes:
- org.jboss.arquillian.junit.Arquillian
- org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder
- org.jboss.arquillian.test.impl.EventTestRunnerAdaptor
- org.jboss.arquillian.test.impl.TestContextHandler
The TestContextHandler is a little bit of a problem as it is loaded through an extension. And as far as I can see there is no way to disable / remove an extension, only to enable / add one.
-
3. Re: Accessing the test class if a, e.g., a BeforeSetup event is fired
g.hohl Dec 1, 2016 7:32 AM (in response to g.hohl)Okay, after writing 27 classes and interfaces I can now handle also the other life-cycle phases.
Unfortunately that doesn't seem to solve my original problem. Currently I need to add extra VM arguments if I want to execute the JUnit tests in Eclipse:
-Djboss.home=target/wildfly-10.1.0.Final -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dlogging.configuration=file:src/test/resources/logging.properties
But it's not very handy if you have to copy that to every JUnit launch configuration. And if someone of your team-mates doesn't know it...
Why it doesn't solve my problem: Also I set these properties using System.getProperties().setProperty(String, String) in the BeforeSetup event, it seems that some parts of WildFly have already been loaded.
I get the following message after the BeforeSetup event:
Cannot not load JBoss LogManager. The LogManager has likely been accessed prior to this initialization.
And after the BeforeStart event WildFly exits with an exception completely:
Dez 01, 2016 1:22:01 PM org.jboss.msc.service.ServiceContainerImpl <clinit>
INFO: JBoss MSC version 1.2.6.Final
Dez 01, 2016 1:22:01 PM org.jboss.as.server.ApplicationServerService start
INFO: WFLYSRV0049: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final) starting
Dez 01, 2016 1:22:03 PM org.jboss.as.controller.AbstractOperationContext executeStep
ERROR: WFLYCTL0013: Operation ("parallel-extension-add") failed - address: ([])
java.lang.RuntimeException: WFLYCTL0079: Failed initializing module org.jboss.as.logging
at org.jboss.as.controller.extension.ParallelExtensionAddHandler$1.execute(ParallelExtensionAddHandler.java:115)
at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:890)
at org.jboss.as.controller.AbstractOperationContext.processStages(AbstractOperationContext.java:659)
at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:370)
at org.jboss.as.controller.OperationContextImpl.executeOperation(OperationContextImpl.java:1329)
at org.jboss.as.controller.ModelControllerImpl.boot(ModelControllerImpl.java:467)
at org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:387)
at org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:349)
at org.jboss.as.server.ServerService.boot(ServerService.java:397)
at org.jboss.as.server.ServerService.boot(ServerService.java:366)
at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:299)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: WFLYLOG0078: The logging subsystem requires the log manager to be org.jboss.logmanager.LogManager. The subsystem has not be initialized and cannot be used. To use JBoss Log Manager you must add the system property "java.util.logging.manager" and set it to "org.jboss.logmanager.LogManager"
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.jboss.as.controller.extension.ParallelExtensionAddHandler$1.execute(ParallelExtensionAddHandler.java:107)
... 11 more
Caused by: java.lang.IllegalStateException: WFLYLOG0078: The logging subsystem requires the log manager to be org.jboss.logmanager.LogManager. The subsystem has not be initialized and cannot be used. To use JBoss Log Manager you must add the system property "java.util.logging.manager" and set it to "org.jboss.logmanager.LogManager"
at org.jboss.as.logging.LoggingExtension.initialize(LoggingExtension.java:147)
at org.jboss.as.controller.extension.ExtensionAddHandler.initializeExtension(ExtensionAddHandler.java:131)
at org.jboss.as.controller.extension.ExtensionAddHandler.initializeExtension(ExtensionAddHandler.java:104)
at org.jboss.as.controller.extension.ParallelExtensionAddHandler$ExtensionInitializeTask.call(ParallelExtensionAddHandler.java:144)
at org.jboss.as.controller.extension.ParallelExtensionAddHandler$ExtensionInitializeTask.call(ParallelExtensionAddHandler.java:127)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Dez 01, 2016 1:22:03 PM org.jboss.as.server.ServerService$4 logExit
FATAL: WFLYSRV0056: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.
Dez 01, 2016 1:22:03 PM org.jboss.as.server.ApplicationServerService stop
INFO: WFLYSRV0050: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final) stopped in 65ms
Seems I have to go back again and look at which point that WildFly instance or logging instance is initialized.