[hibernate-dev] How should hibernate-entitymanager test classes be instrumented?

Gail Badner gbadner at redhat.com
Tue Jul 14 20:08:33 EDT 2015


Actually, I'm confused.

The pull request [1] contains:

+task instrument(dependsOn: compileTestJava) << {
+    ant.taskdef(name: 'hibInstrument',
+            classname: 'org.hibernate.tool.instrument.javassist.InstrumentTask',
+            classpath: configurations.testCompile.asPath)
+    ant.hibInstrument(verbose: 'true'){
+        fileset(dir:"$buildDir/classes/test/org/hibernate/jpa/test/callbacks/"){
+            include(name: "EntityWithLazyProperty.class")
+        }
+    }
+    println("hibernate instrumentation")
+}
+
+test.dependsOn instrument

IIUC, only $buildDir/classes/test/org/hibernate/jpa/test/callbacks/EntityWithLazyProperty.class is instrumented (not all test classes).

Am I missing something (very possible).

Thanks,
Gail

----- Original Message -----
> From: "Gail Badner" <gbadner at redhat.com>
> To: "Steve Ebersole" <steve at hibernate.org>
> Cc: "Hibernate" <hibernate-dev at lists.jboss.org>
> Sent: Monday, July 13, 2015 4:12:10 PM
> Subject: Re: [hibernate-dev] How should hibernate-entitymanager test classes be instrumented?
> 
> OK, got it.
> Thanks!
> Gail
> 
> ----- Original Message -----
> > From: "Steve Ebersole" <steve at hibernate.org>
> > To: "Gail Badner" <gbadner at redhat.com>, "Hibernate"
> > <hibernate-dev at lists.jboss.org>
> > Sent: Monday, July 13, 2015 3:43:21 PM
> > Subject: Re: [hibernate-dev] How should hibernate-entitymanager test
> > classes be instrumented?
> > 
> > No, that is not the correct way.  That would force all test classes to be
> > instrumented where we only need a few to be instrumented.
> > 
> > There are 2 options:
> > 
> > 1) Move all the tests that require instrumentation into a new SourceSet and
> > then associate the instrument task with that SourceSet only.
> > 2) Use an "enhancing classloader" and instrument the classes as they are
> > loaded *for just those tests*.  We do this already today.
> >  org.hibernate.jpa.test.instrument.InterceptFieldClassFileTransformerTest
> > is one such test already in hibernate-entitymanager, but it is only
> > partial.  If you want to go this route, I'd suggest looking
> > at
> > org.hibernate.test.instrument.runtime.AbstractTransformingClassLoaderInstrumentTestCase.
> > Luis also recently added some tests for the new bytecode enhancement code
> > that follow this paradigm.
> > 
> > 
> > On Fri, Jul 10, 2015 at 7:10 PM Gail Badner <gbadner at redhat.com> wrote:
> > 
> > > I'm looking into some bugs having to do with lazy properties using Entity
> > > Manager.
> > >
> > > There is a commit for a pull request that adds an instrument task to
> > > hibernate-entitymanager.gradle that uses the ant task:
> > >
> > >
> > > https://github.com/gbadner/hibernate-core/commit/ecacc18cd48b960b7e9b303b6a298d4e15448d22
> > >
> > > Is this acceptable? Is there a different way this should be done?
> > >
> > > Thanks,
> > > Gail
> > > _______________________________________________
> > > hibernate-dev mailing list
> > > hibernate-dev at lists.jboss.org
> > > https://lists.jboss.org/mailman/listinfo/hibernate-dev
> > >
> > 
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
> 


More information about the hibernate-dev mailing list