ibatis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgbut...@apache.org
Subject svn commit: r941462 [1/5] - in /ibatis/java/ibator/trunk/core: ibator-systests-common/src/main/java/ibatortest/util/ ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/ ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/cond...
Date Wed, 05 May 2010 20:13:19 GMT
Author: jgbutler
Date: Wed May  5 20:13:17 2010
New Revision: 941462

URL: http://svn.apache.org/viewvc?rev=941462&view=rev
Log:
[ibator] test refactoring

Added:
    ibatis/java/ibator/trunk/core/ibator-systests-common/src/main/java/ibatortest/util/
    ibatis/java/ibator/trunk/core/ibator-systests-common/src/main/java/ibatortest/util/SqlScriptRunner.java
    ibatis/java/ibator/trunk/core/ibator-systests-common/src/main/java/ibatortest/util/TestUtilities.java
Modified:
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/AbstractTest.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/CountByExampleTest.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/DeleteByExampleTest.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/DeleteByPrimaryKeyTest.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/InsertTest.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/SelectByExampleTest.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/SelectByPrimaryKeyTest.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/UpdateByExampleTest.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/UpdateByPrimaryKeyTest.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/flat/java2/FlatJava2Test.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/flat/java2/UpdateByExampleTest.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/hierarchical/java2/HierarchicalJava2Test.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/hierarchical/java2/UpdateByExampleTest.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/miscellaneous/MiscellaneousTest.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/AbstractTest.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/execute/conditional/java2/AbstractConditionalJava2Test.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/execute/conditional/java2/ConditionalJava2Test.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/execute/conditional/java2/UpdateByExampleTest.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/execute/conditional/java5/AbstractConditionalJava5Test.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/execute/conditional/java5/ConditionalJava5Test.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/execute/conditional/java5/UpdateByExampleTest.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/execute/flat/java2/AbstractFlatJava2Test.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/execute/flat/java2/FlatJava2Test.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/execute/flat/java2/UpdateByExampleTest.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/execute/flat/java5/AbstractFlatJava5Test.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/execute/flat/java5/FlatJava5Test.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/execute/flat/java5/UpdateByExampleTest.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/execute/hierarchical/java2/AbstractHierarchicalJava2Test.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/execute/hierarchical/java2/HierarchicalJava2Test.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/execute/hierarchical/java2/UpdateByExampleTest.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/execute/hierarchical/java5/AbstractHierarchicalJava5Test.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/execute/hierarchical/java5/HierarchicalJava5Test.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/execute/hierarchical/java5/UpdateByExampleTest.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/execute/miscellaneous/AbstractMiscellaneousTest.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/execute/miscellaneous/MiscellaneousTest.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis3/src/test/java/ibatortest/AbstractTest.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis3/src/test/java/ibatortest/execute/conditional/java5/ConditionalJava5Test.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis3/src/test/java/ibatortest/execute/conditional/java5/UpdateByExampleTest.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis3/src/test/java/ibatortest/execute/flat/java5/FlatJava5Test.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis3/src/test/java/ibatortest/execute/flat/java5/UpdateByExampleTest.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis3/src/test/java/ibatortest/execute/hierarchical/java5/HierarchicalJava5Test.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis3/src/test/java/ibatortest/execute/hierarchical/java5/UpdateByExampleTest.java
    ibatis/java/ibator/trunk/core/ibator-systests-ibatis3/src/test/java/ibatortest/execute/miscellaneous/MiscellaneousTest.java

Added: ibatis/java/ibator/trunk/core/ibator-systests-common/src/main/java/ibatortest/util/SqlScriptRunner.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-common/src/main/java/ibatortest/util/SqlScriptRunner.java?rev=941462&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-common/src/main/java/ibatortest/util/SqlScriptRunner.java (added)
+++ ibatis/java/ibator/trunk/core/ibator-systests-common/src/main/java/ibatortest/util/SqlScriptRunner.java Wed May  5 20:13:17 2010
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2009 The Apache Software Foundation.
+ *
+ * Licensed 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 ibatortest.util;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+/**
+ * This class is used to execute an SQL script before a code generation
+ * run if necessary.  Note that this class mainly exists to support the Ibator
+ * build.  It is intentionally not documented and not supported.
+ * 
+ * @author Jeff Butler
+ */
+public class SqlScriptRunner {
+    private String driver;
+    private String url;
+    private String userid;
+    private String password;
+    private File sourceFile;
+
+    public SqlScriptRunner(File sourceFile, String driver, String url,
+            String userId, String password) throws Exception {
+        
+        if (!sourceFile.exists()) {
+            throw new Exception("SQL script file does not exist");
+        }
+        
+        if (driver == null || driver.length() == 0) {
+            throw new Exception("JDBC Driver is required");
+        }
+        
+        if (url == null || url.length() == 0) {
+            throw new Exception("JDBC URL is required");
+        }
+        
+        this.sourceFile = sourceFile;
+        this.driver = driver;
+        this.url = url;
+        this.userid = userId;
+        this.password = password;
+    }
+
+    public void executeScript() throws Exception {
+
+        Connection connection = null;
+
+        try {
+            Class.forName(driver);
+            connection = DriverManager.getConnection(url, userid, password);
+
+            Statement statement = connection.createStatement();
+
+            BufferedReader br = new BufferedReader(new FileReader(sourceFile));
+
+            String sql;
+
+            while ((sql = readStatement(br)) != null) {
+                statement.execute(sql);
+            }
+
+            closeStatement(statement);
+            connection.commit();
+            br.close();
+        } finally {
+            closeConnection(connection);
+        }
+    }
+
+    public String getDriver() {
+        return driver;
+    }
+
+    public void setDriver(String driver) {
+        this.driver = driver;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    private void closeConnection(Connection connection) {
+        if (connection != null) {
+            try {
+                connection.close();
+            } catch (SQLException e) {
+                // ignore
+                ;
+            }
+        }
+    }
+
+    private void closeStatement(Statement statement) {
+        if (statement != null) {
+            try {
+                statement.close();
+            } catch (SQLException e) {
+                // ignore
+                ;
+            }
+        }
+    }
+
+    private String readStatement(BufferedReader br) throws IOException {
+        StringBuffer sb = new StringBuffer();
+
+        String line;
+
+        while ((line = br.readLine()) != null) {
+            if (line.startsWith("--")) { //$NON-NLS-1$
+                continue;
+            }
+
+            if (line == null || line.length() == 0) {
+                continue;
+            }
+
+            if (line.endsWith(";")) { //$NON-NLS-1$
+                sb.append(line.substring(0, line.length() - 1));
+                break;
+            } else {
+                sb.append(' ');
+                sb.append(line);
+            }
+        }
+
+        String s = sb.toString().trim();
+
+        return s.length() > 0 ? s : null;
+    }
+}

Added: ibatis/java/ibator/trunk/core/ibator-systests-common/src/main/java/ibatortest/util/TestUtilities.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-common/src/main/java/ibatortest/util/TestUtilities.java?rev=941462&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-common/src/main/java/ibatortest/util/TestUtilities.java (added)
+++ ibatis/java/ibator/trunk/core/ibator-systests-common/src/main/java/ibatortest/util/TestUtilities.java Wed May  5 20:13:17 2010
@@ -0,0 +1,84 @@
+package ibatortest.util;
+
+import java.io.File;
+import java.net.URL;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Random;
+
+public class TestUtilities {
+    
+    private static DateFormat dateOnlyFormat = SimpleDateFormat.getDateInstance();
+    private static DateFormat timeOnlyFormat = SimpleDateFormat.getTimeInstance();
+    
+    public static byte[] generateRandomBlob() {
+        Random random = new Random(System.currentTimeMillis());
+
+        byte[] answer = new byte[256];
+
+        random.nextBytes(answer);
+
+        return answer;
+    }
+
+    public static boolean blobsAreEqual(byte[] blob1, byte[] blob2) {
+        if (blob1 == null) {
+            return blob2 == null;
+        }
+
+        if (blob2 == null) {
+            return blob1 == null;
+        }
+
+        boolean rc = blob1.length == blob2.length;
+
+        if (rc) {
+            for (int i = 0; i < blob1.length; i++) {
+                if (blob1[i] != blob2[i]) {
+                    rc = false;
+                    break;
+                }
+            }
+        }
+
+        return rc;
+    }
+    
+    public static boolean datesAreEqual(Date date1, Date date2) {
+        if (date1 == null) {
+            return date2 == null;
+        }
+
+        if (date2 == null) {
+            return date1 == null;
+        }
+
+        return dateOnlyFormat.format(date1).equals(dateOnlyFormat.format(date2));
+
+    }
+    
+    public static boolean timesAreEqual(Date date1, Date date2) {
+        if (date1 == null) {
+            return date2 == null;
+        }
+
+        if (date2 == null) {
+            return date1 == null;
+        }
+
+        return timeOnlyFormat.format(date1).equals(timeOnlyFormat.format(date2));
+
+    }
+
+    public static void createDatabase(URL sqlScript) throws Exception {
+        SqlScriptRunner runner = new SqlScriptRunner(
+                new File(sqlScript.toURI()),
+                "org.hsqldb.jdbcDriver",
+                "jdbc:hsqldb:mem:aname",
+                "sa",
+                "");
+            
+        runner.executeScript();
+    }
+}

Modified: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/AbstractTest.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/AbstractTest.java?rev=941462&r1=941461&r2=941462&view=diff
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/AbstractTest.java (original)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/AbstractTest.java Wed May  5 20:13:17 2010
@@ -16,22 +16,18 @@
 
 package ibatortest.java2;
 
+import ibatortest.util.TestUtilities;
+
 import java.io.Reader;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
+import java.net.URL;
 import java.util.Properties;
-import java.util.Random;
 
-import com.ibatis.common.jdbc.ScriptRunner;
+import junit.framework.TestCase;
+
 import com.ibatis.common.resources.Resources;
 import com.ibatis.sqlmap.client.SqlMapClient;
 import com.ibatis.sqlmap.client.SqlMapClientBuilder;
 
-import junit.framework.TestCase;
-
 /**
  * @author Jeff Butler
  *
@@ -39,8 +35,6 @@ import junit.framework.TestCase;
 public abstract class AbstractTest extends TestCase {
 
     private SqlMapClient sqlMapClient;
-    private static DateFormat dateOnlyFormat = SimpleDateFormat.getDateInstance();
-    private static DateFormat timeOnlyFormat = SimpleDateFormat.getTimeInstance();
 
     protected void initSqlMapClient(String configFile, Properties props) throws Exception {
         Reader reader = Resources.getResourceAsReader(configFile);
@@ -49,85 +43,9 @@ public abstract class AbstractTest exten
     }
 
     protected void setUp() throws Exception {
-        Connection conn = null;
-
-        try {
-            Class.forName("org.hsqldb.jdbcDriver");
-            conn = DriverManager.getConnection("jdbc:hsqldb:mem:aname", "sa", "");
-
-            Reader reader = Resources.getResourceAsReader("CreateDB.sql");
-
-            ScriptRunner runner = new ScriptRunner(conn, true, false);
-            runner.setLogWriter(null);
-            runner.setErrorLogWriter(null);
-            runner.runScript(reader);
-            conn.commit();
-
-            reader.close();
-        } finally {
-            if (conn != null) {
-                conn.close();
-            }
-        }
-    }
-
-    protected byte[] generateRandomBlob() {
-        Random random = new Random(System.currentTimeMillis());
-
-        byte[] answer = new byte[256];
-
-        random.nextBytes(answer);
-
-        return answer;
-    }
-
-    protected boolean blobsAreEqual(byte[] blob1, byte[] blob2) {
-        if (blob1 == null) {
-            return blob2 == null;
-        }
-
-        if (blob2 == null) {
-            return blob1 == null;
-        }
-
-        boolean rc = blob1.length == blob2.length;
-
-        if (rc) {
-            for (int i = 0; i < blob1.length; i++) {
-                if (blob1[i] != blob2[i]) {
-                    rc = false;
-                    break;
-                }
-            }
-        }
-
-        return rc;
-    }
-
-    protected boolean datesAreEqual(Date date1, Date date2) {
-        if (date1 == null) {
-            return date2 == null;
-        }
-
-        if (date2 == null) {
-            return date1 == null;
-        }
-
-        return dateOnlyFormat.format(date1).equals(dateOnlyFormat.format(date2));
-
-    }
-
-    protected boolean timesAreEqual(Date date1, Date date2) {
-        if (date1 == null) {
-            return date2 == null;
-        }
-
-        if (date2 == null) {
-            return date1 == null;
-        }
-
-        return timeOnlyFormat.format(date1).equals(timeOnlyFormat.format(date2));
+        URL url = AbstractTest.class.getClassLoader().getResource("CreateDB.sql");
 
+        TestUtilities.createDatabase(url);
     }
 
     protected SqlMapClient getSqlMapClient() {

Modified: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/CountByExampleTest.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/CountByExampleTest.java?rev=941462&r1=941461&r2=941462&view=diff
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/CountByExampleTest.java (original)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/CountByExampleTest.java Wed May  5 20:13:17 2010
@@ -21,6 +21,7 @@ import ibatortest.java2.generated.condit
 import ibatortest.java2.generated.conditional.java2.model.PkfieldsblobsExample;
 import ibatortest.java2.generated.conditional.java2.model.PkonlyExample;
 import ibatortest.java2.generated.conditional.java2.model.PkonlyKey;
+import ibatortest.util.TestUtilities;
 
 public class CountByExampleTest extends AbstractConditionalJava2Test {
 
@@ -101,7 +102,7 @@ public class CountByExampleTest extends 
             record.setId2(new Integer(4));
             record.setFirstname("Jeff");
             record.setLastname("Smith");
-            record.setBlob1(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new Pkfieldsblobs();
@@ -109,7 +110,7 @@ public class CountByExampleTest extends 
             record.setId2(new Integer(6));
             record.setFirstname("Scott");
             record.setLastname("Jones");
-            record.setBlob1(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             PkfieldsblobsExample example = new PkfieldsblobsExample();
@@ -163,14 +164,14 @@ public class CountByExampleTest extends 
         try {
             Pkblobs record = new Pkblobs();
             record.setId(new Integer(3));
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new Pkblobs();
             record.setId(new Integer(6));
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             PkblobsExample example = new PkblobsExample();
@@ -193,15 +194,15 @@ public class CountByExampleTest extends 
             FieldsblobsWithBLOBs record = new FieldsblobsWithBLOBs();
             record.setFirstname("Jeff");
             record.setLastname("Smith");
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new FieldsblobsWithBLOBs();
             record.setFirstname("Scott");
             record.setLastname("Jones");
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             FieldsblobsExample example = new FieldsblobsExample();

Modified: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/DeleteByExampleTest.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/DeleteByExampleTest.java?rev=941462&r1=941461&r2=941462&view=diff
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/DeleteByExampleTest.java (original)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/DeleteByExampleTest.java Wed May  5 20:13:17 2010
@@ -21,6 +21,7 @@ import ibatortest.java2.generated.condit
 import ibatortest.java2.generated.conditional.java2.model.PkfieldsblobsExample;
 import ibatortest.java2.generated.conditional.java2.model.PkonlyExample;
 import ibatortest.java2.generated.conditional.java2.model.PkonlyKey;
+import ibatortest.util.TestUtilities;
 
 import java.util.List;
 
@@ -136,14 +137,14 @@ public class DeleteByExampleTest extends
         try {
             Pkblobs record = new Pkblobs();
             record.setId(new Integer(3));
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new Pkblobs();
             record.setId(new Integer(6));
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             PkblobsExample example = new PkblobsExample();
@@ -172,7 +173,7 @@ public class DeleteByExampleTest extends
             record.setId2(new Integer(4));
             record.setFirstname("Jeff");
             record.setLastname("Smith");
-            record.setBlob1(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new Pkfieldsblobs();
@@ -180,7 +181,7 @@ public class DeleteByExampleTest extends
             record.setId2(new Integer(6));
             record.setFirstname("Scott");
             record.setLastname("Jones");
-            record.setBlob1(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             PkfieldsblobsExample example = new PkfieldsblobsExample();
@@ -207,15 +208,15 @@ public class DeleteByExampleTest extends
             FieldsblobsWithBLOBs record = new FieldsblobsWithBLOBs();
             record.setFirstname("Jeff");
             record.setLastname("Smith");
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new FieldsblobsWithBLOBs();
             record.setFirstname("Scott");
             record.setLastname("Jones");
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             FieldsblobsExample example = new FieldsblobsExample();

Modified: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/DeleteByPrimaryKeyTest.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/DeleteByPrimaryKeyTest.java?rev=941462&r1=941461&r2=941462&view=diff
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/DeleteByPrimaryKeyTest.java (original)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/DeleteByPrimaryKeyTest.java Wed May  5 20:13:17 2010
@@ -17,6 +17,7 @@ import ibatortest.java2.generated.condit
 import ibatortest.java2.generated.conditional.java2.model.PkfieldsblobsKey;
 import ibatortest.java2.generated.conditional.java2.model.PkonlyExample;
 import ibatortest.java2.generated.conditional.java2.model.PkonlyKey;
+import ibatortest.util.TestUtilities;
 
 import java.util.List;
 
@@ -86,8 +87,8 @@ public class DeleteByPrimaryKeyTest exte
         try {
             Pkblobs record = new Pkblobs();
             record.setId(new Integer(3));
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             PkblobsExample example = new PkblobsExample();
@@ -114,7 +115,7 @@ public class DeleteByPrimaryKeyTest exte
             record.setId2(new Integer(4));
             record.setFirstname("Jeff");
             record.setLastname("Smith");
-            record.setBlob1(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new Pkfieldsblobs();
@@ -122,7 +123,7 @@ public class DeleteByPrimaryKeyTest exte
             record.setId2(new Integer(6));
             record.setFirstname("Scott");
             record.setLastname("Jones");
-            record.setBlob1(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             PkfieldsblobsExample example = new PkfieldsblobsExample();

Modified: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/InsertTest.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/InsertTest.java?rev=941462&r1=941461&r2=941462&view=diff
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/InsertTest.java (original)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/InsertTest.java Wed May  5 20:13:17 2010
@@ -20,6 +20,7 @@ import ibatortest.java2.generated.condit
 import ibatortest.java2.generated.conditional.java2.model.PkfieldsblobsExample;
 import ibatortest.java2.generated.conditional.java2.model.PkonlyExample;
 import ibatortest.java2.generated.conditional.java2.model.PkonlyKey;
+import ibatortest.util.TestUtilities;
 
 import java.math.BigDecimal;
 import java.util.Date;
@@ -101,7 +102,7 @@ public class InsertTest extends Abstract
             Pkfields returnedRecord = dao.selectByPrimaryKey(key);
             assertNotNull(returnedRecord);
     
-            assertTrue(datesAreEqual(record.getDatefield(), returnedRecord
+            assertTrue(TestUtilities.datesAreEqual(record.getDatefield(), returnedRecord
                     .getDatefield()));
             assertEquals(record.getDecimal100field(), returnedRecord
                     .getDecimal100field());
@@ -115,7 +116,7 @@ public class InsertTest extends Abstract
             assertEquals(record.getId1(), returnedRecord.getId1());
             assertEquals(record.getId2(), returnedRecord.getId2());
             assertEquals(record.getLastname(), returnedRecord.getLastname());
-            assertTrue(timesAreEqual(record.getTimefield(), returnedRecord
+            assertTrue(TestUtilities.timesAreEqual(record.getTimefield(), returnedRecord
                     .getTimefield()));
             assertEquals(record.getTimestampfield(), returnedRecord
                     .getTimestampfield());
@@ -130,8 +131,8 @@ public class InsertTest extends Abstract
         try {
             Pkblobs record = new Pkblobs();
             record.setId(new Integer(3));
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             PkblobsExample example = new PkblobsExample();
@@ -140,9 +141,9 @@ public class InsertTest extends Abstract
     
             Pkblobs returnedRecord = (Pkblobs) answer.get(0);
             assertEquals(record.getId(), returnedRecord.getId());
-            assertTrue(blobsAreEqual(record.getBlob1(), returnedRecord
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob1(), returnedRecord
                     .getBlob1()));
-            assertTrue(blobsAreEqual(record.getBlob2(), returnedRecord
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob2(), returnedRecord
                     .getBlob2()));
         } catch (Exception e) {
             fail(e.getMessage());
@@ -158,7 +159,7 @@ public class InsertTest extends Abstract
             record.setId2(new Integer(4));
             record.setFirstname("Jeff");
             record.setLastname("Smith");
-            record.setBlob1(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             PkfieldsblobsExample example = new PkfieldsblobsExample();
@@ -170,7 +171,7 @@ public class InsertTest extends Abstract
             assertEquals(record.getId2(), returnedRecord.getId2());
             assertEquals(record.getFirstname(), returnedRecord.getFirstname());
             assertEquals(record.getLastname(), returnedRecord.getLastname());
-            assertTrue(blobsAreEqual(record.getBlob1(), returnedRecord
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob1(), returnedRecord
                     .getBlob1()));
         } catch (Exception e) {
             fail(e.getMessage());
@@ -184,8 +185,8 @@ public class InsertTest extends Abstract
             FieldsblobsWithBLOBs record = new FieldsblobsWithBLOBs();
             record.setFirstname("Jeff");
             record.setLastname("Smith");
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             FieldsblobsExample example = new FieldsblobsExample();
@@ -196,9 +197,9 @@ public class InsertTest extends Abstract
                     .get(0);
             assertEquals(record.getFirstname(), returnedRecord.getFirstname());
             assertEquals(record.getLastname(), returnedRecord.getLastname());
-            assertTrue(blobsAreEqual(record.getBlob1(), returnedRecord
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob1(), returnedRecord
                     .getBlob1()));
-            assertTrue(blobsAreEqual(record.getBlob2(), returnedRecord
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob2(), returnedRecord
                     .getBlob2()));
         } catch (Exception e) {
             fail(e.getMessage());

Modified: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/SelectByExampleTest.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/SelectByExampleTest.java?rev=941462&r1=941461&r2=941462&view=diff
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/SelectByExampleTest.java (original)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/SelectByExampleTest.java Wed May  5 20:13:17 2010
@@ -22,6 +22,7 @@ import ibatortest.java2.generated.condit
 import ibatortest.java2.generated.conditional.java2.model.PkfieldsblobsExample;
 import ibatortest.java2.generated.conditional.java2.model.PkonlyExample;
 import ibatortest.java2.generated.conditional.java2.model.PkonlyKey;
+import ibatortest.util.TestUtilities;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -609,14 +610,14 @@ public class SelectByExampleTest extends
         try {
             Pkblobs record = new Pkblobs();
             record.setId(new Integer(3));
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new Pkblobs();
             record.setId(new Integer(6));
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             PkblobsExample example = new PkblobsExample();
@@ -640,14 +641,14 @@ public class SelectByExampleTest extends
         try {
             Pkblobs record = new Pkblobs();
             record.setId(new Integer(3));
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new Pkblobs();
             record.setId(new Integer(6));
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             PkblobsExample example = new PkblobsExample();
@@ -666,14 +667,14 @@ public class SelectByExampleTest extends
         try {
             Pkblobs record = new Pkblobs();
             record.setId(new Integer(3));
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new Pkblobs();
             record.setId(new Integer(6));
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             PkblobsExample example = new PkblobsExample();
@@ -684,8 +685,8 @@ public class SelectByExampleTest extends
     
             Pkblobs newRecord = (Pkblobs) answer.get(0);
             assertEquals(record.getId(), newRecord.getId());
-            assertTrue(blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
-            assertTrue(blobsAreEqual(record.getBlob2(), newRecord.getBlob2()));
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob2(), newRecord.getBlob2()));
         } catch (Exception e) {
             fail(e.getMessage());
         }
@@ -700,7 +701,7 @@ public class SelectByExampleTest extends
             record.setId2(new Integer(4));
             record.setFirstname("Jeff");
             record.setLastname("Smith");
-            record.setBlob1(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new Pkfieldsblobs();
@@ -708,7 +709,7 @@ public class SelectByExampleTest extends
             record.setId2(new Integer(6));
             record.setFirstname("Scott");
             record.setLastname("Jones");
-            record.setBlob1(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             PkfieldsblobsExample example = new PkfieldsblobsExample();
@@ -736,7 +737,7 @@ public class SelectByExampleTest extends
             record.setId2(new Integer(4));
             record.setFirstname("Jeff");
             record.setLastname("Smith");
-            record.setBlob1(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new Pkfieldsblobs();
@@ -744,7 +745,7 @@ public class SelectByExampleTest extends
             record.setId2(new Integer(6));
             record.setFirstname("Scott");
             record.setLastname("Jones");
-            record.setBlob1(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             PkfieldsblobsExample example = new PkfieldsblobsExample();
@@ -757,7 +758,7 @@ public class SelectByExampleTest extends
             assertEquals(record.getId2(), newRecord.getId2());
             assertEquals(record.getFirstname(), newRecord.getFirstname());
             assertEquals(record.getLastname(), newRecord.getLastname());
-            assertTrue(blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
         } catch (Exception e) {
             fail(e.getMessage());
         }
@@ -772,7 +773,7 @@ public class SelectByExampleTest extends
             record.setId2(new Integer(4));
             record.setFirstname("Jeff");
             record.setLastname("Smith");
-            record.setBlob1(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new Pkfieldsblobs();
@@ -780,7 +781,7 @@ public class SelectByExampleTest extends
             record.setId2(new Integer(6));
             record.setFirstname("Scott");
             record.setLastname("Jones");
-            record.setBlob1(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             PkfieldsblobsExample example = new PkfieldsblobsExample();
@@ -799,15 +800,15 @@ public class SelectByExampleTest extends
             FieldsblobsWithBLOBs record = new FieldsblobsWithBLOBs();
             record.setFirstname("Jeff");
             record.setLastname("Smith");
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new FieldsblobsWithBLOBs();
             record.setFirstname("Scott");
             record.setLastname("Jones");
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             FieldsblobsExample example = new FieldsblobsExample();
@@ -831,15 +832,15 @@ public class SelectByExampleTest extends
             FieldsblobsWithBLOBs record = new FieldsblobsWithBLOBs();
             record.setFirstname("Jeff");
             record.setLastname("Smith");
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new FieldsblobsWithBLOBs();
             record.setFirstname("Scott");
             record.setLastname("Jones");
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             FieldsblobsExample example = new FieldsblobsExample();
@@ -851,8 +852,8 @@ public class SelectByExampleTest extends
                     .get(0);
             assertEquals(record.getFirstname(), newRecord.getFirstname());
             assertEquals(record.getLastname(), newRecord.getLastname());
-            assertTrue(blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
-            assertTrue(blobsAreEqual(record.getBlob2(), newRecord.getBlob2()));
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob2(), newRecord.getBlob2()));
         } catch (Exception e) {
             fail(e.getMessage());
         }
@@ -865,15 +866,15 @@ public class SelectByExampleTest extends
             FieldsblobsWithBLOBs record = new FieldsblobsWithBLOBs();
             record.setFirstname("Jeff");
             record.setLastname("Smith");
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new FieldsblobsWithBLOBs();
             record.setFirstname("Scott");
             record.setLastname("Jones");
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             FieldsblobsExample example = new FieldsblobsExample();

Modified: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/SelectByPrimaryKeyTest.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/SelectByPrimaryKeyTest.java?rev=941462&r1=941461&r2=941462&view=diff
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/SelectByPrimaryKeyTest.java (original)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/SelectByPrimaryKeyTest.java Wed May  5 20:13:17 2010
@@ -11,6 +11,7 @@ import ibatortest.java2.generated.condit
 import ibatortest.java2.generated.conditional.java2.model.Pkfieldsblobs;
 import ibatortest.java2.generated.conditional.java2.model.PkfieldsblobsExample;
 import ibatortest.java2.generated.conditional.java2.model.PkfieldsblobsKey;
+import ibatortest.util.TestUtilities;
 
 import java.util.List;
 
@@ -55,21 +56,21 @@ public class SelectByPrimaryKeyTest exte
         try {
             Pkblobs record = new Pkblobs();
             record.setId(new Integer(3));
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new Pkblobs();
             record.setId(new Integer(6));
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             Pkblobs newRecord = dao.selectByPrimaryKey(new Integer(6));
             assertNotNull(newRecord);
             assertEquals(record.getId(), newRecord.getId());
-            assertTrue(blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
-            assertTrue(blobsAreEqual(record.getBlob2(), newRecord.getBlob2()));
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob2(), newRecord.getBlob2()));
         } catch (Exception e) {
             fail(e.getMessage());
         }
@@ -84,7 +85,7 @@ public class SelectByPrimaryKeyTest exte
             record.setId2(new Integer(4));
             record.setFirstname("Jeff");
             record.setLastname("Smith");
-            record.setBlob1(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new Pkfieldsblobs();
@@ -92,7 +93,7 @@ public class SelectByPrimaryKeyTest exte
             record.setId2(new Integer(6));
             record.setFirstname("Scott");
             record.setLastname("Jones");
-            record.setBlob1(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             PkfieldsblobsExample example = new PkfieldsblobsExample();
@@ -107,7 +108,7 @@ public class SelectByPrimaryKeyTest exte
             assertEquals(record.getId2(), newRecord.getId2());
             assertEquals(record.getFirstname(), newRecord.getFirstname());
             assertEquals(record.getLastname(), newRecord.getLastname());
-            assertTrue(blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
         } catch (Exception e) {
             fail(e.getMessage());
         }

Modified: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/UpdateByExampleTest.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/UpdateByExampleTest.java?rev=941462&r1=941461&r2=941462&view=diff
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/UpdateByExampleTest.java (original)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/UpdateByExampleTest.java Wed May  5 20:13:17 2010
@@ -38,6 +38,7 @@ import ibatortest.java2.generated.condit
 import ibatortest.java2.generated.conditional.java2.model.PkfieldsblobsExample;
 import ibatortest.java2.generated.conditional.java2.model.PkonlyExample;
 import ibatortest.java2.generated.conditional.java2.model.PkonlyKey;
+import ibatortest.util.TestUtilities;
 
 import java.util.List;
 
@@ -329,18 +330,18 @@ public class UpdateByExampleTest extends
         try {
             Pkblobs record = new Pkblobs();
             record.setId(new Integer(3));
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new Pkblobs();
             record.setId(new Integer(6));
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             Pkblobs newRecord = new Pkblobs();
-            newRecord.setBlob1(generateRandomBlob());
+            newRecord.setBlob1(TestUtilities.generateRandomBlob());
             
             PkblobsExample example = new PkblobsExample();
             example.createCriteria().andIdGreaterThan(new Integer(4));
@@ -353,8 +354,8 @@ public class UpdateByExampleTest extends
             Pkblobs returnedRecord = (Pkblobs) answer.get(0);
             
             assertEquals(new Integer(6), returnedRecord.getId());
-            assertTrue(blobsAreEqual(newRecord.getBlob1(), returnedRecord.getBlob1()));
-            assertTrue(blobsAreEqual(record.getBlob2(), returnedRecord.getBlob2()));
+            assertTrue(TestUtilities.blobsAreEqual(newRecord.getBlob1(), returnedRecord.getBlob1()));
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob2(), returnedRecord.getBlob2()));
         } catch (Exception e) {
             fail(e.getMessage());
         }
@@ -366,14 +367,14 @@ public class UpdateByExampleTest extends
         try {
             Pkblobs record = new Pkblobs();
             record.setId(new Integer(3));
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new Pkblobs();
             record.setId(new Integer(6));
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             Pkblobs newRecord = new Pkblobs();
@@ -390,8 +391,8 @@ public class UpdateByExampleTest extends
             Pkblobs returnedRecord = (Pkblobs) answer.get(0);
             
             assertEquals(new Integer(8), returnedRecord.getId());
-            assertTrue(blobsAreEqual(record.getBlob1(), returnedRecord.getBlob1()));
-            assertTrue(blobsAreEqual(record.getBlob2(), returnedRecord.getBlob2()));
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob1(), returnedRecord.getBlob1()));
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob2(), returnedRecord.getBlob2()));
         } catch (Exception e) {
             fail(e.getMessage());
         }
@@ -403,14 +404,14 @@ public class UpdateByExampleTest extends
         try {
             Pkblobs record = new Pkblobs();
             record.setId(new Integer(3));
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new Pkblobs();
             record.setId(new Integer(6));
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             Pkblobs newRecord = new Pkblobs();
@@ -443,7 +444,7 @@ public class UpdateByExampleTest extends
             record.setId2(new Integer(4));
             record.setFirstname("Jeff");
             record.setLastname("Smith");
-            record.setBlob1(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new Pkfieldsblobs();
@@ -451,7 +452,7 @@ public class UpdateByExampleTest extends
             record.setId2(new Integer(6));
             record.setFirstname("Scott");
             record.setLastname("Jones");
-            record.setBlob1(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
             dao.insert(record);
 
             Pkfieldsblobs newRecord = new Pkfieldsblobs();
@@ -470,7 +471,7 @@ public class UpdateByExampleTest extends
             assertEquals(record.getId2(), returnedRecord.getId2());
             assertEquals(newRecord.getFirstname(), returnedRecord.getFirstname());
             assertEquals(record.getLastname(), returnedRecord.getLastname());
-            assertTrue(blobsAreEqual(record.getBlob1(), returnedRecord.getBlob1()));
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob1(), returnedRecord.getBlob1()));
             
         } catch (Exception e) {
             fail(e.getMessage());
@@ -486,7 +487,7 @@ public class UpdateByExampleTest extends
             record.setId2(new Integer(4));
             record.setFirstname("Jeff");
             record.setLastname("Smith");
-            record.setBlob1(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new Pkfieldsblobs();
@@ -494,7 +495,7 @@ public class UpdateByExampleTest extends
             record.setId2(new Integer(6));
             record.setFirstname("Scott");
             record.setLastname("Jones");
-            record.setBlob1(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
             dao.insert(record);
 
             Pkfieldsblobs newRecord = new Pkfieldsblobs();
@@ -515,7 +516,7 @@ public class UpdateByExampleTest extends
             assertEquals(newRecord.getId2(), returnedRecord.getId2());
             assertEquals(newRecord.getFirstname(), returnedRecord.getFirstname());
             assertNull(returnedRecord.getLastname());
-            assertTrue(blobsAreEqual(record.getBlob1(), returnedRecord.getBlob1()));
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob1(), returnedRecord.getBlob1()));
             
         } catch (Exception e) {
             fail(e.getMessage());
@@ -531,7 +532,7 @@ public class UpdateByExampleTest extends
             record.setId2(new Integer(4));
             record.setFirstname("Jeff");
             record.setLastname("Smith");
-            record.setBlob1(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new Pkfieldsblobs();
@@ -539,7 +540,7 @@ public class UpdateByExampleTest extends
             record.setId2(new Integer(6));
             record.setFirstname("Scott");
             record.setLastname("Jones");
-            record.setBlob1(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
             dao.insert(record);
 
             Pkfieldsblobs newRecord = new Pkfieldsblobs();
@@ -574,15 +575,15 @@ public class UpdateByExampleTest extends
             FieldsblobsWithBLOBs record = new FieldsblobsWithBLOBs();
             record.setFirstname("Jeff");
             record.setLastname("Smith");
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new FieldsblobsWithBLOBs();
             record.setFirstname("Scott");
             record.setLastname("Jones");
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
 
             FieldsblobsWithBLOBs newRecord = new FieldsblobsWithBLOBs();
@@ -599,8 +600,8 @@ public class UpdateByExampleTest extends
             
             assertEquals(record.getFirstname(), returnedRecord.getFirstname());
             assertEquals(newRecord.getLastname(), returnedRecord.getLastname());
-            assertTrue(blobsAreEqual(record.getBlob1(), returnedRecord.getBlob1()));
-            assertTrue(blobsAreEqual(record.getBlob2(), returnedRecord.getBlob2()));
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob1(), returnedRecord.getBlob1()));
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob2(), returnedRecord.getBlob2()));
         } catch (Exception e) {
             fail(e.getMessage());
         }
@@ -613,15 +614,15 @@ public class UpdateByExampleTest extends
             FieldsblobsWithBLOBs record = new FieldsblobsWithBLOBs();
             record.setFirstname("Jeff");
             record.setLastname("Smith");
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new FieldsblobsWithBLOBs();
             record.setFirstname("Scott");
             record.setLastname("Jones");
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
 
             Fieldsblobs newRecord = new Fieldsblobs();
@@ -639,8 +640,8 @@ public class UpdateByExampleTest extends
             
             assertEquals(newRecord.getFirstname(), returnedRecord.getFirstname());
             assertEquals(newRecord.getLastname(), returnedRecord.getLastname());
-            assertTrue(blobsAreEqual(record.getBlob1(), returnedRecord.getBlob1()));
-            assertTrue(blobsAreEqual(record.getBlob2(), returnedRecord.getBlob2()));
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob1(), returnedRecord.getBlob1()));
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob2(), returnedRecord.getBlob2()));
         } catch (Exception e) {
             fail(e.getMessage());
         }
@@ -653,15 +654,15 @@ public class UpdateByExampleTest extends
             FieldsblobsWithBLOBs record = new FieldsblobsWithBLOBs();
             record.setFirstname("Jeff");
             record.setLastname("Smith");
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new FieldsblobsWithBLOBs();
             record.setFirstname("Scott");
             record.setLastname("Jones");
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
 
             FieldsblobsWithBLOBs newRecord = new FieldsblobsWithBLOBs();

Modified: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/UpdateByPrimaryKeyTest.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/UpdateByPrimaryKeyTest.java?rev=941462&r1=941461&r2=941462&view=diff
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/UpdateByPrimaryKeyTest.java (original)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/UpdateByPrimaryKeyTest.java Wed May  5 20:13:17 2010
@@ -10,6 +10,7 @@ import ibatortest.java2.generated.condit
 import ibatortest.java2.generated.conditional.java2.model.PkfieldsKey;
 import ibatortest.java2.generated.conditional.java2.model.Pkfieldsblobs;
 import ibatortest.java2.generated.conditional.java2.model.PkfieldsblobsKey;
+import ibatortest.util.TestUtilities;
 
 public class UpdateByPrimaryKeyTest extends AbstractConditionalJava2Test {
 
@@ -74,7 +75,7 @@ public class UpdateByPrimaryKeyTest exte
     
             Pkfields returnedRecord = dao.selectByPrimaryKey(key);
     
-            assertTrue(datesAreEqual(record.getDatefield(), returnedRecord
+            assertTrue(TestUtilities.datesAreEqual(record.getDatefield(), returnedRecord
                     .getDatefield()));
             assertEquals(record.getDecimal100field(), returnedRecord
                     .getDecimal100field());
@@ -89,7 +90,7 @@ public class UpdateByPrimaryKeyTest exte
             assertEquals(record.getId1(), returnedRecord.getId1());
             assertEquals(record.getId2(), returnedRecord.getId2());
             assertEquals(record.getLastname(), returnedRecord.getLastname());
-            assertTrue(timesAreEqual(record.getTimefield(), returnedRecord
+            assertTrue(TestUtilities.timesAreEqual(record.getTimefield(), returnedRecord
                     .getTimefield()));
             assertEquals(record.getTimestampfield(), returnedRecord
                     .getTimestampfield());
@@ -104,22 +105,22 @@ public class UpdateByPrimaryKeyTest exte
         try {
             Pkblobs record = new Pkblobs();
             record.setId(new Integer(3));
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             record = new Pkblobs();
             record.setId(new Integer(3));
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.updateByPrimaryKey(record);
     
             Pkblobs newRecord = dao.selectByPrimaryKey(new Integer(3));
     
             assertNotNull(newRecord);
             assertEquals(record.getId(), newRecord.getId());
-            assertTrue(blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
-            assertTrue(blobsAreEqual(record.getBlob2(), newRecord.getBlob2()));
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob2(), newRecord.getBlob2()));
         } catch (Exception e) {
             fail(e.getMessage());
         }
@@ -131,21 +132,21 @@ public class UpdateByPrimaryKeyTest exte
         try {
             Pkblobs record = new Pkblobs();
             record.setId(new Integer(3));
-            record.setBlob1(generateRandomBlob());
-            record.setBlob2(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
+            record.setBlob2(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             Pkblobs newRecord = new Pkblobs();
             newRecord.setId(new Integer(3));
-            newRecord.setBlob2(generateRandomBlob());
+            newRecord.setBlob2(TestUtilities.generateRandomBlob());
             dao.updateByPrimaryKeySelective(newRecord);
     
             Pkblobs returnedRecord = dao.selectByPrimaryKey(new Integer(3));
             assertNotNull(returnedRecord);
             assertEquals(record.getId(), returnedRecord.getId());
-            assertTrue(blobsAreEqual(record.getBlob1(), returnedRecord
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob1(), returnedRecord
                     .getBlob1()));
-            assertTrue(blobsAreEqual(newRecord.getBlob2(), returnedRecord
+            assertTrue(TestUtilities.blobsAreEqual(newRecord.getBlob2(), returnedRecord
                     .getBlob2()));
         } catch (Exception e) {
             fail(e.getMessage());
@@ -161,7 +162,7 @@ public class UpdateByPrimaryKeyTest exte
             record.setId2(new Integer(4));
             record.setFirstname("Jeff");
             record.setLastname("Smith");
-            record.setBlob1(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             Pkfieldsblobs updateRecord = new Pkfieldsblobs();
@@ -169,7 +170,7 @@ public class UpdateByPrimaryKeyTest exte
             updateRecord.setId2(new Integer(4));
             updateRecord.setFirstname("Scott");
             updateRecord.setLastname("Jones");
-            updateRecord.setBlob1(generateRandomBlob());
+            updateRecord.setBlob1(TestUtilities.generateRandomBlob());
     
             int rows = dao.updateByPrimaryKeyWithBLOBs(updateRecord);
             assertEquals(1, rows);
@@ -182,7 +183,7 @@ public class UpdateByPrimaryKeyTest exte
             assertEquals(updateRecord.getLastname(), newRecord.getLastname());
             assertEquals(record.getId1(), newRecord.getId1());
             assertEquals(record.getId2(), newRecord.getId2());
-            assertTrue(blobsAreEqual(updateRecord.getBlob1(), newRecord
+            assertTrue(TestUtilities.blobsAreEqual(updateRecord.getBlob1(), newRecord
                     .getBlob1()));
         } catch (Exception e) {
             fail(e.getMessage());
@@ -198,7 +199,7 @@ public class UpdateByPrimaryKeyTest exte
             record.setId2(new Integer(4));
             record.setFirstname("Jeff");
             record.setLastname("Smith");
-            record.setBlob1(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             Pkfieldsblobs updateRecord = new Pkfieldsblobs();
@@ -218,7 +219,7 @@ public class UpdateByPrimaryKeyTest exte
             assertEquals(updateRecord.getLastname(), newRecord.getLastname());
             assertEquals(record.getId1(), newRecord.getId1());
             assertEquals(record.getId2(), newRecord.getId2());
-            assertTrue(blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob1(), newRecord.getBlob1()));
         } catch (Exception e) {
             fail(e.getMessage());
         }
@@ -233,7 +234,7 @@ public class UpdateByPrimaryKeyTest exte
             record.setId2(new Integer(4));
             record.setFirstname("Jeff");
             record.setLastname("Smith");
-            record.setBlob1(generateRandomBlob());
+            record.setBlob1(TestUtilities.generateRandomBlob());
             dao.insert(record);
     
             Pkfieldsblobs updateRecord = new Pkfieldsblobs();
@@ -253,7 +254,7 @@ public class UpdateByPrimaryKeyTest exte
                     .getLastname());
             assertEquals(record.getId1(), returnedRecord.getId1());
             assertEquals(record.getId2(), returnedRecord.getId2());
-            assertTrue(blobsAreEqual(record.getBlob1(), returnedRecord
+            assertTrue(TestUtilities.blobsAreEqual(record.getBlob1(), returnedRecord
                     .getBlob1()));
         } catch (Exception e) {
             fail(e.getMessage());



Mime
View raw message