cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r956476 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test: java/org/apache/cayenne/ java/org/apache/cayenne/remote/ java/org/apache/cayenne/testdo/mt/ java/org/apache/cayenne/testdo/mt/auto/ resources/ resources/dml/
Date Mon, 21 Jun 2010 07:37:42 GMT
Author: aadamchik
Date: Mon Jun 21 07:37:42 2010
New Revision: 956476

URL: http://svn.apache.org/viewvc?rev=956476&view=rev
Log:
DI-enabled unit tests

    * switching more test cases

Added:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextPrimitiveTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTablePrimitives.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/MtTablePrimitives.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTablePrimitives.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/auto/_MtTablePrimitives.java
Removed:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTableBool.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/MtTableBool.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTableBool.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/auto/_MtTableBool.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/dml/CayenneContextNamedQueryCachingTest.xml
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/dml/CayenneContextPaginatedListCachingTest.xml
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/dml/CayenneContextWithDataContextTest.xml
Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextNamedQueryCachingTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextPaginatedListCachingTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextWithDataContextTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/LightSuperClassTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/RemoteCayenneCase.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMultiTier.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/cayenne-multi-tier.xml
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/multi-tier.map.xml

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextNamedQueryCachingTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextNamedQueryCachingTest.java?rev=956476&r1=956475&r2=956476&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextNamedQueryCachingTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextNamedQueryCachingTest.java Mon Jun 21 07:37:42 2010
@@ -22,100 +22,102 @@ package org.apache.cayenne;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.cayenne.access.ClientServerChannel;
+import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.query.NamedQuery;
-import org.apache.cayenne.remote.ClientChannel;
-import org.apache.cayenne.remote.service.LocalConnection;
-import org.apache.cayenne.unit.AccessStack;
-import org.apache.cayenne.unit.CayenneCase;
-import org.apache.cayenne.unit.CayenneResources;
-import org.apache.cayenne.unit.UnitLocalConnection;
+import org.apache.cayenne.test.jdbc.DBHelper;
+import org.apache.cayenne.test.jdbc.TableHelper;
+import org.apache.cayenne.unit.di.DataChannelInterceptor;
+import org.apache.cayenne.unit.di.UnitTestClosure;
+import org.apache.cayenne.unit.di.client.ClientCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
+
+@UseServerRuntime(ClientCase.MULTI_TIER_PROJECT)
+public class CayenneContextNamedQueryCachingTest extends ClientCase {
+
+    @Inject
+    private DBHelper dbHelper;
 
-public class CayenneContextNamedQueryCachingTest extends CayenneCase {
+    @Inject
+    private CayenneContext context;
 
-    protected UnitLocalConnection connection;
-    protected CayenneContext context;
+    @Inject(ClientCase.ROP_CLIENT_KEY)
+    private DataChannelInterceptor clientServerInterceptor;
 
-    @Override
-    protected AccessStack buildAccessStack() {
-        return CayenneResources
-                .getResources()
-                .getAccessStack(MULTI_TIER_ACCESS_STACK);
-    }
+    private TableHelper tMtTable1;
 
     @Override
-    protected void setUp() throws Exception {
-        super.setUp();
+    protected void setUpAfterInjection() throws Exception {
+        dbHelper.deleteAll("MT_TABLE2");
+        dbHelper.deleteAll("MT_TABLE1");
+
+        tMtTable1 = new TableHelper(dbHelper, "MT_TABLE1");
+        tMtTable1.setColumns("TABLE1_ID", "GLOBAL_ATTRIBUTE1", "SERVER_ATTRIBUTE1");
+    }
 
-        ClientServerChannel serverChannel = new ClientServerChannel(getDomain());
-        connection = new UnitLocalConnection(
-                serverChannel,
-                LocalConnection.HESSIAN_SERIALIZATION);
-        ClientChannel clientChannel = new ClientChannel(connection);
-        context = new CayenneContext(clientChannel);
+    protected void createThreeMtTable1sDataSet() throws Exception {
+        tMtTable1.insert(1, "g1", "s1");
+        tMtTable1.insert(2, "g2", "s2");
+        tMtTable1.insert(3, "g3", "s3");
     }
 
     public void testLocalCache() throws Exception {
-        deleteTestData();
-        createTestData("prepare");
+        createThreeMtTable1sDataSet();
 
-        NamedQuery q1 = new NamedQuery("MtQueryWithLocalCache");
+        final NamedQuery q1 = new NamedQuery("MtQueryWithLocalCache");
 
-        List result1 = context.performQuery(q1);
+        final List<?> result1 = context.performQuery(q1);
         assertEquals(3, result1.size());
 
-        connection.setBlockingMessages(true);
-        try {
-            List result2 = context.performQuery(q1);
-            assertSame(result1, result2);
-        }
-        finally {
-            connection.setBlockingMessages(false);
-        }
+        clientServerInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
+
+            public void execute() {
+                List<?> result2 = context.performQuery(q1);
+                assertSame(result1, result2);
+            }
+        });
 
         // refresh
         q1.setForceNoCache(true);
-        List result3 = context.performQuery(q1);
+        List<?> result3 = context.performQuery(q1);
         assertNotSame(result1, result3);
         assertEquals(3, result3.size());
     }
 
     public void testLocalCacheParameterized() throws Exception {
-        deleteTestData();
-        createTestData("prepare");
+        createThreeMtTable1sDataSet();
 
-        NamedQuery q1 = new NamedQuery("ParameterizedMtQueryWithLocalCache", Collections
-                .singletonMap("g", "g1"));
+        final NamedQuery q1 = new NamedQuery(
+                "ParameterizedMtQueryWithLocalCache",
+                Collections.singletonMap("g", "g1"));
 
-        NamedQuery q2 = new NamedQuery("ParameterizedMtQueryWithLocalCache", Collections
-                .singletonMap("g", "g2"));
+        final NamedQuery q2 = new NamedQuery(
+                "ParameterizedMtQueryWithLocalCache",
+                Collections.singletonMap("g", "g2"));
 
-        List result1 = context.performQuery(q1);
+        final List<?> result1 = context.performQuery(q1);
         assertEquals(1, result1.size());
 
-        connection.setBlockingMessages(true);
-        try {
-            List result2 = context.performQuery(q1);
-            assertSame(result1, result2);
-        }
-        finally {
-            connection.setBlockingMessages(false);
-        }
+        clientServerInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
+
+            public void execute() {
+                List<?> result2 = context.performQuery(q1);
+                assertSame(result1, result2);
+            }
+        });
 
-        List result3 = context.performQuery(q2);
+        final List<?> result3 = context.performQuery(q2);
         assertNotSame(result1, result3);
         assertEquals(1, result3.size());
-        
-        connection.setBlockingMessages(true);
-        try {
-            List result4 = context.performQuery(q2);
-            assertSame(result3, result4);
-            
-            List result5 = context.performQuery(q1);
-            assertSame(result1, result5);
-        }
-        finally {
-            connection.setBlockingMessages(false);
-        }
+
+        clientServerInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
+
+            public void execute() {
+                List<?> result4 = context.performQuery(q2);
+                assertSame(result3, result4);
+
+                List<?> result5 = context.performQuery(q1);
+                assertSame(result1, result5);
+            }
+        });
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextPaginatedListCachingTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextPaginatedListCachingTest.java?rev=956476&r1=956475&r2=956476&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextPaginatedListCachingTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextPaginatedListCachingTest.java Mon Jun 21 07:37:42 2010
@@ -20,55 +20,56 @@ package org.apache.cayenne;
 
 import java.util.List;
 
-import org.apache.cayenne.access.ClientServerChannel;
+import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.query.QueryCacheStrategy;
 import org.apache.cayenne.query.SelectQuery;
 import org.apache.cayenne.query.SortOrder;
-import org.apache.cayenne.remote.ClientChannel;
-import org.apache.cayenne.remote.service.LocalConnection;
+import org.apache.cayenne.test.jdbc.DBHelper;
+import org.apache.cayenne.test.jdbc.TableHelper;
 import org.apache.cayenne.testdo.mt.ClientMtTable1;
-import org.apache.cayenne.unit.AccessStack;
-import org.apache.cayenne.unit.CayenneCase;
-import org.apache.cayenne.unit.CayenneResources;
-import org.apache.cayenne.unit.UnitLocalConnection;
+import org.apache.cayenne.unit.di.client.ClientCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
 
-public class CayenneContextPaginatedListCachingTest extends CayenneCase {
+@UseServerRuntime(ClientCase.MULTI_TIER_PROJECT)
+public class CayenneContextPaginatedListCachingTest extends ClientCase {
 
-    protected UnitLocalConnection connection;
-    protected CayenneContext context;
+    @Inject
+    private DBHelper dbHelper;
 
-    @Override
-    protected AccessStack buildAccessStack() {
-        return CayenneResources.getResources().getAccessStack(MULTI_TIER_ACCESS_STACK);
-    }
+    @Inject
+    private CayenneContext context;
+
+    private TableHelper tMtTable1;
 
     @Override
-    protected void setUp() throws Exception {
-        super.setUp();
+    protected void setUpAfterInjection() throws Exception {
+        dbHelper.deleteAll("MT_TABLE2");
+        dbHelper.deleteAll("MT_TABLE1");
 
-        ClientServerChannel serverChannel = new ClientServerChannel(getDomain());
-        connection = new UnitLocalConnection(
-                serverChannel,
-                LocalConnection.HESSIAN_SERIALIZATION);
-        ClientChannel clientChannel = new ClientChannel(connection);
-        context = new CayenneContext(clientChannel);
+        tMtTable1 = new TableHelper(dbHelper, "MT_TABLE1");
+        tMtTable1.setColumns("TABLE1_ID", "GLOBAL_ATTRIBUTE1", "SERVER_ATTRIBUTE1");
+    }
+
+    protected void createSevenMtTable1sDataSet() throws Exception {
+        for (int i = 1; i <= 7; i++) {
+            tMtTable1.insert(i, "g" + i, "s" + i);
+        }
     }
 
     public void testLocalCache() throws Exception {
-        deleteTestData();
-        createTestData("prepare");
+        createSevenMtTable1sDataSet();
 
         SelectQuery query = new SelectQuery(ClientMtTable1.class);
         query.addOrdering(ClientMtTable1.GLOBAL_ATTRIBUTE1_PROPERTY, SortOrder.ASCENDING);
         query.setPageSize(3);
         query.setCacheStrategy(QueryCacheStrategy.LOCAL_CACHE);
 
-        List<?> result1 = context.performQuery(query);
+        List<ClientMtTable1> result1 = context.performQuery(query);
         assertEquals(7, result1.size());
 
         // ensure we can resolve all objects without a failure...
-        for(Object x : result1) {
-            ((ClientMtTable1) x).getGlobalAttribute1();
+        for (ClientMtTable1 x : result1) {
+            x.getGlobalAttribute1();
         }
     }
 }

Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextPrimitiveTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextPrimitiveTest.java?rev=956476&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextPrimitiveTest.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextPrimitiveTest.java Mon Jun 21 07:37:42 2010
@@ -0,0 +1,90 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne;
+
+import java.util.List;
+
+import org.apache.cayenne.di.Inject;
+import org.apache.cayenne.query.SelectQuery;
+import org.apache.cayenne.query.SortOrder;
+import org.apache.cayenne.test.jdbc.DBHelper;
+import org.apache.cayenne.test.jdbc.TableHelper;
+import org.apache.cayenne.testdo.mt.ClientMtTablePrimitives;
+import org.apache.cayenne.testdo.mt.MtTablePrimitives;
+import org.apache.cayenne.unit.di.client.ClientCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
+
+@UseServerRuntime(ClientCase.MULTI_TIER_PROJECT)
+public class CayenneContextPrimitiveTest extends ClientCase {
+
+    @Inject
+    private CayenneContext context;
+
+    @Inject
+    private DBHelper dbHelper;
+
+    private TableHelper tMtTablePrimitives;
+
+    @Override
+    protected void setUpAfterInjection() throws Exception {
+        dbHelper.deleteAll("MT_TABLE_PRIMITIVES");
+
+        tMtTablePrimitives = new TableHelper(dbHelper, "MT_TABLE_PRIMITIVES");
+        tMtTablePrimitives.setColumns("ID", "BOOLEAN_COLUMN", "INT_COLUMN");
+    }
+
+    private void createTwoPrimitivesDataSet() throws Exception {
+        tMtTablePrimitives.insert(1, true, 0);
+        tMtTablePrimitives.insert(2, false, 5);
+    }
+
+    public void testSelectPrimitives() throws Exception {
+        createTwoPrimitivesDataSet();
+
+        SelectQuery query = new SelectQuery(ClientMtTablePrimitives.class);
+        query.addOrdering("db:" + MtTablePrimitives.ID_PK_COLUMN, SortOrder.ASCENDING);
+
+        List<ClientMtTablePrimitives> results = context.performQuery(query);
+        assertTrue(results.get(0).isBooleanColumn());
+        assertFalse(results.get(1).isBooleanColumn());
+
+        assertEquals(0, results.get(0).getIntColumn());
+        assertEquals(5, results.get(1).getIntColumn());
+    }
+
+    public void testCommitChangesPrimitives() throws Exception {
+
+        ClientMtTablePrimitives object = context.newObject(ClientMtTablePrimitives.class);
+
+        object.setBooleanColumn(true);
+        object.setIntColumn(3);
+
+        context.commitChanges();
+
+        assertTrue(tMtTablePrimitives.getBoolean("BOOLEAN_COLUMN"));
+        assertEquals(3, tMtTablePrimitives.getInt("INT_COLUMN"));
+
+        object.setBooleanColumn(false);
+        object.setIntColumn(8);
+        context.commitChanges();
+
+        assertFalse(tMtTablePrimitives.getBoolean("BOOLEAN_COLUMN"));
+        assertEquals(8, tMtTablePrimitives.getInt("INT_COLUMN"));
+    }
+}

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=956476&r1=956475&r2=956476&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 Mon Jun 21 07:37:42 2010
@@ -24,149 +24,104 @@ import java.util.List;
 
 import org.apache.cayenne.access.ClientServerChannel;
 import org.apache.cayenne.access.DataContext;
-import org.apache.cayenne.access.DataDomain;
+import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.map.LifecycleEvent;
 import org.apache.cayenne.query.ObjectIdQuery;
 import org.apache.cayenne.query.QueryCacheStrategy;
 import org.apache.cayenne.query.SelectQuery;
 import org.apache.cayenne.query.SortOrder;
 import org.apache.cayenne.reflect.LifecycleCallbackRegistry;
-import org.apache.cayenne.remote.ClientChannel;
-import org.apache.cayenne.remote.ClientConnection;
 import org.apache.cayenne.remote.RemoteIncrementalFaultList;
-import org.apache.cayenne.remote.service.LocalConnection;
+import org.apache.cayenne.test.jdbc.DBHelper;
+import org.apache.cayenne.test.jdbc.TableHelper;
 import org.apache.cayenne.testdo.mt.ClientMtMeaningfulPk;
 import org.apache.cayenne.testdo.mt.ClientMtReflexive;
 import org.apache.cayenne.testdo.mt.ClientMtTable1;
 import org.apache.cayenne.testdo.mt.ClientMtTable2;
-import org.apache.cayenne.testdo.mt.ClientMtTableBool;
 import org.apache.cayenne.testdo.mt.MtReflexive;
 import org.apache.cayenne.testdo.mt.MtTable1;
-import org.apache.cayenne.testdo.mt.MtTableBool;
-import org.apache.cayenne.unit.AccessStack;
-import org.apache.cayenne.unit.CayenneCase;
-import org.apache.cayenne.unit.CayenneResources;
-import org.apache.cayenne.unit.UnitLocalConnection;
+import org.apache.cayenne.unit.di.DataChannelInterceptor;
+import org.apache.cayenne.unit.di.UnitTestClosure;
+import org.apache.cayenne.unit.di.client.ClientCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
 
-public class CayenneContextWithDataContextTest extends CayenneCase {
-    
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        deleteTestData();
-    }
+@UseServerRuntime(ClientCase.MULTI_TIER_PROJECT)
+public class CayenneContextWithDataContextTest extends ClientCase {
 
-    @Override
-    protected AccessStack buildAccessStack() {
-        return CayenneResources.getResources().getAccessStack(MULTI_TIER_ACCESS_STACK);
-    }
+    @Inject
+    private CayenneContext clientContext;
 
-    public void testLocalCacheStaysLocal() {
+    @Inject
+    private DBHelper dbHelper;
 
-        DataContext context = createDataContext();
-        ClientServerChannel clientServerChannel = new ClientServerChannel(context);
-        UnitLocalConnection connection = new UnitLocalConnection(
-                clientServerChannel,
-                LocalConnection.HESSIAN_SERIALIZATION);
-        ClientChannel channel = new ClientChannel(connection);
-        CayenneContext clientContext = new CayenneContext(channel);
+    @Inject(ClientCase.ROP_CLIENT_KEY)
+    private DataChannelInterceptor clientServerInterceptor;
 
-        SelectQuery query = new SelectQuery(ClientMtTable1.class);
-        query.setCacheStrategy(QueryCacheStrategy.LOCAL_CACHE);
+    @Inject
+    private ClientServerChannel clientServerChannel;
 
-        assertEquals(0, clientContext.getQueryCache().size());
-        assertEquals(0, context.getQueryCache().size());
+    private TableHelper tMtTable1;
+    private TableHelper tMtTable2;
 
-        List<?> results = clientContext.performQuery(query);
-
-        assertEquals(1, clientContext.getQueryCache().size());
-        assertSame(results, clientContext.getQueryCache().get(
-                query.getMetaData(clientContext.getEntityResolver())));
-
-        assertEquals(0, context.getQueryCache().size());
-    }
+    private TableHelper tMtMeaningfulPK;
 
-    public void testSelectPrimitives() {
-        insertValue();
-        DataContext context = createDataContext();
-        ClientServerChannel clientServerChannel = new ClientServerChannel(context);
-        UnitLocalConnection connection = new UnitLocalConnection(
-                clientServerChannel,
-                LocalConnection.HESSIAN_SERIALIZATION);
-        ClientChannel channel = new ClientChannel(connection);
-        CayenneContext clientContext = new CayenneContext(channel);
+    @Override
+    protected void setUpAfterInjection() throws Exception {
+        dbHelper.deleteAll("MT_TABLE2");
+        dbHelper.deleteAll("MT_TABLE1");
 
-        SelectQuery query = new SelectQuery(ClientMtTableBool.class);
-        query.addOrdering("db:" + MtTableBool.ID_PK_COLUMN, SortOrder.ASCENDING);
+        tMtTable1 = new TableHelper(dbHelper, "MT_TABLE1");
+        tMtTable1.setColumns("TABLE1_ID", "GLOBAL_ATTRIBUTE1", "SERVER_ATTRIBUTE1");
 
-        List<ClientMtTableBool> results = clientContext.performQuery(query);
-        assertTrue(results.get(1).isBlablacheck());
-        assertFalse(results.get(4).isBlablacheck());
+        tMtTable2 = new TableHelper(dbHelper, "MT_TABLE2");
+        tMtTable2.setColumns("TABLE2_ID", "TABLE1_ID", "GLOBAL_ATTRIBUTE");
 
-        assertEquals(1, results.get(1).getNumber());
-        assertEquals(5, results.get(5).getNumber());
+        tMtMeaningfulPK = new TableHelper(dbHelper, "MT_MEANINGFUL_PK");
+        tMtMeaningfulPK.setColumns("PK");
     }
 
-    public void testCommitChangesPrimitives() {
-
-        DataContext dataContext = createDataContext();
-
-        ClientConnection connection = new LocalConnection(new ClientServerChannel(
-                getDomain()));
-        ClientChannel channel = new ClientChannel(connection);
-        CayenneContext context = new CayenneContext(channel);
-        ClientMtTableBool obj = context.newObject(ClientMtTableBool.class);
-
-        obj.setBlablacheck(true);
-        obj.setNumber(3);
+    private void deleteAndCreateTwoMeaningfulPKsDataSet() throws Exception {
+        tMtMeaningfulPK.deleteAll();
+        tMtMeaningfulPK.insert("A");
+        tMtMeaningfulPK.insert("B");
+    }
 
-        context.commitChanges();
+    private void createTwoMtTable1sAnd2sDataSet() throws Exception {
+        tMtTable1.insert(1, "g1", "s1");
+        tMtTable1.insert(2, "g2", "s2");
 
-        SelectQuery query = new SelectQuery(MtTableBool.class);
-        List<MtTableBool> results = dataContext.performQuery(query);
+        tMtTable2.insert(1, 1, "g1");
+        tMtTable2.insert(2, 1, "g2");
+    }
 
-        assertTrue(results.get(0).isBlablacheck());
-        assertEquals(3, results.get(0).getNumber());
+    private void createEightMtTable1s() throws Exception {
+        for (int i = 1; i <= 8; i++) {
+            tMtTable1.insert(i, "g" + i, "s" + i);
+        }
+    }
 
-        obj.setBlablacheck(false);
-        obj.setNumber(8);
-        context.commitChanges();
+    public void testLocalCacheStaysLocal() {
 
-        query = new SelectQuery(MtTableBool.class);
-        results = dataContext.performQuery(query);
+        DataContext serverContext = (DataContext) clientServerChannel.getParentChannel();
 
-        assertFalse(results.get(0).isBlablacheck());
-        assertEquals(8, results.get(0).getNumber());
+        SelectQuery query = new SelectQuery(ClientMtTable1.class);
+        query.setCacheStrategy(QueryCacheStrategy.LOCAL_CACHE);
 
-    }
+        assertEquals(0, clientContext.getQueryCache().size());
+        assertEquals(0, serverContext.getQueryCache().size());
 
-    public void insertValue() {
-        DataContext context = createDataContext();
+        List<?> results = clientContext.performQuery(query);
 
-        MtTableBool obj;
+        assertEquals(1, clientContext.getQueryCache().size());
+        assertSame(results, clientContext.getQueryCache().get(
+                query.getMetaData(clientContext.getEntityResolver())));
 
-        for (int i = 0; i < 6; i++) {
-            if (i < 3) {
-                obj = context.newObject(MtTableBool.class);
-                obj.setBlablacheck(true);
-                obj.setNumber(i);
-                context.commitChanges();
-            }
-            else {
-                obj = context.newObject(MtTableBool.class);
-                obj.setBlablacheck(false);
-                obj.setNumber(i);
-                context.commitChanges();
-            }
-        }
+        assertEquals(0, serverContext.getQueryCache().size());
     }
 
     public void testPostAddCallback() throws Exception {
 
-        ClientServerChannel csChannel = new ClientServerChannel(getDomain());
-
-        // an exception was triggered within POST_LOAD callback
-        LifecycleCallbackRegistry callbackRegistry = csChannel
+        LifecycleCallbackRegistry callbackRegistry = clientServerChannel
                 .getEntityResolver()
                 .getCallbackRegistry();
 
@@ -197,19 +152,14 @@ public class CayenneContextWithDataConte
                 public void preUpdate(Object entity) {
                 }
 
-				public void prePersist(Object entity) {
-				}
+                public void prePersist(Object entity) {
+                }
             });
 
-            ClientConnection connection = new LocalConnection(csChannel);
-            ClientChannel channel = new ClientChannel(connection);
-
-            CayenneContext context = new CayenneContext(channel);
-
-            context.newObject(ClientMtTable1.class);
+            clientContext.newObject(ClientMtTable1.class);
 
             assertFalse(flag[0]);
-            context.commitChanges();
+            clientContext.commitChanges();
             assertTrue(flag[0]);
         }
         finally {
@@ -217,23 +167,11 @@ public class CayenneContextWithDataConte
         }
     }
 
-    class TestClientServerChannel extends ClientServerChannel {
-
-        TestClientServerChannel(DataDomain domain) {
-            super(domain);
-        }
-
-        public ObjectContext getServerContext() {
-            return serverContext;
-        }
-    }
-
     public void testPostAddOnObjectCallback() throws Exception {
 
-        TestClientServerChannel csChannel = new TestClientServerChannel(getDomain());
+        DataContext serverContext = (DataContext) clientServerChannel.getParentChannel();
 
-        // an exception was triggered within POST_LOAD callback
-        LifecycleCallbackRegistry callbackRegistry = csChannel
+        LifecycleCallbackRegistry callbackRegistry = serverContext
                 .getEntityResolver()
                 .getCallbackRegistry();
 
@@ -243,21 +181,14 @@ public class CayenneContextWithDataConte
                     MtTable1.class,
                     "prePersistMethod");
 
-            ClientConnection connection = new LocalConnection(csChannel);
-            ClientChannel channel = new ClientChannel(connection);
-
-            CayenneContext context = new CayenneContext(channel);
-
-            Persistent clientObject = context.newObject(ClientMtTable1.class);
-
-            context.commitChanges();
+            Persistent clientObject = clientContext.newObject(ClientMtTable1.class);
+            clientContext.commitChanges();
 
             // find peer
-            MtTable1 peer = (MtTable1) csChannel
-                    .getServerContext()
-                    .getGraphManager()
-                    .getNode(clientObject.getObjectId());
+            MtTable1 peer = (MtTable1) serverContext.getGraphManager().getNode(
+                    clientObject.getObjectId());
 
+            assertNotNull(peer);
             assertTrue(peer.isPrePersisted());
         }
         finally {
@@ -267,10 +198,8 @@ public class CayenneContextWithDataConte
 
     public void testPreRemoveCallback() throws Exception {
 
-        ClientServerChannel csChannel = new ClientServerChannel(getDomain());
-
         // an exception was triggered within POST_LOAD callback
-        LifecycleCallbackRegistry callbackRegistry = csChannel
+        LifecycleCallbackRegistry callbackRegistry = clientServerChannel
                 .getEntityResolver()
                 .getCallbackRegistry();
 
@@ -301,23 +230,18 @@ public class CayenneContextWithDataConte
                 public void preUpdate(Object entity) {
                 }
 
-				public void prePersist(Object entity) {
-				}
+                public void prePersist(Object entity) {
+                }
             });
 
-            ClientConnection connection = new LocalConnection(csChannel);
-            ClientChannel channel = new ClientChannel(connection);
-
-            CayenneContext context = new CayenneContext(channel);
-
-            ClientMtTable1 object = context.newObject(ClientMtTable1.class);
+            ClientMtTable1 object = clientContext.newObject(ClientMtTable1.class);
 
             assertFalse(flag[0]);
-            context.commitChanges();
+            clientContext.commitChanges();
             assertFalse(flag[0]);
 
-            context.deleteObject(object);
-            context.commitChanges();
+            clientContext.deleteObject(object);
+            clientContext.commitChanges();
             assertTrue(flag[0]);
         }
         finally {
@@ -327,12 +251,8 @@ public class CayenneContextWithDataConte
 
     public void testCAY830() throws Exception {
 
-        deleteTestData();
-
-        ClientServerChannel csChannel = new ClientServerChannel(getDomain());
-
         // an exception was triggered within POST_LOAD callback
-        LifecycleCallbackRegistry callbackRegistry = csChannel
+        LifecycleCallbackRegistry callbackRegistry = clientServerChannel
                 .getEntityResolver()
                 .getCallbackRegistry();
 
@@ -360,26 +280,21 @@ public class CayenneContextWithDataConte
                 public void preUpdate(Object entity) {
                 }
 
-				public void prePersist(Object entity) {
-				}
+                public void prePersist(Object entity) {
+                }
             });
 
-            ClientConnection connection = new LocalConnection(csChannel);
-            ClientChannel channel = new ClientChannel(connection);
-
-            CayenneContext context = new CayenneContext(channel);
-
-            ClientMtReflexive o1 = context.newObject(ClientMtReflexive.class);
+            ClientMtReflexive o1 = clientContext.newObject(ClientMtReflexive.class);
             o1.setName("parent");
 
-            ClientMtReflexive o2 = context.newObject(ClientMtReflexive.class);
+            ClientMtReflexive o2 = clientContext.newObject(ClientMtReflexive.class);
             o2.setName("child");
             o2.setToParent(o1);
-            context.commitChanges();
+            clientContext.commitChanges();
 
-            context.deleteObject(o1);
-            context.deleteObject(o2);
-            context.commitChanges();
+            clientContext.deleteObject(o1);
+            clientContext.deleteObject(o2);
+            clientContext.commitChanges();
             // per CAY-830 an exception is thrown here
         }
         finally {
@@ -388,45 +303,31 @@ public class CayenneContextWithDataConte
     }
 
     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);
+        ClientMtTable1 o = clientContext.newObject(ClientMtTable1.class);
         o.setGlobalAttribute1("1");
-        context.commitChanges();
+        clientContext.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());
+        clientContext.rollbackChanges();
 
-        assertTrue(context.modifiedObjects().isEmpty());
+        assertEquals("1", o.getGlobalAttribute1());
+        assertTrue(clientContext.modifiedObjects().isEmpty());
     }
 
     public void testCreateFault() throws Exception {
-        createTestData("prepare");
+        tMtTable1.insert(1, "g1", "s1");
 
-        // must attach to the real channel...
-        ClientConnection connection = new LocalConnection(new ClientServerChannel(
-                getDomain()));
-        ClientChannel channel = new ClientChannel(connection);
-
-        CayenneContext context = new CayenneContext(channel);
-        ObjectId id = new ObjectId("MtTable1", MtTable1.TABLE1_ID_PK_COLUMN, new Integer(
-                1));
+        ObjectId id = new ObjectId("MtTable1", MtTable1.TABLE1_ID_PK_COLUMN, 1);
 
-        Object fault = context.createFault(id);
+        Object fault = clientContext.createFault(id);
         assertTrue(fault instanceof ClientMtTable1);
 
         ClientMtTable1 o = (ClientMtTable1) fault;
         assertEquals(PersistenceState.HOLLOW, o.getPersistenceState());
-        assertSame(context, o.getObjectContext());
+        assertSame(clientContext, o.getObjectContext());
         assertNull(o.getGlobalAttribute1Direct());
 
         // make sure we haven't tripped the fault yet
@@ -438,21 +339,11 @@ public class CayenneContextWithDataConte
     }
 
     public void testCreateBadFault() throws Exception {
-        deleteTestData();
-        createTestData("prepare");
-
-        // this clears domain cache
-        createDataContext();
-
-        UnitLocalConnection connection = new UnitLocalConnection(new ClientServerChannel(
-                getDomain()), LocalConnection.HESSIAN_SERIALIZATION);
-        ClientChannel channel = new ClientChannel(connection);
-        CayenneContext context = new CayenneContext(channel);
+        tMtTable1.insert(1, "g1", "s1");
 
-        ObjectId id = new ObjectId("MtTable1", MtTable1.TABLE1_ID_PK_COLUMN, new Integer(
-                2));
+        ObjectId id = new ObjectId("MtTable1", MtTable1.TABLE1_ID_PK_COLUMN, 2);
 
-        Object fault = context.createFault(id);
+        Object fault = clientContext.createFault(id);
         assertTrue(fault instanceof ClientMtTable1);
 
         ClientMtTable1 o = (ClientMtTable1) fault;
@@ -468,213 +359,173 @@ public class CayenneContextWithDataConte
     }
 
     public void testMeaningfulPK() throws Exception {
-        createTestData("testMeaningfulPK");
+        deleteAndCreateTwoMeaningfulPKsDataSet();
 
         SelectQuery query = new SelectQuery(ClientMtMeaningfulPk.class);
         query.addOrdering(ClientMtMeaningfulPk.PK_PROPERTY, SortOrder.DESCENDING);
 
-        UnitLocalConnection connection = new UnitLocalConnection(new ClientServerChannel(
-                getDomain()), LocalConnection.HESSIAN_SERIALIZATION);
-        ClientChannel channel = new ClientChannel(connection);
-        CayenneContext context = new CayenneContext(channel);
-
-        List results = context.performQuery(query);
+        List<?> results = clientContext.performQuery(query);
         assertEquals(2, results.size());
     }
 
     public void testPrefetchingToOne() throws Exception {
-        createTestData("testPrefetching");
+        createTwoMtTable1sAnd2sDataSet();
 
-        UnitLocalConnection connection = new UnitLocalConnection(new ClientServerChannel(
-                getDomain()), LocalConnection.HESSIAN_SERIALIZATION);
-        ClientChannel channel = new ClientChannel(connection);
-        CayenneContext context = new CayenneContext(channel);
-
-        ObjectId prefetchedId = new ObjectId(
+        final ObjectId prefetchedId = new ObjectId(
                 "MtTable1",
                 MtTable1.TABLE1_ID_PK_COLUMN,
-                new Integer(1));
+                1);
 
         SelectQuery q = new SelectQuery(ClientMtTable2.class);
         q.addOrdering(ClientMtTable2.GLOBAL_ATTRIBUTE_PROPERTY, SortOrder.ASCENDING);
         q.addPrefetch(ClientMtTable2.TABLE1_PROPERTY);
 
-        List results = context.performQuery(q);
+        final List<ClientMtTable2> results = clientContext.performQuery(q);
 
-        connection.setBlockingMessages(true);
-        try {
+        clientServerInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
 
-            assertEquals(2, results.size());
-            Iterator it = results.iterator();
-            while (it.hasNext()) {
-                ClientMtTable2 o = (ClientMtTable2) it.next();
-                assertEquals(PersistenceState.COMMITTED, o.getPersistenceState());
-                assertSame(context, o.getObjectContext());
+            public void execute() {
+                assertEquals(2, results.size());
 
-                ClientMtTable1 o1 = o.getTable1();
-                assertNotNull(o1);
-                assertEquals(PersistenceState.COMMITTED, o1.getPersistenceState());
-                assertSame(context, o1.getObjectContext());
-                assertEquals(prefetchedId, o1.getObjectId());
+                for (ClientMtTable2 o : results) {
+                    assertEquals(PersistenceState.COMMITTED, o.getPersistenceState());
+                    assertSame(clientContext, o.getObjectContext());
+
+                    ClientMtTable1 o1 = o.getTable1();
+                    assertNotNull(o1);
+                    assertEquals(PersistenceState.COMMITTED, o1.getPersistenceState());
+                    assertSame(clientContext, o1.getObjectContext());
+                    assertEquals(prefetchedId, o1.getObjectId());
+                }
             }
-        }
-        finally {
-            connection.setBlockingMessages(false);
-        }
+        });
     }
 
     public void testPrefetchingToOneNull() throws Exception {
-        createTestData("testPrefetchingToOneNull");
-
-        UnitLocalConnection connection = new UnitLocalConnection(new ClientServerChannel(
-                getDomain()), LocalConnection.HESSIAN_SERIALIZATION);
-        ClientChannel channel = new ClientChannel(connection);
-        CayenneContext context = new CayenneContext(channel);
+        tMtTable2.insert(15, null, "g3");
 
         SelectQuery q = new SelectQuery(ClientMtTable2.class);
         q.addPrefetch(ClientMtTable2.TABLE1_PROPERTY);
 
-        List results = context.performQuery(q);
+        final List<ClientMtTable2> results = clientContext.performQuery(q);
 
-        connection.setBlockingMessages(true);
-        try {
+        clientServerInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
 
-            assertEquals(1, results.size());
+            public void execute() {
 
-            ClientMtTable2 o = (ClientMtTable2) results.get(0);
-            assertEquals(PersistenceState.COMMITTED, o.getPersistenceState());
-            assertSame(context, o.getObjectContext());
+                assertEquals(1, results.size());
 
-            assertNull(o.getTable1());
-        }
-        finally {
-            connection.setBlockingMessages(false);
-        }
+                ClientMtTable2 o = results.get(0);
+                assertEquals(PersistenceState.COMMITTED, o.getPersistenceState());
+                assertSame(clientContext, o.getObjectContext());
+
+                assertNull(o.getTable1());
+            }
+        });
     }
 
     public void testPrefetchingToMany() throws Exception {
-        createTestData("testPrefetching");
-
-        UnitLocalConnection connection = new UnitLocalConnection(new ClientServerChannel(
-                getDomain()), LocalConnection.HESSIAN_SERIALIZATION);
-        ClientChannel channel = new ClientChannel(connection);
-        CayenneContext context = new CayenneContext(channel);
+        createTwoMtTable1sAnd2sDataSet();
 
         SelectQuery q = new SelectQuery(ClientMtTable1.class);
         q.addOrdering(ClientMtTable1.GLOBAL_ATTRIBUTE1_PROPERTY, SortOrder.ASCENDING);
         q.addPrefetch(ClientMtTable1.TABLE2ARRAY_PROPERTY);
 
-        List results = context.performQuery(q);
+        final List<ClientMtTable1> results = clientContext.performQuery(q);
 
-        connection.setBlockingMessages(true);
-        try {
+        clientServerInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
 
-            ClientMtTable1 o1 = (ClientMtTable1) results.get(0);
-            assertEquals(PersistenceState.COMMITTED, o1.getPersistenceState());
-            assertSame(context, o1.getObjectContext());
-
-            List children1 = o1.getTable2Array();
-
-            assertEquals(2, children1.size());
-            Iterator it = children1.iterator();
-            while (it.hasNext()) {
-                ClientMtTable2 o = (ClientMtTable2) it.next();
-                assertEquals(PersistenceState.COMMITTED, o.getPersistenceState());
-                assertSame(context, o.getObjectContext());
+            public void execute() {
 
-                // TODO: fixme...
-                // assertEquals(o1, o.getTable1());
+                ClientMtTable1 o1 = results.get(0);
+                assertEquals(PersistenceState.COMMITTED, o1.getPersistenceState());
+                assertSame(clientContext, o1.getObjectContext());
+
+                List<?> children1 = o1.getTable2Array();
+
+                assertEquals(2, children1.size());
+                Iterator<?> it = children1.iterator();
+                while (it.hasNext()) {
+                    ClientMtTable2 o = (ClientMtTable2) it.next();
+                    assertEquals(PersistenceState.COMMITTED, o.getPersistenceState());
+                    assertSame(clientContext, o.getObjectContext());
+
+                    // TODO: fixme... reverse relationship is not connected and will
+                    // cause a fetch
+                    // assertEquals(o1, o.getTable1());
+                }
             }
-        }
-        finally {
-            connection.setBlockingMessages(false);
-        }
+        });
     }
 
     public void testPerformPaginatedQuery() throws Exception {
-        deleteTestData();
-        createTestData("testPerformPaginatedQuery");
-
-        UnitLocalConnection connection = new UnitLocalConnection(new ClientServerChannel(
-                getDomain()), LocalConnection.HESSIAN_SERIALIZATION);
-        ClientChannel channel = new ClientChannel(connection);
-        CayenneContext context = new CayenneContext(channel);
+        createEightMtTable1s();
 
         SelectQuery query = new SelectQuery(ClientMtTable1.class);
         query.setPageSize(5);
-        List objects = context.performQuery(query);
+        List<ClientMtTable1> objects = clientContext.performQuery(query);
         assertNotNull(objects);
         assertTrue(objects instanceof RemoteIncrementalFaultList);
     }
 
     public void testPrefetchingToManyEmpty() throws Exception {
-        createTestData("testPrefetching");
-
-        UnitLocalConnection connection = new UnitLocalConnection(new ClientServerChannel(
-                getDomain()), LocalConnection.HESSIAN_SERIALIZATION);
-        ClientChannel channel = new ClientChannel(connection);
-        CayenneContext context = new CayenneContext(channel);
+        createTwoMtTable1sAnd2sDataSet();
 
         SelectQuery q = new SelectQuery(ClientMtTable1.class);
         q.addOrdering(ClientMtTable1.GLOBAL_ATTRIBUTE1_PROPERTY, SortOrder.ASCENDING);
         q.addPrefetch(ClientMtTable1.TABLE2ARRAY_PROPERTY);
 
-        List results = context.performQuery(q);
+        final List<ClientMtTable1> results = clientContext.performQuery(q);
 
-        connection.setBlockingMessages(true);
-        try {
+        clientServerInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
 
-            ClientMtTable1 o2 = (ClientMtTable1) results.get(1);
-            assertEquals(PersistenceState.COMMITTED, o2.getPersistenceState());
-            assertSame(context, o2.getObjectContext());
-
-            List children2 = o2.getTable2Array();
-            assertFalse(((ValueHolder) children2).isFault());
-            assertEquals(0, children2.size());
-        }
-        finally {
-            connection.setBlockingMessages(false);
-        }
+            public void execute() {
+                ClientMtTable1 o2 = results.get(1);
+                assertEquals(PersistenceState.COMMITTED, o2.getPersistenceState());
+                assertSame(clientContext, o2.getObjectContext());
+
+                List<ClientMtTable2> children2 = o2.getTable2Array();
+                assertFalse(((ValueHolder) children2).isFault());
+                assertEquals(0, children2.size());
+            }
+        });
     }
 
     public void testOIDQueryInterception() throws Exception {
 
-        deleteTestData();
-
-        UnitLocalConnection connection = new UnitLocalConnection(new ClientServerChannel(
-                getDomain()));
-        ClientChannel channel = new ClientChannel(connection);
-        CayenneContext context = new CayenneContext(channel);
-
-        ClientMtTable1 o = context.newObject(ClientMtTable1.class);
+        final ClientMtTable1 o = clientContext.newObject(ClientMtTable1.class);
         o.setGlobalAttribute1("aaa");
 
         // fetch new
-        ObjectIdQuery q1 = new ObjectIdQuery(o.getObjectId(), false, ObjectIdQuery.CACHE);
-
-        connection.setBlockingMessages(true);
-        try {
-            List objects = context.performQuery(q1);
-            assertEquals(1, objects.size());
-            assertSame(o, objects.get(0));
-        }
-        finally {
-            connection.setBlockingMessages(false);
-        }
+        final ObjectIdQuery q1 = new ObjectIdQuery(
+                o.getObjectId(),
+                false,
+                ObjectIdQuery.CACHE);
+
+        clientServerInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
+
+            public void execute() {
+                List<?> objects = clientContext.performQuery(q1);
+                assertEquals(1, objects.size());
+                assertSame(o, objects.get(0));
+            }
+        });
 
-        context.commitChanges();
+        clientContext.commitChanges();
 
         // fetch committed
-        ObjectIdQuery q2 = new ObjectIdQuery(o.getObjectId(), false, ObjectIdQuery.CACHE);
-
-        connection.setBlockingMessages(true);
-        try {
-            List objects = context.performQuery(q2);
-            assertEquals(1, objects.size());
-            assertSame(o, objects.get(0));
-        }
-        finally {
-            connection.setBlockingMessages(false);
-        }
+        final ObjectIdQuery q2 = new ObjectIdQuery(
+                o.getObjectId(),
+                false,
+                ObjectIdQuery.CACHE);
+
+        clientServerInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
+
+            public void execute() {
+                List<?> objects = clientContext.performQuery(q2);
+                assertEquals(1, objects.size());
+                assertSame(o, objects.get(0));
+            }
+        });
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/LightSuperClassTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/LightSuperClassTest.java?rev=956476&r1=956475&r2=956476&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/LightSuperClassTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/LightSuperClassTest.java Mon Jun 21 07:37:42 2010
@@ -25,7 +25,7 @@ import org.apache.cayenne.testdo.persist
 import org.apache.cayenne.testdo.persistent.Country;
 
 public class LightSuperClassTest extends PersistentCase {
-    
+     
     public void testServer() throws Exception {
         deleteTestData();
         

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/RemoteCayenneCase.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/RemoteCayenneCase.java?rev=956476&r1=956475&r2=956476&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/RemoteCayenneCase.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/RemoteCayenneCase.java Mon Jun 21 07:37:42 2010
@@ -30,7 +30,7 @@ import org.apache.cayenne.unit.UnitLocal
 /**
  * JUnit case to test ROP functionality
  */
-public abstract class RemoteCayenneCase extends CayenneCase {
+public abstract class RemoteCayenneCase extends CayenneCase { 
     protected CayenneContext context;
     
     protected DataContext parentDataContext;

Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTablePrimitives.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTablePrimitives.java?rev=956476&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTablePrimitives.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTablePrimitives.java Mon Jun 21 07:37:42 2010
@@ -0,0 +1,10 @@
+package org.apache.cayenne.testdo.mt;
+
+import org.apache.cayenne.testdo.mt.auto._ClientMtTablePrimitives;
+
+/**
+ * A persistent class mapped as "MtTablePrimitives" Cayenne entity.
+ */
+public class ClientMtTablePrimitives extends _ClientMtTablePrimitives {
+
+}

Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/MtTablePrimitives.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/MtTablePrimitives.java?rev=956476&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/MtTablePrimitives.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/MtTablePrimitives.java Mon Jun 21 07:37:42 2010
@@ -0,0 +1,7 @@
+package org.apache.cayenne.testdo.mt;
+
+import org.apache.cayenne.testdo.mt.auto._MtTablePrimitives;
+
+public class MtTablePrimitives extends _MtTablePrimitives {
+
+}

Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTablePrimitives.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTablePrimitives.java?rev=956476&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTablePrimitives.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTablePrimitives.java Mon Jun 21 07:37:42 2010
@@ -0,0 +1,60 @@
+package org.apache.cayenne.testdo.mt.auto;
+
+import org.apache.cayenne.PersistentObject;
+
+/**
+ * A generated persistent class mapped as "MtTablePrimitives" Cayenne entity. It is a good idea to
+ * avoid changing this class manually, since it will be overwritten next time code is
+ * regenerated. If you need to make any customizations, put them in a subclass.
+ */
+public abstract class _ClientMtTablePrimitives extends PersistentObject {
+
+    public static final String BOOLEAN_COLUMN_PROPERTY = "booleanColumn";
+    public static final String INT_COLUMN_PROPERTY = "intColumn";
+
+    protected boolean booleanColumn;
+    protected int intColumn;
+
+    public boolean isBooleanColumn() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "booleanColumn", false);
+        }
+
+        return booleanColumn;
+    }
+    public void setBooleanColumn(boolean booleanColumn) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "booleanColumn", false);
+        }
+
+        Object oldValue = this.booleanColumn;
+        this.booleanColumn = booleanColumn;
+
+        // notify objectContext about simple property change
+        if(objectContext != null) {
+            objectContext.propertyChanged(this, "booleanColumn", oldValue, booleanColumn);
+        }
+    }
+
+    public int getIntColumn() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "intColumn", false);
+        }
+
+        return intColumn;
+    }
+    public void setIntColumn(int intColumn) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "intColumn", false);
+        }
+
+        Object oldValue = this.intColumn;
+        this.intColumn = intColumn;
+
+        // notify objectContext about simple property change
+        if(objectContext != null) {
+            objectContext.propertyChanged(this, "intColumn", oldValue, intColumn);
+        }
+    }
+
+}

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMultiTier.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMultiTier.java?rev=956476&r1=956475&r2=956476&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMultiTier.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMultiTier.java Mon Jun 21 07:37:42 2010
@@ -3,7 +3,6 @@ package org.apache.cayenne.testdo.mt.aut
 import java.util.List;
 
 import org.apache.cayenne.ObjectContext;
-import org.apache.cayenne.PersistentObject;
 import org.apache.cayenne.query.NamedQuery;
 import org.apache.cayenne.testdo.mt.ClientMtTable1;
 

Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/auto/_MtTablePrimitives.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/auto/_MtTablePrimitives.java?rev=956476&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/auto/_MtTablePrimitives.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/testdo/mt/auto/_MtTablePrimitives.java Mon Jun 21 07:37:42 2010
@@ -0,0 +1,34 @@
+package org.apache.cayenne.testdo.mt.auto;
+
+import org.apache.cayenne.CayenneDataObject;
+
+/**
+ * Class _MtTablePrimitives was generated by Cayenne.
+ * It is probably a good idea to avoid changing this class manually,
+ * since it may be overwritten next time code is regenerated.
+ * If you need to make any customizations, please use subclass.
+ */
+public abstract class _MtTablePrimitives extends CayenneDataObject {
+
+    public static final String BOOLEAN_COLUMN_PROPERTY = "booleanColumn";
+    public static final String INT_COLUMN_PROPERTY = "intColumn";
+
+    public static final String ID_PK_COLUMN = "ID";
+
+    public void setBooleanColumn(boolean booleanColumn) {
+        writeProperty("booleanColumn", booleanColumn);
+    }
+	public boolean isBooleanColumn() {
+        Boolean value = (Boolean)readProperty("booleanColumn");
+        return (value != null) ? value.booleanValue() : false;
+    }
+
+    public void setIntColumn(int intColumn) {
+        writeProperty("intColumn", intColumn);
+    }
+    public int getIntColumn() {
+        Object value = readProperty("intColumn");
+        return (value != null) ? (Integer) value : 0;
+    }
+
+}

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/cayenne-multi-tier.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/cayenne-multi-tier.xml?rev=956476&r1=956475&r2=956476&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/cayenne-multi-tier.xml (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/cayenne-multi-tier.xml Mon Jun 21 07:37:42 2010
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
 <domain project-version="6">
 	<map name="multi-tier"/>
-</domain>
\ No newline at end of file
+</domain>

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/multi-tier.map.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/multi-tier.map.xml?rev=956476&r1=956475&r2=956476&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/multi-tier.map.xml (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/multi-tier.map.xml Mon Jun 21 07:37:42 2010
@@ -81,10 +81,10 @@
 	<db-entity name="MT_TABLE5">
 		<db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
 	</db-entity>
-	<db-entity name="MT_TABLE_BOOL">
+	<db-entity name="MT_TABLE_PRIMITIVES">
 		<db-attribute name="BOOLEAN_COLUMN" type="BOOLEAN"/>
 		<db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
-		<db-attribute name="NUMERIC_COLUMN" type="INTEGER"/>
+		<db-attribute name="INT_COLUMN" type="INTEGER"/>
 	</db-entity>
 	<db-entity name="MT_TOONE_DEP">
 		<db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
@@ -143,9 +143,9 @@
 	</obj-entity>
 	<obj-entity name="MtTable5" className="org.apache.cayenne.testdo.mt.MtTable5" clientClassName="org.apache.cayenne.testdo.mt.ClientMtTable5" dbEntityName="MT_TABLE5">
 	</obj-entity>
-	<obj-entity name="MtTableBool" className="org.apache.cayenne.testdo.mt.MtTableBool" clientClassName="org.apache.cayenne.testdo.mt.ClientMtTableBool" dbEntityName="MT_TABLE_BOOL">
-		<obj-attribute name="blablacheck" type="boolean" db-attribute-path="BOOLEAN_COLUMN"/>
-		<obj-attribute name="number" type="int" db-attribute-path="NUMERIC_COLUMN"/>
+	<obj-entity name="MtTablePrimitives" className="org.apache.cayenne.testdo.mt.MtTablePrimitives" clientClassName="org.apache.cayenne.testdo.mt.ClientMtTablePrimitives" dbEntityName="MT_TABLE_PRIMITIVES">
+		<obj-attribute name="booleanColumn" type="boolean" db-attribute-path="BOOLEAN_COLUMN"/>
+		<obj-attribute name="intColumn" type="int" db-attribute-path="INT_COLUMN"/>
 	</obj-entity>
 	<obj-entity name="MtTooneDep" className="org.apache.cayenne.testdo.mt.MtTooneDep" clientClassName="org.apache.cayenne.testdo.mt.ClientMtTooneDep" dbEntityName="MT_TOONE_DEP">
 	</obj-entity>



Mime
View raw message