cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r671545 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne: CayenneContextDataObjectUtilsTest.java CayenneContextSQLTemplateTest.java
Date Wed, 25 Jun 2008 13:22:58 GMT
Author: aadamchik
Date: Wed Jun 25 06:22:58 2008
New Revision: 671545

URL: http://svn.apache.org/viewvc?rev=671545&view=rev
Log:
CAY-979 ROP client serialization mechanism dependencies
(this commit is to fix a problem similar to the one described in CAY-979; i.e. it fixes unit
tests, not the underlying problem)

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

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextDataObjectUtilsTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextDataObjectUtilsTest.java?rev=671545&r1=671544&r2=671545&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextDataObjectUtilsTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextDataObjectUtilsTest.java
Wed Jun 25 06:22:58 2008
@@ -23,7 +23,6 @@
 import org.apache.cayenne.remote.ClientChannel;
 import org.apache.cayenne.remote.service.LocalConnection;
 import org.apache.cayenne.testdo.mt.ClientMtTable1;
-import org.apache.cayenne.testdo.mt.MtTable1;
 import org.apache.cayenne.unit.AccessStack;
 import org.apache.cayenne.unit.CayenneCase;
 import org.apache.cayenne.unit.CayenneResources;
@@ -37,7 +36,9 @@
 
     private CayenneContext createClientContext() {
         ClientServerChannel serverChannel = new ClientServerChannel(getDomain());
-        LocalConnection connection = new LocalConnection(serverChannel);
+        LocalConnection connection = new LocalConnection(
+                serverChannel,
+                LocalConnection.HESSIAN_SERIALIZATION);
         ClientChannel clientChannel = new ClientChannel(connection);
         return new CayenneContext(clientChannel);
     }
@@ -49,7 +50,7 @@
         CayenneContext context = createClientContext();
 
         context.performGenericQuery(new SQLTemplate(
-                MtTable1.class,
+                ClientMtTable1.class,
                 "insert into MT_TABLE1 "
                         + "(TABLE1_ID, GLOBAL_ATTRIBUTE1, SERVER_ATTRIBUTE1) "
                         + "values (1, 'g1', 's1')"));

Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextSQLTemplateTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextSQLTemplateTest.java?rev=671545&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextSQLTemplateTest.java
(added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CayenneContextSQLTemplateTest.java
Wed Jun 25 06:22:58 2008
@@ -0,0 +1,62 @@
+/*****************************************************************
+ *   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 org.apache.cayenne.access.ClientServerChannel;
+import org.apache.cayenne.query.SQLTemplate;
+import org.apache.cayenne.query.SelectQuery;
+import org.apache.cayenne.remote.ClientChannel;
+import org.apache.cayenne.remote.service.LocalConnection;
+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;
+
+public class CayenneContextSQLTemplateTest extends CayenneCase {
+
+    @Override
+    protected AccessStack buildAccessStack() {
+        return CayenneResources.getResources().getAccessStack(MULTI_TIER_ACCESS_STACK);
+    }
+
+    private CayenneContext createClientContext() {
+        ClientServerChannel serverChannel = new ClientServerChannel(getDomain());
+        LocalConnection connection = new LocalConnection(
+                serverChannel,
+                LocalConnection.HESSIAN_SERIALIZATION);
+        ClientChannel clientChannel = new ClientChannel(connection);
+        return new CayenneContext(clientChannel);
+    }
+
+    public void testObjectRoot() throws Exception {
+
+        deleteTestData();
+
+        CayenneContext context = createClientContext();
+
+        assertNull(DataObjectUtils.objectForPK(context, ClientMtTable1.class, 1));
+        context.performGenericQuery(new SQLTemplate(
+                ClientMtTable1.class,
+                "insert into MT_TABLE1 "
+                        + "(TABLE1_ID, GLOBAL_ATTRIBUTE1, SERVER_ATTRIBUTE1) "
+                        + "values (1, 'g1', 's1')"));
+
+        assertNotNull(DataObjectUtils.objectForPK(context, ClientMtTable1.class, 1));
+    }
+}



Mime
View raw message