You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2011/05/14 12:48:21 UTC

svn commit: r1103023 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/DbRelationshipTest.java

Author: aadamchik
Date: Sat May 14 10:48:21 2011
New Revision: 1103023

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

    patch by Dzmitry Kazimirchyk - DbRelationshipTest

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

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/DbRelationshipTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/DbRelationshipTest.java?rev=1103023&r1=1103022&r2=1103023&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/DbRelationshipTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/DbRelationshipTest.java Sat May 14 10:48:21 2011
@@ -22,30 +22,38 @@ package org.apache.cayenne.map;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.cayenne.unit.CayenneCase;
+import org.apache.cayenne.configuration.server.ServerRuntime;
+import org.apache.cayenne.di.Inject;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
 
-public class DbRelationshipTest extends CayenneCase {
+@UseServerRuntime(ServerCase.TESTMAP_PROJECT)
+public class DbRelationshipTest extends ServerCase {
+
+    @Inject
+    private ServerRuntime runtime;
 
     protected DbEntity artistEnt;
     protected DbEntity paintingEnt;
     protected DbEntity galleryEnt;
 
     @Override
-    public void setUp() throws Exception {
-        artistEnt = getDbEntity("ARTIST");
-        paintingEnt = getDbEntity("PAINTING");
-        galleryEnt = getDbEntity("GALLERY");
+    public void setUpAfterInjection() throws Exception {
+        artistEnt = runtime.getDataDomain().getEntityResolver().getDbEntity("ARTIST");
+        paintingEnt = runtime.getDataDomain().getEntityResolver().getDbEntity("PAINTING");
+        galleryEnt = runtime.getDataDomain().getEntityResolver().getDbEntity("GALLERY");
     }
 
     public void testSrcFkSnapshotWithTargetSnapshot() throws Exception {
-        Map map = new HashMap();
+        Map<String, Object> map = new HashMap<String, Object>();
         Integer id = new Integer(44);
         map.put("GALLERY_ID", id);
 
         DbRelationship dbRel = (DbRelationship) galleryEnt
                 .getRelationship("paintingArray");
-        Map targetMap = dbRel.getReverseRelationship().srcFkSnapshotWithTargetSnapshot(
-                map);
+        Map<String, Object> targetMap = dbRel
+                .getReverseRelationship()
+                .srcFkSnapshotWithTargetSnapshot(map);
         assertEquals(id, targetMap.get("GALLERY_ID"));
     }