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

Steve Ebersole steve at hibernate.org
Mon Jul 13 18:43:21 EDT 2015


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
>


More information about the hibernate-dev mailing list