Hibernate SVN: r10630 - trunk/HibernateExt/tools/src/test/org/hibernate/tool/test
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2006-10-19 13:14:49 -0400 (Thu, 19 Oct 2006)
New Revision: 10630
Modified:
trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/DriverMetaDataTest.java
Log:
Modified: trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/DriverMetaDataTest.java
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/DriverMetaDataTest.java 2006-10-19 17:14:28 UTC (rev 10629)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/DriverMetaDataTest.java 2006-10-19 17:14:49 UTC (rev 10630)
@@ -86,8 +86,23 @@
System.out.println(map);
}
+ }
+
+ public void testCaseTest() {
-
+
+ MetaDataDialect dialect = new JDBCMetaDataDialect();
+
+ Settings settings = cfg.buildSettings();
+
+ dialect.configure( settings.getConnectionProvider(), settings.getSQLExceptionConverter() );
+
+ Iterator tables = dialect.getTables( settings.getDefaultCatalogName(), settings.getDefaultSchemaName(), identifier( "TAB_MASTER"));
+
+ assertHasNext( 1, tables );
+
+
+
}
17 years, 6 months
Hibernate SVN: r10629 - trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2006-10-19 13:14:28 -0400 (Thu, 19 Oct 2006)
New Revision: 10629
Modified:
trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/PersistentClassesTest.java
Log:
class/tableleak in junitest
Modified: trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/PersistentClassesTest.java
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/PersistentClassesTest.java 2006-10-19 17:14:00 UTC (rev 10628)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/PersistentClassesTest.java 2006-10-19 17:14:28 UTC (rev 10629)
@@ -169,6 +169,7 @@
assertFalse(Hibernate.isInitialized(order.getItemsForOrderId() ) );
t.commit();
session.close();
+ sf.close();
}
/**
17 years, 6 months
Hibernate SVN: r10628 - trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2006-10-19 13:14:00 -0400 (Thu, 19 Oct 2006)
New Revision: 10628
Modified:
trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/CompositeIdTest.java
Log:
classleak in junitest
Modified: trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/CompositeIdTest.java
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/CompositeIdTest.java 2006-10-19 17:12:03 UTC (rev 10627)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/CompositeIdTest.java 2006-10-19 17:14:00 UTC (rev 10628)
@@ -265,8 +265,10 @@
}
assertFalse("hashcode should be different from system", hash==System.identityHashCode(object));
+ factory.close();
Thread.currentThread().setContextClassLoader(ucl.getParent() );
+
TestHelper.deleteDir(outputdir);
}
protected String getCustomerOrderQuery() {
17 years, 6 months
Hibernate SVN: r10627 - trunk/HibernateExt/tools/src/testsupport/generictemplates/pojo
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2006-10-19 13:12:03 -0400 (Thu, 19 Oct 2006)
New Revision: 10627
Modified:
trunk/HibernateExt/tools/src/testsupport/generictemplates/pojo/generic-class.ftl
Log:
Modified: trunk/HibernateExt/tools/src/testsupport/generictemplates/pojo/generic-class.ftl
===================================================================
--- trunk/HibernateExt/tools/src/testsupport/generictemplates/pojo/generic-class.ftl 2006-10-19 17:11:51 UTC (rev 10626)
+++ trunk/HibernateExt/tools/src/testsupport/generictemplates/pojo/generic-class.ftl 2006-10-19 17:12:03 UTC (rev 10627)
@@ -6,3 +6,7 @@
booleanProperty=${booleanProperty?if_exists?string}
<#if booleanProperty?exists && !booleanProperty>booleanWasTrue=true</#if>
myTool.value=<#if myTool?exists>${myTool.unqualify("myTool.value")}</#if>
+<#if refproperty?exists>
+<#assign inline= refproperty?interpret>
+refproperty=<@inline/>
+</#if>
17 years, 6 months
Hibernate SVN: r10626 - trunk/HibernateExt/tools/src/test/org/hibernate/tool
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2006-10-19 13:11:51 -0400 (Thu, 19 Oct 2006)
New Revision: 10626
Modified:
trunk/HibernateExt/tools/src/test/org/hibernate/tool/JDBCMetaDataBinderTestCase.java
Log:
fix possible statement leak in junittest
Modified: trunk/HibernateExt/tools/src/test/org/hibernate/tool/JDBCMetaDataBinderTestCase.java
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/JDBCMetaDataBinderTestCase.java 2006-10-19 17:11:24 UTC (rev 10625)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/JDBCMetaDataBinderTestCase.java 2006-10-19 17:11:51 UTC (rev 10626)
@@ -76,6 +76,7 @@
return; // don't do anything to avoid crippled db
}
+ Statement statement = null;
Connection con = null;
try {
@@ -85,10 +86,11 @@
storesLowerCaseIdentifiers = metaData.storesLowerCaseIdentifiers();
storesUpperCaseIdentifiers = metaData.storesUpperCaseIdentifiers();
- Statement statement = con.createStatement();
+ statement = con.createStatement();
+
for (int i = 0; i < sqls.length; i++) {
String ddlsql = sqls[i];
System.out.println("Execute: " + ddlsql);
@@ -104,10 +106,11 @@
}
}
}
- if (statement!=null) statement.close();
con.commit();
} finally {
+ if (statement!=null) statement.close();
testSettings.getConnectionProvider().closeConnection(con);
+
}
}
17 years, 6 months
Hibernate SVN: r10625 - in trunk/HibernateExt/tools/src/test/org/hibernate/tool: . hbmlint
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2006-10-19 13:11:24 -0400 (Thu, 19 Oct 2006)
New Revision: 10625
Added:
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenLazy.hbm.xml
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenLazy.java
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenNonLazy.java
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/CachingSettings.hbm.xml
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/FakeNonLazy.java
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/HbmLintAllTests.java
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/HbmLintTest.java
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/IdentifierIssues.hbm.xml
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/SchemaAnalyzerTest.java
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/SchemaIssues.hbm.xml
Log:
Missing tests for hbmlint
Added: trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenLazy.hbm.xml
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenLazy.hbm.xml 2006-10-19 17:10:48 UTC (rev 10624)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenLazy.hbm.xml 2006-10-19 17:11:24 UTC (rev 10625)
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.hibernate.tool.hbmlint">
+
+ <!-- category has caching for collection but its target is not cached -->
+ <class name="BrokenLazy" lazy="true">
+
+ <id name="id" type="long">
+ <generator class="native"/>
+ </id>
+
+ </class>
+
+ <class name="BrokenNonLazy" lazy="false">
+ <id name="id" type="long">
+ <generator class="native" />
+ </id>
+
+ </class>
+
+ <class name="FakeNonLazy" lazy="false">
+ <id name="id" type="long">
+ <generator class="native" />
+ </id>
+
+ </class>
+
+
+</hibernate-mapping>
Added: trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenLazy.java
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenLazy.java 2006-10-19 17:10:48 UTC (rev 10624)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenLazy.java 2006-10-19 17:11:24 UTC (rev 10625)
@@ -0,0 +1,11 @@
+package org.hibernate.tool.hbmlint;
+
+public class BrokenLazy {
+
+ long id;
+
+ public BrokenLazy(long id) {
+ this.id = id;
+ }
+}
+
Added: trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenNonLazy.java
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenNonLazy.java 2006-10-19 17:10:48 UTC (rev 10624)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/BrokenNonLazy.java 2006-10-19 17:11:24 UTC (rev 10625)
@@ -0,0 +1,11 @@
+package org.hibernate.tool.hbmlint;
+
+public class BrokenNonLazy {
+
+ long id;
+
+ public BrokenNonLazy(long id) {
+ this.id = id;
+ }
+}
+
Added: trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/CachingSettings.hbm.xml
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/CachingSettings.hbm.xml 2006-10-19 17:10:48 UTC (rev 10624)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/CachingSettings.hbm.xml 2006-10-19 17:11:24 UTC (rev 10625)
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.hibernate.tool.hbmlint">
+
+ <!-- category has caching for collection but its target is not cached -->
+ <class name="Category">
+
+ <id name="id" type="long">
+ <generator class="native"/>
+ </id>
+
+ <set name="childCategories">
+ <cache usage="read-only"/>
+ <key column="PARENT_ID"/>
+ <one-to-many class="Category"/>
+ </set>
+
+ </class>
+
+ <class name="NoTable">
+ <id name="id" type="long">
+ <generator class="native"/>
+ </id>
+
+ </class>
+</hibernate-mapping>
Added: trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/FakeNonLazy.java
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/FakeNonLazy.java 2006-10-19 17:10:48 UTC (rev 10624)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/FakeNonLazy.java 2006-10-19 17:11:24 UTC (rev 10625)
@@ -0,0 +1,37 @@
+package org.hibernate.tool.hbmlint;
+
+import org.hibernate.bytecode.javassist.FieldHandled;
+import org.hibernate.bytecode.javassist.FieldHandler;
+
+import net.sf.cglib.transform.impl.InterceptFieldCallback;
+import net.sf.cglib.transform.impl.InterceptFieldEnabled;
+
+public class FakeNonLazy implements InterceptFieldEnabled, FieldHandled {
+
+ long id;
+
+ public FakeNonLazy(long id) {
+ this.id = id;
+ }
+
+ public InterceptFieldCallback getInterceptFieldCallback() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setInterceptFieldCallback(InterceptFieldCallback callback) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public FieldHandler getFieldHandler() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setFieldHandler(FieldHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+}
+
Added: trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/HbmLintAllTests.java
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/HbmLintAllTests.java 2006-10-19 17:10:48 UTC (rev 10624)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/HbmLintAllTests.java 2006-10-19 17:11:24 UTC (rev 10625)
@@ -0,0 +1,17 @@
+package org.hibernate.tool.hbmlint;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class HbmLintAllTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite( "Test for org.hibernate.tool.hbmlint" );
+ //$JUnit-BEGIN$
+ suite.addTestSuite( HbmLintTest.class );
+ suite.addTestSuite( SchemaAnalyzerTest.class );
+ //$JUnit-END$
+ return suite;
+ }
+
+}
Added: trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/HbmLintTest.java
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/HbmLintTest.java 2006-10-19 17:10:48 UTC (rev 10624)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/HbmLintTest.java 2006-10-19 17:11:24 UTC (rev 10625)
@@ -0,0 +1,94 @@
+package org.hibernate.tool.hbmlint;
+
+import java.util.List;
+
+import org.hibernate.cfg.Configuration;
+import org.hibernate.tool.JDBCMetaDataBinderTestCase;
+import org.hibernate.tool.hbm2x.HbmLintExporter;
+import org.hibernate.tool.hbmlint.detector.BadCachingDetector;
+import org.hibernate.tool.hbmlint.detector.InstrumentationDetector;
+import org.hibernate.tool.hbmlint.detector.ShadowedIdentifierDetector;
+
+public class HbmLintTest extends JDBCMetaDataBinderTestCase {
+
+ public HbmLintTest() {
+ super();
+ }
+
+ protected String[] getMappings() {
+ return new String[] { "hbmlint/CachingSettings.hbm.xml", "hbmlint/IdentifierIssues.hbm.xml", "hbmlint/BrokenLazy.hbm.xml" };
+ }
+
+ public void testExporter() {
+
+ Configuration cfg = new Configuration();
+ addMappings( getMappings(), cfg );
+ cfg.buildMappings();
+
+ new HbmLintExporter(cfg, getOutputDir()).start();
+
+ }
+ public void testValidateCache() {
+
+ Configuration cfg = new Configuration();
+ addMappings( getMappings(), cfg );
+ cfg.buildMappings();
+
+ HbmLint analyzer = new HbmLint(new Detector[] { new BadCachingDetector() });
+
+ analyzer.analyze(cfg);
+
+ List result = analyzer.getResults();
+
+ assertEquals(1,result.size());
+
+ System.out.println(result);
+
+ }
+
+ public void testValidateIdentifier() {
+
+ Configuration cfg = new Configuration();
+ addMappings( getMappings(), cfg );
+ cfg.buildMappings();
+
+ HbmLint analyzer = new HbmLint(new Detector[] { new ShadowedIdentifierDetector() });
+
+ analyzer.analyze(cfg);
+
+ List result = analyzer.getResults();
+
+ assertEquals(1,result.size());
+
+ System.out.println(result);
+
+ }
+
+ public void testBytecodeRestrictions() {
+
+ Configuration cfg = new Configuration();
+ addMappings( getMappings(), cfg );
+ cfg.buildMappings();
+
+ HbmLint analyzer = new HbmLint(new Detector[] { new InstrumentationDetector() });
+
+ analyzer.analyze(cfg);
+
+ List result = analyzer.getResults();
+
+ assertEquals(2,result.size());
+
+ System.out.println(result);
+
+ }
+
+ protected String[] getCreateSQL() {
+ return new String[0];// { "create table Category (id numeric(5), parent_id numeric(5))" };
+ }
+
+ protected String[] getDropSQL() {
+ return new String[0];// { "drop table Category" };
+ }
+
+
+}
Added: trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/IdentifierIssues.hbm.xml
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/IdentifierIssues.hbm.xml 2006-10-19 17:10:48 UTC (rev 10624)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/IdentifierIssues.hbm.xml 2006-10-19 17:11:24 UTC (rev 10625)
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.hibernate.tool.hbmlint">
+
+ <!-- category has caching for collection but its target is not cached -->
+ <class name="IdentifierProblem">
+
+ <id name="name" type="long">
+ <generator class="native"/>
+ </id>
+
+ <property name="id" type="string"/>
+
+ </class>
+
+</hibernate-mapping>
Added: trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/SchemaAnalyzerTest.java
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/SchemaAnalyzerTest.java 2006-10-19 17:10:48 UTC (rev 10624)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/SchemaAnalyzerTest.java 2006-10-19 17:11:24 UTC (rev 10625)
@@ -0,0 +1,100 @@
+package org.hibernate.tool.hbmlint;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.hibernate.cfg.Configuration;
+import org.hibernate.mapping.Table;
+import org.hibernate.tool.JDBCMetaDataBinderTestCase;
+import org.hibernate.tool.hbm2x.HbmLintExporter;
+import org.hibernate.tool.hbmlint.detector.SchemaByMetaDataDetector;
+
+public class SchemaAnalyzerTest extends JDBCMetaDataBinderTestCase {
+
+ public SchemaAnalyzerTest() {
+ super();
+ }
+
+ protected String[] getMappings() {
+ return new String[] { "hbmlint/SchemaIssues.hbm.xml" };
+ }
+
+ static class MockCollector implements IssueCollector {
+ List problems = new ArrayList();
+
+ public void reportIssue(Issue analyze) {
+
+ problems.add(analyze);
+ }
+ }
+
+ public void testSchemaAnalyzer() {
+ Configuration cfg = new Configuration();
+ addMappings( getMappings(), cfg );
+ cfg.buildMappings();
+
+ SchemaByMetaDataDetector analyzer = new SchemaByMetaDataDetector();
+ analyzer.initialize( cfg, cfg.buildSettings() );
+
+ Iterator tableMappings = cfg.getTableMappings();
+
+
+ while ( tableMappings.hasNext() ) {
+ Table table = (Table) tableMappings.next();
+
+ MockCollector mc = new MockCollector();
+
+ if(table.getName().equalsIgnoreCase( "missingtable" )) {
+ analyzer.visit( cfg, table, mc );
+ assertEquals(mc.problems.size(),1);
+ Issue ap = (Issue) mc.problems.get( 0 );
+ assertTrue(ap.getDescription().indexOf( "Missing table" ) >=0);
+ } else if(table.getName().equalsIgnoreCase( "category" )) {
+ analyzer.visit( cfg, table, mc );
+ assertEquals(mc.problems.size(),1);
+ Issue ap = (Issue) mc.problems.get( 0 );
+ assertTrue(ap.getDescription().indexOf( "missing column: name" ) >=0);
+ } else if(table.getName().equalsIgnoreCase( "badtype" )) {
+ analyzer.visit( cfg, table, mc );
+ assertEquals(mc.problems.size(),1);
+ Issue ap = (Issue) mc.problems.get( 0 );
+ assertTrue(ap.getDescription().indexOf( "wrong column type for name" ) >=0);
+ } else {
+ fail("Unkown table " + table);
+ }
+ }
+
+ MockCollector mc = new MockCollector();
+ analyzer.visitGenerators( cfg, mc );
+ assertEquals(1,mc.problems.size());
+ Issue issue = (Issue) mc.problems.get( 0 );
+ assertTrue(issue.getDescription().indexOf( "hibernate_unique_key" ) >=0);
+
+ }
+
+
+
+ public void testExporter() {
+
+ Configuration cfg = new Configuration();
+ addMappings( getMappings(), cfg );
+ cfg.buildMappings();
+
+ new HbmLintExporter(cfg, getOutputDir()).start();
+
+ }
+
+ protected String[] getCreateSQL() {
+ return new String[] { "create table Category (id int, parent_id numeric(5))",
+ "create table BadType (id int, name varchar(100))",
+ "create sequence should_be_there start with 1",
+ "create table hilo_table (id int)"};
+ }
+
+ protected String[] getDropSQL() {
+ return new String[] { "drop table Category", "drop table BadType", "drop sequence should_be_there", "drop table hilo_table" };
+ }
+
+
+}
Added: trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/SchemaIssues.hbm.xml
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/SchemaIssues.hbm.xml 2006-10-19 17:10:48 UTC (rev 10624)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbmlint/SchemaIssues.hbm.xml 2006-10-19 17:11:24 UTC (rev 10625)
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.hibernate.tool.hbmlint">
+
+ <class name="Category">
+
+ <id name="id" type="int">
+ <generator class="sequence">
+ <param name="sequence">should_be_there</param>
+ </generator>
+ </id>
+
+ <property name="name" type="string"/>
+
+ </class>
+
+ <class name="BadType">
+
+ <id name="id" type="int">
+ <generator class="hilo"/>
+ </id>
+
+ <property name="name" type="text"/>
+
+ </class>
+
+ <class name="MissingTable">
+ <id name="id" type="long">
+ <generator class="hilo">
+ <param name="table">hilo_table</param>
+ </generator>
+ </id>
+ </class>
+</hibernate-mapping>
17 years, 6 months
Hibernate SVN: r10624 - trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2006-10-19 13:10:48 -0400 (Thu, 19 Oct 2006)
New Revision: 10624
Modified:
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/GenericExporterTest.java
Log:
test recursive property evaluation.
Modified: trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/GenericExporterTest.java
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/GenericExporterTest.java 2006-10-19 17:10:24 UTC (rev 10623)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/GenericExporterTest.java 2006-10-19 17:10:48 UTC (rev 10624)
@@ -107,8 +107,10 @@
ge.setOutputDirectory(getOutputDir());
Properties p = new Properties();
p.setProperty("proptest", "A value");
+ p.setProperty( "refproperty", "proptest=${proptest}" );
p.setProperty("hibernatetool.booleanProperty", "true");
p.setProperty("hibernatetool.myTool.toolclass", "org.hibernate.tool.hbm2x.Cfg2JavaTool");
+
ge.setProperties(p);
ge.setTemplateName("generictemplates/pojo/generic-class.ftl");
ge.setFilePattern("{package-name}/generic{class-name}.txt");
@@ -121,6 +123,8 @@
assertEquals(generated.getProperty("hibernatetool.booleanProperty"), "true");
assertNull(generated.getProperty("booleanWasTrue"));
assertEquals(generated.getProperty("myTool.value"), "value");
+ assertEquals(generated.getProperty("refproperty"), "proptest=A value");
+
}
protected String getBaseForMappings() {
17 years, 6 months
Hibernate SVN: r10623 - trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2006-10-19 13:10:24 -0400 (Thu, 19 Oct 2006)
New Revision: 10623
Modified:
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/DocExporterTest.java
Log:
Modified: trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/DocExporterTest.java
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/DocExporterTest.java 2006-10-19 17:09:49 UTC (rev 10622)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/DocExporterTest.java 2006-10-19 17:10:24 UTC (rev 10623)
@@ -36,7 +36,7 @@
}
protected void tearDown() throws Exception {
- //super.tearDown();
+ super.tearDown();
}
public void testExporter() {
17 years, 6 months
Hibernate SVN: r10622 - trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2006-10-19 13:09:49 -0400 (Thu, 19 Oct 2006)
New Revision: 10622
Modified:
trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/OverrideRepository.java
Log:
fix equals
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/OverrideRepository.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/OverrideRepository.java 2006-10-19 15:58:30 UTC (rev 10621)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/OverrideRepository.java 2006-10-19 17:09:49 UTC (rev 10622)
@@ -217,9 +217,11 @@
}
public boolean equals(Object obj) {
+ if(obj==null) return false;
+ if(!(obj instanceof TypeMappingKey)) return false;
TypeMappingKey other = (TypeMappingKey) obj;
- if(obj==null) return false;
+
return type==other.type && length==other.length;
}
17 years, 6 months
Hibernate SVN: r10621 - trunk/HibernateExt/tools/src/java/org/hibernate/tool/ant
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2006-10-19 11:58:30 -0400 (Thu, 19 Oct 2006)
New Revision: 10621
Modified:
trunk/HibernateExt/tools/src/java/org/hibernate/tool/ant/HibernateToolTask.java
Log:
HBX-752 extends org.hibernate.tool.ant.HibernateToolTask
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/tool/ant/HibernateToolTask.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/tool/ant/HibernateToolTask.java 2006-10-19 15:50:37 UTC (rev 10620)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/tool/ant/HibernateToolTask.java 2006-10-19 15:58:30 UTC (rev 10621)
@@ -75,38 +75,42 @@
public ExporterTask createHbm2DDL() {
ExporterTask generator = new Hbm2DDLExporterTask(this);
- generators.add(generator);
+ addGenerator( generator );
return generator;
}
public ExporterTask createHbmTemplate() {
ExporterTask generator = new GenericExporterTask(this);
- generators.add(generator);
+ addGenerator( generator );
return generator;
}
public ExporterTask createHbm2CfgXml() {
ExporterTask generator = new Hbm2CfgXmlExporterTask(this);
- generators.add(generator);
+ addGenerator( generator );
return generator;
}
+
+ protected boolean addGenerator(ExporterTask generator) {
+ return generators.add(generator);
+ }
public ExporterTask createHbm2Java() {
ExporterTask generator = new Hbm2JavaExporterTask(this);
- generators.add(generator);
+ addGenerator( generator );
return generator;
}
public ExporterTask createHbm2HbmXml() {
ExporterTask generator= new Hbm2HbmXmlExporterTask(this);
- generators.add(generator);
+ addGenerator( generator );
return generator;
}
public ExporterTask createHbm2Doc() {
ExporterTask generator= new Hbm2DocExporterTask(this);
- generators.add(generator);
+ addGenerator( generator );
return generator;
}
@@ -118,7 +122,7 @@
public ExporterTask createHbm2DAO(){
ExporterTask generator= new Hbm2DAOExporterTask(this);
- generators.add(generator);
+ addGenerator( generator );
return generator;
}
17 years, 6 months