[hibernate-commits] Hibernate SVN: r12894 - in branches/Branch_3_2/HibernateExt/tools: lib/testlibs and 8 other directories.
hibernate-commits at lists.jboss.org
hibernate-commits at lists.jboss.org
Fri Aug 3 09:48:07 EDT 2007
Author: max.andersen at jboss.com
Date: 2007-08-03 09:48:06 -0400 (Fri, 03 Aug 2007)
New Revision: 12894
Added:
branches/Branch_3_2/HibernateExt/tools/src/testoutputdependent/properties/
branches/Branch_3_2/HibernateExt/tools/src/testoutputdependent/properties/PropertiesUsage.java
Removed:
branches/Branch_3_2/HibernateExt/tools/lib/testlibs/jboss-seam.jar
branches/Branch_3_2/HibernateExt/tools/lib/testlibs/myfaces-api.jar
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/seam/SeamExporter.java
branches/Branch_3_2/HibernateExt/tools/src/templates/seam/
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ant/SeamAntTest.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Hbm2SeamTest.java
Modified:
branches/Branch_3_2/HibernateExt/tools/doc/reference/en/modules/ant.xml
branches/Branch_3_2/HibernateExt/tools/doc/reference/en/modules/plugins.xml
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/BasicPOJOClass.java
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/BaseTestCase.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ant/AntAllTests.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Hbm2XAllTests.java
Log:
Bye bye old dusty seam 0.x templates
Modified: branches/Branch_3_2/HibernateExt/tools/doc/reference/en/modules/ant.xml
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/doc/reference/en/modules/ant.xml 2007-08-03 13:11:28 UTC (rev 12893)
+++ branches/Branch_3_2/HibernateExt/tools/doc/reference/en/modules/ant.xml 2007-08-03 13:48:06 UTC (rev 12894)
@@ -739,25 +739,24 @@
handling.</para>
<section>
- <title>Seam Exporter via
+ <title>Exporter via
<literal><hbmtemplate></literal></title>
<para>The following is an example of reverse engineering via
- <literal><jdbcconfiguration></literal> and use the
- SeamExporter via the <literal><hbmtemplate></literal> to
- generate a Seam application skeleton.</para>
+ <literal><jdbcconfiguration></literal> and use a custom
+ Exporter via the <literal><hbmtemplate></literal>.</para>
<para><programlisting><![CDATA[ <hibernatetool destdir="${destdir}">
<jdbcconfiguration
configurationfile="hibernate.cfg.xml"
- packagename="x.y.z.seam.crud"/>
+ packagename="my.model"/>
<!-- setup properties -->
- <property key="seam_appname" value="Registration"/>
- <property key="seam_shortname" value="crud"/>
+ <property key="appname" value="Registration"/>
+ <property key="shortname" value="crud"/>
<hbmtemplate
- exporterclass="org.hibernate.tool.hbm2x.seam.SeamExporter"
+ exporterclass="my.own.Exporter"
filepattern="."/>
</hibernatetool>
Modified: branches/Branch_3_2/HibernateExt/tools/doc/reference/en/modules/plugins.xml
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/doc/reference/en/modules/plugins.xml 2007-08-03 13:11:28 UTC (rev 12893)
+++ branches/Branch_3_2/HibernateExt/tools/doc/reference/en/modules/plugins.xml 2007-08-03 13:48:06 UTC (rev 12894)
@@ -628,20 +628,6 @@
database schema and some of the mappings.</para></entry>
</row>
- <row>
- <entry><para>JBoss Seam skeleton app [Beta]</para></entry>
-
- <entry><para>Generates a complete JBoss Seam skeleton app. The
- generation will include annotated POJO's, Seam controller beans
- and a JSP for the presentation layer. See the generated
- readme.txt for how to use it. </para><para>Note: this exporter
- generates a full application, including a build.xml thus you
- will get the best results if you use an output directory which
- is the root of your project.</para><para>Currently this
- generation is the old style of CRUD generation for Seam 1.0. If
- you use Seam 1.1 seam-gen is more apropriate and
- uptodate.</para></entry>
- </row>
</tbody>
</tgroup>
</table>
Deleted: branches/Branch_3_2/HibernateExt/tools/lib/testlibs/jboss-seam.jar
===================================================================
(Binary files differ)
Deleted: branches/Branch_3_2/HibernateExt/tools/lib/testlibs/myfaces-api.jar
===================================================================
(Binary files differ)
Modified: branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/BasicPOJOClass.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/BasicPOJOClass.java 2007-08-03 13:11:28 UTC (rev 12893)
+++ branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/BasicPOJOClass.java 2007-08-03 13:48:06 UTC (rev 12894)
@@ -202,6 +202,7 @@
return generateEquals( thisName, otherName, allPropertiesIterator, useGenerics );
}
+ /** returns the properties that would be visible on this entity as a pojo. This does not return *all* properties since hibernate has certain properties that are only relevant in context of persistence. */
public abstract Iterator getAllPropertiesIterator();
protected String generateEquals(String thisName, String otherName, Iterator allPropertiesIterator, boolean useGenerics) {
Modified: branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java 2007-08-03 13:11:28 UTC (rev 12893)
+++ branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java 2007-08-03 13:48:06 UTC (rev 12894)
@@ -121,6 +121,7 @@
return getAllPropertiesIterator(clazz);
}
+
public Iterator getAllPropertiesIterator(PersistentClass pc) {
List properties = new ArrayList();
List iterators = new ArrayList();
Deleted: branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/seam/SeamExporter.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/seam/SeamExporter.java 2007-08-03 13:11:28 UTC (rev 12893)
+++ branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/seam/SeamExporter.java 2007-08-03 13:48:06 UTC (rev 12894)
@@ -1,92 +0,0 @@
-package org.hibernate.tool.hbm2x.seam;
-
-import java.io.File;
-import java.util.Properties;
-
-import org.hibernate.cfg.Configuration;
-import org.hibernate.tool.hbm2x.AbstractExporter;
-import org.hibernate.tool.hbm2x.GenericExporter;
-import org.hibernate.tool.hbm2x.POJOExporter;
-
-public class SeamExporter extends AbstractExporter {
-
- public SeamExporter() {
- }
-
- public SeamExporter(Configuration cfg, File outputdir) {
- super(cfg, outputdir);
- init();
- }
-
- private void init() {
-
- }
-
- protected void setupContext() {
- if(!getProperties().contains("seam_appname")) {
- getProperties().put("seam_appname", "SeamApplication");
- }
- if(!getProperties().contains("seam_shortname")) {
- getProperties().put("seam_shortname", "seamapp");
- }
-
- super.setupContext();
- }
-
- public String getName() {
- return "hbm2seam";
- }
-
- public void doStart() {
-
- configureExporter( "seam/build.xml.ftl", "build.xml").start();
- configureExporter( "seam/build.properties.ftl", "build.properties").start();
- configureExporter( "seam/components.xml.ftl", "resources/WEB-INF/components.xml").start();
- configureExporter( "seam/readme.txt.ftl", "readme.txt").start();
- new File( getOutputDirectory(), "lib" ).mkdir();
-
- configureExporter( "seam/seam.properties.ftl", "resources/seam.properties").start();
- configureExporter( "seam/messages.properties.ftl", "resources/WEB-INF/classes/messages.properties").start();
-
- configureExporter( "seam/web.xml.ftl", "resources/WEB-INF/web.xml").start();
- configureExporter( "seam/faces-config.xml.ftl", "resources/WEB-INF/faces-config.xml").start();
- new File( getOutputDirectory(), "resources/WEB-INF/lib" ).mkdir();
-
- configureExporter( "seam/persistence.xml.ftl", "resources/META-INF/persistence.xml").start();
-
- configureExporter( "seam/application.xml.ftl", "resources/META-INF/application.xml").start();
- configureExporter( "seam/jboss-app.xml.ftl", "resources/META-INF/jboss-app.xml").start();
-
- configureExporter( "seam/edit.jsp.ftl", "resources/jsp/edit{class-name}.jsp").start();
- configureExporter( "seam/find.jsp.ftl", "resources/jsp/find{class-name}.jsp").start();
- configureExporter( "seam/index.html.ftl", "resources/jsp/index.html").start();
- configureExporter( "seam/screen.css.ftl", "resources/jsp/style/default/screen.css").start();
-
- POJOExporter exporter = new POJOExporter(getConfiguration(),getOutputDirectory());
- exporter.setProperties((Properties) getProperties().clone());
- exporter.setTemplatePath(getTemplatePaths());
- exporter.setArtifactCollector(getArtifactCollector());
- exporter.getProperties().setProperty("ejb3", "true");
- exporter.getProperties().setProperty("jdk5", "true");
- exporter.setFilePattern("src/{package-name}/{class-name}.java");
- exporter.start();
-
- configureExporter( "seam/finder.java.ftl", "src/{package-name}/{class-name}Finder.java").start();
- configureExporter( "seam/finderbean.java.ftl", "src/{package-name}/{class-name}FinderBean.java").start();
- configureExporter( "seam/selector.java.ftl", "src/{package-name}/{class-name}Selector.java").start();
-
- configureExporter( "seam/editor.java.ftl", "src/{package-name}/{class-name}Editor.java").start();
- configureExporter( "seam/editorbean.java.ftl", "src/{package-name}/{class-name}EditorBean.java").start();
-
- }
-
- private GenericExporter configureExporter(String template, String pattern) {
- GenericExporter exporter = new GenericExporter(getConfiguration(),getOutputDirectory());
- exporter.setProperties((Properties) getProperties().clone());
- exporter.setTemplatePath(getTemplatePaths());
- exporter.setTemplateName(template);
- exporter.setFilePattern(pattern);
- exporter.setArtifactCollector(getArtifactCollector());
- return exporter;
- }
-}
Modified: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/BaseTestCase.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/BaseTestCase.java 2007-08-03 13:11:28 UTC (rev 12893)
+++ branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/BaseTestCase.java 2007-08-03 13:48:06 UTC (rev 12894)
@@ -10,6 +10,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.io.SAXReader;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Settings;
import org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect;
@@ -146,5 +149,19 @@
}
}
+ /** parse the url, fails if not valid xml. Does not validate against the DTD because they are remote */
+ public Document assertValidXML(File url) {
+ SAXReader reader = new SAXReader();
+ reader.setValidation(false);
+ Document document = null;
+ try {
+ document = reader.read(url);
+ }
+ catch (DocumentException e) {
+ fail("Could not parse " + url + ":" + e);
+ }
+ assertNotNull(document);
+ return document;
+ }
}
Modified: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ant/AntAllTests.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ant/AntAllTests.java 2007-08-03 13:11:28 UTC (rev 12893)
+++ branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ant/AntAllTests.java 2007-08-03 13:48:06 UTC (rev 12894)
@@ -8,8 +8,7 @@
public static Test suite() {
TestSuite suite = new TestSuite("Test for org.hibernate.tool.ant");
//$JUnit-BEGIN$
- suite.addTestSuite(AntHibernateToolTest.class);
- suite.addTestSuite(SeamAntTest.class);
+ suite.addTestSuite(AntHibernateToolTest.class);
suite.addTestSuite(JavaFormatterTest.class);
//$JUnit-END$
return suite;
Deleted: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ant/SeamAntTest.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ant/SeamAntTest.java 2007-08-03 13:11:28 UTC (rev 12893)
+++ branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ant/SeamAntTest.java 2007-08-03 13:48:06 UTC (rev 12894)
@@ -1,117 +0,0 @@
-/*
- * Created on 13-Feb-2005
- *
- */
-package org.hibernate.tool.ant;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.dom4j.Document;
-import org.dom4j.DocumentException;
-import org.dom4j.io.SAXReader;
-import org.hibernate.tool.test.TestHelper;
-
-/**
- * A temporary test class for controlling the seam template generation
- * via an antfile.
- *
- * @author max
- *
- */
-public class SeamAntTest extends BuildFileTestCase {
-
- public SeamAntTest(String name) {
- super(name);
- }
-
-
- protected void tearDown() throws Exception {
- System.out.println(getLog() );
- super.tearDown();
- }
-
-
- protected void setUp() throws Exception {
- //HibernateUberspect.initMethodNotFoundCount(); // enable some tracing of velocity errors
- configureProject("src/testsupport/seamtest-build.xml");
- }
-
- public void testCrudGeneration() {
- executeTarget("generate-crud");
- File baseDir = new File(project.getProperty("destdir"));
-
- assertFileAndExists(new File(baseDir, "build.xml"));
- assertFileAndExists(new File(baseDir, "resources/seam.properties"));
- assertFileAndExists(new File(baseDir, "resources/WEB-INF/components.xml"));
-
- validXMLFile( new File(baseDir, "resources/WEB-INF/web.xml") );
-
- validXMLFile( new File(baseDir, "resources/WEB-INF/faces-config.xml") );
-
- validXMLFile( new File(baseDir, "resources/META-INF/application.xml") );
-
- validXMLFile( new File(baseDir, "resources/META-INF/jboss-app.xml") );
-
- // cannot check for valid xml since the jsp's has <%@ in the top
- validFile( new File(baseDir, "resources/jsp/editIssue.jsp") );
- validFile( new File(baseDir, "resources/jsp/findIssue.jsp") );
-
- validFile(new File(baseDir, "src/org/jboss/seam/example/crud/Issue.java"));
-
- validFile(new File(baseDir, "src/org/jboss/seam/example/crud/IssueFinder.java"));
- validFile(new File(baseDir, "src/org/jboss/seam/example/crud/IssueFinderBean.java"));
-
- validFile(new File(baseDir, "src/org/jboss/seam/example/crud/IssueEditor.java"));
- validFile(new File(baseDir, "src/org/jboss/seam/example/crud/IssueEditorBean.java"));
-
- File srcDir = new File(baseDir, "src");
- List files = TestHelper.visitAllFiles(srcDir, new ArrayList());
- List jars = new ArrayList();
- jars.add("ejb3-persistence.jar");
- jars.add("jboss-ejb3x.jar");
- jars.add("jboss-annotations-ejb3.jar");
- jars.add("hibernate-annotations.jar");
- jars.add("jboss-seam.jar");
- jars.add("myfaces-api.jar");
-
- TestHelper.compile( srcDir, new File(baseDir, "classes"), files, "1.5", TestHelper.buildClasspath(jars));
- }
-
-
- private void validXMLFile(File xmlfile) {
- validFile( xmlfile );
- assertParse(xmlfile);
- }
-
-
- private void validFile(File xmlfile) {
- assertFileAndExists(xmlfile);
- assertEquals( "$ found in " + xmlfile, null, TestHelper.findFirstString( "$", xmlfile ));
- }
-
-
- public static Test suite() {
- return new TestSuite(SeamAntTest.class);
- }
-
- /** parse the url, fails if not valid xml. Does not validate against the DTD because they are remote */
- public Document assertParse(File url) {
- SAXReader reader = new SAXReader();
- reader.setValidation(false);
- Document document = null;
- try {
- document = reader.read(url);
- }
- catch (DocumentException e) {
- fail("Could not parse " + url + ":" + e);
- }
- assertNotNull(document);
- return document;
- }
-
-}
Deleted: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Hbm2SeamTest.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Hbm2SeamTest.java 2007-08-03 13:11:28 UTC (rev 12893)
+++ branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Hbm2SeamTest.java 2007-08-03 13:48:06 UTC (rev 12894)
@@ -1,65 +0,0 @@
-/*
- * Created on 2004-12-01
- *
- */
-package org.hibernate.tool.hbm2x;
-
-import java.io.File;
-
-import org.hibernate.tool.NonReflectiveTestCase;
-import org.hibernate.tool.hbm2x.seam.SeamExporter;
-
-/**
- * @author max
- *
- */
-public class Hbm2SeamTest extends NonReflectiveTestCase {
-
- private ArtifactCollector artifactCollector;
-
- public Hbm2SeamTest(String name) {
- super( name, "hbm2seamoutput" );
- }
-
- protected void setUp() throws Exception {
- super.setUp();
-
- SeamExporter exporter = new SeamExporter(getCfg(), getOutputDir() );
- exporter.start();
-
- artifactCollector = exporter.getArtifactCollector();
-
- }
-
-
- public void testFileExistence() {
- assertFileAndExists(new File(getOutputDir(), "src/org/hibernate/tool/hbm2x/Article.java") );
- assertFileAndExists(new File(getOutputDir(), "src/org/hibernate/tool/hbm2x/Author.java") );
- assertFileAndExists(new File(getOutputDir(), "resources/jsp/editAuthor.jsp") );
- assertFileAndExists(new File(getOutputDir(), "build.xml") );
- }
-
- public void testArtifactCollection() {
- assertEquals(12,artifactCollector.getFileCount("java"));
- assertEquals(1,artifactCollector.getFileCount("html"));
- assertEquals(4,artifactCollector.getFileCount("jsp"));
- assertEquals(7,artifactCollector.getFileCount("xml"));
- assertEquals(3,artifactCollector.getFileCount("properties"));
- assertEquals(1,artifactCollector.getFileCount("txt"));
- assertEquals(1,artifactCollector.getFileCount("css"));
-
- assertEquals(7,artifactCollector.getFileTypes().size());
- }
-
- protected String getBaseForMappings() {
- return "org/hibernate/tool/hbm2x/";
- }
-
- protected String[] getMappings() {
- return new String[] {
- "Article.hbm.xml",
- "Author.hbm.xml"
- };
- }
-
-}
Modified: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Hbm2XAllTests.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Hbm2XAllTests.java 2007-08-03 13:11:28 UTC (rev 12893)
+++ branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Hbm2XAllTests.java 2007-08-03 13:48:06 UTC (rev 12894)
@@ -23,8 +23,7 @@
suite.addTestSuite( Hbm2CfgTest.class );
suite.addTestSuite( GenericExporterTest.class );
suite.addTestSuite( Hbm2HibernateDAOTest.class );
- suite.addTestSuite( DocExporterTest.class );
- suite.addTestSuite( Hbm2SeamTest.class );
+ suite.addTestSuite( DocExporterTest.class );
suite.addTestSuite( PropertiesTest.class );
//$JUnit-END$
return suite;
Added: branches/Branch_3_2/HibernateExt/tools/src/testoutputdependent/properties/PropertiesUsage.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/testoutputdependent/properties/PropertiesUsage.java (rev 0)
+++ branches/Branch_3_2/HibernateExt/tools/src/testoutputdependent/properties/PropertiesUsage.java 2007-08-03 13:48:06 UTC (rev 12894)
@@ -0,0 +1,10 @@
+package properties;
+
+public class PropertiesUsage {
+
+ public void personName(){
+ PPerson person = new PPerson();
+ person.setName( "name" );
+ person.setContact(true);
+ }
+}
More information about the hibernate-commits
mailing list