[
https://issues.jboss.org/browse/AS7-3521?page=com.atlassian.jira.plugin.s...
]
Aslak Knutsen commented on AS7-3521:
------------------------------------
The problem here is that you're trying to Inject something(ManagementClient) from a
context (Container Context) before it exists. The context with a ManagementClient only
exists after you have started the Container.
You can work around this by splitting it up in multiple @Test methods, e.g.
{code}
@ArquillianResource
ContainerController cc;
@Test
public void start() {
cc.start()
}
@Test
public void start(@ArquillianResource ManagementClient client) {
// do stuff with client
}
{code}
@ArquillianResource ManagementClient injection does not work in
'manual' container mode
---------------------------------------------------------------------------------------
Key: AS7-3521
URL:
https://issues.jboss.org/browse/AS7-3521
Project: Application Server 7
Issue Type: Bug
Components: Test Suite
Reporter: Ivo Studensky
Assignee: Andrew Rubinger
Priority: Critical
Labels: arq_qe_blocker
Fix For: 7.1.1.Final
ManagementClient cannot be injected by @ArquillianResource annotation if the test runs in
the manual container mode, i.e. if the test itself controls start/stop actions on the
container. In such case the injection fails with ' java.lang.RuntimeException: Could
not lookup value for field private
org.jboss.as.arquillian.container.ManagementClient'.
See the snippet of output log:
{noformat}
java.lang.RuntimeException: Could not lookup value for field private static
org.jboss.as.arquillian.container.ManagementClient
org.jboss.jbossts.txbridge.tests.inbound.junit.BasicTests.managementClient
at
org.jboss.arquillian.test.impl.enricher.resource.ArquillianResourceTestEnricher.enrich(ArquillianResourceTestEnricher.java:61)
at
org.jboss.arquillian.test.impl.TestInstanceEnricher.enrich(TestInstanceEnricher.java:52)
at
org.jboss.arquillian.container.test.impl.ClientTestInstanceEnricher.enrich(ClientTestInstanceEnricher.java:51)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)
at
org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
at
org.jboss.arquillian.container.test.impl.client.ContainerEventController.createContext(ContainerEventController.java:142)
at
org.jboss.arquillian.container.test.impl.client.ContainerEventController.createBeforeContext(ContainerEventController.java:124)
.
.
.
Caused by: java.lang.RuntimeException: Provider for type class
org.jboss.as.arquillian.container.ManagementClient returned a null value:
org.jboss.as.arquillian.container.ManagementClientProvider@3d47358f
at
org.jboss.arquillian.test.impl.enricher.resource.ArquillianResourceTestEnricher.lookup(ArquillianResourceTestEnricher.java:115)
at
org.jboss.arquillian.test.impl.enricher.resource.ArquillianResourceTestEnricher.enrich(ArquillianResourceTestEnricher.java:57)
... 71 more
{noformat}
I've isolated a test-case for this issue into my private branch on github, see:
https://github.com/istudens/jboss-as/compare/inject_mgmt_client
Steps to reproduce the issue:
1. git clone git@github.com:istudens/jboss-as.git
2. cd jboss-as
3. git checkout inject_mgmt_client
4. ./build.sh clean install -Dts.noSmoke -DskipTests
5. cd testsuite/integration/manual
6. mvn clean install
This issue is related to AS7-1415.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira