HHH-4397 Split test involving database specific features (like sequence / identity)

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@17726 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Strong Liu 2009-10-13 15:57:41 +00:00
parent f5a280bc5b
commit 766a044dc3
3 changed files with 55 additions and 25 deletions

View File

@ -34,6 +34,14 @@ public class ManyToOneReferencedColumnNameTest extends TestCase {
s.close(); s.close();
} }
@Override
protected boolean runForCurrentDialect() {
return super.runForCurrentDialect() && getDialect().supportsIdentityColumns();
}
protected Class[] getMappings() { protected Class[] getMappings() {
return new Class[] { return new Class[] {
Item.class, Item.class,

View File

@ -4,7 +4,6 @@ package org.hibernate.test.annotations.xml.hbm;
import java.util.HashSet; import java.util.HashSet;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.cfg.Configuration;
import org.hibernate.test.annotations.TestCase; import org.hibernate.test.annotations.TestCase;
/** /**
@ -63,32 +62,10 @@ public class HbmTest extends TestCase {
s.close(); s.close();
} }
public void testManyToOneAndInterface() throws Exception {
Session s = openSession();
s.getTransaction().begin();
B b = new BImpl();
b.setBId( 1 );
s.persist( b );
Z z = new ZImpl();
z.setB( b );
s.persist( z );
s.flush();
s.getTransaction().rollback();
s.close();
}
@Override
protected void configure(Configuration cfg) {
super.configure( cfg );
//cfg.addClass( Government.class );
}
protected Class[] getMappings() { protected Class[] getMappings() {
return new Class[]{ return new Class[]{
PrimeMinister.class, PrimeMinister.class,
Sky.class, Sky.class,
ZImpl.class
}; };
} }
@ -97,8 +74,6 @@ public class HbmTest extends TestCase {
return new String[]{ return new String[]{
"org/hibernate/test/annotations/xml/hbm/Government.hbm.xml", "org/hibernate/test/annotations/xml/hbm/Government.hbm.xml",
"org/hibernate/test/annotations/xml/hbm/CloudType.hbm.xml", "org/hibernate/test/annotations/xml/hbm/CloudType.hbm.xml",
"org/hibernate/test/annotations/xml/hbm/A.hbm.xml",
"org/hibernate/test/annotations/xml/hbm/B.hbm.xml"
}; };
} }
} }

View File

@ -0,0 +1,47 @@
//$Id:HbmTest.java 9793 2006-04-26 02:20:18 -0400 (mer., 26 avr. 2006) epbernard $
package org.hibernate.test.annotations.xml.hbm;
import org.hibernate.Session;
import org.hibernate.test.annotations.TestCase;
/**
* @author Emmanuel Bernard
*/
public class HbmWithIdentityTest extends TestCase {
public void testManyToOneAndInterface() throws Exception {
Session s = openSession();
s.getTransaction().begin();
B b = new BImpl();
b.setBId( 1 );
s.persist( b );
Z z = new ZImpl();
z.setB( b );
s.persist( z );
s.flush();
s.getTransaction().rollback();
s.close();
}
@Override
protected boolean runForCurrentDialect() {
return super.runForCurrentDialect() && getDialect().supportsIdentityColumns();
}
protected Class[] getMappings() {
return new Class[]{
Sky.class,
ZImpl.class
};
}
@Override
protected String[] getXmlFiles() {
return new String[]{
"org/hibernate/test/annotations/xml/hbm/A.hbm.xml",
"org/hibernate/test/annotations/xml/hbm/B.hbm.xml"
};
}
}