tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <david.blev...@visi.com>
Subject Re: Enhancer annoyance
Date Tue, 13 May 2008 19:54:36 GMT
I wonder if what's going on is that the test case is getting it's  
hands on the Entity classes before we're loaded and able to tell  
OpenJPA that the classes need to be dynamically enhanced.  OpenJPA's  
unenhanced support is ok, but not feature complete.

One way to verify would be to split your test case into two classes;  
the TestCase subclass which would do nothing more than setup OpenEJB  
via the InitialContext and have a test method that delegated to your  
second class which actually did test.  The idea being the second class  
which references the entity classes wouldn't get loaded until after  
the first class has run and setup the dynamic enhancer.

Let us know if that's the case as we can probably document this kind  
of OpenJPA specific testing technique.  Definitely in Java 6 this kind  
of thing will be easier as class redefining is there as well as being  
able to install an enhancer post-startup (i.e. no agent).

-David

On May 13, 2008, at 11:23 AM, JimOR wrote:

>
> I'm running into a mild annoyance running a junit test suite  
> directly from
> within Eclipse.  I have the -javaagent VM arg in my run  
> configuration, and
> the problem does goes away if I run an ant task to call the enhancer
> directly prior to running my test suite.
>
> The problem is that access to any collection from the first Entity  
> listed as
> 'subclassed' gives an NPE, which in my configuration is a failure.   
> The
> remaining Entities test fine, and you'll notice that the enhancer  
> happily
> processes that Entity after reporting it being subclassed.
>
> As I stated, it's a mild annoyance because when any tests fail, I  
> only have
> to launch that ant enhancer task and re-run the test.  Any thoughts?
>
> following is a portion of my test suite output:
>
> INFO- portfolio.data.junit.suite.InitialTestSetup.suiteSetUp(Line: 
> 45) -
> InitialTestSetup Started
> Apache OpenEJB 3.0    build: 20080408-04:13
> http://openejb.apache.org/
> 656  PortfolioData  INFO   [main] openjpa.Runtime - Starting OpenJPA  
> 1.0.1
> 1250  PortfolioData  INFO   [main] openjpa.jdbc.JDBC - Using  
> dictionary
> class "org.apache.openjpa.jdbc.sql.PostgresDictionary" (PostgreSQL  
> 8.1.4
> ,PostgreSQL Native Driver PostgreSQL 8.1 JDBC3 with SSL (build 405)).
> 1625  PortfolioData  INFO   [main] openjpa.Enhance - Creating  
> subclass for
> "[class portfolio.data.entities.Category, class
> portfolio.data.entities.Account, class  
> portfolio.data.entities.Accounttype,
> class portfolio.data.entities.Owner]". This means that your  
> application will
> be less efficient and will consume more memory than it would if you  
> ran the
> OpenJPA enhancer. Additionally, lazy loading will not be available for
> one-to-one and many-to-one persistent attributes in types using field
> access; they will be loaded eagerly instead.
> 2578  PortfolioData  TRACE  [main] openjpa.Enhance - Enhancing type  
> "class
> portfolio.data.entities.Category".
> 2938  PortfolioData  TRACE  [main] openjpa.Enhance - Enhancing type  
> "class
> portfolio.data.entities.Account".
> 3328  PortfolioData  TRACE  [main] openjpa.Enhance - Enhancing type  
> "class
> portfolio.data.entities.Accounttype".
> 3594  PortfolioData  TRACE  [main] openjpa.Enhance - Enhancing type  
> "class
> portfolio.data.entities.Owner".
> INFO- portfolio.data.junit.suite.InitialTestSetup.suiteSetUp(Line: 
> 54) -
> Context is Set, ejb in Context:
> 	.=
>
> AccountBeanLocal 
> = 
> proxy 
> = 
> portfolio 
> .data 
> .beans 
> .PortfolioCRUD;deployment=AccountBean;pk=2291cc984d5ae5a2:-3af9f98d: 
> 119e366778c:-8000
>
> AccounttypeBeanLocal 
> = 
> proxy 
> = 
> portfolio 
> .data 
> .beans 
> .AccounttypeManager 
> ;deployment=AccounttypeBean;pk=2291cc984d5ae5a2:-3af9f98d: 
> 119e366778c:-7fff
>
> CategoryBeanLocal 
> = 
> proxy 
> = 
> portfolio 
> .data 
> .beans 
> .PortfolioCRUD;deployment=CategoryBean;pk=2291cc984d5ae5a2:-3af9f98d: 
> 119e366778c:-7ffd
>
> OwnerBeanLocal 
> = 
> proxy 
> = 
> portfolio 
> .data 
> .beans 
> .PortfolioCRUD;deployment=OwnerBean;pk=2291cc984d5ae5a2:-3af9f98d: 
> 119e366778c:-7ffc
>
> PortFolioCRUDBeanLocal 
> = 
> proxy 
> = 
> portfolio 
> .data 
> .beans 
> .PortfolioCRUD 
> ;deployment=PortFolioCRUDBean;pk=2291cc984d5ae5a2:-3af9f98d: 
> 119e366778c:-7ffe
> INFO- portfolio.data.junit.suite.InitialTestSetup.suiteSetUp(Line: 
> 64) -
> Framework initialization and bean lookup took 8.844
> -- 
> View this message in context: http://www.nabble.com/Enhancer-annoyance-tp17215212p17215212.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>
>


Mime
View raw message