List:Commits« Previous MessageNext Message »
From:Craig L Russell Date:July 7 2010 8:45pm
Subject:bzr commit into clusterj branch (Craig.Russell:289)
View as plain text  
#At file:///Users/clr/ndb/root/clusterj-working/ based on revid:craig.russell@stripped

  289 Craig L Russell	2010-07-07
      Refactor AbstractClusterJModelTest

    modified:
      clusterj-test/src/main/java/testsuite/clusterj/AbstractClusterJModelTest.java
=== modified file 'clusterj-test/src/main/java/testsuite/clusterj/AbstractClusterJModelTest.java'
--- a/clusterj-test/src/main/java/testsuite/clusterj/AbstractClusterJModelTest.java	2010-04-27 13:18:14 +0000
+++ b/clusterj-test/src/main/java/testsuite/clusterj/AbstractClusterJModelTest.java	2010-07-07 20:45:33 +0000
@@ -27,6 +27,8 @@ import java.util.Calendar;
 import java.util.List;
 import java.util.TimeZone;
 
+import com.mysql.clusterj.Session;
+
 import testsuite.clusterj.model.AllPrimitives;
 import testsuite.clusterj.model.Dn2id;
 import testsuite.clusterj.model.Employee;
@@ -127,7 +129,7 @@ public abstract class AbstractClusterJMo
     protected static Object[] dn2idPK = setupDn2idPK();
 
     /** The instances used in the tests, generated by generateInstances */
-    List<IdBase> instances = new ArrayList<IdBase>();
+    protected List<IdBase> instances = new ArrayList<IdBase>();
 
     /** List of expected results, generated by generateInstances */
     private List<Object[]> expected = null;
@@ -571,49 +573,56 @@ public abstract class AbstractClusterJMo
     }
 
     protected void createAllPrimitivesInstances(int number) {
+        createAllPrimitivesInstances(session, number);
+    }
+
+    protected void createAllPrimitivesInstances(Session session, int number) {
         for (int i = 0; i < number; ++i) {
             AllPrimitives instance = session.newInstance(AllPrimitives.class);
-            instance.setId(i);
-            instance.setInt_not_null_hash(i);
-            instance.setInt_not_null_btree(i);
-            instance.setInt_not_null_both(i);
-            instance.setInt_not_null_none(i);
-            instance.setInt_null_hash(i);
-            instance.setInt_null_btree(i);
-            instance.setInt_null_both(i);
-            instance.setInt_null_none(i);
-    
-            instance.setLong_not_null_hash((long)i);
-            instance.setLong_not_null_btree((long)i);
-            instance.setLong_not_null_both((long)i);
-            instance.setLong_not_null_none((long)i);
-            instance.setLong_null_hash((long)i);
-            instance.setLong_null_btree((long)i);
-            instance.setLong_null_both((long)i);
-            instance.setLong_null_none((long)i);
-    
-            instance.setByte_not_null_hash((byte)i);
-            instance.setByte_not_null_btree((byte)i);
-            instance.setByte_not_null_both((byte)i);
-            instance.setByte_not_null_none((byte)i);
-            instance.setByte_null_hash((byte)i);
-            instance.setByte_null_btree((byte)i);
-            instance.setByte_null_both((byte)i);
-            instance.setByte_null_none((byte)i);
-    
-            instance.setShort_not_null_hash((short)i);
-            instance.setShort_not_null_btree((short)i);
-            instance.setShort_not_null_both((short)i);
-            instance.setShort_not_null_none((short)i);
-            instance.setShort_null_hash((short)i);
-            instance.setShort_null_btree((short)i);
-            instance.setShort_null_both((short)i);
-            instance.setShort_null_none((short)i);
-    
+            initialize(instance, i);
             instances.add(instance);
         }
     }
 
+    protected void initialize(AllPrimitives instance, int i) {
+        instance.setId(i);
+        instance.setInt_not_null_hash(i);
+        instance.setInt_not_null_btree(i);
+        instance.setInt_not_null_both(i);
+        instance.setInt_not_null_none(i);
+        instance.setInt_null_hash(i);
+        instance.setInt_null_btree(i);
+        instance.setInt_null_both(i);
+        instance.setInt_null_none(i);
+
+        instance.setLong_not_null_hash((long)i);
+        instance.setLong_not_null_btree((long)i);
+        instance.setLong_not_null_both((long)i);
+        instance.setLong_not_null_none((long)i);
+        instance.setLong_null_hash((long)i);
+        instance.setLong_null_btree((long)i);
+        instance.setLong_null_both((long)i);
+        instance.setLong_null_none((long)i);
+
+        instance.setByte_not_null_hash((byte)i);
+        instance.setByte_not_null_btree((byte)i);
+        instance.setByte_not_null_both((byte)i);
+        instance.setByte_not_null_none((byte)i);
+        instance.setByte_null_hash((byte)i);
+        instance.setByte_null_btree((byte)i);
+        instance.setByte_null_both((byte)i);
+        instance.setByte_null_none((byte)i);
+
+        instance.setShort_not_null_hash((short)i);
+        instance.setShort_not_null_btree((short)i);
+        instance.setShort_not_null_both((short)i);
+        instance.setShort_not_null_none((short)i);
+        instance.setShort_null_hash((short)i);
+        instance.setShort_null_btree((short)i);
+        instance.setShort_null_both((short)i);
+        instance.setShort_null_none((short)i);
+    }
+
     protected static Object[] setupDn2idPK() {
         Object[] result = new Object[16];
         result[0] = "dc=com";


Attachment: [text/bzr-bundle] bzr/craig.russell@oracle.com-20100707204533-slsibtztq9vopjft.bundle
Thread
bzr commit into clusterj branch (Craig.Russell:289)Craig L Russell7 Jul