tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Spencer <paulspen...@mindspring.com>
Subject Re: Problems getting EJB via annotation in test class.
Date Mon, 26 Nov 2007 19:09:08 GMT
David Blevins wrote:
> 
> On Nov 26, 2007, at 12:51 AM, Jacek Laskowski wrote:
> 
>> On Nov 25, 2007 11:09 PM, Paul Spencer <paulspencer@mindspring.com> 
>> wrote:
>>
>>> Since the test is using OpenEJB as an embedded server, why is the test
>>> class not considered as a DI target?
>>
>> if (test class == ejb class && test case == interceptor class) {
>>  // the test class *is* a target of DI machinery
>> }
> 
> Well the tricky thing about that statement is that if the "test class" 
> is an ejb or interceptor, it's no longer a JUnit test class (i.e. 
> something run by junit).  But the statement is correct in that you can 
> put test *logic* in an ejb or interceptor which is deployed in the 
> embedded container along with the app you'd like to test.
>
This seems opposite from my experience, although the result may be the 
same.  If a class exists in Maven's test class path, i.e. 
target/test-classes, then that class will not have fields set via DI.  I 
posted a sample test, which is a modification of one of OpenEJB's 
examples, in this thread. The post is dated  26-nov-2007 @ 06:53 EST.

> -David
> 
> 

Paul Spencer

Mime
View raw message