cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [1/2] cayenne git commit: CAY-2259 QueryCache: support for referencing type-safe caches + move cayenne-cache-invalidation module out of lifecycle module
Date Mon, 03 Apr 2017 13:39:19 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 67225b387 -> d71bfe1b2


http://git-wip-us.apache.org/repos/asf/cayenne/blob/d71bfe1b/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/cache/CacheInvalidationIT.java
----------------------------------------------------------------------
diff --git a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/cache/CacheInvalidationIT.java
b/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/cache/CacheInvalidationIT.java
deleted file mode 100644
index 440da21..0000000
--- a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/cache/CacheInvalidationIT.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*****************************************************************
- *   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.lifecycle.cache;
-
-import org.apache.cayenne.ObjectContext;
-import org.apache.cayenne.lifecycle.db.E1;
-import org.apache.cayenne.lifecycle.unit.CacheInvalidationCase;
-import org.apache.cayenne.query.ObjectSelect;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * @since 4.0
- */
-public class CacheInvalidationIT extends CacheInvalidationCase {
-
-    @Ignore("MapQueryCache doesn't store cache groups in different caches, so it can't run
this test for now.")
-    @Test
-    public void testInvalidate_Custom() throws Exception {
-        ObjectContext context = runtime.newContext();
-
-        // no explicit cache group must still work - it lands inside default cache called
'cayenne.default.cache'
-        ObjectSelect<E1> g0 = ObjectSelect.query(E1.class).localCache();
-        ObjectSelect<E1> g1 = ObjectSelect.query(E1.class).localCache("g1");
-        ObjectSelect<E1> g2 = ObjectSelect.query(E1.class).localCache("g2");
-
-        assertEquals(0, g0.selectCount(context));
-        assertEquals(0, g1.selectCount(context));
-        assertEquals(0, g2.selectCount(context));
-
-        e1.insert(1).insert(2);
-
-        // inserted via SQL... query results are still cached...
-        assertEquals(0, g0.selectCount(context));
-        assertEquals(0, g1.selectCount(context));
-        assertEquals(0, g2.selectCount(context));
-
-
-        E1 e1 = context.newObject(E1.class);
-        context.commitChanges();
-        runtime.getDataDomain().getQueryCache().removeGroup("g1");
-
-        // inserted via Cayenne... "g1" should get auto refreshed...
-        assertEquals(0, g0.selectCount(context));
-        assertEquals(3, g1.selectCount(context));
-        assertEquals(0, g2.selectCount(context));
-
-        context.deleteObject(e1);
-        context.commitChanges();
-
-        // deleted via Cayenne... "g1" should get auto refreshed
-        assertEquals(0, g0.selectCount(context));
-        assertEquals(2, g1.selectCount(context));
-        assertEquals(0, g2.selectCount(context));
-    }
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d71bfe1b/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/unit/CacheInvalidationCase.java
----------------------------------------------------------------------
diff --git a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/unit/CacheInvalidationCase.java
b/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/unit/CacheInvalidationCase.java
deleted file mode 100644
index 1350ce4..0000000
--- a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/unit/CacheInvalidationCase.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*****************************************************************
- *   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.lifecycle.unit;
-
-import java.util.Collection;
-import java.util.Collections;
-
-import org.apache.cayenne.Persistent;
-import org.apache.cayenne.configuration.server.ServerRuntime;
-import org.apache.cayenne.configuration.server.ServerRuntimeBuilder;
-import org.apache.cayenne.di.Module;
-import org.apache.cayenne.lifecycle.cache.CacheInvalidationModuleBuilder;
-import org.apache.cayenne.lifecycle.cache.InvalidationFunction;
-import org.apache.cayenne.lifecycle.cache.InvalidationHandler;
-import org.apache.cayenne.test.jdbc.DBHelper;
-import org.apache.cayenne.test.jdbc.TableHelper;
-import org.junit.After;
-import org.junit.Before;
-
-public class CacheInvalidationCase {
-
-	protected ServerRuntime runtime;
-
-	protected TableHelper e1;
-
-	@Before
-	public void startCayenne() throws Exception {
-		this.runtime = configureCayenne().build();
-
-		DBHelper dbHelper = new DBHelper(runtime.getDataSource());
-
-		this.e1 = new TableHelper(dbHelper, "E1").setColumns("ID");
-		this.e1.deleteAll();
-	}
-
-	protected ServerRuntimeBuilder configureCayenne() {
-		Module cacheInvalidationModule = CacheInvalidationModuleBuilder
-				.builder()
-                .noCacheGroupsHandler()
-				.invalidationHandler(G1InvalidationHandler.class)
-				.build();
-
-		return ServerRuntime.builder()
-				.addModule(cacheInvalidationModule)
-				.addConfig("cayenne-lifecycle.xml");
-	}
-
-	@After
-	public void shutdownCayenne() {
-		if (runtime != null) {
-			runtime.shutdown();
-		}
-	}
-
-	public static class G1InvalidationHandler implements InvalidationHandler {
-		@Override
-		public InvalidationFunction canHandle(Class<? extends Persistent> type) {
-			return new InvalidationFunction() {
-				@Override
-				public Collection<String> apply(Persistent persistent) {
-					return Collections.singleton("g1");
-				}
-			};
-		}
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d71bfe1b/docs/doc/src/main/resources/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --git a/docs/doc/src/main/resources/RELEASE-NOTES.txt b/docs/doc/src/main/resources/RELEASE-NOTES.txt
index 20f6164..058e88c 100644
--- a/docs/doc/src/main/resources/RELEASE-NOTES.txt
+++ b/docs/doc/src/main/resources/RELEASE-NOTES.txt
@@ -18,10 +18,10 @@ CAY-2109 cayenne-crypto: add value authentication (HMAC)
 CAY-2210 Query cache: incorrect cache key for queries with custom value objects
 CAY-2255 ObjectSelect improvement: columns as full entities
 CAY-2258 DI: type-safe binding of List and Map
-CAY-2266 Move EventBridge implementations into autoloadable modules
-CAY-2267 Contribute lifecycle events listeners via DI
 CAY-2259 QueryCache: support for referencing type-safe caches
 CAY-2261 Replace NamedQuery with MappedXYZ in *datamap.vm
+CAY-2266 Move EventBridge implementations into autoloadable modules
+CAY-2267 Contribute lifecycle events listeners via DI
 CAY-2268 DI: Refactor ListBuilder API ambiguities for before() / after() bindings
 CAY-2269 Add support for date/time components extraction in expression functions
 CAY-2270 Update function support in expression parser

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d71bfe1b/docs/doc/src/main/resources/UPGRADE.txt
----------------------------------------------------------------------
diff --git a/docs/doc/src/main/resources/UPGRADE.txt b/docs/doc/src/main/resources/UPGRADE.txt
index ff68183..9011802 100644
--- a/docs/doc/src/main/resources/UPGRADE.txt
+++ b/docs/doc/src/main/resources/UPGRADE.txt
@@ -7,6 +7,13 @@ IMPORTANT: be sure to read all notes for the intermediate releases between
your
 
 UPGRADING TO 4.0.M6
 
+* Per CAY-2262 new modules moved out from cayenne-lifecycle and should be added to pom.xml
if the corresponding
+        functionality is used by your project:
+       - cayenne-cache-invalidation module
+
+* Per CAY-2259 InvalidationFunction returns CacheGroupDescriptor instead of simple String
with cache group name,
+       change your custom functions accordingly.
+
 * Per CAY-2268 DI methods for binding ordered lists, introduced in 4.0.M3 where changed:
        - method after() replaced by explicit addAfter(), addAllAfter()
        - method before() replaced by insertBefore(), insertAllBefore()

http://git-wip-us.apache.org/repos/asf/cayenne/blob/d71bfe1b/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 6895ce8..a3d82b6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,13 +62,14 @@
 		<module>cayenne-joda</module>
 		<module>cayenne-dbcp2</module>
 		<module>cayenne-jcache</module>
+		<module>cayenne-cache-invalidation</module>
 		<module>itests</module>
 		<module>modeler</module>
 		<module>maven-plugins</module>
 		<module>tutorials</module>
 		<module>docs</module>
 		<module>eventbridges</module>
-	</modules>
+    </modules>
 	<issueManagement>
 		<system>jira</system>
 		<url>https://issues.apache.org/jira/browse/CAY</url>


Mime
View raw message