cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1103405 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SelectQueryPrefetchRouterActionTest.java
Date Sun, 15 May 2011 14:47:37 GMT
Author: aadamchik
Date: Sun May 15 14:47:37 2011
New Revision: 1103405

URL: http://svn.apache.org/viewvc?rev=1103405&view=rev
Log:
CAY-1564 CayenneCase unit tests conversion(4)

patch by Dzmitry Kazimirchyk - SelectQueryPrefetchRouterActionTest

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

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SelectQueryPrefetchRouterActionTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SelectQueryPrefetchRouterActionTest.java?rev=1103405&r1=1103404&r2=1103405&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SelectQueryPrefetchRouterActionTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/SelectQueryPrefetchRouterActionTest.java
Sun May 15 14:47:37 2011
@@ -19,19 +19,25 @@
 
 package org.apache.cayenne.query;
 
+import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.exp.Expression;
 import org.apache.cayenne.exp.ExpressionFactory;
+import org.apache.cayenne.map.EntityResolver;
 import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.testdo.testmap.Artist;
 import org.apache.cayenne.testdo.testmap.Gallery;
 import org.apache.cayenne.testdo.testmap.Painting;
-import org.apache.cayenne.unit.CayenneCase;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
 
-public class SelectQueryPrefetchRouterActionTest extends CayenneCase {
+@UseServerRuntime(ServerCase.TESTMAP_PROJECT)
+public class SelectQueryPrefetchRouterActionTest extends ServerCase {
+
+    @Inject
+    private EntityResolver resolver;
 
     public void testPaintings1() {
-        ObjEntity paintingEntity = getDomain().getEntityResolver().lookupObjEntity(
-                Painting.class);
+        ObjEntity paintingEntity = resolver.lookupObjEntity(Painting.class);
         SelectQuery q = new SelectQuery(Artist.class, ExpressionFactory.matchExp(
                 "artistName",
                 "abc"));
@@ -40,7 +46,7 @@ public class SelectQueryPrefetchRouterAc
         SelectQueryPrefetchRouterAction action = new SelectQueryPrefetchRouterAction();
 
         MockQueryRouter router = new MockQueryRouter();
-        action.route(q, router, getDomain().getEntityResolver());
+        action.route(q, router, resolver);
         assertEquals(1, router.getQueryCount());
 
         PrefetchSelectQuery prefetch = (PrefetchSelectQuery) router.getQueries().get(0);
@@ -51,8 +57,7 @@ public class SelectQueryPrefetchRouterAc
     }
 
     public void testPrefetchPaintings2() {
-        ObjEntity paintingEntity = getDomain().getEntityResolver().lookupObjEntity(
-                Painting.class);
+        ObjEntity paintingEntity = resolver.lookupObjEntity(Painting.class);
 
         SelectQuery q = new SelectQuery(Artist.class, Expression
                 .fromString("artistName = 'abc' or artistName = 'xyz'"));
@@ -61,7 +66,7 @@ public class SelectQueryPrefetchRouterAc
         SelectQueryPrefetchRouterAction action = new SelectQueryPrefetchRouterAction();
 
         MockQueryRouter router = new MockQueryRouter();
-        action.route(q, router, getDomain().getEntityResolver());
+        action.route(q, router, resolver);
         assertEquals(1, router.getQueryCount());
 
         PrefetchSelectQuery prefetch = (PrefetchSelectQuery) router.getQueries().get(0);
@@ -73,8 +78,7 @@ public class SelectQueryPrefetchRouterAc
     }
 
     public void testGalleries() {
-        ObjEntity galleryEntity = getDomain().getEntityResolver().lookupObjEntity(
-                Gallery.class);
+        ObjEntity galleryEntity = resolver.lookupObjEntity(Gallery.class);
         SelectQuery q = new SelectQuery(Artist.class, ExpressionFactory.matchExp(
                 "artistName",
                 "abc"));
@@ -83,7 +87,7 @@ public class SelectQueryPrefetchRouterAc
         SelectQueryPrefetchRouterAction action = new SelectQueryPrefetchRouterAction();
 
         MockQueryRouter router = new MockQueryRouter();
-        action.route(q, router, getDomain().getEntityResolver());
+        action.route(q, router, resolver);
         assertEquals(1, router.getQueryCount());
 
         PrefetchSelectQuery prefetch = (PrefetchSelectQuery) router.getQueries().get(0);



Mime
View raw message