cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1090121 - in /cayenne/main/branches/STABLE-3.0: docs/doc/src/main/resources/ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/
Date Fri, 08 Apr 2011 05:48:35 GMT
Author: aadamchik
Date: Fri Apr  8 05:48:35 2011
New Revision: 1090121

URL: http://svn.apache.org/viewvc?rev=1090121&view=rev
Log:
CAY-1432 java.io.NotSerializableException when using OSCache for query cache with prefetches
and persitent cache.

patch by Dzmitry Kazimirchyk

Added:
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataDomainQueryActionTest.java
Modified:
    cayenne/main/branches/STABLE-3.0/docs/doc/src/main/resources/RELEASE-NOTES.txt
    cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ListWithPrefetches.java

Modified: cayenne/main/branches/STABLE-3.0/docs/doc/src/main/resources/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/docs/doc/src/main/resources/RELEASE-NOTES.txt?rev=1090121&r1=1090120&r2=1090121&view=diff
==============================================================================
--- cayenne/main/branches/STABLE-3.0/docs/doc/src/main/resources/RELEASE-NOTES.txt (original)
+++ cayenne/main/branches/STABLE-3.0/docs/doc/src/main/resources/RELEASE-NOTES.txt Fri Apr
 8 05:48:35 2011
@@ -19,6 +19,7 @@ CAY-1500 MySQL JDBC Batching
 Bug Fixes Since 3.0.1:
 
 CAY-1403 Method "readNestedProperty" Should Resolve Through Iterative Invocations onto DataObject
and Not Complete Within Cayenne.readNestedProperty
+CAY-1432 java.io.NotSerializableException when using OSCache for query cache with prefetches
and persitent cache. 
 CAY-1444 NPE when persisting a newly instatiated object
 CAY-1456 Investigate auto-increment columns on DB2 and switch the adapter policy to support
them
 CAY-1484 Flattened attribute queries are incorrectly generated

Modified: cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ListWithPrefetches.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ListWithPrefetches.java?rev=1090121&r1=1090120&r2=1090121&view=diff
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ListWithPrefetches.java
(original)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ListWithPrefetches.java
Fri Apr  8 05:48:35 2011
@@ -19,6 +19,7 @@
 
 package org.apache.cayenne.access;
 
+import java.io.Serializable;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Iterator;
@@ -37,7 +38,7 @@ import java.util.Map;
 //
 // Future alternatives may include caching the entire QueryResponse... or maybe leaving
 // everything the way it is.
-class ListWithPrefetches implements List {
+class ListWithPrefetches implements List, Serializable {
 
     private final List list;
     private final Map prefetchResultsByPath;

Added: cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataDomainQueryActionTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataDomainQueryActionTest.java?rev=1090121&view=auto
==============================================================================
--- cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataDomainQueryActionTest.java
(added)
+++ cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataDomainQueryActionTest.java
Fri Apr  8 05:48:35 2011
@@ -0,0 +1,89 @@
+/*****************************************************************
+ *   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.access;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.apache.cayenne.ObjectContext;
+import org.apache.cayenne.cache.MockQueryCache;
+import org.apache.cayenne.cache.QueryCache;
+import org.apache.cayenne.cache.QueryCacheEntryFactory;
+import org.apache.cayenne.query.QueryCacheStrategy;
+import org.apache.cayenne.query.QueryMetadata;
+import org.apache.cayenne.query.SelectQuery;
+import org.apache.cayenne.query.SortOrder;
+import org.apache.cayenne.testdo.testmap.Painting;
+import org.apache.cayenne.unit.CayenneCase;
+
+
+public class DataDomainQueryActionTest extends CayenneCase {
+
+    @Override
+    public void setUp() throws Exception {
+        deleteTestData();
+    }
+    
+    @Override
+    public void tearDown() {
+        getDomain().resetProperties();
+    }
+   
+    public void testCachedQuery() {
+        
+        DataDomain domain = getDomain();
+        
+        ObjectContext context = createDataContext();
+        
+        Painting p = context.newObject(Painting.class);
+        p.setPaintingTitle("sample");
+        
+        SelectQuery query = new SelectQuery(Painting.class);
+        
+        query.addPrefetch(Painting.TO_GALLERY_PROPERTY);
+        query.addPrefetch(Painting.TO_ARTIST_PROPERTY);
+        query.addOrdering(Painting.PAINTING_TITLE_PROPERTY, SortOrder.ASCENDING);
+        query.setCacheStrategy(QueryCacheStrategy.SHARED_CACHE);
+        query.setPageSize(5);
+        
+        QueryCache cache = domain.queryCache;
+        
+        domain.queryCache = new MockQueryCache() {
+           
+            @Override
+            public List get(QueryMetadata metadata, QueryCacheEntryFactory factory) {
+                Object results = factory.createObject();
+                assertTrue("Query cache is not serializable.", results instanceof Serializable);
+                
+                return null;
+            }
+            
+            @Override
+            public void put(QueryMetadata metadata, List results) {
+                assertTrue("Query cache is not serializable.", results instanceof Serializable);
+            }
+        };
+        
+        DataDomainQueryAction action = new DataDomainQueryAction(context, domain, query);
+        action.execute();
+        
+        domain.queryCache = cache;
+    }
+    
+}



Mime
View raw message