deltaspike-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gerhard Petracek <gerhard.petra...@gmail.com>
Subject Re: TestControl Module - ConversationScope
Date Wed, 02 Apr 2014 09:29:36 GMT
hi rainer,

it would be great if you can provide a link to a demo which illustrates the
issue (with my demo-setup the workaround works fine).

regards,
gerhard

http://www.irian.at

Your JSF/JavaEE powerhouse -
JavaEE Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces



2014-04-02 10:56 GMT+02:00 Rainer Schön <rainer.schoen.dev@gmail.com>:

> Hi Gerhard
>
> Unfortunately your solution does not work neither (I tried it already
> before posting the mail). When I start Weld SE myself (no CdiTestRunner) in
> the BeforeClass method, it works fine with all scopes, but then I loose the
> comfort of having injection service into the UnitTest file and must do this
> manually by means of the DS BeanProvider.
>
> I will create a jira-ticket for this.
>
> By the way, +1  for this module as soon as this scope works. It saves me a
> lot of the more time consuming and sometimes cumbersome deployments of
> Arquillian tests.
>
> Thanks for your assistance.
> Rainer
>
> Am 02.04.2014 10:10, schrieb Gerhard Petracek:
>
>  hi rainer,
>>
>> it looks like a restriction with weld (it works fine with owb) -> please
>> create a jira-ticket for it.
>>
>> for now you can use: @TestControl(startScopes = {RequestScoped.class,
>> SessionScoped.class, ConversationScoped.class})
>> (for every test method)
>>
>> regards,
>> gerhard
>>
>> http://www.irian.at
>>
>> Your JSF/JavaEE powerhouse -
>> JavaEE Consulting, Development and
>> Courses in English and German
>>
>> Professional Support for Apache MyFaces
>>
>>
>>
>> 2014-04-02 9:52 GMT+02:00 Rainer Schön <rainer.schoen.dev@gmail.com>:
>>
>>  Hi all
>>>
>>> When I inject a ConversationScoped bean into the test, I get the
>>> following
>>> error (Deltapsike 0.6, Weld SE 2.1.1 JUnit 4.11):
>>>
>>> Apr 01, 2014 11:19:37 PM org.apache.deltaspike.testcontrol.api.junit.
>>> CdiTestRunner$ContainerAwareTestContext startScopes
>>> SEVERE: failed to start scope @javax.enterprise.context.
>>> ConversationScoped
>>> java.lang.NullPointerException
>>>          at org.jboss.weld.context.bound.BoundConversationContextImpl.
>>> setRequestAttribute(BoundConversationContextImpl.java:29)
>>>          at org.jboss.weld.context.bound.BoundConversationContextImpl.
>>> setRequestAttribute(BoundConversationContextImpl.java:10)
>>>          at org.jboss.weld.context.AbstractConversationContext.
>>> associate(
>>> AbstractConversationContext.java:134)
>>>          at org.apache.deltaspike.cdise.weld.ContextController.
>>> startConversationScope(ContextController.java:122)
>>>          at org.apache.deltaspike.cdise.weld.WeldContextControl.
>>> startConversationScope(WeldContextControl.java:149)
>>>          at org.apache.deltaspike.cdise.weld.WeldContextControl.
>>> startContext(WeldContextControl.java:74)
>>>          at org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner$
>>> ContainerAwareTestContext.startScopes(CdiTestRunner.java:595)
>>>          at org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner$
>>> ContainerAwareTestContext.applyBeforeClassConfig(CdiTestRunner.java:462)
>>>          at org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner$
>>> BeforeClassStatement.evaluate(CdiTestRunner.java:347)
>>>          at org.junit.internal.runners.statements.RunAfters.evaluate(
>>> RunAfters.java:27)
>>>          at org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner$
>>> AfterClassStatement.evaluate(CdiTestRunner.java:374)
>>>          at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
>>>          at org.apache.deltaspike.testcontrol.api.junit.
>>> CdiTestRunner.run(
>>> CdiTestRunner.java:129)
>>>          at org.eclipse.jdt.internal.junit4.runner.
>>> JUnit4TestReference.run(
>>> JUnit4TestReference.java:50)
>>>          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)
>>>
>>> My test set up:
>>>
>>> @FixMethodOrder(MethodSorters.NAME_ASCENDING)
>>> @RunWith(CdiTestRunner.class)
>>> @TestControl(startScopes = {ConversationScoped.class})
>>> public class PubliOrderManagerTest ...
>>>
>>> @Inject
>>> private ManagerBean mgr;  // the ConversationScoped bean
>>>
>>> @Inject
>>> private Conversation conversation;
>>>
>>>
>>> @Test
>>> public void A_testLookupItems() {
>>>          conversation.begin();
>>>          ...
>>>
>>> @Test
>>> public void Z_testRemove() {
>>>          conversation.end();
>>>          ...
>>>
>>>
>>> What am I doing wrong? Any help appreciated.
>>>
>>> Rainer
>>>
>>>
>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message