-
1. Re: injecting InitialContext and ServiceContainer into Arquillian junit testcase
igarashitm Apr 25, 2012 5:16 PM (in response to igarashitm)found one of those - Arquillian test should have at least one @Deployment - so added following.
@Deployment public static JavaArchive createDeployment() { return ShrinkWrap.create(JavaArchive.class) .addClass(Hello.class) .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); }
But hit an another problem
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [ServiceContainer] with qualifiers [@Default] at injection point [[field] @Inject private org.switchyard.test.arquillian.hello.HelloArquillianTest._serviceContainer]
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:275)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:244)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:107)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:127)
at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:346)
at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:331)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:366)
at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:83)
at org.jboss.as.weld.services.WeldService.start(WeldService.java:76)
... 5 more
-
2. Re: injecting InitialContext and ServiceContainer into Arquillian junit testcase
igarashitm Apr 25, 2012 7:18 PM (in response to igarashitm)Injection succeeded once I removed the beans.xml from @Deployment and changed the field accessibility to public, Thanks @aslak !!
hmm, but should it be public anyway when I need to perform injection ???
And then I'm seeing next error ... It seems that is class accessibility problem in the AS7. Some testcases in the AS7 testsuite are doing same thing(ex. PureTestCase in the testsuite/integration/smoke), so should be able to do though... maybe I need to ask it to the AS7 community.
Caused by: java.lang.ClassNotFoundException: org.jboss.as.connector.ConnectorServices from [Module "deployment.49386822-451a-4cd6-89d4-466069ebf570.jar:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]
-
3. Re: injecting InitialContext and ServiceContainer into Arquillian junit testcase
aslak Apr 26, 2012 6:17 AM (in response to igarashitm)private or public field shouldn't matter. It's up to the Enricher impl, but I believe most support privat fields as well as public.
Does the PureTestCase define something extra in their MANIFEST.MF file?
-
4. Re: injecting InitialContext and ServiceContainer into Arquillian junit testcase
igarashitm Apr 26, 2012 9:05 AM (in response to aslak)Hey, do we need field.setAccessible(true) right before field.set()?
I couldn't find MANIFEST.MF for PureTestCase. I have noticed there is no module directory in the jbossHome for as7 testsuite/integration/smoke, so I may need some trick to achieve this, and it may not be applicable for our SwitchYard testkit ...
-
5. Re: injecting InitialContext and ServiceContainer into Arquillian junit testcase
aslak Apr 26, 2012 6:23 PM (in response to igarashitm)hmm, yea that enricher doesn't allow for private fields. silly. report a issue
-
6. Re: injecting InitialContext and ServiceContainer into Arquillian junit testcase
aslak Apr 26, 2012 6:23 PM (in response to aslak)the modules dir is located some where else. I believe you can find the path defined in the testsuite/pom