db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1056899 [4/4] - in /db/torque/torque4/trunk: torque-runtime/ torque-runtime/src/main/java/ torque-runtime/src/main/java/org/apache/torque/map/ torque-runtime/src/main/java/org/apache/torque/oid/ torque-runtime/src/main/java/org/apache/torq...
Date Sun, 09 Jan 2011 09:52:46 GMT
Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/util/SummaryHelperTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/util/SummaryHelperTest.java?rev=1056899&r1=1056898&r2=1056899&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/util/SummaryHelperTest.java
(original)
+++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/util/SummaryHelperTest.java
Sun Jan  9 09:52:45 2011
@@ -20,20 +20,18 @@ package org.apache.torque.util;
  */
 
 import java.io.StringWriter;
+import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.commons.collections.OrderedMap;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.torque.BaseRuntimeTestCase;
 import org.apache.torque.Torque;
-import org.apache.torque.util.ListOrderedMapCI;
 import org.apache.torque.test.Summarize1;
 import org.apache.torque.test.Summarize1Peer;
 import org.apache.torque.util.functions.FunctionFactory;
 
-import com.workingdogs.village.Value;
-
-
 /**
  * Test code for SummaryHelper.
  *
@@ -114,84 +112,86 @@ public class SummaryHelperTest extends B
         SummaryHelper summary = new SummaryHelper();
 
         summary.setExcludeExprColumns(true);
+        List<Class<?>> returnTypes = new ArrayList<Class<?>>();
+
         summary.addGroupBy ( Summarize1Peer.GROUP_BY1 );
+        returnTypes.add(String.class);
+
         summary.addAggregate("COUNT_RECS",
                                 FunctionFactory.count(Summarize1Peer.ID));
+        returnTypes.add(Integer.class);
+
         summary.addAggregate("AVG_INT1",
                                 FunctionFactory.avg(Summarize1Peer.INT_1));
+        returnTypes.add(Integer.class);
+
         summary.addAggregate("MIN_INT1",
                                 FunctionFactory.min(Summarize1Peer.INT_1));
+        returnTypes.add(Integer.class);
+
         summary.addAggregate("MAX_INT1",
                                 FunctionFactory.max(Summarize1Peer.INT_1));
+        returnTypes.add(Integer.class);
+
         summary.addAggregate("SUM_INT1",
                                 FunctionFactory.sum(Summarize1Peer.INT_1));
+        returnTypes.add(Integer.class);
 
         summary.addAggregate("AVG_FLOAT1",
                                 FunctionFactory.avg(Summarize1Peer.FLOAT1));
+        returnTypes.add(Float.class);
+
         summary.addAggregate("MIN_FLOAT1",
                                 FunctionFactory.min(Summarize1Peer.FLOAT1));
+        returnTypes.add(Float.class);
+
         summary.addAggregate("MAX_FLOAT1",
                                 FunctionFactory.max(Summarize1Peer.FLOAT1));
+        returnTypes.add(Float.class);
+
         summary.addAggregate("SUM_FLOAT1",
                                 FunctionFactory.sum(Summarize1Peer.FLOAT1));
+        returnTypes.add(Float.class);
 
-        List results = summary.summarize( c );
+        List<ListOrderedMapCI> results = summary.summarize(c, returnTypes);
 
         StringWriter out = new StringWriter();
         summary.dumpResults(out, results, true);
         out.close();
-        logger.debug("\n"+out.toString());
+        logger.debug("\n" + out.toString());
 
         assertTrue("No results returned", results.size() > 0 );
         assertTrue("Invalid number of records returned. Expected 4 but got " +
                        results.size(), results.size() == 4 );
 
-        ListOrderedMapCI rec = (ListOrderedMapCI) results.get(0);
-
-        int expectedColumns = 10;
+        ListOrderedMapCI rec = results.get(0);
 
-        // Some DB server (Oracle) add an uppercased column when addAscendingOrderBY is used.
-        if ( rec.size() == expectedColumns + 1 ) {
-          expectedColumns++;
-        }
-        assertEquals("Number of columns incorrect! Expected "
-                        + expectedColumns
-                        + " but got "
-                        + rec.size(),
-                    expectedColumns,
-                    rec.size());
         assertTrue( "GROUP_BY1 valued not correct",
-                "A1".equals(((Value) rec.get("GROUP_BY1")).asString()) );
+                "A1".equals(rec.get("GROUP_BY1").toString()) );
         assertTrue("COUNT_RECS not correct value",
-                ((Value) rec.get("COUNT_RECS")).asInt() == 4 );
+                ((Integer) rec.get("COUNT_RECS")).intValue() == 4 );
         assertTrue("AVG_INT1 not correct value",
-                ((Value) rec.get("AVG_INT1")).asInt() == 2 );
+                ((Integer) rec.get("AVG_INT1")).intValue() == 2 );
         assertTrue("MIN_INT1 not correct value",
-                ((Value) rec.get("MIN_INT1")).asInt() == 1 );
+                ((Integer) rec.get("MIN_INT1")).intValue() == 1 );
         assertTrue("MAX_INT1 not correct value",
-                ((Value) rec.get("MAX_INT1")).asInt() == 4 );
+                ((Integer) rec.get("MAX_INT1")).intValue() == 4 );
         assertTrue("SUM_INT1 not correct value",
-                ((Value) rec.get("SUM_INT1")).asInt() == 10 );
+                ((Integer) rec.get("SUM_INT1")).intValue() == 10 );
 
-        rec = (ListOrderedMapCI) results.get(3);
-        assertEquals("Number of columns incorrect! Expected "
-                + expectedColumns
-                + " but got "
-                + rec.size(),
-            expectedColumns,
-            rec.size());
+        rec = results.get(3);
         assertTrue( "GROUP_BY1 valued not correct",
-                "D1".equals(((Value) rec.get("GROUP_BY1")).asString()) );
+                "D1".equals((String) rec.get("GROUP_BY1")));
         assertTrue("COUNT_RECS not correct value",
-                ((Value) rec.get("COUNT_RECS")).asInt() == 4 );
+                ((Integer) rec.get("COUNT_RECS")).intValue() == 4 );
         assertTrue("AVG_FLOAT1 not correct value",
-                ((Value) rec.get("AVG_FLOAT1")).asFloat() == 11.0f );
+                ((Float) rec.get("AVG_FLOAT1")).floatValue() == 11.0f );
         assertTrue("MIN_FLOAT1 not correct value",
-                ((Value) rec.get("MIN_FLOAT1")).asFloat() == 8.0f );
+                ((Float) rec.get("MIN_FLOAT1")).floatValue() == 8.0f );
         assertTrue("MAX_FLOAT1 not correct value",
-                ((Value) rec.get("MAX_FLOAT1")).asFloat() == 14.0f );
+                ((Float) rec.get("MAX_FLOAT1")).floatValue() == 14.0f );
         assertTrue("SUM_FLOAT1 not correct value",
-                ((Value) rec.get("SUM_FLOAT1")).asFloat() == 44.0f );
+                ((Float) rec.get("SUM_FLOAT1")).floatValue() == 44.0f );
 
     }
     /*
@@ -203,27 +203,45 @@ public class SummaryHelperTest extends B
         SummaryHelper summary = new SummaryHelper();
 
         summary.setExcludeExprColumns(true);
+        List<Class<?>> returnTypes = new ArrayList<Class<?>>();
+
         summary.addAggregate("COUNT_RECS",
                                 FunctionFactory.count(Summarize1Peer.ID));
+        returnTypes.add(Integer.class);
+
         summary.addAggregate("AVG_INT1",
                                 FunctionFactory.avg(Summarize1Peer.INT_1));
+        returnTypes.add(Integer.class);
+
         summary.addAggregate("MIN_INT1",
                                 FunctionFactory.min(Summarize1Peer.INT_1));
+        returnTypes.add(Integer.class);
+
         summary.addAggregate("MAX_INT1",
                                 FunctionFactory.max(Summarize1Peer.INT_1));
+        returnTypes.add(Integer.class);
+
         summary.addAggregate("SUM_INT1",
                                 FunctionFactory.sum(Summarize1Peer.INT_1));
+        returnTypes.add(Integer.class);
 
         summary.addAggregate("AVG_FLOAT1",
                 FunctionFactory.avg(Summarize1Peer.FLOAT1));
+        returnTypes.add(Float.class);
+
         summary.addAggregate("MIN_FLOAT1",
                 FunctionFactory.min(Summarize1Peer.FLOAT1));
+        returnTypes.add(Float.class);
+
         summary.addAggregate("MAX_FLOAT1",
                 FunctionFactory.max(Summarize1Peer.FLOAT1));
+        returnTypes.add(Float.class);
+
         summary.addAggregate("SUM_FLOAT1",
                 FunctionFactory.sum(Summarize1Peer.FLOAT1));
+        returnTypes.add(Float.class);
 
-        List results = summary.summarize(c);
+        List<ListOrderedMapCI> results = summary.summarize(c, returnTypes);
 
         StringWriter out = new StringWriter();
         summary.dumpResults(out, results, true);
@@ -234,29 +252,29 @@ public class SummaryHelperTest extends B
         assertTrue("Invalid number of records returned.  Expected 1 but got " +
                        results.size(), results.size() == 1 );
 
-        ListOrderedMapCI rec = (ListOrderedMapCI) results.get(0);
+        ListOrderedMapCI rec = results.get(0);
 
         assertTrue( "Number of columns incorrect! Did ExcludeExpColumns work? " +
                        "Expected 9 but got " + rec.size(), rec.size() == 9 );
         assertTrue("COUNT_RECS not correct value",
-                ((Value) rec.get("COUNT_RECS")).asInt() == 16 );
+                ((Integer) rec.get("COUNT_RECS")).intValue() == 16 );
         assertTrue("AVG_INT1 not correct value",
-                ((Value) rec.get("AVG_INT1")).asInt() == 4 );
+                ((Integer) rec.get("AVG_INT1")).intValue() == 4 );
         assertTrue("MIN_INT1 not correct value",
-                ((Value) rec.get("MIN_INT1")).asInt() == 1 );
+                ((Integer) rec.get("MIN_INT1")).intValue() == 1 );
         assertTrue("MAX_INT1 not correct value",
-                ((Value) rec.get("MAX_INT1")).asInt() == 7 );
+                ((Integer) rec.get("MAX_INT1")).intValue() == 7 );
         assertTrue("SUM_INT1 not correct value",
-                ((Value) rec.get("SUM_INT1")).asInt() == 64 );
+                ((Integer) rec.get("SUM_INT1")).intValue() == 64 );
 
         assertTrue("AVG_FLOAT1 not correct value",
-                ((Value) rec.get("AVG_FLOAT1")).asFloat() == 8.0f );
+                ((Float) rec.get("AVG_FLOAT1")).floatValue() == 8.0f );
         assertTrue("MIN_FLOAT1 not correct value",
-                ((Value) rec.get("MIN_FLOAT1")).asFloat() == 2.0f );
+                ((Float) rec.get("MIN_FLOAT1")).floatValue() == 2.0f );
         assertTrue("MAX_FLOAT1 not correct value",
-                ((Value) rec.get("MAX_FLOAT1")).asFloat() == 14.0f );
+                ((Float) rec.get("MAX_FLOAT1")).floatValue() == 14.0f );
         assertTrue("SUM_FLOAT1 not correct value",
-                ((Value) rec.get("SUM_FLOAT1")).asFloat() == 128.0f );
+                ((Float) rec.get("SUM_FLOAT1")).floatValue() == 128.0f );
     }
 
 }

Propchange: db/torque/torque4/trunk/torque-test/src/test/profile/
            ('svn:mergeinfo' removed)

Modified: db/torque/torque4/trunk/torque-test/src/test/profile/mysql/Torque.properties
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/profile/mysql/Torque.properties?rev=1056899&r1=1056898&r2=1056899&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/profile/mysql/Torque.properties (original)
+++ db/torque/torque4/trunk/torque-test/src/test/profile/mysql/Torque.properties Sun Jan 
9 09:52:45 2011
@@ -29,7 +29,7 @@ torque.dsfactory.bookstore.factory = org
 torque.dsfactory.bookstore.connection.driver = org.gjt.mm.mysql.Driver
 torque.dsfactory.bookstore.connection.url = jdbc:mysql://localhost:3306/bookstore
 torque.dsfactory.bookstore.connection.user = root
-torque.dsfactory.bookstore.connection.password = 
+torque.dsfactory.bookstore.connection.password = mysql
 
 torque.dsfactory.bookstore.pool.validationQuery = SELECT 1
 

Modified: db/torque/torque4/trunk/torque-test/src/test/profile/oracle/Torque.properties
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/profile/oracle/Torque.properties?rev=1056899&r1=1056898&r2=1056899&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/profile/oracle/Torque.properties (original)
+++ db/torque/torque4/trunk/torque-test/src/test/profile/oracle/Torque.properties Sun Jan
 9 09:52:45 2011
@@ -29,6 +29,9 @@ torque.dsfactory.bookstore.factory = org
 torque.dsfactory.bookstore.connection.driver = oracle.jdbc.driver.OracleDriver
 torque.dsfactory.bookstore.connection.url = jdbc:oracle:thin:@localhost:1521:XE
 torque.dsfactory.bookstore.connection.user = torque
-torque.dsfactory.bookstore.connection.password = 
+torque.dsfactory.bookstore.connection.password = torque
 
 torque.dsfactory.bookstore.pool.validationQuery = SELECT 1 FROM DUAL
+
+# use Caching. This property is only used if managers are used by generators.
+torque.manager.useCache = true
\ No newline at end of file

Modified: db/torque/torque4/trunk/torque-test/src/test/profile/postgresql/Torque.properties
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/profile/postgresql/Torque.properties?rev=1056899&r1=1056898&r2=1056899&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/profile/postgresql/Torque.properties (original)
+++ db/torque/torque4/trunk/torque-test/src/test/profile/postgresql/Torque.properties Sun
Jan  9 09:52:45 2011
@@ -28,7 +28,10 @@ torque.database.bookstore.adapter = post
 torque.dsfactory.bookstore.factory = org.apache.torque.dsfactory.SharedPoolDataSourceFactory
 torque.dsfactory.bookstore.connection.driver = org.postgresql.Driver
 torque.dsfactory.bookstore.connection.url = jdbc:postgresql://localhost:5432/bookstore
-torque.dsfactory.bookstore.connection.user = torque
-torque.dsfactory.bookstore.connection.password = torque
+torque.dsfactory.bookstore.connection.user = postgres
+torque.dsfactory.bookstore.connection.password = postgresql
 
 torque.dsfactory.bookstore.pool.validationQuery = SELECT 1
+
+# use Caching. This property is only used if managers are used by generators.
+torque.manager.useCache = true
\ No newline at end of file

Propchange: db/torque/torque4/trunk/torque-test/src/test/resources/TestComponentConfig.xml
            ('svn:mergeinfo' removed)

Propchange: db/torque/torque4/trunk/torque-test/src/test/resources/TestRoleConfig.xml
            ('svn:mergeinfo' removed)

Propchange: db/torque/torque4/trunk/torque-test/src/test/resources/TurbineResources.properties
            ('svn:mergeinfo' removed)

Propchange: db/torque/torque4/trunk/torque-test/src/test/resources/cache.ccf
            ('svn:mergeinfo' removed)

Propchange: db/torque/torque4/trunk/torque-test/src/test/resources/commons-logging.properties
            ('svn:mergeinfo' removed)

Propchange: db/torque/torque4/trunk/torque-test/src/test/resources/log4j.properties
            ('svn:mergeinfo' removed)

Propchange: db/torque/torque4/trunk/torque-test/src/test/sql/
            ('svn:mergeinfo' removed)



---------------------------------------------------------------------
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