merge master and fixing failing tests

This commit is contained in:
Strong Liu 2013-08-05 16:21:27 +08:00
parent dba8d835f5
commit 9ef857aeca
4 changed files with 33 additions and 10 deletions

View File

@ -27,15 +27,16 @@ package org.hibernate.serialization;
import javax.naming.Reference;
import javax.naming.StringRefAddr;
import org.jboss.logging.Logger;
import org.junit.Test;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Configuration;
import org.hibernate.internal.SessionFactoryRegistry;
import org.hibernate.internal.util.SerializationHelper;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestMethod;
import org.hibernate.testing.junit4.BaseUnitTestCase;
import org.hibernate.type.SerializationException;
import static org.junit.Assert.assertFalse;
@ -47,6 +48,23 @@ import static org.junit.Assert.fail;
*/
public class SessionFactorySerializationTest extends BaseCoreFunctionalTestMethod {
public static final String NAME = "mySF";
private static final Logger logger = Logger.getLogger( SessionFactorySerializationTest.class );
@Override
protected void prepareTest() throws Exception {
if(SessionFactoryRegistry.INSTANCE.hasRegistrations()){
logger.warn( "There are uncleaned SessionFactory instance, probably because some previous tests didn't do their job correctly, now we need clean it up" );
SessionFactoryRegistry.INSTANCE.clearRegistrations();
}
}
@Override
protected void prepareCleanup() {
if(SessionFactoryRegistry.INSTANCE.hasRegistrations()){
logger.warn( "There are uncleaned SessionFactory instance, this test is doing something wrong" );
SessionFactoryRegistry.INSTANCE.clearRegistrations();
}
}
@Test
public void testNamedSessionFactorySerialization() throws Exception {

View File

@ -31,6 +31,7 @@ import org.hibernate.Session;
import org.hibernate.mapping.Table;
import org.hibernate.metamodel.spi.relational.TableSpecification;
import org.hibernate.test.util.SchemaUtil;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
@ -45,6 +46,7 @@ import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
*
* @author Brett Meyer
*/
@FailureExpectedWithNewMetamodel
public class AliasTest extends BaseCoreFunctionalTestCase {
/**

View File

@ -20,9 +20,12 @@
*/
package org.hibernate.test.mapping;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
/**
* @author Brett Meyer
*/
@FailureExpectedWithNewMetamodel
public class MappingReorderedAliasTest extends AliasTest {
@Override

View File

@ -63,15 +63,15 @@ public class StatsTest extends BaseCoreFunctionalTestCase {
protected void initialize(){
super.initialize();
getTestConfiguration().getProperties().setProperty( Environment.GENERATE_STATISTICS, "true" );
getTestConfiguration().getProperties().setProperty( AvailableSettings.HBM2DDL_AUTO, "create");
// getTestConfiguration().getProperties().setProperty( AvailableSettings.HBM2DDL_AUTO, "create");
}
@Override
protected boolean createSchema() {
return false;
}
// @Override
// protected boolean createSchema() {
// return false;
// }
@Test
@SuppressWarnings( {"UnusedAssignment"})
@ -168,13 +168,13 @@ public class StatsTest extends BaseCoreFunctionalTestCase {
tx.commit();
s.close();
sf.close();
// sf.close();
}
@Test
public void testQueryStatGathering() {
SessionFactory sf = sessionFactory();
sf.getStatistics().clear();
Session s = sf.openSession();
Transaction tx = s.beginTransaction();
fillDb(s);
@ -255,7 +255,7 @@ public class StatsTest extends BaseCoreFunctionalTestCase {
cleanDb( s );
tx.commit();
s.close();
sf.close();
// sf.close();
}
private Continent fillDb(Session s) {