cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1124485 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextDataChannelEventsTest.java
Date Thu, 19 May 2011 01:06:13 GMT
Author: aadamchik
Date: Thu May 19 01:06:13 2011
New Revision: 1124485

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

patches by Dzmitry Kazimirchyk - DataContextDataChannelEventsTest

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

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextDataChannelEventsTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextDataChannelEventsTest.java?rev=1124485&r1=1124484&r2=1124485&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextDataChannelEventsTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextDataChannelEventsTest.java
Thu May 19 01:06:13 2011
@@ -22,21 +22,27 @@ package org.apache.cayenne.access;
 import org.apache.cayenne.DataChannel;
 import org.apache.cayenne.DataChannelListener;
 import org.apache.cayenne.ObjectContext;
+import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.graph.GraphEvent;
 import org.apache.cayenne.testdo.testmap.Artist;
-import org.apache.cayenne.unit.CayenneCase;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
 import org.apache.cayenne.unit.util.ThreadedTestHelper;
 import org.apache.cayenne.util.EventUtil;
 
 /**
  * Tests that DataContext sends DataChannel events.
- *
  */
-public class DataContextDataChannelEventsTest extends CayenneCase {
+@UseServerRuntime(ServerCase.TESTMAP_PROJECT)
+public class DataContextDataChannelEventsTest extends ServerCase {
 
-    public void testCommitEvent() {
-        DataContext context = createDataContext();
+    @Inject
+    private DataContext context;
+
+    @Inject
+    private DataContext peer;
 
+    public void testCommitEvent() {
         Artist a = context.newObject(Artist.class);
         a.setArtistName("X");
         context.commitChanges();
@@ -53,8 +59,6 @@ public class DataContextDataChannelEvent
     }
 
     public void testRollbackEvent() {
-        DataContext context = createDataContext();
-
         Artist a = context.newObject(Artist.class);
         a.setArtistName("X");
         context.commitChanges();
@@ -71,8 +75,6 @@ public class DataContextDataChannelEvent
     }
 
     public void testChangeEventOnChildChange() {
-        DataContext context = createDataContext();
-
         Artist a = context.newObject(Artist.class);
         a.setArtistName("X");
         context.commitChanges();
@@ -92,8 +94,6 @@ public class DataContextDataChannelEvent
     }
 
     public void testChangeEventOnPeerChange() throws Exception {
-        DataContext context = createDataContext();
-
         Artist a = context.newObject(Artist.class);
         a.setArtistName("X");
         context.commitChanges();
@@ -101,7 +101,6 @@ public class DataContextDataChannelEvent
         final MockChannelListener listener = new MockChannelListener();
         EventUtil.listenForChannelEvents(context, listener);
 
-        DataContext peer = createDataContextWithSharedCache(false);
         Artist a1 = (Artist) peer.localObject(a.getObjectId(), a);
 
         a1.setArtistName("Y");
@@ -119,8 +118,6 @@ public class DataContextDataChannelEvent
     }
 
     public void testChangeEventOnPeerChangeSecondNestingLevel() throws Exception {
-        DataContext context = createDataContext();
-
         ObjectContext childPeer1 = context.createChildContext();
 
         Artist a = childPeer1.newObject(Artist.class);



Mime
View raw message