You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by Mark Struberg <st...@yahoo.de> on 2012/10/01 09:52:34 UTC

Fw: Mock Contexts

gnnn our mail server sucks big times lately. Always rejects my mails the first time :/



----- Forwarded Message -----
> From: Mark Struberg <st...@yahoo.de>
> To: deltaspike <de...@incubator.apache.org>
> Cc: 
> Sent: Monday, October 1, 2012 9:51 AM
> Subject: Mock Contexts
> 
> 
> 
> Hi!
> 
> While hacking the @ViewScoped support I ran across our MockViewContext.
> In CODI we used a Map based dummy implementation in ProjectStage == UnitTest.
> But that might be counter productive if 'real' container unit testing is 
> done with Arquillian.
> 
> Otoh
> such a Mock Context is really useful in some cases. After thinking a 
> bit about it I came up with providing a MockContext which can be mapped 
> in for any other Context via ProcessAnnotatedType.
> 
> Not sure how to run this though as currently scopes don't allow for 
> @Nonbinding payload, do they?
> 
> The idea is to add a Configuration for all Scopes which should get mapped to a 
> dummy context.
> Then
> replace all configured scopes on the beans with 'DealtaSpikeMock' + 
> original Context name and automatically register a Context for all those
> configured dummy scopes.
> The lifecycle of the beans can be 
> controlled by simply injecting the Extension and accessing the 
> underlying context via the original scope annotation.
> 
> That way we can get rid of all 'manual' Mock Contexts and only use them 
> when really needed.
> 
> LieGrue,
> strub
> 

Re: Fw: Mock Contexts

Posted by Bernard Łabno <s4...@pjwstk.edu.pl>.
Marc, I can talk it over on IRC. I'll be there tommorow since 10am (gmt+1)

2012/10/3 Mark Struberg <st...@yahoo.de>

>
> Bernard, any feedback on this?
>
>
> Do you have some time for discussing this on the list or via IRC? I would
> like to get this baby going and your input would be very valuable for sure.
>
>
> txs and LieGrue,
> strub
>
> >________________________________
> > From: Mark Struberg <st...@yahoo.de>
> >To: "deltaspike-dev@incubator.apache.org" <
> deltaspike-dev@incubator.apache.org>
> >Sent: Monday, October 1, 2012 10:04 AM
> >Subject: Re: Fw: Mock Contexts
> >
> >Hi Bernard!
> >
> >The idea is to have a Mock Context which is portable across all
> containers and can handle various scopes.
> >I guess this is pretty easy to implement. The tricky part is how to
> enable/configure this features.
> >
> >
> >The ViewScopedContext support exists in OWB since early 2009 and I ported
> it over to CODI and Seam3 in 2010.
> >
> >LieGrue,
> >strub
> >
> >
> >
> >----- Original Message -----
> >> From: Bernard Łabno <s4...@pjwstk.edu.pl>
> >> To: deltaspike-dev@incubator.apache.org
> >> Cc:
> >> Sent: Monday, October 1, 2012 9:57 AM
> >> Subject: Re: Fw: Mock Contexts
> >>
> >> I'm writing Arquillian extension that provides conversation and view
> >> contexts.
> >>
> >> https://community.jboss.org/thread/200461
> >>
> >> 2012/10/1 Mark Struberg <st...@yahoo.de>
> >>
> >>>  gnnn our mail server sucks big times lately. Always rejects my mails
> the
> >>>  first time :/
> >>>
> >>>
> >>>
> >>>  ----- Forwarded Message -----
> >>>  > From: Mark Struberg <st...@yahoo.de>
> >>>  > To: deltaspike <de...@incubator.apache.org>
> >>>  > Cc:
> >>>  > Sent: Monday, October 1, 2012 9:51 AM
> >>>  > Subject: Mock Contexts
> >>>  >
> >>>  >
> >>>  >
> >>>  > Hi!
> >>>  >
> >>>  > While hacking the @ViewScoped support I ran across our
> >> MockViewContext.
> >>>  > In CODI we used a Map based dummy implementation in ProjectStage ==
> >>>  UnitTest.
> >>>  > But that might be counter productive if 'real' container unit
> >> testing is
> >>>  > done with Arquillian.
> >>>  >
> >>>  > Otoh
> >>>  > such a Mock Context is really useful in some cases. After thinking a
> >>>  > bit about it I came up with providing a MockContext which can be
> >> mapped
> >>>  > in for any other Context via ProcessAnnotatedType.
> >>>  >
> >>>  > Not sure how to run this though as currently scopes don't allow
> >> for
> >>>  > @Nonbinding payload, do they?
> >>>  >
> >>>  > The idea is to add a Configuration for all Scopes which should get
> >>>  mapped to a
> >>>  > dummy context.
> >>>  > Then
> >>>  > replace all configured scopes on the beans with
> >> 'DealtaSpikeMock' +
> >>>  > original Context name and automatically register a Context for all
> >> those
> >>>  > configured dummy scopes.
> >>>  > The lifecycle of the beans can be
> >>>  > controlled by simply injecting the Extension and accessing the
> >>>  > underlying context via the original scope annotation.
> >>>  >
> >>>  > That way we can get rid of all 'manual' Mock Contexts and only
> >> use them
> >>>  > when really needed.
> >>>  >
> >>>  > LieGrue,
> >>>  > strub
> >>>  >
> >>>
> >>
> >
> >
> >
>

Re: Fw: Mock Contexts

Posted by Mark Struberg <st...@yahoo.de>.
Bernard, any feedback on this?


Do you have some time for discussing this on the list or via IRC? I would like to get this baby going and your input would be very valuable for sure.


txs and LieGrue,
strub

>________________________________
> From: Mark Struberg <st...@yahoo.de>
>To: "deltaspike-dev@incubator.apache.org" <de...@incubator.apache.org> 
>Sent: Monday, October 1, 2012 10:04 AM
>Subject: Re: Fw: Mock Contexts
> 
>Hi Bernard!
>
>The idea is to have a Mock Context which is portable across all containers and can handle various scopes.
>I guess this is pretty easy to implement. The tricky part is how to enable/configure this features.
>
>
>The ViewScopedContext support exists in OWB since early 2009 and I ported it over to CODI and Seam3 in 2010.
>
>LieGrue,
>strub
>
>
>
>----- Original Message -----
>> From: Bernard Łabno <s4...@pjwstk.edu.pl>
>> To: deltaspike-dev@incubator.apache.org
>> Cc: 
>> Sent: Monday, October 1, 2012 9:57 AM
>> Subject: Re: Fw: Mock Contexts
>> 
>> I'm writing Arquillian extension that provides conversation and view
>> contexts.
>> 
>> https://community.jboss.org/thread/200461
>> 
>> 2012/10/1 Mark Struberg <st...@yahoo.de>
>> 
>>>  gnnn our mail server sucks big times lately. Always rejects my mails the
>>>  first time :/
>>> 
>>> 
>>> 
>>>  ----- Forwarded Message -----
>>>  > From: Mark Struberg <st...@yahoo.de>
>>>  > To: deltaspike <de...@incubator.apache.org>
>>>  > Cc:
>>>  > Sent: Monday, October 1, 2012 9:51 AM
>>>  > Subject: Mock Contexts
>>>  >
>>>  >
>>>  >
>>>  > Hi!
>>>  >
>>>  > While hacking the @ViewScoped support I ran across our 
>> MockViewContext.
>>>  > In CODI we used a Map based dummy implementation in ProjectStage ==
>>>  UnitTest.
>>>  > But that might be counter productive if 'real' container unit 
>> testing is
>>>  > done with Arquillian.
>>>  >
>>>  > Otoh
>>>  > such a Mock Context is really useful in some cases. After thinking a
>>>  > bit about it I came up with providing a MockContext which can be 
>> mapped
>>>  > in for any other Context via ProcessAnnotatedType.
>>>  >
>>>  > Not sure how to run this though as currently scopes don't allow 
>> for
>>>  > @Nonbinding payload, do they?
>>>  >
>>>  > The idea is to add a Configuration for all Scopes which should get
>>>  mapped to a
>>>  > dummy context.
>>>  > Then
>>>  > replace all configured scopes on the beans with 
>> 'DealtaSpikeMock' +
>>>  > original Context name and automatically register a Context for all 
>> those
>>>  > configured dummy scopes.
>>>  > The lifecycle of the beans can be
>>>  > controlled by simply injecting the Extension and accessing the
>>>  > underlying context via the original scope annotation.
>>>  >
>>>  > That way we can get rid of all 'manual' Mock Contexts and only 
>> use them
>>>  > when really needed.
>>>  >
>>>  > LieGrue,
>>>  > strub
>>>  >
>>> 
>>
>
>
>

Re: Fw: Mock Contexts

Posted by Mark Struberg <st...@yahoo.de>.
Hi Bernard!

The idea is to have a Mock Context which is portable across all containers and can handle various scopes.
I guess this is pretty easy to implement. The tricky part is how to enable/configure this features.


The ViewScopedContext support exists in OWB since early 2009 and I ported it over to CODI and Seam3 in 2010.

LieGrue,
strub



----- Original Message -----
> From: Bernard Łabno <s4...@pjwstk.edu.pl>
> To: deltaspike-dev@incubator.apache.org
> Cc: 
> Sent: Monday, October 1, 2012 9:57 AM
> Subject: Re: Fw: Mock Contexts
> 
> I'm writing Arquillian extension that provides conversation and view
> contexts.
> 
> https://community.jboss.org/thread/200461
> 
> 2012/10/1 Mark Struberg <st...@yahoo.de>
> 
>>  gnnn our mail server sucks big times lately. Always rejects my mails the
>>  first time :/
>> 
>> 
>> 
>>  ----- Forwarded Message -----
>>  > From: Mark Struberg <st...@yahoo.de>
>>  > To: deltaspike <de...@incubator.apache.org>
>>  > Cc:
>>  > Sent: Monday, October 1, 2012 9:51 AM
>>  > Subject: Mock Contexts
>>  >
>>  >
>>  >
>>  > Hi!
>>  >
>>  > While hacking the @ViewScoped support I ran across our 
> MockViewContext.
>>  > In CODI we used a Map based dummy implementation in ProjectStage ==
>>  UnitTest.
>>  > But that might be counter productive if 'real' container unit 
> testing is
>>  > done with Arquillian.
>>  >
>>  > Otoh
>>  > such a Mock Context is really useful in some cases. After thinking a
>>  > bit about it I came up with providing a MockContext which can be 
> mapped
>>  > in for any other Context via ProcessAnnotatedType.
>>  >
>>  > Not sure how to run this though as currently scopes don't allow 
> for
>>  > @Nonbinding payload, do they?
>>  >
>>  > The idea is to add a Configuration for all Scopes which should get
>>  mapped to a
>>  > dummy context.
>>  > Then
>>  > replace all configured scopes on the beans with 
> 'DealtaSpikeMock' +
>>  > original Context name and automatically register a Context for all 
> those
>>  > configured dummy scopes.
>>  > The lifecycle of the beans can be
>>  > controlled by simply injecting the Extension and accessing the
>>  > underlying context via the original scope annotation.
>>  >
>>  > That way we can get rid of all 'manual' Mock Contexts and only 
> use them
>>  > when really needed.
>>  >
>>  > LieGrue,
>>  > strub
>>  >
>> 
> 

Re: Fw: Mock Contexts

Posted by Bernard Łabno <s4...@pjwstk.edu.pl>.
I'm writing Arquillian extension that provides conversation and view
contexts.

https://community.jboss.org/thread/200461

2012/10/1 Mark Struberg <st...@yahoo.de>

> gnnn our mail server sucks big times lately. Always rejects my mails the
> first time :/
>
>
>
> ----- Forwarded Message -----
> > From: Mark Struberg <st...@yahoo.de>
> > To: deltaspike <de...@incubator.apache.org>
> > Cc:
> > Sent: Monday, October 1, 2012 9:51 AM
> > Subject: Mock Contexts
> >
> >
> >
> > Hi!
> >
> > While hacking the @ViewScoped support I ran across our MockViewContext.
> > In CODI we used a Map based dummy implementation in ProjectStage ==
> UnitTest.
> > But that might be counter productive if 'real' container unit testing is
> > done with Arquillian.
> >
> > Otoh
> > such a Mock Context is really useful in some cases. After thinking a
> > bit about it I came up with providing a MockContext which can be mapped
> > in for any other Context via ProcessAnnotatedType.
> >
> > Not sure how to run this though as currently scopes don't allow for
> > @Nonbinding payload, do they?
> >
> > The idea is to add a Configuration for all Scopes which should get
> mapped to a
> > dummy context.
> > Then
> > replace all configured scopes on the beans with 'DealtaSpikeMock' +
> > original Context name and automatically register a Context for all those
> > configured dummy scopes.
> > The lifecycle of the beans can be
> > controlled by simply injecting the Extension and accessing the
> > underlying context via the original scope annotation.
> >
> > That way we can get rid of all 'manual' Mock Contexts and only use them
> > when really needed.
> >
> > LieGrue,
> > strub
> >
>