\r
import java.util.List;\r
\r
-import org.springframework.orm.hibernate3.support.HibernateDaoSupport;\r
-\r
import org.apache.commons.logging.Log;\r
import org.apache.commons.logging.LogFactory;\r
-\r
import org.argeo.slc.core.structure.tree.TreeSPath;\r
+import org.argeo.slc.core.test.tree.TreeTestResult;\r
import org.argeo.slc.dao.structure.tree.TreeSPathDao;\r
+import org.springframework.orm.hibernate3.support.HibernateDaoSupport;\r
\r
/**\r
* The Hibernate implementation for tree-based result of the test result dao.\r
import java.util.Date;\r
import java.util.List;\r
\r
-import org.springframework.orm.hibernate3.support.HibernateDaoSupport;\r
-\r
import org.argeo.slc.core.SlcException;\r
import org.argeo.slc.core.structure.tree.TreeSPath;\r
-import org.argeo.slc.core.test.NumericTRId;\r
import org.argeo.slc.core.test.TestResult;\r
-import org.argeo.slc.core.test.TestResultId;\r
import org.argeo.slc.core.test.tree.TreeTestResult;\r
import org.argeo.slc.dao.test.tree.TreeTestResultDao;\r
+import org.springframework.orm.hibernate3.support.HibernateDaoSupport;\r
\r
/**\r
* The Hibernate implementation for tree-based result of the test result dao.\r
+++ /dev/null
-package org.argeo.slc.hibernate.unit;\r
-\r
-import java.sql.Connection;\r
-import java.util.List;\r
-import java.util.Properties;\r
-\r
-import org.hibernate.cfg.Configuration;\r
-import org.hibernate.cfg.Environment;\r
-import org.hibernate.tool.hbm2ddl.SchemaExport;\r
-\r
-/**\r
- * Creates a relational data model from Hibernate mapping files. The benefit of\r
- * this class is to be able to use Hibernate to have test data which are\r
- * independent from the type of database used.\r
- */\r
-public class DbModel {\r
- private String dialect;\r
- private List<String> mappings;\r
-\r
- /** Sets the Hibernate dialect to use. */\r
- public void setDialect(String dialect) {\r
- this.dialect = dialect;\r
- }\r
-\r
- /** Sets the list of mappings to consider. */\r
- public void setMappings(List<String> mappings) {\r
- this.mappings = mappings;\r
- }\r
-\r
- /**\r
- * Creates an Hibernate schema export tool, in order to create the\r
- * underlying datamodel.\r
- */\r
- public SchemaExport createSchemaExport(Connection connection) {\r
- Configuration configuration = new Configuration();\r
- Properties properties = new Properties();\r
- properties.setProperty(Environment.DIALECT, dialect);\r
- properties.setProperty(Environment.HBM2DDL_AUTO, "create");\r
- configuration.setProperties(properties);\r
-\r
- for (String mapping : mappings) {\r
- configuration.addResource(mapping.trim());\r
- }\r
-\r
- return new SchemaExport(configuration, connection);\r
- }\r
-}\r
--- /dev/null
+package org.argeo.slc.hibernate.unit;\r
+\r
+import java.sql.Connection;\r
+import java.util.List;\r
+import java.util.Properties;\r
+\r
+import org.argeo.slc.support.deploy.db.DbModel;\r
+import org.hibernate.cfg.Configuration;\r
+import org.hibernate.cfg.Environment;\r
+import org.hibernate.tool.hbm2ddl.SchemaExport;\r
+\r
+/**\r
+ * Creates a relational data model from Hibernate mapping files. The benefit of\r
+ * this class is to be able to use Hibernate to have test data which are\r
+ * independent from the type of database used.\r
+ */\r
+public class DbModelHibernate implements DbModel {\r
+ private String dialect;\r
+ private List<String> mappings;\r
+\r
+ /** Sets the Hibernate dialect to use. */\r
+ public void setDialect(String dialect) {\r
+ this.dialect = dialect;\r
+ }\r
+\r
+ /** Sets the list of mappings to consider. */\r
+ public void setMappings(List<String> mappings) {\r
+ this.mappings = mappings;\r
+ }\r
+\r
+ /**\r
+ * Creates an Hibernate schema export tool, in order to create the\r
+ * underlying datamodel.\r
+ */\r
+ protected SchemaExport createSchemaExport(Connection connection) {\r
+ Configuration configuration = new Configuration();\r
+ Properties properties = new Properties();\r
+ properties.setProperty(Environment.DIALECT, dialect);\r
+ properties.setProperty(Environment.HBM2DDL_AUTO, "create");\r
+ configuration.setProperties(properties);\r
+\r
+ for (String mapping : mappings) {\r
+ configuration.addResource(mapping.trim());\r
+ }\r
+\r
+ return new SchemaExport(configuration, connection);\r
+ }\r
+\r
+ public void createSchema(Connection connection) {\r
+ SchemaExport schemaExport = createSchemaExport(connection);\r
+ schemaExport.create(true, true);\r
+ }\r
+\r
+}\r
\r
/**\r
* Helper to make db vendor independent tests using DbUnit data sets. Based on\r
- * {@link DbModel}.\r
+ * {@link DbModelHibernate}.\r
*/\r
public abstract class IndependentDbTestCase extends AbstractSpringTestCase {\r
private IDatabaseTester databaseTester;\r
@Override\r
public void execute(IDatabaseConnection connection, IDataSet dataSet)\r
throws DatabaseUnitException, SQLException {\r
- DbModel dbModel = getDbModel();\r
+ DbModelHibernate dbModel = getDbModel();\r
SchemaExport schemaExport = dbModel\r
.createSchemaExport(connection.getConnection());\r
schemaExport.create(true, true);\r
* The DB model to us to create the DDL of the testes database. The default\r
* implementation loads a bean named after {@link #getDbModelBeanName()}.\r
*/\r
- protected DbModel getDbModel() {\r
- return (DbModel) getContext().getBean(getDbModelBeanName());\r
+ protected DbModelHibernate getDbModel() {\r
+ return (DbModelHibernate) getContext().getBean(getDbModelBeanName());\r
}\r
\r
/**\r
<value>\r
org/argeo/slc/hibernate/structure/tree/TreeSRegistry.hbm.xml\r
</value>\r
- <value>\r
- org/argeo/slc/hibernate/test/NumericTRId.hbm.xml\r
- </value>\r
<value>\r
org/argeo/slc/hibernate/test/SimpleResultPart.hbm.xml\r
</value>\r
+++ /dev/null
-<?xml version="1.0"?>\r
-<!DOCTYPE hibernate-mapping PUBLIC\r
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"\r
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">\r
-<hibernate-mapping package="org.argeo.slc.core.test">\r
- <class name="NumericTRId" table="NUMERIC_TR_ID">\r
-\r
- <id name="tid" column="T_ID">\r
- <generator class="native" />\r
- </id>\r
- <property name="value" column="VALUE" not-null="true"\r
- unique="true" />\r
- </class>\r
-</hibernate-mapping>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>\r
-<!DOCTYPE hibernate-mapping PUBLIC\r
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"\r
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">\r
-<hibernate-mapping package="org.argeo.slc.core.test">\r
- <class name="TestResultId" table="TEST_RESULT_ID">\r
- <id name="tid" column="T_ID">\r
- <generator class="native" />\r
- </id>\r
- </class>\r
-</hibernate-mapping>
\ No newline at end of file