Author: max.andersen(a)jboss.com
Date: 2006-08-24 06:30:07 -0400 (Thu, 24 Aug 2006)
New Revision: 10334
Modified:
trunk/HibernateExt/tools/src/test/org/hibernate/tool/BaseTestCase.java
trunk/HibernateExt/tools/src/test/org/hibernate/tool/NonReflectiveTestCase.java
Log:
testcleanup
Modified: trunk/HibernateExt/tools/src/test/org/hibernate/tool/BaseTestCase.java
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/BaseTestCase.java 2006-08-24
10:29:31 UTC (rev 10333)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/BaseTestCase.java 2006-08-24
10:30:07 UTC (rev 10334)
@@ -115,6 +115,24 @@
public boolean appliesTo(Dialect dialect) {
return true;
}
+
+ /**
+ * @return
+ */
+ protected String getBaseForMappings() {
+ return "org/hibernate/tool/";
+ }
+
+
+ protected void addMappings(String[] files, Configuration cfg) {
+ for (int i=0; i<files.length; i++) {
+ if ( !files[i].startsWith("net/") ) {
+ files[i] = getBaseForMappings() + files[i];
+ }
+ //System.out.println("bc in " + this.getClass() + " " +
getBaseForMappings() + " " + files[i]);
+ cfg.addResource( files[i], this.getClass().getClassLoader() );
+ }
+ }
}
Modified: trunk/HibernateExt/tools/src/test/org/hibernate/tool/NonReflectiveTestCase.java
===================================================================
---
trunk/HibernateExt/tools/src/test/org/hibernate/tool/NonReflectiveTestCase.java 2006-08-24
10:29:31 UTC (rev 10333)
+++
trunk/HibernateExt/tools/src/test/org/hibernate/tool/NonReflectiveTestCase.java 2006-08-24
10:30:07 UTC (rev 10334)
@@ -2,6 +2,7 @@
package org.hibernate.tool;
import java.io.File;
+import java.util.Iterator;
import org.hibernate.HibernateException;
import org.hibernate.Interceptor;
@@ -10,6 +11,9 @@
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.SessionFactoryImplementor;
+import org.hibernate.mapping.ForeignKey;
+import org.hibernate.mapping.Index;
+import org.hibernate.mapping.Table;
import org.hibernate.tool.test.TestHelper;
public abstract class NonReflectiveTestCase extends BaseTestCase {
@@ -44,14 +48,9 @@
cfg.setProperty(Environment.HBM2DDL_AUTO, "create-drop");
}
- for (int i=0; i<files.length; i++) {
- if ( !files[i].startsWith("net/") ) {
- files[i] = getBaseForMappings() + files[i];
- }
- //System.out.println("bc in " + this.getClass() + " " +
getBaseForMappings() + " " + files[i]);
- getCfg().addResource( files[i], this.getClass().getClassLoader() );
- }
-
+ Configuration cfg2 = getCfg();
+ addMappings( files, cfg2 );
+
/*if ( getCacheConcurrencyStrategy()!=null ) {
Iterator iter = cfg.getClassMappings();
@@ -87,16 +86,9 @@
}*/
setDialect( Dialect.getDialect() );
- getCfg().buildMappings();
+ cfg2.buildMappings();
}
- /**
- * @return
- */
- protected String getBaseForMappings() {
- return "org/hibernate/tool/";
- }
-
public String getCacheConcurrencyStrategy() {
return "nonstrict-read-write";
}
Show replies by date