Author: max.andersen(a)jboss.com
Date: 2006-11-07 08:44:49 -0500 (Tue, 07 Nov 2006)
New Revision: 10749
Modified:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Hbm2JavaEjb3Test.java
Log:
fix possible statement leak in junittest
Modified:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Hbm2JavaEjb3Test.java
===================================================================
---
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Hbm2JavaEjb3Test.java 2006-11-07
13:44:36 UTC (rev 10748)
+++
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Hbm2JavaEjb3Test.java 2006-11-07
13:44:49 UTC (rev 10749)
@@ -116,7 +116,52 @@
}
+ public void testAnnotationColumnDefaults() {
+ PersistentClass classMapping =
getCfg().getClassMapping("org.hibernate.tool.hbm2x.Article");
+ Cfg2JavaTool cfg2java = new Cfg2JavaTool();
+ POJOClass clazz = cfg2java.getPOJOClass(classMapping);
+
+ Property p = classMapping.getProperty("content");
+
+ String string = clazz.generateAnnColumnAnnotation( p );
+
+ assertNotNull(string);
+ assertEquals(-1, string.indexOf("unique="));
+ assertTrue(string.indexOf("nullable=")>=0);
+ assertEquals(-1, string.indexOf("insertable="));
+ assertEquals(-1, string.indexOf("updatable="));
+ assertTrue(string.indexOf("length=10000")>0);
+
+ p = classMapping.getProperty("name");
+ string = clazz.generateAnnColumnAnnotation( p );
+
+ assertNotNull(string);
+ assertEquals(-1, string.indexOf("unique="));
+ assertTrue(string.indexOf("nullable=")>=0);
+ assertEquals(-1, string.indexOf("insertable="));
+ assertTrue(string.indexOf("updatable=false")>0);
+ assertTrue(string.indexOf("length=100")>0);
+
+
+ classMapping = getCfg().getClassMapping( "org.hibernate.tool.hbm2x.Train" );
+ clazz = cfg2java.getPOJOClass(classMapping);
+
+ p = classMapping.getProperty( "name" );
+ string = clazz.generateAnnColumnAnnotation( p );
+ assertNotNull(string);
+ assertTrue(string.indexOf("unique=true")>0);
+ assertTrue(string.indexOf("nullable=")>=0);
+ assertEquals(-1, string.indexOf("insertable="));
+ assertEquals(-1,string.indexOf("updatable="));
+ assertEquals(-1, string.indexOf("length="));
+
+ }
+ protected void tearDown() throws Exception {
+
+ //super.tearDown();
+ }
+
protected String getBaseForMappings() {
return "org/hibernate/tool/hbm2x/";
}
Show replies by date