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/05/09 13:11:18 UTC
svn commit: r654756 - in
/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src:
main/java/org/apache/cayenne/cache/MapQueryCache.java
test/java/org/apache/cayenne/cache/MapQueryCacheTest.java
Author: aadamchik
Date: Fri May 9 04:11:18 2008
New Revision: 654756
URL: http://svn.apache.org/viewvc?rev=654756&view=rev
Log:
CAY-1053 MapQueryCache.CacheEntry not serializable
Added:
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/cache/MapQueryCacheTest.java
Modified:
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/cache/MapQueryCache.java
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/cache/MapQueryCache.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/cache/MapQueryCache.java?rev=654756&r1=654755&r2=654756&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/cache/MapQueryCache.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/cache/MapQueryCache.java Fri May 9 04:11:18 2008
@@ -144,7 +144,7 @@
return map.size();
}
- final class CacheEntry {
+ final class CacheEntry implements Serializable {
List<?> list;
String[] cacheGroups;
Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/cache/MapQueryCacheTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/cache/MapQueryCacheTest.java?rev=654756&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/cache/MapQueryCacheTest.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/cache/MapQueryCacheTest.java Fri May 9 04:11:18 2008
@@ -0,0 +1,47 @@
+/*****************************************************************
+ * 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.cache;
+
+import java.util.ArrayList;
+
+import junit.framework.TestCase;
+
+import org.apache.cayenne.query.MockQueryMetadata;
+import org.apache.cayenne.util.Util;
+
+public class MapQueryCacheTest extends TestCase {
+
+ public void testSerializability() throws Exception {
+
+ MapQueryCache cache = new MapQueryCache(5);
+ cache.put(new MockQueryMetadata() {
+
+ @Override
+ public String getCacheKey() {
+ return "key";
+ }
+ }, new ArrayList<Object>());
+
+ assertEquals(1, cache.size());
+
+ MapQueryCache deserialized = (MapQueryCache) Util.cloneViaSerialization(cache);
+ assertNotNull(deserialized);
+ assertEquals(1, deserialized.size());
+ }
+}