Re: [Resin-interest] Bean as HessianServices Breaks Injection

2010-01-19 Thread Scott Ferguson
Scott Hernandez wrote:
> Cool, (more below)
>
> On Tue, Jan 19, 2010 at 8:29 AM, Alex  wrote:
>   
>> On 2010-01-16, at 6:47 PM, Scott Hernandez wrote:
>> 
>>> I noticed when I registered my class as a HessianService it was no
>>> longer able to inject it. Is this an expected behavior?
>>>   
>> This seems broken, I've added a bug report to 
>> http://bugs.caucho.com/view.php?id=3852
>>
>> We are adding ResinBeanContext with the intended use from JUnit tests. 
>> Basically it's a light container
>> that bootstraps Resin CDI Implementation allowing for bean creation in a way 
>> that's done inside resin.
>> 
>
> Is this going to be the suggested way to unit test apps then?
>   
Yes, although there may be some tests that need different containers.

The ResinBeanContainer is a CDI/EJB context (with the usual Resin things 
like database configuration), but it is not a servlet environment. (No 
ServletContext, no servlet listeners, etc.) So it will work fine for the 
key parts of unit testing.

For that need a servlet environment (more toward integration rather than 
unit testing), you'd need to use ResinEmbed currently (which is a full 
embedded Resin server.) Alex has brought up the idea of creating a 
WebAppContainer (or ServletContainer) which is something in between: a 
web-app context, but not a full server.

Jon's idea of running subEtha's tests as part of our nightly regressions 
is an interesting one, basically a kind of CI testing where we could svn 
update to the latest subetha, and run the tests against the current 
Resin build.

To make that happen, the subetha testing environment would need to be 
pretty self-contained, at least for the tests that we'd be running, i.e. 
they'd basically need to work in a bare environment and do any 
self-configuration/mocking/database instantiation as part of the test run.

-- Scott
> As you can probably tell from our source code the main reason we
> expose the objects as HessianServices is so that we can run unit tests
> against the container. There are still a few places where it might be
> useful to expose services for things other than unit testing, but for
> the most part that is why we need to use HessianServices.
>
>
> ___
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest
>
>   



___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] Bean as HessianServices Breaks Injection

2010-01-19 Thread Scott Hernandez
Cool, (more below)

On Tue, Jan 19, 2010 at 8:29 AM, Alex  wrote:
> On 2010-01-16, at 6:47 PM, Scott Hernandez wrote:
>> I noticed when I registered my class as a HessianService it was no
>> longer able to inject it. Is this an expected behavior?
> This seems broken, I've added a bug report to 
> http://bugs.caucho.com/view.php?id=3852
>
> We are adding ResinBeanContext with the intended use from JUnit tests. 
> Basically it's a light container
> that bootstraps Resin CDI Implementation allowing for bean creation in a way 
> that's done inside resin.

Is this going to be the suggested way to unit test apps then?

As you can probably tell from our source code the main reason we
expose the objects as HessianServices is so that we can run unit tests
against the container. There are still a few places where it might be
useful to expose services for things other than unit testing, but for
the most part that is why we need to use HessianServices.


___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] Bean as HessianServices Breaks Injection

2010-01-19 Thread Alex

On 2010-01-16, at 6:47 PM, Scott Hernandez wrote:

> I noticed when I registered my class as a HessianService it was no
> longer able to inject it. Is this an expected behavior?
This seems broken, I've added a bug report to 
http://bugs.caucho.com/view.php?id=3852

We are adding ResinBeanContext with the intended use from JUnit tests. 
Basically it's a light container 
that bootstraps Resin CDI Implementation allowing for bean creation in a way 
that's done inside resin.

usage:

 * static void main(String []args)
 * {
 *   ResinBeanContainer cdi = new ResinBeanContainer();
 *
 *   cdi.addModule("test.jar");
 *   cdi.start();
 *
 *   RequestContext req = cxt.beginRequest();
 *   try {
 * MyMain main = cxt.getInstance(MyMain.class);
 *
 * main.main(args);
 *   } finally {
 * req.close();
 *   }
 * }


Thanks,
--Alex
> 
> I am working against 4.0.3.
> 
> BTW. You can reproduce all the problems I'm find using our resin4.0.3
> branch of subetha -
> http://subetha.googlecode.com/svn/branches/resin4.0.3/. There are
> quite a few more things that seems broken I will post about when I
> have more time.
> 
> Take a look at 
> http://subetha.googlecode.com/svn/branches/resin4.0.3/src/org/subethamail/core/admin/ListWizardBean.java
> for an example bean that no longer works once I add this to our
> config:
> 
>  urlPattern="/api/ListWizard"/>
> 
> -Scott
> 
> 
> ___
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest




___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] Bean as HessianServices Breaks Injection

2010-01-16 Thread Jon Stevens
Given that we have a nice and fairly complex open source reference
implementation application (subetha), it would be great if Scott (et. al)
would test Resin 4.x releases against it.

jon


On Sat, Jan 16, 2010 at 6:47 PM, Scott Hernandez  wrote:

> I noticed when I registered my class as a HessianService it was no
> longer able to inject it. Is this an expected behavior?
>
> I am working against 4.0.3.
>
> BTW. You can reproduce all the problems I'm find using our resin4.0.3
> branch of subetha -
> http://subetha.googlecode.com/svn/branches/resin4.0.3/. There are
> quite a few more things that seems broken I will post about when I
> have more time.
>
> Take a look at
> http://subetha.googlecode.com/svn/branches/resin4.0.3/src/org/subethamail/core/admin/ListWizardBean.java
> for an example bean that no longer works once I add this to our
> config:
>
>  urlPattern="/api/ListWizard"/>
>
> -Scott
>
>
> ___
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest
>
___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


[Resin-interest] Bean as HessianServices Breaks Injection

2010-01-16 Thread Scott Hernandez
I noticed when I registered my class as a HessianService it was no
longer able to inject it. Is this an expected behavior?

I am working against 4.0.3.

BTW. You can reproduce all the problems I'm find using our resin4.0.3
branch of subetha -
http://subetha.googlecode.com/svn/branches/resin4.0.3/. There are
quite a few more things that seems broken I will post about when I
have more time.

Take a look at 
http://subetha.googlecode.com/svn/branches/resin4.0.3/src/org/subethamail/core/admin/ListWizardBean.java
for an example bean that no longer works once I add this to our
config:



-Scott


___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest