You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Rahul Thakur <ra...@gmail.com> on 2007/01/21 02:49:32 UTC

How to unit test the Enhancer?

Hi,

I'd like to put together a couple of unit tests for the Enhancer mojo. 
For this I had a look at openjpa-kernel module where the PCEnhancer is 
located but could not find any tests.

How can I test if a persistence-enabled class has been enhanced as 
expected from a unit test? Appreciate any pointers.

Cheers,
Rahul 


Re: How to unit test the Enhancer?

Posted by Rahul Thakur <ra...@gmail.com>.
Hi Craig,

[snip]
>> If not, are there plans to put together such tests into OpenJPA 
>> itself?
>
> OpenJPA is, like most Apache projects, a do-ocracy. If you have an 
> itch, you are encouraged to scratch it.

Yep, totally agree there and I would love to 'scratch' this 'itch' as 
well, but right now I am scratching many ;-). My intent was to see if 
there was something I could readily use (like the resources pointed out 
by yourself) or if it something was expected soon that would address 
this (Patrick's other email covered that aspect).

> I'm just guessing here, but it's likely that a test suite that is 
> used for Kodo and not already contributed to OpenJPA has significant 
> resource constraints to make it suitable for OpenJPA.
>
> If this is important for you, you will need to take the initiative to 
> propose a solution that you can implement.
>

I would like to get the testing set up at this stage when I don't have 
too much code (openjpa maven plugin and an ORM generator module that I 
want to use in Continuum) - so yes, I'd say this is important. Though I 
am not sure how much time and effort I would be able to commit to it if 
I picked it up.

> The process for proposing a new feature would be to discuss it on 
> this alias (done) and then once there is concurrence that such a 
> feature would be useful (done), create a JIRA issue to track it. The 
> JIRA would then contain the further discussion on how to implement 
> the feature.
>

Done, http://issues.apache.org/jira/browse/OPENJPA-105

Cheers,

Rahul




Re: How to unit test the Enhancer?

Posted by Craig L Russell <Cr...@Sun.COM>.
Hi Rahul,

On Jan 22, 2007, at 2:10 PM, Rahul Thakur wrote:

> Hi Patrick,
>
> Thanks for the pointer, I think something might be better than  
> nothing - I will use this approach to test the Enhancer!
>
> When you say 'majority Kodo test suite has not yet made it into  
> OpenJPA' - do you mean that this is scheduled to happen sometime?
>
> If not, are there plans to put together such tests into OpenJPA  
> itself?

OpenJPA is, like most Apache projects, a do-ocracy. If you have an  
itch, you are encouraged to scratch it.

I'm just guessing here, but it's likely that a test suite that is  
used for Kodo and not already contributed to OpenJPA has significant  
resource constraints to make it suitable for OpenJPA.

If this is important for you, you will need to take the initiative to  
propose a solution that you can implement.

The process for proposing a new feature would be to discuss it on  
this alias (done) and then once there is concurrence that such a  
feature would be useful (done), create a JIRA issue to track it. The  
JIRA would then contain the further discussion on how to implement  
the feature.

Regards,

Craig
>
> Thanks,
> Rahul
>
>
>
> Patrick Linskey wrote:
>> You could also just test that the class implements
>> org.apache.openjpa.enhance.PersistenceCapable. Such a check  
>> assumes that
>> the OpenJPA enhancement is happening correctly under the covers, but
>> should be a good first approximation at least.
>>
>> FTR, yes, there are tests for this stuff. Sadly, the majority of the
>> Kodo test suite has not yet made it into OpenJPA.
>>
>> -Patrick
>>
>>

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


RE: How to unit test the Enhancer?

Posted by Patrick Linskey <pl...@bea.com>.
> When you say 'majority Kodo test suite has not yet made it 
> into OpenJPA' 
> - do you mean that this is scheduled to happen sometime?

I hope to see more of the Kodo test suite make its way into OpenJPA over
time. It's not a concrete goal on our (BEA's) roadmap, though, so it
takes a back seat to things like getting releases out etc.

-Patrick
_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

Re: How to unit test the Enhancer?

Posted by Rahul Thakur <ra...@gmail.com>.
Hi Patrick,

Thanks for the pointer, I think something might be better than nothing - 
I will use this approach to test the Enhancer!

When you say 'majority Kodo test suite has not yet made it into OpenJPA' 
- do you mean that this is scheduled to happen sometime?

If not, are there plans to put together such tests into OpenJPA itself?

Thanks,
Rahul



Patrick Linskey wrote:
> You could also just test that the class implements
> org.apache.openjpa.enhance.PersistenceCapable. Such a check assumes that
> the OpenJPA enhancement is happening correctly under the covers, but
> should be a good first approximation at least.
>
> FTR, yes, there are tests for this stuff. Sadly, the majority of the
> Kodo test suite has not yet made it into OpenJPA.
>
> -Patrick
>
>   

RE: How to unit test the Enhancer?

Posted by Patrick Linskey <pl...@bea.com>.
You could also just test that the class implements
org.apache.openjpa.enhance.PersistenceCapable. Such a check assumes that
the OpenJPA enhancement is happening correctly under the covers, but
should be a good first approximation at least.

FTR, yes, there are tests for this stuff. Sadly, the majority of the
Kodo test suite has not yet made it into OpenJPA.

-Patrick

-- 
Patrick Linskey
BEA Systems, Inc. 

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it. 

> -----Original Message-----
> From: Rahul Thakur [mailto:rahul.thakur.xdev@gmail.com] 
> Sent: Sunday, January 21, 2007 11:00 PM
> To: open-jpa-dev@incubator.apache.org
> Subject: Re: How to unit test the Enhancer?
> 
> Hi Craig,
> 
> Thanks for that; that was closer to what I was I looking for 
> in OpenJPA, 
> but I haven't found anything. Something I could use to verify 
> in my own 
> unit test.
> 
> Any other pointers, anyone?
> 
> TIA,
> 
> Rahul
> 
> 
> ----- Original Message ----- 
> From: "Craig L Russell" <Cr...@Sun.COM>
> To: <op...@incubator.apache.org>
> Sent: Monday, January 22, 2007 7:15 PM
> Subject: Re: How to unit test the Enhancer?
> 
> 
> > Hi Rahul,
> >
> > You might look at the work-in-progress going on at Apache 
> JDO http:// 
> > db.apache.org/jdo/ and http://wiki.apache.org/jdo/ProjectStructure. 
> > The JDO 1.1 project includes an enhancer verification 
> program that is 
> > not yet updated for JDO 2.0, but it should give you some ideas on 
> > what technology exists.
> >
> > If you need more details after looking at the project, please feel 
> > free to follow up on the jdo-dev alias.
> >
> > Regards,
> >
> > Craig
> >
> > On Jan 20, 2007, at 5:49 PM, Rahul Thakur wrote:
> >
> >> Hi,
> >>
> >> I'd like to put together a couple of unit tests for the Enhancer 
> >> mojo. For this I had a look at openjpa-kernel module where the 
> >> PCEnhancer is located but could not find any tests.
> >>
> >> How can I test if a persistence-enabled class has been enhanced as 
> >> expected from a unit test? Appreciate any pointers.
> >>
> >> Cheers,
> >> Rahul
> >
> > Craig Russell
> > DB PMC
> > clr@apache.org http://db.apache.org/jdo
> >
> >
> > 
> 
> 

Re: How to unit test the Enhancer?

Posted by Rahul Thakur <ra...@gmail.com>.
Hi Craig,

Thanks for that; that was closer to what I was I looking for in OpenJPA, 
but I haven't found anything. Something I could use to verify in my own 
unit test.

Any other pointers, anyone?

TIA,

Rahul


----- Original Message ----- 
From: "Craig L Russell" <Cr...@Sun.COM>
To: <op...@incubator.apache.org>
Sent: Monday, January 22, 2007 7:15 PM
Subject: Re: How to unit test the Enhancer?


> Hi Rahul,
>
> You might look at the work-in-progress going on at Apache JDO http:// 
> db.apache.org/jdo/ and http://wiki.apache.org/jdo/ProjectStructure. 
> The JDO 1.1 project includes an enhancer verification program that is 
> not yet updated for JDO 2.0, but it should give you some ideas on 
> what technology exists.
>
> If you need more details after looking at the project, please feel 
> free to follow up on the jdo-dev alias.
>
> Regards,
>
> Craig
>
> On Jan 20, 2007, at 5:49 PM, Rahul Thakur wrote:
>
>> Hi,
>>
>> I'd like to put together a couple of unit tests for the Enhancer 
>> mojo. For this I had a look at openjpa-kernel module where the 
>> PCEnhancer is located but could not find any tests.
>>
>> How can I test if a persistence-enabled class has been enhanced as 
>> expected from a unit test? Appreciate any pointers.
>>
>> Cheers,
>> Rahul
>
> Craig Russell
> DB PMC
> clr@apache.org http://db.apache.org/jdo
>
>
> 


Re: How to unit test the Enhancer?

Posted by Craig L Russell <Cr...@Sun.COM>.
Hi Rahul,

You might look at the work-in-progress going on at Apache JDO http:// 
db.apache.org/jdo/ and http://wiki.apache.org/jdo/ProjectStructure.  
The JDO 1.1 project includes an enhancer verification program that is  
not yet updated for JDO 2.0, but it should give you some ideas on  
what technology exists.

If you need more details after looking at the project, please feel  
free to follow up on the jdo-dev alias.

Regards,

Craig

On Jan 20, 2007, at 5:49 PM, Rahul Thakur wrote:

> Hi,
>
> I'd like to put together a couple of unit tests for the Enhancer  
> mojo. For this I had a look at openjpa-kernel module where the  
> PCEnhancer is located but could not find any tests.
>
> How can I test if a persistence-enabled class has been enhanced as  
> expected from a unit test? Appreciate any pointers.
>
> Cheers,
> Rahul

Craig Russell
DB PMC
clr@apache.org http://db.apache.org/jdo



Re: How to unit test the Enhancer?

Posted by Marc Prud'hommeaux <mp...@apache.org>.
Rahul-

If it worked, then the persistence tests should pass. E.g., the  
following should work from the top-level of the project:

   mvn clean test -Dtest=TestPersistence -Dopenjpa.loglevel=trace



On Jan 20, 2007, at 5:49 PM, Rahul Thakur wrote:

> Hi,
>
> I'd like to put together a couple of unit tests for the Enhancer  
> mojo. For this I had a look at openjpa-kernel module where the  
> PCEnhancer is located but could not find any tests.
>
> How can I test if a persistence-enabled class has been enhanced as  
> expected from a unit test? Appreciate any pointers.
>
> Cheers,
> Rahul