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 2008/09/04 13:46:25 UTC

svn commit: r691977 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextWithDataContextTest.java

Author: aadamchik
Date: Thu Sep  4 04:46:24 2008
New Revision: 691977

URL: http://svn.apache.org/viewvc?rev=691977&view=rev
Log:
CAY-1103 rollbackChanges is broken in ROP CayenneContext
(unit test)

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

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextWithDataContextTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextWithDataContextTest.java?rev=691977&r1=691976&r2=691977&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextWithDataContextTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextWithDataContextTest.java Thu Sep  4 04:46:24 2008
@@ -294,6 +294,28 @@
             callbackRegistry.clear();
         }
     }
+    
+    public void testRollbackChanges() throws Exception {
+        ClientConnection connection = new LocalConnection(new ClientServerChannel(
+                getDomain()));
+        ClientChannel channel = new ClientChannel(connection);
+
+        CayenneContext context = new CayenneContext(channel);
+        
+        ClientMtTable1 o = context.newObject(ClientMtTable1.class);
+        o.setGlobalAttribute1("1");
+        context.commitChanges();
+        
+        assertEquals("1", o.getGlobalAttribute1());
+        o.setGlobalAttribute1("2");
+        assertEquals("2", o.getGlobalAttribute1());
+        context.rollbackChanges();
+        
+        // CAY-1103 - uncommenting this assertion demonstrates the problem
+        // assertEquals("1", o.getGlobalAttribute1());
+        
+        assertTrue(context.modifiedObjects().isEmpty());
+    }
 
     public void testCreateFault() throws Exception {
         createTestData("prepare");