cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1125982 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/PrefetchProcessorTreeBuilderTest.java
Date Sun, 22 May 2011 15:08:40 GMT
Author: aadamchik
Date: Sun May 22 15:08:40 2011
New Revision: 1125982

URL: http://svn.apache.org/viewvc?rev=1125982&view=rev
Log:
CAY-1565 CayenneCase unit tests conversion(5)

patches by Dzmitry Kazimirchyk - PrefetchProcessorTreeBuilderTest

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

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/PrefetchProcessorTreeBuilderTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/PrefetchProcessorTreeBuilderTest.java?rev=1125982&r1=1125981&r2=1125982&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/PrefetchProcessorTreeBuilderTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/PrefetchProcessorTreeBuilderTest.java
Sun May 22 15:08:40 2011
@@ -25,8 +25,10 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.cayenne.DataRow;
+import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.DbEntity;
+import org.apache.cayenne.map.EntityResolver;
 import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.query.MockQueryMetadata;
 import org.apache.cayenne.query.PrefetchTreeNode;
@@ -35,16 +37,22 @@ import org.apache.cayenne.reflect.ClassD
 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 PrefetchProcessorTreeBuilderTest extends CayenneCase {
+@UseServerRuntime(ServerCase.TESTMAP_PROJECT)
+public class PrefetchProcessorTreeBuilderTest extends ServerCase {
+
+    @Inject
+    private DataContext context;
+
+    @Inject
+    private EntityResolver resolver;
 
     public void testBuildTreeNoPrefetches() {
 
-        final ClassDescriptor descriptor = getDomain()
-                .getEntityResolver()
-                .getClassDescriptor("Artist");
-        List dataRows = new ArrayList();
+        final ClassDescriptor descriptor = resolver.getClassDescriptor("Artist");
+        List<Object> dataRows = new ArrayList<Object>();
         dataRows.add(new DataRow(4));
         dataRows.add(new DataRow(4));
 
@@ -83,12 +91,12 @@ public class PrefetchProcessorTreeBuilde
 
         PrefetchTreeNode tree = new PrefetchTreeNode();
         HierarchicalObjectResolver resolver = new HierarchicalObjectResolver(
-                createDataContext(),
+                context,
                 metadata);
         PrefetchProcessorTreeBuilder builder = new PrefetchProcessorTreeBuilder(
                 resolver,
                 dataRows,
-                new HashMap());
+                new HashMap<Object, Object>());
 
         PrefetchProcessorNode processingTree = builder.buildTree(tree);
 
@@ -103,16 +111,14 @@ public class PrefetchProcessorTreeBuilde
 
     public void testBuildTreeWithPrefetches() {
 
-        final ClassDescriptor descriptor = getDomain()
-                .getEntityResolver()
-                .getClassDescriptor("Artist");
-        ObjEntity e2 = getObjEntity("Painting");
-        ObjEntity e3 = getObjEntity("Gallery");
-        ObjEntity e4 = getObjEntity("Exhibit");
-        ObjEntity e5 = getObjEntity("ArtistExhibit");
+        final ClassDescriptor descriptor = resolver.getClassDescriptor("Artist");
+        ObjEntity e2 = resolver.getObjEntity("Painting");
+        ObjEntity e3 = resolver.getObjEntity("Gallery");
+        ObjEntity e4 = resolver.getObjEntity("Exhibit");
+        ObjEntity e5 = resolver.getObjEntity("ArtistExhibit");
 
-        List mainRows = new ArrayList();
-        Map extraRows = new HashMap();
+        List<Object> mainRows = new ArrayList<Object>();
+        Map<Object, Object> extraRows = new HashMap<Object, Object>();
 
         PrefetchTreeNode tree = new PrefetchTreeNode();
         tree.addPath(Artist.PAINTING_ARRAY_PROPERTY).setPhantom(false);
@@ -158,7 +164,7 @@ public class PrefetchProcessorTreeBuilde
         };
 
         HierarchicalObjectResolver resolver = new HierarchicalObjectResolver(
-                createDataContext(),
+                context,
                 metadata);
         PrefetchProcessorTreeBuilder builder = new PrefetchProcessorTreeBuilder(
                 resolver,
@@ -197,4 +203,5 @@ public class PrefetchProcessorTreeBuilde
         assertFalse(n5.isPhantom());
         assertTrue(n5.isPartitionedByParent());
     }
+
 }



Mime
View raw message