You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by st...@apache.org on 2021/06/16 11:01:47 UTC

[openjpa] branch master updated (1742f62 -> c6f4282)

This is an automated email from the ASF dual-hosted git repository.

struberg pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/openjpa.git.


    from 1742f62  fix indention and add missing javadocs
     new f8d2585  OPENJPA-2876 unit test to show wrong SQL
     new c6f4282  OPENJPA-2876 fix schema 'refresh'

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 openjpa-examples/image-gallery/pom.xml             |  5 ++
 openjpa-examples/openbooks/pom.xml                 |  5 ++
 .../openjpa/jdbc/kernel/JDBCBrokerFactory.java     | 22 +++----
 .../org/apache/openjpa/jdbc/meta/MappingTool.java  | 11 +---
 .../org/apache/openjpa/jdbc/schema/SchemaTool.java | 16 ++---
 .../tools/maven/test/ModifyDatabaseTest.java       | 70 ----------------------
 .../pom.xml.disabled => sqlActionRefresh/pom.xml}  | 64 +++++++++++++-------
 .../openjpa/tools/maven/testentity/TestEntity.java |  7 +++
 .../src/main/resources/META-INF/persistence.xml    | 12 ++--
 .../it/sqlActionRefresh/src/main/sql/database.sql  |  2 +
 .../tools/maven/test/ItRefreshSchemaTest.java}     |  8 ++-
 pom.xml                                            |  5 +-
 12 files changed, 91 insertions(+), 136 deletions(-)
 delete mode 100644 openjpa-tools/openjpa-maven-plugin/src/it/modifyDatabase/src/test/java/org/apache/openjpa/tools/maven/test/ModifyDatabaseTest.java
 rename openjpa-tools/openjpa-maven-plugin/src/it/{modifyDatabase/pom.xml.disabled => sqlActionRefresh/pom.xml} (64%)
 rename openjpa-tools/openjpa-maven-plugin/src/it/{modifyDatabase => sqlActionRefresh}/src/main/java/org/apache/openjpa/tools/maven/testentity/TestEntity.java (88%)
 rename openjpa-tools/openjpa-maven-plugin/src/it/{modifyDatabase => sqlActionRefresh}/src/main/resources/META-INF/persistence.xml (83%)
 create mode 100644 openjpa-tools/openjpa-maven-plugin/src/it/sqlActionRefresh/src/main/sql/database.sql
 copy openjpa-tools/openjpa-maven-plugin/src/it/{sqlActionDropSchema/src/test/java/org/apache/openjpa/tools/maven/test/ItDropSchemaTest.java => sqlActionRefresh/src/test/java/org/apache/openjpa/tools/maven/test/ItRefreshSchemaTest.java} (85%)

[openjpa] 01/02: OPENJPA-2876 unit test to show wrong SQL

Posted by st...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

struberg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openjpa.git

commit f8d258594f55cdf06db16f2321a6ae6c6342616e
Author: Mark Struberg <st...@apache.org>
AuthorDate: Wed Jun 16 12:25:45 2021 +0200

    OPENJPA-2876 unit test to show wrong SQL
    
    sqlAction=refresh right now also generates the full DB.
---
 .../tools/maven/test/ModifyDatabaseTest.java       | 70 ----------------------
 .../pom.xml.disabled => sqlActionRefresh/pom.xml}  | 64 +++++++++++++-------
 .../openjpa/tools/maven/testentity/TestEntity.java |  7 +++
 .../src/main/resources/META-INF/persistence.xml    | 12 ++--
 .../it/sqlActionRefresh/src/main/sql/database.sql  |  2 +
 .../tools/maven/test/ItRefreshSchemaTest.java      | 54 +++++++++++++++++
 pom.xml                                            |  5 +-
 7 files changed, 114 insertions(+), 100 deletions(-)

diff --git a/openjpa-tools/openjpa-maven-plugin/src/it/modifyDatabase/src/test/java/org/apache/openjpa/tools/maven/test/ModifyDatabaseTest.java b/openjpa-tools/openjpa-maven-plugin/src/it/modifyDatabase/src/test/java/org/apache/openjpa/tools/maven/test/ModifyDatabaseTest.java
deleted file mode 100644
index 4e8b408..0000000
--- a/openjpa-tools/openjpa-maven-plugin/src/it/modifyDatabase/src/test/java/org/apache/openjpa/tools/maven/test/ModifyDatabaseTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.apache.openjpa.tools.maven.test;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.Arrays;
-
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
-
-import org.apache.openjpa.enhance.PersistenceCapable;
-import org.apache.openjpa.tools.maven.testentity.TestEntity;
-
-import junit.framework.TestCase;
-
-public class ModifyDatabaseTest extends TestCase {
-
-
-    /**
-     * check if the generated classes have been enhanced.
-     * @throws Exception
-     */
-    public void testDatabaseWrite() throws Exception
-    {
-        EntityManagerFactory emf = Persistence.createEntityManagerFactory( "TestUnit" );
-        assertNotNull( emf );
-
-        EntityManager em = emf.createEntityManager();
-        assertNotNull( em );
-
-        try
-        {
-            em.getTransaction().begin();
-
-            TestEntity entity = new TestEntity();
-            entity.setInt1( 4711 );
-            entity.setString1( "myVal" );
-
-            em.persist( entity );
-            em.getTransaction().commit();
-        }
-        finally
-        {
-            em.close();
-        }
-    }
-
-}
diff --git a/openjpa-tools/openjpa-maven-plugin/src/it/modifyDatabase/pom.xml.disabled b/openjpa-tools/openjpa-maven-plugin/src/it/sqlActionRefresh/pom.xml
similarity index 64%
rename from openjpa-tools/openjpa-maven-plugin/src/it/modifyDatabase/pom.xml.disabled
rename to openjpa-tools/openjpa-maven-plugin/src/it/sqlActionRefresh/pom.xml
index 26fe129..2ec2d61 100644
--- a/openjpa-tools/openjpa-maven-plugin/src/it/modifyDatabase/pom.xml.disabled
+++ b/openjpa-tools/openjpa-maven-plugin/src/it/sqlActionRefresh/pom.xml
@@ -24,14 +24,17 @@
 
     <modelVersion>4.0.0</modelVersion>
 
+
     <groupId>org.apache.openjpa.tools.openjpa-maven-plugin.testing</groupId>
     <artifactId>modifyDatabase</artifactId>
     <version>1.0-SNAPSHOT</version>
+
     <dependencies>
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
-            <version>3.8.2</version>
+            <version>4.13.2</version>
+            <scope>test</scope>
         </dependency>
 
         <dependency>
@@ -41,16 +44,23 @@
         </dependency>
 
         <dependency>
-            <groupId>mysql</groupId>
-            <artifactId>mysql-connector-java</artifactId>
-            <version>5.1.11</version>
+            <groupId>org.hsqldb</groupId>
+            <artifactId>hsqldb</artifactId>
+            <version>@hsqldb.version@</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-dbcp2</artifactId>
+            <version>@dbcp2.version@</version>
         </dependency>
     </dependencies>
 
     <build>
         <plugins>
             <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.5.1</version>
                 <configuration>
                     <source>1.8</source>
                     <target>1.8</target>
@@ -60,10 +70,10 @@
             <plugin>
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>sql-maven-plugin</artifactId>
-                <version>1.4</version>
+                <version>1.5</version>
                 <executions>
                     <execution>
-                        <id>dropdatabase</id>
+                        <id>initialdb</id>
                         <phase>process-resources</phase>
                         <goals>
                             <goal>execute</goal>
@@ -71,17 +81,20 @@
                     </execution>
                 </executions>
                 <configuration>
-                    <driver>com.mysql.jdbc.Driver</driver>
-                    <url>jdbc:mysql://localhost/testdb</url>
-                    <username>root</username>
-                    <enableAnonymousPassword>true</enableAnonymousPassword>
-                    <sqlCommand>DROP TABLE TestEntity;</sqlCommand>
+                    <driver>org.hsqldb.jdbcDriver</driver>
+                    <url>jdbc:hsqldb:file:target/openjpa-hsqldb;hsqldb.lock_file=false</url>
+                    <username>SA</username>
+                    <password></password>
+                    <srcFiles>
+                        <srcFile>src/main/sql/database.sql</srcFile>
+                    </srcFiles>
+                    <escapeProcessing>false</escapeProcessing>
                 </configuration>
                 <dependencies>
                     <dependency>
-                        <groupId>mysql</groupId>
-                        <artifactId>mysql-connector-java</artifactId>
-                        <version>5.1.11</version>
+                        <groupId>org.hsqldb</groupId>
+                        <artifactId>hsqldb</artifactId>
+                        <version>@hsqldb.version@</version>
                     </dependency>
                 </dependencies>
             </plugin>
@@ -96,14 +109,16 @@
                         org/apache/openjpa/tools/maven/testentity/TestEntity.class
                     </include>
                     <sqlAction>refresh</sqlAction>
-                    <modifyDatabase>true</modifyDatabase>
+                    <connectionDriverName>org.apache.commons.dbcp2.BasicDataSource</connectionDriverName>
                     <connectionProperties>
-                        driverClass=com.mysql.jdbc.Driver,
-                        jdbcUrl=jdbc:mysql://localhost/testdb,
-                        user=root,
+                        driverClassName=org.hsqldb.jdbcDriver,
+                        url=jdbc:hsqldb:file:target/openjpa-hsqldb;hsqldb.lock_file=false,
+                        username=SA,
                         password=
                     </connectionProperties>
-
+                    <toolProperties>
+                        <DBDictionary>org.apache.openjpa.jdbc.sql.HSQLDictionary</DBDictionary>
+                    </toolProperties>
                 </configuration>
                 <executions>
                     <execution>
@@ -117,9 +132,14 @@
                 </executions>
                 <dependencies>
                     <dependency>
-                        <groupId>mysql</groupId>
-                        <artifactId>mysql-connector-java</artifactId>
-                        <version>5.1.11</version>
+                        <groupId>org.hsqldb</groupId>
+                        <artifactId>hsqldb</artifactId>
+                        <version>@hsqldb.version@</version>
+                    </dependency>
+                    <dependency>
+                        <groupId>org.apache.commons</groupId>
+                        <artifactId>commons-dbcp2</artifactId>
+                        <version>@dbcp2.version@</version>
                     </dependency>
                 </dependencies>
             </plugin>
diff --git a/openjpa-tools/openjpa-maven-plugin/src/it/modifyDatabase/src/main/java/org/apache/openjpa/tools/maven/testentity/TestEntity.java b/openjpa-tools/openjpa-maven-plugin/src/it/sqlActionRefresh/src/main/java/org/apache/openjpa/tools/maven/testentity/TestEntity.java
similarity index 88%
rename from openjpa-tools/openjpa-maven-plugin/src/it/modifyDatabase/src/main/java/org/apache/openjpa/tools/maven/testentity/TestEntity.java
rename to openjpa-tools/openjpa-maven-plugin/src/it/sqlActionRefresh/src/main/java/org/apache/openjpa/tools/maven/testentity/TestEntity.java
index f008ad9..285324b 100644
--- a/openjpa-tools/openjpa-maven-plugin/src/it/modifyDatabase/src/main/java/org/apache/openjpa/tools/maven/testentity/TestEntity.java
+++ b/openjpa-tools/openjpa-maven-plugin/src/it/sqlActionRefresh/src/main/java/org/apache/openjpa/tools/maven/testentity/TestEntity.java
@@ -19,18 +19,25 @@ package org.apache.openjpa.tools.maven.testentity;
  * under the License.
  */
 
+import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Id;
+import javax.persistence.Table;
 
 
 @Entity
+@Table(name="TEST_ENTITY")
 public class TestEntity {
 
   @Id
   private int xint1;
 
+  @Column(name="SOME_VALUE")
   private String string1;
 
+  @Column(name="VAL2", length=100)
+  private String val2;
+
   public int getInt1() {
     return xint1;
   }
diff --git a/openjpa-tools/openjpa-maven-plugin/src/it/modifyDatabase/src/main/resources/META-INF/persistence.xml b/openjpa-tools/openjpa-maven-plugin/src/it/sqlActionRefresh/src/main/resources/META-INF/persistence.xml
similarity index 83%
rename from openjpa-tools/openjpa-maven-plugin/src/it/modifyDatabase/src/main/resources/META-INF/persistence.xml
rename to openjpa-tools/openjpa-maven-plugin/src/it/sqlActionRefresh/src/main/resources/META-INF/persistence.xml
index e4bfd7e..6bdeabb 100644
--- a/openjpa-tools/openjpa-maven-plugin/src/it/modifyDatabase/src/main/resources/META-INF/persistence.xml
+++ b/openjpa-tools/openjpa-maven-plugin/src/it/sqlActionRefresh/src/main/resources/META-INF/persistence.xml
@@ -19,15 +19,15 @@
 
     <!-- simply all annotated persistent entities will be part of this unit-->
     <persistence-unit name="TestUnit">
-
+        <class>org.apache.openjpa.tools.maven.testentity.TestEntity</class>
+<!-- TODO REMOVE
         <properties>
-            <property name="openjpa.jdbc.DBDictionary" value="mysql" />
-            <property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver" />
-            <property name="openjpa.ConnectionURL" value="jdbc:mysql://localhost/testdb" />
-            <property name="openjpa.ConnectionUserName" value="root" />
+            <property name="openjpa.ConnectionDriverName" value="org.hsqldb.jdbcDriver" />
+            <property name="openjpa.ConnectionURL" value="jdbc:hsqldb:file:openjpa-hsqldb" />
+            <property name="openjpa.ConnectionUserName" value="SA" />
             <property name="openjpa.ConnectionPassword" value="" />
-
         </properties>
+-->
 
     </persistence-unit>
 
diff --git a/openjpa-tools/openjpa-maven-plugin/src/it/sqlActionRefresh/src/main/sql/database.sql b/openjpa-tools/openjpa-maven-plugin/src/it/sqlActionRefresh/src/main/sql/database.sql
new file mode 100644
index 0000000..3aa8daa
--- /dev/null
+++ b/openjpa-tools/openjpa-maven-plugin/src/it/sqlActionRefresh/src/main/sql/database.sql
@@ -0,0 +1,2 @@
+CREATE TABLE TEST_ENTITY -- TestEntity
+(xint1 INTEGER NOT NULL, SOME_VALUE VARCHAR(255), PRIMARY KEY (xint1));
diff --git a/openjpa-tools/openjpa-maven-plugin/src/it/sqlActionRefresh/src/test/java/org/apache/openjpa/tools/maven/test/ItRefreshSchemaTest.java b/openjpa-tools/openjpa-maven-plugin/src/it/sqlActionRefresh/src/test/java/org/apache/openjpa/tools/maven/test/ItRefreshSchemaTest.java
new file mode 100644
index 0000000..d89037b
--- /dev/null
+++ b/openjpa-tools/openjpa-maven-plugin/src/it/sqlActionRefresh/src/test/java/org/apache/openjpa/tools/maven/test/ItRefreshSchemaTest.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openjpa.tools.maven.test;
+
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class ItRefreshSchemaTest {
+
+    /** contains the directory where all generated results are placed */
+    private final static String TARGET_DIR = "target";
+
+    /** the file containing the generated SQL syntax */
+    private final static String SQL_FILE = "database.sql";
+
+    /** if the SQL generation has been successful, the following result should be in the SQL file */
+    private final static String VALID_SQL = "ALTER TABLE TEST_ENTITY ADD COLUMN VAL2 VARCHAR(100);";
+
+    /**
+     * check if the generated SQL script is correct.
+     * @throws Exception
+     */
+    @Test
+    public void testSqlGeneration() throws Exception
+    {
+        File sqlFile = new File( TARGET_DIR, SQL_FILE );
+        BufferedReader in = new BufferedReader( new FileReader( sqlFile ) );
+        String sqlIn = in.readLine();
+        assertEquals( VALID_SQL, sqlIn );
+        sqlIn = in.readLine();
+        assertTrue(sqlIn == null || sqlIn.trim().length() == 0);
+    }
+
+}
diff --git a/pom.xml b/pom.xml
index 3591c5e..90f61ba 100644
--- a/pom.xml
+++ b/pom.xml
@@ -86,7 +86,7 @@
         <mssql.connector.version>9.2.1.jre8</mssql.connector.version>
 
         <!-- other common versions -->
-        <kubernetes-client.version>4.7.0</kubernetes-client.version>
+        <kubernetes-client.version>5.4.1</kubernetes-client.version>
         <slf4j.version>1.7.23</slf4j.version>
         <!-- Compile Java source/target class level -->
         <compile.class.source>${java.class.version}</compile.class.source>
@@ -105,6 +105,7 @@
 
         <jmock.version>2.9.0</jmock.version>
         <automatic-module-name>-SUBMODULES-NEED-TO-OVERRIDE-THIS-</automatic-module-name>
+        <dbcp2.version>2.8.0</dbcp2.version>
     </properties>
 
     <licenses>
@@ -1786,7 +1787,7 @@
             <dependency>
                 <groupId>org.apache.commons</groupId>
                 <artifactId>commons-dbcp2</artifactId>
-                <version>2.8.0</version>
+                <version>${dbcp2.version}</version>
             </dependency>
             <dependency>
                 <groupId>javax.xml.bind</groupId>

[openjpa] 02/02: OPENJPA-2876 fix schema 'refresh'

Posted by st...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

struberg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openjpa.git

commit c6f42826b72940aa771a394d42173b2f7fec0428
Author: Mark Struberg <st...@apache.org>
AuthorDate: Tue Jun 15 16:33:31 2021 +0200

    OPENJPA-2876 fix schema 'refresh'
    
    Also had to fix the schema handling via persistence.xml.
    Thinkfully this section has excellent unit test coverage.
---
 openjpa-examples/image-gallery/pom.xml             |  5 +++++
 openjpa-examples/openbooks/pom.xml                 |  5 +++++
 .../openjpa/jdbc/kernel/JDBCBrokerFactory.java     | 22 +++++++++-------------
 .../org/apache/openjpa/jdbc/meta/MappingTool.java  | 11 +++--------
 .../org/apache/openjpa/jdbc/schema/SchemaTool.java | 16 ++++------------
 5 files changed, 26 insertions(+), 33 deletions(-)

diff --git a/openjpa-examples/image-gallery/pom.xml b/openjpa-examples/image-gallery/pom.xml
index 2c2107a..4b3f159 100644
--- a/openjpa-examples/image-gallery/pom.xml
+++ b/openjpa-examples/image-gallery/pom.xml
@@ -60,6 +60,11 @@
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-simple</artifactId>
     </dependency>
+    <dependency>
+      <groupId>com.sun.xml.bind</groupId>
+      <artifactId>jaxb-impl</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
diff --git a/openjpa-examples/openbooks/pom.xml b/openjpa-examples/openbooks/pom.xml
index 01a8836..d4ef913 100644
--- a/openjpa-examples/openbooks/pom.xml
+++ b/openjpa-examples/openbooks/pom.xml
@@ -75,6 +75,11 @@
             <artifactId>mysql-connector-java</artifactId>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>com.sun.xml.bind</groupId>
+            <artifactId>jaxb-impl</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCBrokerFactory.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCBrokerFactory.java
index ecf0f8c..fe9baad 100644
--- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCBrokerFactory.java
+++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCBrokerFactory.java
@@ -25,11 +25,6 @@ import static org.apache.openjpa.conf.SchemaGenerationSource.METADATA;
 import static org.apache.openjpa.conf.SchemaGenerationSource.METADATA_THEN_SCRIPT;
 import static org.apache.openjpa.conf.SchemaGenerationSource.SCRIPT;
 import static org.apache.openjpa.conf.SchemaGenerationSource.SCRIPT_THEN_METADATA;
-import static org.apache.openjpa.jdbc.meta.MappingTool.ACTION_ADD;
-import static org.apache.openjpa.jdbc.meta.MappingTool.ACTION_DROP;
-import static org.apache.openjpa.jdbc.meta.MappingTool.ACTION_SCRIPT_CREATE;
-import static org.apache.openjpa.jdbc.meta.MappingTool.ACTION_SCRIPT_DROP;
-import static org.apache.openjpa.jdbc.meta.MappingTool.ACTION_SCRIPT_LOAD;
 
 import java.util.Arrays;
 import java.util.Collection;
@@ -40,6 +35,7 @@ import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
 import org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl;
 import org.apache.openjpa.jdbc.meta.MappingRepository;
 import org.apache.openjpa.jdbc.meta.MappingTool;
+import org.apache.openjpa.jdbc.schema.SchemaTool;
 import org.apache.openjpa.kernel.AbstractBrokerFactory;
 import org.apache.openjpa.kernel.Bootstrap;
 import org.apache.openjpa.kernel.BrokerImpl;
@@ -197,7 +193,7 @@ public class JDBCBrokerFactory extends AbstractBrokerFactory {
 
         String loadFile = conf.getLoadScriptSource();
         if (loadFile != null) {
-            actions += "," + ACTION_SCRIPT_LOAD;
+            actions += "," + MappingTool.ACTION_SCRIPT_LOAD;
         }
 
         if (actions.length() > 0) {
@@ -207,7 +203,7 @@ public class JDBCBrokerFactory extends AbstractBrokerFactory {
 
     private String generateSchemaCreation(JDBCConfiguration conf) {
         if (conf.getCreateScriptTarget() != null) {
-            return MappingTool.ACTION_ADD;
+            return SchemaTool.ACTION_BUILD;
         } else {
             int createSource = conf.getCreateSourceConstant();
             if (createSource == SchemaGenerationSource.NONE && conf.getCreateScriptSource() != null) {
@@ -215,13 +211,13 @@ public class JDBCBrokerFactory extends AbstractBrokerFactory {
             } else {
                 createSource = METADATA;
             }
-            return mapGenerationStrategyActions(createSource, ACTION_ADD, ACTION_SCRIPT_CREATE);
+            return mapGenerationStrategyActions(createSource, SchemaTool.ACTION_ADD, MappingTool.ACTION_SCRIPT_CREATE);
         }
     }
 
     private String generateSchemaDrop(JDBCConfiguration conf) {
         if (conf.getDropScriptTarget() != null) {
-            return MappingTool.ACTION_DROP;
+            return SchemaTool.ACTION_DROP;
         } else {
             int dropSource = conf.getDropSourceConstant();
             if (dropSource == SchemaGenerationSource.NONE && conf.getDropScriptSource() != null) {
@@ -229,16 +225,16 @@ public class JDBCBrokerFactory extends AbstractBrokerFactory {
             } else {
                 dropSource = METADATA;
             }
-            return mapGenerationStrategyActions(dropSource, ACTION_DROP, ACTION_SCRIPT_DROP);
+            return mapGenerationStrategyActions(dropSource, SchemaTool.ACTION_DROP, MappingTool.ACTION_SCRIPT_DROP);
         }
     }
 
     private String generateSchemaDropCreate(JDBCConfiguration conf) {
         if (conf.getCreateScriptTarget() != null && conf.getDropScriptTarget() != null) {
-            return MappingTool.ACTION_ADD + "," + MappingTool.ACTION_DROP;
+            return SchemaTool.ACTION_BUILD + "," + SchemaTool.ACTION_DROP;
         } else {
-            return mapGenerationStrategyActions(conf.getDropSourceConstant(), ACTION_DROP, ACTION_SCRIPT_DROP) + "," +
-                   mapGenerationStrategyActions(conf.getCreateSourceConstant(), ACTION_ADD, ACTION_SCRIPT_CREATE);
+            return mapGenerationStrategyActions(conf.getDropSourceConstant(), SchemaTool.ACTION_DROP, MappingTool.ACTION_SCRIPT_DROP) + "," +
+                   mapGenerationStrategyActions(conf.getCreateSourceConstant(), SchemaTool.ACTION_ADD, MappingTool.ACTION_SCRIPT_CREATE);
         }
     }
 
diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingTool.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingTool.java
index 246cc89..4d7561b 100644
--- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingTool.java
+++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingTool.java
@@ -534,14 +534,14 @@ public class MappingTool
                             tool = newSchemaTool(schemaAction);
                         }
 
-                        if (schemaAction.equals(ACTION_ADD) && _conf.getCreateScriptTarget() != null) {
+                        if (schemaAction.equals(SchemaTool.ACTION_BUILD) && _conf.getCreateScriptTarget() != null) {
                             tool.setWriter(new PrintWriter(_conf.getCreateScriptTarget()));
                             tool.setIndexes(true);
                             tool.setForeignKeys(true);
                             tool.setSequences(true);
                         }
 
-                        if (schemaAction.equals(ACTION_DROP) && _conf.getDropScriptTarget() != null) {
+                        if (schemaAction.equals(SchemaTool.ACTION_DROP) && _conf.getDropScriptTarget() != null) {
                             tool.setWriter(new PrintWriter(_conf.getDropScriptTarget()));
                         }
 
@@ -1134,12 +1134,7 @@ public class MappingTool
             return false;
         }
 
-        MappingTool tool;
-        try {
-            tool = new MappingTool(conf, flags.action, flags.meta, loader);
-        } catch (IllegalArgumentException iae) {
-            return false;
-        }
+        MappingTool tool = new MappingTool(conf, flags.action, flags.meta, loader);
 
         // setup the tool
         tool.setIgnoreErrors(flags.ignoreErrors);
diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaTool.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaTool.java
index 6abe8cd..d42c5ea 100644
--- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaTool.java
+++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaTool.java
@@ -575,9 +575,7 @@ public class SchemaTool {
                 seqs = value.getSequences();
                 for (Sequence seq : seqs) {
                     if (considerDatabaseState && db.findSequence(value, seq.getQualifiedPath()) != null) {
-                        if (_writer == null) {
-                            continue;
-                        }
+                        continue;
                     }
 
                     if (createSequence(seq)) {
@@ -656,9 +654,7 @@ public class SchemaTool {
             tabs = schema1.getTables();
             for (Table tab : tabs) {
                 if (considerDatabaseState && db.findTable(schema1, tab.getQualifiedPath()) != null) {
-                    if (_writer == null) {
-                        continue;
-                    }
+                    continue;
                 }
 
                 if (createTable(tab)) {
@@ -712,9 +708,7 @@ public class SchemaTool {
             for (Table tab : tabs) {
                 // create unique constraints only on new tables
                 if (!newTables.contains(tab)) {
-                    if (_writer == null) {
-                        continue;
-                    }
+                    continue;
                 }
 
                 uniques = tab.getUniques();
@@ -740,9 +734,7 @@ public class SchemaTool {
                 // create foreign keys on new tables even if fks
                 // have been turned off
                 if (!_fks && !newTables.contains(tab)) {
-                    if (_writer == null) {
-                        continue;
-                    }
+                    continue;
                 }
 
                 fks = tab.getForeignKeys();