db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r991068 - in /db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates: TestProcessing.java jdbc2schema/Jdbc2SchemaTest.java
Date Tue, 31 Aug 2010 03:34:17 GMT
Author: tfischer
Date: Tue Aug 31 03:34:17 2010
New Revision: 991068

URL: http://svn.apache.org/viewvc?rev=991068&view=rev
Log:
- add createdb templates to test run
- delete generation directories before test

Modified:
    db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java
    db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/jdbc2schema/Jdbc2SchemaTest.java

Modified: db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java?rev=991068&r1=991067&r2=991068&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java
Tue Aug 31 03:34:17 2010
@@ -27,6 +27,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.torque.generator.configuration.UnitDescriptor;
 import org.apache.torque.generator.configuration.option.MapOptionsConfiguration;
 import org.apache.torque.generator.configuration.paths.CustomProjectPaths;
@@ -36,10 +37,38 @@ import org.apache.torque.generator.contr
 import org.apache.torque.generator.file.Fileset;
 import org.apache.torque.generator.source.SourceProvider;
 import org.apache.torque.generator.source.stream.FileSourceProvider;
+import org.junit.Before;
 import org.junit.Test;
 
 public class TestProcessing
 {
+    @Before
+    public void setUp() throws Exception
+    {
+        String testRoot = "target";
+        {
+            File generatedDocDir = new File(testRoot, "generated-docs");
+            FileUtils.deleteDirectory(generatedDocDir);
+        }
+        {
+            File generatedSourcesDir = new File(testRoot, "generated-sources");
+            FileUtils.deleteDirectory(generatedSourcesDir);
+        }
+        {
+            File generatedSources2Dir
+                = new File(testRoot, "generated-sources-2");
+            FileUtils.deleteDirectory(generatedSources2Dir);
+        }
+        {
+            File generatedSqlDir = new File(testRoot, "generated-sql");
+            FileUtils.deleteDirectory(generatedSqlDir);
+        }
+        {
+            File generatedXdocsDir = new File(testRoot, "generated-xdocs");
+            FileUtils.deleteDirectory(generatedXdocsDir);
+        }
+    }
+    
     @Test
     public void testProcessSchemaXml() throws Exception
     {
@@ -77,7 +106,7 @@ public class TestProcessing
                 new MapOptionsConfiguration(overrideOptions),
                 null));
 
-        // sql templates
+        // sql ddl templates
         projectPaths
                 = new CustomProjectPaths(
                     new Maven2DirectoryProjectPaths(new File(".")));
@@ -98,6 +127,27 @@ public class TestProcessing
                 new MapOptionsConfiguration(overrideOptions),
                 null));
 
+        // sql createdb templates
+        projectPaths
+                = new CustomProjectPaths(
+                    new Maven2DirectoryProjectPaths(new File(".")));
+        projectPaths.setConfigurationDir(
+                new File("src/main/resources/org/apache/torque/templates/sql/createdb"));
+        projectPaths.setSourceDir(
+                new File("src/test/schema"));
+        projectPaths.setNewFileTargetDir(
+                new File("target/generated-sql"));
+        projectPaths.setModifiedFileTargetDir(
+                new File("target/generated-sql-2"));
+        unitDescriptors.add(new UnitDescriptor(
+                UnitDescriptor.Packaging.DIRECTORY,
+                projectPaths,
+                new DefaultTorqueGeneratorPaths(),
+                null,
+                null,
+                new MapOptionsConfiguration(overrideOptions),
+                null));
+
         // idbroker-init-sql templates
         projectPaths
                 = new CustomProjectPaths(

Modified: db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/jdbc2schema/Jdbc2SchemaTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/jdbc2schema/Jdbc2SchemaTest.java?rev=991068&r1=991067&r2=991068&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/jdbc2schema/Jdbc2SchemaTest.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/jdbc2schema/Jdbc2SchemaTest.java
Tue Aug 31 03:34:17 2010
@@ -37,6 +37,7 @@ import java.util.StringTokenizer;
 
 import junitx.framework.FileAssert;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.log4j.BasicConfigurator;
 import org.apache.log4j.Logger;
 import org.apache.torque.generator.configuration.UnitDescriptor;
@@ -103,6 +104,12 @@ public class Jdbc2SchemaTest
           statement.close();
         }
         connection.close();
+
+        String testRoot = "target";
+        {
+            File generatedSchemaDir = new File(testRoot, "generated-schema");
+            FileUtils.deleteDirectory(generatedSchemaDir);
+        }
     }
 
     @Test



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message