You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@deltaspike.apache.org by Rainer Schön <ra...@gmail.com> on 2014/08/19 21:18:21 UTC

CdiTestRunner and DS Scopes

Hi all

I run into a problem, when using CdiTestRunner, Weld-SE (2.1.2) and Deltaspike (1.0.1) scopes like GroupedConversationScope. Even if I start the scopes with @TestControl(startScopes = {RequestScoped.class, SessionScoped.class, GroupedConversationScoped.class}) the latter scope is not available and gives me a  [WELD-001303: No active contexts for scope type org.apache.deltaspike.core.api.scope.GroupedConversationScoped] error.

Any ideas, how this can be solved?

Regards, Rainer

Re: CdiTestRunner and DS Scopes

Posted by Rainer Schön <ra...@gmail.com>.
Dear Gerhard

Thanks for your quick hint. I added the WindowContext#activateWindow to my @Before method. Unfortunately nothing changed. I created a  demo ;) with a GroupedConversationScoped bean and activated the window scope, and it worked. So I tried to track down the problem eliminating all injections in the test class. The problem was an injected object exposing state by a @Named @Produces method of the tested GroupedConversationScoped controller for convenience use in the facelet EL. Obviously this caused the controller to be constructed before the first call to activateWindow. Hope this explanation helps other users in similar situations.

Again, thanks
Rainer

Am 19.08.2014 um 22:43 schrieb Gerhard Petracek:
> hi rainer,
>
> @TestControl is just needed for cdi std.-scopes.
> for window-aware scopes you just need to activate a logical window (see
> e.g. [1]).
>
> regards,
> gerhard
>
> [1]
> https://github.com/os890/ee6-ds-demo/blob/master/src/test/java/org/os890/demo/ee6/test/PageBeanTest.java
>
> http://www.irian.at
>
> Your JSF/JavaEE powerhouse -
> JavaEE Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>
>
>
> 2014-08-19 21:18 GMT+02:00 Rainer Schön <ra...@gmail.com>:
>
>> Hi all
>>
>> I run into a problem, when using CdiTestRunner, Weld-SE (2.1.2) and
>> Deltaspike (1.0.1) scopes like GroupedConversationScope. Even if I start
>> the scopes with @TestControl(startScopes = {RequestScoped.class,
>> SessionScoped.class, GroupedConversationScoped.class}) the latter scope
>> is not available and gives me a  [WELD-001303: No active contexts for scope
>> type org.apache.deltaspike.core.api.scope.GroupedConversationScoped]
>> error.
>>
>> Any ideas, how this can be solved?
>>
>> Regards, Rainer
>>
>


Re: CdiTestRunner and DS Scopes

Posted by Gerhard Petracek <ge...@gmail.com>.
hi rainer,

@TestControl is just needed for cdi std.-scopes.
for window-aware scopes you just need to activate a logical window (see
e.g. [1]).

regards,
gerhard

[1]
https://github.com/os890/ee6-ds-demo/blob/master/src/test/java/org/os890/demo/ee6/test/PageBeanTest.java

http://www.irian.at

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

Professional Support for Apache MyFaces



2014-08-19 21:18 GMT+02:00 Rainer Schön <ra...@gmail.com>:

> Hi all
>
> I run into a problem, when using CdiTestRunner, Weld-SE (2.1.2) and
> Deltaspike (1.0.1) scopes like GroupedConversationScope. Even if I start
> the scopes with @TestControl(startScopes = {RequestScoped.class,
> SessionScoped.class, GroupedConversationScoped.class}) the latter scope
> is not available and gives me a  [WELD-001303: No active contexts for scope
> type org.apache.deltaspike.core.api.scope.GroupedConversationScoped]
> error.
>
> Any ideas, how this can be solved?
>
> Regards, Rainer
>