db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1377466 - /db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SelectFunctionTest.java
Date Sun, 26 Aug 2012 17:26:49 GMT
Author: tv
Date: Sun Aug 26 17:26:49 2012
New Revision: 1377466

URL: http://svn.apache.org/viewvc?rev=1377466&view=rev
Log:
Use peer instance

Modified:
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SelectFunctionTest.java

Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SelectFunctionTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SelectFunctionTest.java?rev=1377466&r1=1377465&r2=1377466&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SelectFunctionTest.java
(original)
+++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SelectFunctionTest.java
Sun Aug 26 17:26:49 2012
@@ -24,7 +24,7 @@ import org.apache.torque.criteria.Criter
 import org.apache.torque.om.mapper.IntegerMapper;
 import org.apache.torque.test.Summarize1;
 import org.apache.torque.test.Summarize1Peer;
-import org.apache.torque.util.BasePeer;
+import org.apache.torque.util.BasePeerImpl;
 import org.apache.torque.util.functions.Avg;
 import org.apache.torque.util.functions.Count;
 import org.apache.torque.util.functions.Max;
@@ -42,6 +42,8 @@ public class SelectFunctionTest extends 
         1, 1, 1, 5
     };
 
+    private BasePeerImpl<Integer> peer;
+
     @Override
     public void setUp() throws Exception
     {
@@ -57,8 +59,12 @@ public class SelectFunctionTest extends 
             rec.setInt1(INT_VALUES[i] );
             rec.save();
         }
-    }
 
+        peer = new BasePeerImpl<Integer>(
+                new IntegerMapper(),
+                Summarize1Peer.getTableMap(),
+                Summarize1Peer.DATABASE_NAME);
+    }
 
     /**
      * Tests a select using the Avg function.
@@ -69,9 +75,8 @@ public class SelectFunctionTest extends 
     {
         Criteria criteria = new Criteria().addSelectColumn(
                 new Avg(Summarize1Peer.INT_1));
-        Integer avg = BasePeer.doSelectSingleRecord(
-                criteria,
-                new IntegerMapper());
+
+        Integer avg = peer.doSelectSingleRecord(criteria);
 
         assertEquals(new Integer(2), avg);
     }
@@ -85,9 +90,8 @@ public class SelectFunctionTest extends 
     {
         Criteria criteria = new Criteria().addSelectColumn(
                 new Avg(Summarize1Peer.INT_1, true));
-        Integer avg = BasePeer.doSelectSingleRecord(
-                criteria,
-                new IntegerMapper());
+
+        Integer avg = peer.doSelectSingleRecord(criteria);
 
         assertEquals(new Integer(3), avg);
     }
@@ -100,9 +104,8 @@ public class SelectFunctionTest extends 
     public void testSelectCount() throws Exception
     {
         Criteria criteria = new Criteria().addSelectColumn(new Count("*"));
-        Integer count = Summarize1Peer.doSelectSingleRecord(
-                criteria,
-                new IntegerMapper());
+
+        Integer count = peer.doSelectSingleRecord(criteria);
 
         assertEquals(new Integer(4), count);
     }
@@ -116,9 +119,8 @@ public class SelectFunctionTest extends 
     {
         Criteria criteria = new Criteria().addSelectColumn(
                 new Count(Summarize1Peer.INT_1, true));
-        Integer count = BasePeer.doSelectSingleRecord(
-                criteria,
-                new IntegerMapper());
+
+        Integer count = peer.doSelectSingleRecord(criteria);
 
         assertEquals(new Integer(2), count);
     }
@@ -132,9 +134,8 @@ public class SelectFunctionTest extends 
     {
         Criteria criteria = new Criteria().addSelectColumn(
                 new Min(Summarize1Peer.INT_1));
-        Integer min = BasePeer.doSelectSingleRecord(
-                criteria,
-                new IntegerMapper());
+
+        Integer min = peer.doSelectSingleRecord(criteria);
 
         assertEquals(new Integer(1), min);
     }
@@ -148,9 +149,8 @@ public class SelectFunctionTest extends 
     {
         Criteria criteria = new Criteria().addSelectColumn(
                 new Max(Summarize1Peer.INT_1));
-        Integer max = BasePeer.doSelectSingleRecord(
-                criteria,
-                new IntegerMapper());
+
+        Integer max = peer.doSelectSingleRecord(criteria);
 
         assertEquals(new Integer(5), max);
     }
@@ -164,9 +164,8 @@ public class SelectFunctionTest extends 
    {
        Criteria criteria = new Criteria().addSelectColumn(
                new Sum(Summarize1Peer.INT_1));
-       Integer sum = BasePeer.doSelectSingleRecord(
-               criteria,
-               new IntegerMapper());
+
+       Integer sum = peer.doSelectSingleRecord(criteria);
 
        assertEquals(new Integer(8), sum);
    }
@@ -180,9 +179,8 @@ public class SelectFunctionTest extends 
    {
        Criteria criteria = new Criteria().addSelectColumn(
                new Sum(Summarize1Peer.INT_1, true));
-       Integer sum = BasePeer.doSelectSingleRecord(
-               criteria,
-               new IntegerMapper());
+
+       Integer sum = peer.doSelectSingleRecord(criteria);
 
        assertEquals(new Integer(6), sum);
    }



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


Mime
View raw message