cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1334375 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/DataContextMaxIdQualifierTest.java
Date Sat, 05 May 2012 10:07:29 GMT
Author: aadamchik
Date: Sat May  5 10:07:28 2012
New Revision: 1334375

URL: http://svn.apache.org/viewvc?rev=1334375&view=rev
Log:
CAY-1700 Split long DISJOINT_BY_ID prefetch query on several smaller queries

replacing static property initializer with setup/teardown

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/DataContextMaxIdQualifierTest.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/DataContextMaxIdQualifierTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/DataContextMaxIdQualifierTest.java?rev=1334375&r1=1334374&r2=1334375&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/DataContextMaxIdQualifierTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/DataContextMaxIdQualifierTest.java
Sat May  5 10:07:28 2012
@@ -1,5 +1,8 @@
 package org.apache.cayenne;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.cayenne.access.DataContext;
 import org.apache.cayenne.configuration.Constants;
 import org.apache.cayenne.di.Inject;
@@ -14,11 +17,9 @@ import org.apache.cayenne.unit.di.UnitTe
 import org.apache.cayenne.unit.di.server.ServerCase;
 import org.apache.cayenne.unit.di.server.UseServerRuntime;
 
-import java.util.ArrayList;
-import java.util.List;
-
 @UseServerRuntime(ServerCase.TESTMAP_PROJECT)
 public class DataContextMaxIdQualifierTest extends ServerCase {
+
     @Inject
     protected DataContext context;
 
@@ -31,12 +32,11 @@ public class DataContextMaxIdQualifierTe
     protected TableHelper tBag;
     protected TableHelper tBox;
 
-    static {
-        System.setProperty(Constants.SERVER_MAX_ID_QUALIFIER_SIZE_PROPERTY, "100");
-    }
-
     @Override
     protected void setUpAfterInjection() throws Exception {
+
+        System.setProperty(Constants.SERVER_MAX_ID_QUALIFIER_SIZE_PROPERTY, "100");
+
         dbHelper.deleteAll("BALL");
         dbHelper.deleteAll("BOX_THING");
         dbHelper.deleteAll("THING");
@@ -51,6 +51,11 @@ public class DataContextMaxIdQualifierTe
         tBox.setColumns("ID", "BAG_ID", "NAME");
     }
 
+    @Override
+    protected void tearDownBeforeInjection() throws Exception {
+        System.getProperties().remove(Constants.SERVER_MAX_ID_QUALIFIER_SIZE_PROPERTY);
+    }
+
     public void testDisjointByIdPrefetch() throws Exception {
         for (int i = 0; i < 1000; i++) {
             tBag.insert(i + 1, "bag" + (i + 1));
@@ -58,10 +63,11 @@ public class DataContextMaxIdQualifierTe
         }
 
         final SelectQuery query = new SelectQuery(Bag.class);
-        query.addPrefetch(Bag.BOXES_PROPERTY)
-                .setSemantics(PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
+        query.addPrefetch(Bag.BOXES_PROPERTY).setSemantics(
+                PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
 
         int queriesCount = queryInterceptor.runWithQueryCounter(new UnitTestClosure() {
+
             public void execute() {
                 context.performQuery(query);
             }
@@ -79,6 +85,7 @@ public class DataContextMaxIdQualifierTe
         final SelectQuery query = new SelectQuery(Box.class);
         query.setPageSize(100);
         int queriesCount = queryInterceptor.runWithQueryCounter(new UnitTestClosure() {
+
             public void execute() {
                 final List<Box> boxes = context.performQuery(query);
                 List<Box> tempList = new ArrayList<Box>();



Mime
View raw message