fixing test code only

This commit is contained in:
Strong Liu 2013-01-27 02:33:31 +08:00
parent 6b94af8c55
commit 396918ccfc
4 changed files with 22 additions and 2 deletions

View File

@ -1,5 +1,6 @@
package org.hibernate.test.dynamicentity.tuplizer; package org.hibernate.test.dynamicentity.tuplizer;
import org.hibernate.mapping.PersistentClass; import org.hibernate.mapping.PersistentClass;
import org.hibernate.metamodel.spi.binding.EntityBinding;
import org.hibernate.property.Getter; import org.hibernate.property.Getter;
import org.hibernate.property.Setter; import org.hibernate.property.Setter;
import org.hibernate.proxy.ProxyFactory; import org.hibernate.proxy.ProxyFactory;
@ -16,6 +17,10 @@ public class MyEntityTuplizer extends PojoEntityTuplizer {
super( entityMetamodel, mappedEntity ); super( entityMetamodel, mappedEntity );
} }
public MyEntityTuplizer(EntityMetamodel entityMetamodel, EntityBinding entityBinding) {
super( entityMetamodel, entityBinding);
}
protected Instantiator buildInstantiator(PersistentClass persistentClass) { protected Instantiator buildInstantiator(PersistentClass persistentClass) {
return new MyEntityInstantiator( persistentClass.getEntityName() ); return new MyEntityInstantiator( persistentClass.getEntityName() );
} }
@ -27,4 +32,14 @@ public class MyEntityTuplizer extends PojoEntityTuplizer {
// Here we simply use the default... // Here we simply use the default...
return super.buildProxyFactory( persistentClass, idGetter, idSetter ); 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 );
}
} }

View File

@ -35,7 +35,6 @@ import org.hibernate.test.dynamicentity.Company;
import org.hibernate.test.dynamicentity.Customer; import org.hibernate.test.dynamicentity.Customer;
import org.hibernate.test.dynamicentity.Person; import org.hibernate.test.dynamicentity.Person;
import org.hibernate.test.dynamicentity.ProxyHelper; import org.hibernate.test.dynamicentity.ProxyHelper;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
@ -54,7 +53,6 @@ import static org.junit.Assert.assertNotNull;
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@FailureExpectedWithNewMetamodel
public class TuplizerDynamicEntityTest extends BaseCoreFunctionalTestCase { public class TuplizerDynamicEntityTest extends BaseCoreFunctionalTestCase {
@Override @Override
public String[] getMappings() { public String[] getMappings() {

View File

@ -56,6 +56,9 @@ public class MyEntityTuplizer extends PojoEntityTuplizer {
protected Instantiator buildInstantiator(PersistentClass persistentClass) { protected Instantiator buildInstantiator(PersistentClass persistentClass) {
return new MyEntityInstantiator( persistentClass.getEntityName() ); return new MyEntityInstantiator( persistentClass.getEntityName() );
} }
protected Instantiator buildInstantiator(EntityBinding persistentClass) {
return new MyEntityInstantiator( persistentClass.getEntityName() );
}
public String determineConcreteSubclassEntityName(Object entityInstance, SessionFactoryImplementor factory) { public String determineConcreteSubclassEntityName(Object entityInstance, SessionFactoryImplementor factory) {
String entityName = ProxyHelper.extractEntityName( entityInstance ); String entityName = ProxyHelper.extractEntityName( entityInstance );

View File

@ -36,6 +36,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
import org.hibernate.EmptyInterceptor;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.Interceptor; import org.hibernate.Interceptor;
import org.hibernate.Session; import org.hibernate.Session;
@ -198,6 +199,9 @@ public abstract class BaseCoreFunctionalTestCase extends BaseUnitTestCase {
if ( configuration.getSessionFactoryObserver() != null ){ if ( configuration.getSessionFactoryObserver() != null ){
sessionFactoryBuilder.add( configuration.getSessionFactoryObserver() ); sessionFactoryBuilder.add( configuration.getSessionFactoryObserver() );
} }
if ( configuration.getInterceptor() != EmptyInterceptor.INSTANCE ) {
sessionFactoryBuilder.with( configuration.getInterceptor() );
}
} }
protected void rebuildSessionFactory() { protected void rebuildSessionFactory() {