[hibernate-commits] Hibernate SVN: r17717 - in annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations: xml/hbm and 1 other directory.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Tue Oct 13 09:31:07 EDT 2009


Author: stliu
Date: 2009-10-13 09:31:07 -0400 (Tue, 13 Oct 2009)
New Revision: 17717

Added:
   annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/RequiresDialect.java
   annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/xml/hbm/HbmWithIdentityTest.java
Log:
JBPAPP-2910 HHH-4415 : TestCase could check for superclass of Dialect before skipping it

Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/RequiresDialect.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/RequiresDialect.java	                        (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/RequiresDialect.java	2009-10-13 13:31:07 UTC (rev 17717)
@@ -0,0 +1,20 @@
+// $Id: RequiresDialect.java 15025 2008-08-11 09:14:39Z hardy.ferentschik $
+package org.hibernate.test.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.hibernate.dialect.Dialect;
+
+/**
+ * Annotations used to mark a test to be specific to a given dialect.
+ * 
+ * @author Hardy Ferentschik
+ */
+ at Target({ElementType.METHOD, ElementType.TYPE})
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface RequiresDialect {
+	Class<? extends Dialect>[] value();
+}

Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/xml/hbm/HbmWithIdentityTest.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/xml/hbm/HbmWithIdentityTest.java	                        (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/xml/hbm/HbmWithIdentityTest.java	2009-10-13 13:31:07 UTC (rev 17717)
@@ -0,0 +1,54 @@
+//$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.cfg.Configuration;
+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 void configure(Configuration cfg) {
+		super.configure( cfg );
+	}
+
+	
+	
+	@Override
+	protected boolean runForCurrentDialect() {
+		return super.runForCurrentDialect() && getDialect().supportsIdentityColumns();
+	}
+
+	protected Class[] getMappings() {
+		return new 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"
+		};
+	}
+}



More information about the hibernate-commits mailing list