I already tried to get Arquillian to work but it seems to be very hard to get it working in IBM RAD without maven. Just right now I am trying to get all libs I need to successfully run a test, but as I said, without maven it's a pain...

I still don't understand why these CdiAware tests throw a NPE...

Regards,
Christian

Am 24.11.2011 13:17, schrieb Mark Struberg:
Hi Christian!

Since you added all WebSphere-8.0 libs you don't need the openwebbeans-* jars 
(WS includes them already).

Btw, the myfaces-extcdi-test was developed to perform quick standalone tests.

For testing a full EE server you might better use Arquillian.

I'm not sure if there is already a final arquillian-connector for WS-8 but it's 
at least work in progress [1].

There is of course one for openwebbeans standalone too.


LieGrue,
strub


[1] http://community.jboss.org/message/559002



----- Original Message -----
From: Christian Beikov<c.bei...@curecomp.com>
To: users@myfaces.apache.org
Cc:
Sent: Thursday, November 24, 2011 1:01 PM
Subject: IBM RAD with JUnit and AbstractCdiAwareTest

Hello!

I finally got myself to try out the JUnit-CDI tests but the actual result is
dissappointing. I added the following libraries to the build path of a project:

myfaces-extcdi-base-test-infrastructure-1.0.1.jar
myfaces-extcdi-bundle-jsf20-1.0.1.jar
myfaces-extcdi-cargo-support-module-1.0.1.jar
myfaces-extcdi-jsf-support-module-1.0.1.jar
myfaces-extcdi-junit-support-module-1.0.1.jar
myfaces-extcdi-owb-support-module-1.0.1.jar
myfaces-test20-1.0.4.jar
openwebbeans-impl-1.1.2.jar
openwebbeans-spi-1.1.2.jar

....and also the Websphere 8.0 libs.
My first test case is minimal:

@RunWith(JUnit4.class)
public class CoreExceptionHandlerTest extends
org.apache.myfaces.extensions.cdi.test.junit4.AbstractCdiAwareTest{

     @Inject
     private CoreExceptionHandlerTestBean bean;

     @Test
     public void testCoreExceptionHandler() {
         try {
             bean.provokeException();
         } catch (Exception e) {
             fail();
         }
     }
}

When i try to run it, I get the following Exception:

java.lang.NullPointerException
     at
org.apache.myfaces.extensions.cdi.test.TestContainerFactory.isServletContextAwareContainer(TestContainerFactory.java:142)
     at
org.apache.myfaces.extensions.cdi.test.TestContainerFactory.getNewCdiTestContainer(TestContainerFactory.java:120)
     at
org.apache.myfaces.extensions.cdi.test.TestContainerFactory.createTestContainer(TestContainerFactory.java:56)
     at
org.apache.myfaces.extensions.cdi.test.strategy.AbstractCdiAwareTestStrategy.before(AbstractCdiAwareTestStrategy.java:73)
     at
org.apache.myfaces.extensions.cdi.test.strategy.AbstractCdiAwareTestStrategy.beforeMethod(AbstractCdiAwareTestStrategy.java:44)
     at
org.apache.myfaces.extensions.cdi.test.junit4.AbstractCdiAwareTest.beforeMethod(AbstractCdiAwareTest.java:37)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
     at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
     at java.lang.reflect.Method.invoke(Method.java:611)
     at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
     at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
     at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
     at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
     at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
     at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
     at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
     at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
     at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
     at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
     at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
     at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
     at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
     at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

java.lang.NullPointerException
     at
org.apache.myfaces.extensions.cdi.test.strategy.AbstractCdiAwareTestStrategy.after(AbstractCdiAwareTestStrategy.java:87)
     at
org.apache.myfaces.extensions.cdi.test.strategy.AbstractCdiAwareTestStrategy.afterMethod(AbstractCdiAwareTestStrategy.java:54)
     at
org.apache.myfaces.extensions.cdi.test.junit4.AbstractCdiAwareTest.afterMethod(AbstractCdiAwareTest.java:47)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
     at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
     at java.lang.reflect.Method.invoke(Method.java:611)
     at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
     at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
     at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
     at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:37)
     at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
     at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
     at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
     at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
     at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
     at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
     at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
     at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
     at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Could anyone help me please? I alread read something about that on the mailing
list, but adding all libraries as suggested did not help me.

Regards,
Christian


Reply via email to