From 396918ccfc75c15354300847be0740f58434d755 Mon Sep 17 00:00:00 2001 From: Strong Liu Date: Sun, 27 Jan 2013 02:33:31 +0800 Subject: [PATCH] fixing test code only --- .../dynamicentity/tuplizer/MyEntityTuplizer.java | 15 +++++++++++++++ .../tuplizer/TuplizerDynamicEntityTest.java | 2 -- .../dynamicentity/tuplizer2/MyEntityTuplizer.java | 3 +++ .../junit4/BaseCoreFunctionalTestCase.java | 4 ++++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/hibernate-core/src/test/java/org/hibernate/test/dynamicentity/tuplizer/MyEntityTuplizer.java b/hibernate-core/src/test/java/org/hibernate/test/dynamicentity/tuplizer/MyEntityTuplizer.java index 5519b773e5..6c4522d6e3 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/dynamicentity/tuplizer/MyEntityTuplizer.java +++ b/hibernate-core/src/test/java/org/hibernate/test/dynamicentity/tuplizer/MyEntityTuplizer.java @@ -1,5 +1,6 @@ package org.hibernate.test.dynamicentity.tuplizer; import org.hibernate.mapping.PersistentClass; +import org.hibernate.metamodel.spi.binding.EntityBinding; import org.hibernate.property.Getter; import org.hibernate.property.Setter; import org.hibernate.proxy.ProxyFactory; @@ -16,6 +17,10 @@ public class MyEntityTuplizer extends PojoEntityTuplizer { super( entityMetamodel, mappedEntity ); } + public MyEntityTuplizer(EntityMetamodel entityMetamodel, EntityBinding entityBinding) { + super( entityMetamodel, entityBinding); + } + protected Instantiator buildInstantiator(PersistentClass persistentClass) { return new MyEntityInstantiator( persistentClass.getEntityName() ); } @@ -27,4 +32,14 @@ public class MyEntityTuplizer extends PojoEntityTuplizer { // Here we simply use the default... return super.buildProxyFactory( persistentClass, idGetter, idSetter ); } + + @Override + protected Instantiator buildInstantiator(EntityBinding entityBinding) { + return new MyEntityInstantiator( entityBinding.getEntityName() ); + } + + @Override + protected ProxyFactory buildProxyFactory(EntityBinding entityBinding, Getter idGetter, Setter idSetter) { + return super.buildProxyFactory( entityBinding, idGetter, idSetter ); + } } diff --git a/hibernate-core/src/test/java/org/hibernate/test/dynamicentity/tuplizer/TuplizerDynamicEntityTest.java b/hibernate-core/src/test/java/org/hibernate/test/dynamicentity/tuplizer/TuplizerDynamicEntityTest.java index e73bc2a657..14acf9ccd7 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/dynamicentity/tuplizer/TuplizerDynamicEntityTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/dynamicentity/tuplizer/TuplizerDynamicEntityTest.java @@ -35,7 +35,6 @@ import org.hibernate.test.dynamicentity.Company; import org.hibernate.test.dynamicentity.Customer; import org.hibernate.test.dynamicentity.Person; import org.hibernate.test.dynamicentity.ProxyHelper; -import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import static org.junit.Assert.assertEquals; @@ -54,7 +53,6 @@ import static org.junit.Assert.assertNotNull; * * @author Steve Ebersole */ -@FailureExpectedWithNewMetamodel public class TuplizerDynamicEntityTest extends BaseCoreFunctionalTestCase { @Override public String[] getMappings() { diff --git a/hibernate-core/src/test/java/org/hibernate/test/dynamicentity/tuplizer2/MyEntityTuplizer.java b/hibernate-core/src/test/java/org/hibernate/test/dynamicentity/tuplizer2/MyEntityTuplizer.java index ccec5b4991..87ca0e276e 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/dynamicentity/tuplizer2/MyEntityTuplizer.java +++ b/hibernate-core/src/test/java/org/hibernate/test/dynamicentity/tuplizer2/MyEntityTuplizer.java @@ -56,6 +56,9 @@ public class MyEntityTuplizer extends PojoEntityTuplizer { protected Instantiator buildInstantiator(PersistentClass persistentClass) { return new MyEntityInstantiator( persistentClass.getEntityName() ); } + protected Instantiator buildInstantiator(EntityBinding persistentClass) { + return new MyEntityInstantiator( persistentClass.getEntityName() ); + } public String determineConcreteSubclassEntityName(Object entityInstance, SessionFactoryImplementor factory) { String entityName = ProxyHelper.extractEntityName( entityInstance ); diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/junit4/BaseCoreFunctionalTestCase.java b/hibernate-testing/src/main/java/org/hibernate/testing/junit4/BaseCoreFunctionalTestCase.java index 31dc26e989..6a504341f1 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/junit4/BaseCoreFunctionalTestCase.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/junit4/BaseCoreFunctionalTestCase.java @@ -36,6 +36,7 @@ import java.util.List; import java.util.Map; import java.util.Properties; +import org.hibernate.EmptyInterceptor; import org.hibernate.HibernateException; import org.hibernate.Interceptor; import org.hibernate.Session; @@ -198,6 +199,9 @@ public abstract class BaseCoreFunctionalTestCase extends BaseUnitTestCase { if ( configuration.getSessionFactoryObserver() != null ){ sessionFactoryBuilder.add( configuration.getSessionFactoryObserver() ); } + if ( configuration.getInterceptor() != EmptyInterceptor.INSTANCE ) { + sessionFactoryBuilder.with( configuration.getInterceptor() ); + } } protected void rebuildSessionFactory() {