Author: hardy.ferentschik
Date: 2008-08-01 08:17:53 -0400 (Fri, 01 Aug 2008)
New Revision: 15012
Modified:
entitymanager/trunk/
entitymanager/trunk/changelog.txt
entitymanager/trunk/ivy.xml
entitymanager/trunk/pom.xml
entitymanager/trunk/readme.txt
entitymanager/trunk/src/test/org/hibernate/ejb/test/instrument/InstrumentedClassLoader.java
entitymanager/trunk/src/test/org/hibernate/ejb/test/instrument/InterceptFieldClassFileTransformerTest.java
Log:
Synced with core rlease 3.3.0.CR2.
Updated test for byte code enhancement due to the fact that javassist is now default
provider.
Property changes on: entitymanager/trunk
___________________________________________________________________
Name: svn:ignore
+ .*
target
build
test_output
Modified: entitymanager/trunk/changelog.txt
===================================================================
--- entitymanager/trunk/changelog.txt 2008-08-01 09:32:46 UTC (rev 15011)
+++ entitymanager/trunk/changelog.txt 2008-08-01 12:17:53 UTC (rev 15012)
@@ -1,7 +1,7 @@
Hibernate EntityManager Changelog
==================================
-3.4.0.CR2 (29-07-2008)
+3.4.0.CR2 (01-08-2008)
----------------------
** Bug
Modified: entitymanager/trunk/ivy.xml
===================================================================
--- entitymanager/trunk/ivy.xml 2008-08-01 09:32:46 UTC (rev 15011)
+++ entitymanager/trunk/ivy.xml 2008-08-01 12:17:53 UTC (rev 15012)
@@ -16,7 +16,7 @@
<dependency name="ejb3-persistence" rev="1.0.2.GA"
conf="default->default"/>
<dependency name="commons-annotations" rev="3.1.0.CR2"
conf="default->default"/>
<dependency name="annotations" rev="3.4.0.CR2"
conf="default->default"/>
- <dependency org="org.hibernate" name="hibernate-core"
rev="3.3.0.CR1" conf="default->default"/>
+ <dependency org="org.hibernate" name="hibernate-core"
rev="3.3.0.CR2" conf="default->default"/>
<dependency org="dom4j" name="dom4j" rev="1.6.1"
conf="default->default"/>
<dependency org="javax.transaction" name="jta"
rev="1.1" conf="default->default"/>
<dependency org="javassist" name="javassist"
rev="3.4.GA" conf="default->default"/>
Modified: entitymanager/trunk/pom.xml
===================================================================
--- entitymanager/trunk/pom.xml 2008-08-01 09:32:46 UTC (rev 15011)
+++ entitymanager/trunk/pom.xml 2008-08-01 12:17:53 UTC (rev 15012)
@@ -39,7 +39,7 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
- <version>3.3.0.CR1</version>
+ <version>3.3.0.CR2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Modified: entitymanager/trunk/readme.txt
===================================================================
--- entitymanager/trunk/readme.txt 2008-08-01 09:32:46 UTC (rev 15011)
+++ entitymanager/trunk/readme.txt 2008-08-01 12:17:53 UTC (rev 15012)
@@ -1,6 +1,6 @@
Hibernate EntityManager
==================================================
-Version: 3.4.0.CR2, 29.07.2008
+Version: 3.4.0.CR2, 01.08.2008
THIS RELEASE OF HIBERNATE ENTITYMANAGER REQUIRES HIBERNATE CORE 3.3 (and above)
Modified:
entitymanager/trunk/src/test/org/hibernate/ejb/test/instrument/InstrumentedClassLoader.java
===================================================================
---
entitymanager/trunk/src/test/org/hibernate/ejb/test/instrument/InstrumentedClassLoader.java 2008-08-01
09:32:46 UTC (rev 15011)
+++
entitymanager/trunk/src/test/org/hibernate/ejb/test/instrument/InstrumentedClassLoader.java 2008-08-01
12:17:53 UTC (rev 15012)
@@ -20,7 +20,7 @@
@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
- if ( "java.lang.Object".equals( name ) ) return getParent().loadClass( name
);
+ if ( name != null && name.startsWith( "java.lang." ) ) return
getParent().loadClass( name );
Class c = findLoadedClass( name );
if ( c != null ) return c;
InputStream is = this.getResourceAsStream( name.replace( ".", "/" )
+ ".class" );
Modified:
entitymanager/trunk/src/test/org/hibernate/ejb/test/instrument/InterceptFieldClassFileTransformerTest.java
===================================================================
---
entitymanager/trunk/src/test/org/hibernate/ejb/test/instrument/InterceptFieldClassFileTransformerTest.java 2008-08-01
09:32:46 UTC (rev 15011)
+++
entitymanager/trunk/src/test/org/hibernate/ejb/test/instrument/InterceptFieldClassFileTransformerTest.java 2008-08-01
12:17:53 UTC (rev 15012)
@@ -1,6 +1,7 @@
//$Id$
package org.hibernate.ejb.test.instrument;
+import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
@@ -8,17 +9,34 @@
/**
* @author Emmanuel Bernard
+ * @author Hardy Ferentschik
*/
public class InterceptFieldClassFileTransformerTest extends TestCase {
+ /**
+ * Tests that class file enhancement works.
+ *
+ * @throws Exception in case the test fails.
+ */
public void testEnhancement() throws Exception {
List<String> entities = new ArrayList<String>();
entities.add( "org.hibernate.ejb.test.instrument.Simple" );
+
+ // sanity check that the class is unmodified and does not contain getFieldHandler()
+ try {
+ org.hibernate.ejb.test.instrument.Simple.class.getDeclaredMethod(
"getFieldHandler" );
+ fail();
+ } catch ( NoSuchMethodException nsme ) {
+ // success
+ }
+
+ // use custom class loader which enhances the class
InstrumentedClassLoader cl = new InstrumentedClassLoader(
Thread.currentThread().getContextClassLoader() );
cl.setEntities( entities );
- Class interceptedFieldEnabled = cl.loadClass(
"net.sf.cglib.transform.impl.InterceptFieldEnabled" );
Class clazz = cl.loadClass( entities.get( 0 ) );
- //clazz = cl.loadClass( "org.hibernate.ejb.test.instrument.Simple" );
- assertTrue( interceptedFieldEnabled.isAssignableFrom( clazz ) );
- clazz.getName();
+
+ // javassist is our default byte code enhancer. Enhancing will eg add the method
getFieldHandler()
+ // see org.hibernate.bytecode.javassist.FieldTransformer
+ Method method = clazz.getDeclaredMethod( "getFieldHandler" );
+ assertNotNull( method );
}
}
Show replies by date