You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by rm...@apache.org on 2017/09/01 15:41:08 UTC

svn commit: r1806984 - /commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/

Author: rmannibucau
Date: Fri Sep  1 15:41:07 2017
New Revision: 1806984

URL: http://svn.apache.org/viewvc?rev=1806984&view=rev
Log:
JCS-183 bad shortcut, adding back the cache activation + fixing bad copy/paste in cdi interceptors

Modified:
    commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CDIJCacheHelper.java
    commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CacheInvocationContextImpl.java
    commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CachePutInterceptor.java
    commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CacheRemoveAllInterceptor.java
    commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CacheRemoveInterceptor.java

Modified: commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CDIJCacheHelper.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CDIJCacheHelper.java?rev=1806984&r1=1806983&r2=1806984&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CDIJCacheHelper.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CDIJCacheHelper.java Fri Sep  1 15:41:07 2017
@@ -96,6 +96,7 @@ public class CDIJCacheHelper
                 if (methodMeta == null)
                 {
                     methodMeta = createMeta(ic);
+                    methods.put(key, methodMeta);
                 }
             }
         }

Modified: commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CacheInvocationContextImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CacheInvocationContextImpl.java?rev=1806984&r1=1806983&r2=1806984&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CacheInvocationContextImpl.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CacheInvocationContextImpl.java Fri Sep  1 15:41:07 2017
@@ -81,10 +81,12 @@ public class CacheInvocationContextImpl<
         }
         else
         {
+            int outIdx = 0;
             for (int idx = 0; idx < indexes.length; idx++)
             {
                 final int i = indexes[idx];
-                parametersAsArray[i] = newCacheInvocationParameterImpl(parameterTypes[i], args[i], parameterAnnotations.get(i), i);
+                parametersAsArray[outIdx] = newCacheInvocationParameterImpl(parameterTypes[i], args[i], parameterAnnotations.get(i), i);
+                outIdx++;
             }
         }
         return parametersAsArray;

Modified: commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CachePutInterceptor.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CachePutInterceptor.java?rev=1806984&r1=1806983&r2=1806984&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CachePutInterceptor.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CachePutInterceptor.java Fri Sep  1 15:41:07 2017
@@ -45,15 +45,15 @@ public class CachePutInterceptor impleme
     {
         final CDIJCacheHelper.MethodMeta methodMeta = helper.findMeta(ic);
 
-        final String cacheName = methodMeta.getCacheResultCacheName();
+        final String cacheName = methodMeta.getCachePutCacheName();
 
-        final CacheResolverFactory cacheResolverFactory = methodMeta.getCacheResultResolverFactory();
+        final CacheResolverFactory cacheResolverFactory = methodMeta.getCachePutResolverFactory();
         final CacheKeyInvocationContext<CachePut> context = new CacheKeyInvocationContextImpl<CachePut>(
                 ic, methodMeta.getCachePut(), cacheName, methodMeta);
         final CacheResolver cacheResolver = cacheResolverFactory.getCacheResolver(context);
         final Cache<Object, Object> cache = cacheResolver.resolveCache(context);
 
-        final GeneratedCacheKey cacheKey = methodMeta.getCacheResultKeyGenerator().generateCacheKey(context);
+        final GeneratedCacheKey cacheKey = methodMeta.getCachePutKeyGenerator().generateCacheKey(context);
         final CachePut cachePut = methodMeta.getCachePut();
         final boolean afterInvocation = methodMeta.isCachePutAfter();
 

Modified: commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CacheRemoveAllInterceptor.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CacheRemoveAllInterceptor.java?rev=1806984&r1=1806983&r2=1806984&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CacheRemoveAllInterceptor.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CacheRemoveAllInterceptor.java Fri Sep  1 15:41:07 2017
@@ -44,9 +44,9 @@ public class CacheRemoveAllInterceptor i
     {
         final CDIJCacheHelper.MethodMeta methodMeta = helper.findMeta(ic);
 
-        final String cacheName = methodMeta.getCacheResultCacheName();
+        final String cacheName = methodMeta.getCacheRemoveAllCacheName();
 
-        final CacheResolverFactory cacheResolverFactory = methodMeta.getCacheResultResolverFactory();
+        final CacheResolverFactory cacheResolverFactory = methodMeta.getCacheRemoveAllResolverFactory();
         final CacheKeyInvocationContext<CacheRemoveAll> context = new CacheKeyInvocationContextImpl<CacheRemoveAll>(
                 ic, methodMeta.getCacheRemoveAll(), cacheName, methodMeta);
         final CacheResolver cacheResolver = cacheResolverFactory.getCacheResolver(context);

Modified: commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CacheRemoveInterceptor.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CacheRemoveInterceptor.java?rev=1806984&r1=1806983&r2=1806984&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CacheRemoveInterceptor.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CacheRemoveInterceptor.java Fri Sep  1 15:41:07 2017
@@ -45,15 +45,15 @@ public class CacheRemoveInterceptor impl
     {
         final CDIJCacheHelper.MethodMeta methodMeta = helper.findMeta(ic);
 
-        final String cacheName = methodMeta.getCacheResultCacheName();
+        final String cacheName = methodMeta.getCacheRemoveCacheName();
 
-        final CacheResolverFactory cacheResolverFactory = methodMeta.getCacheResultResolverFactory();
+        final CacheResolverFactory cacheResolverFactory = methodMeta.getCacheRemoveResolverFactory();
         final CacheKeyInvocationContext<CacheRemove> context = new CacheKeyInvocationContextImpl<CacheRemove>(
                 ic, methodMeta.getCacheRemove(), cacheName, methodMeta);
         final CacheResolver cacheResolver = cacheResolverFactory.getCacheResolver(context);
         final Cache<Object, Object> cache = cacheResolver.resolveCache(context);
 
-        final GeneratedCacheKey cacheKey = methodMeta.getCacheResultKeyGenerator().generateCacheKey(context);
+        final GeneratedCacheKey cacheKey = methodMeta.getCacheRemoveKeyGenerator().generateCacheKey(context);
         final CacheRemove cacheRemove = methodMeta.getCacheRemove();
         final boolean afterInvocation = methodMeta.isCacheRemoveAfter();
 



Fwd: svn commit: r1806984 - /commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/

Posted by Gary Gregory <ga...@gmail.com>.
Is there any way to unit test that?

Gary

---------- Forwarded message ----------
From: <rm...@apache.org>
Date: Fri, Sep 1, 2017 at 9:41 AM
Subject: svn commit: r1806984 -
/commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/
To: commits@commons.apache.org


Author: rmannibucau
Date: Fri Sep  1 15:41:07 2017
New Revision: 1806984

URL: http://svn.apache.org/viewvc?rev=1806984&view=rev
Log:
JCS-183 bad shortcut, adding back the cache activation + fixing bad
copy/paste in cdi interceptors

Modified:
    commons/proper/jcs/trunk/commons-jcs-jcache/src/main/
java/org/apache/commons/jcs/jcache/cdi/CDIJCacheHelper.java
    commons/proper/jcs/trunk/commons-jcs-jcache/src/main/
java/org/apache/commons/jcs/jcache/cdi/CacheInvocationContextImpl.java
    commons/proper/jcs/trunk/commons-jcs-jcache/src/main/
java/org/apache/commons/jcs/jcache/cdi/CachePutInterceptor.java
    commons/proper/jcs/trunk/commons-jcs-jcache/src/main/
java/org/apache/commons/jcs/jcache/cdi/CacheRemoveAllInterceptor.java
    commons/proper/jcs/trunk/commons-jcs-jcache/src/main/
java/org/apache/commons/jcs/jcache/cdi/CacheRemoveInterceptor.java

Modified: commons/proper/jcs/trunk/commons-jcs-jcache/src/main/
java/org/apache/commons/jcs/jcache/cdi/CDIJCacheHelper.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/
commons-jcs-jcache/src/main/java/org/apache/commons/jcs/
jcache/cdi/CDIJCacheHelper.java?rev=1806984&r1=1806983&r2=1806984&view=diff
============================================================
==================
--- commons/proper/jcs/trunk/commons-jcs-jcache/src/main/
java/org/apache/commons/jcs/jcache/cdi/CDIJCacheHelper.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-jcache/src/main/
java/org/apache/commons/jcs/jcache/cdi/CDIJCacheHelper.java Fri Sep  1
15:41:07 2017
@@ -96,6 +96,7 @@ public class CDIJCacheHelper
                 if (methodMeta == null)
                 {
                     methodMeta = createMeta(ic);
+                    methods.put(key, methodMeta);
                 }
             }
         }

Modified: commons/proper/jcs/trunk/commons-jcs-jcache/src/main/
java/org/apache/commons/jcs/jcache/cdi/CacheInvocationContextImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/
commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/
CacheInvocationContextImpl.java?rev=1806984&r1=1806983&r2=1806984&view=diff
============================================================
==================
--- commons/proper/jcs/trunk/commons-jcs-jcache/src/main/
java/org/apache/commons/jcs/jcache/cdi/CacheInvocationContextImpl.java
(original)
+++ commons/proper/jcs/trunk/commons-jcs-jcache/src/main/
java/org/apache/commons/jcs/jcache/cdi/CacheInvocationContextImpl.java Fri
Sep  1 15:41:07 2017
@@ -81,10 +81,12 @@ public class CacheInvocationContextImpl<
         }
         else
         {
+            int outIdx = 0;
             for (int idx = 0; idx < indexes.length; idx++)
             {
                 final int i = indexes[idx];
-                parametersAsArray[i] =
newCacheInvocationParameterImpl(parameterTypes[i],
args[i], parameterAnnotations.get(i), i);
+                parametersAsArray[outIdx] =
newCacheInvocationParameterImpl(parameterTypes[i],
args[i], parameterAnnotations.get(i), i);
+                outIdx++;
             }
         }
         return parametersAsArray;

Modified: commons/proper/jcs/trunk/commons-jcs-jcache/src/main/
java/org/apache/commons/jcs/jcache/cdi/CachePutInterceptor.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/
commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/
CachePutInterceptor.java?rev=1806984&r1=1806983&r2=1806984&view=diff
============================================================
==================
--- commons/proper/jcs/trunk/commons-jcs-jcache/src/main/
java/org/apache/commons/jcs/jcache/cdi/CachePutInterceptor.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-jcache/src/main/
java/org/apache/commons/jcs/jcache/cdi/CachePutInterceptor.java Fri Sep  1
15:41:07 2017
@@ -45,15 +45,15 @@ public class CachePutInterceptor impleme
     {
         final CDIJCacheHelper.MethodMeta methodMeta = helper.findMeta(ic);

-        final String cacheName = methodMeta.getCacheResultCacheName();
+        final String cacheName = methodMeta.getCachePutCacheName();

-        final CacheResolverFactory cacheResolverFactory = methodMeta.
getCacheResultResolverFactory();
+        final CacheResolverFactory cacheResolverFactory = methodMeta.
getCachePutResolverFactory();
         final CacheKeyInvocationContext<CachePut> context = new
CacheKeyInvocationContextImpl<CachePut>(
                 ic, methodMeta.getCachePut(), cacheName, methodMeta);
         final CacheResolver cacheResolver = cacheResolverFactory.
getCacheResolver(context);
         final Cache<Object, Object> cache = cacheResolver.resolveCache(
context);

-        final GeneratedCacheKey cacheKey = methodMeta.
getCacheResultKeyGenerator().generateCacheKey(context);
+        final GeneratedCacheKey cacheKey = methodMeta.
getCachePutKeyGenerator().generateCacheKey(context);
         final CachePut cachePut = methodMeta.getCachePut();
         final boolean afterInvocation = methodMeta.isCachePutAfter();


Modified: commons/proper/jcs/trunk/commons-jcs-jcache/src/main/
java/org/apache/commons/jcs/jcache/cdi/CacheRemoveAllInterceptor.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/
commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/
CacheRemoveAllInterceptor.java?rev=1806984&r1=1806983&r2=1806984&view=diff
============================================================
==================
--- commons/proper/jcs/trunk/commons-jcs-jcache/src/main/
java/org/apache/commons/jcs/jcache/cdi/CacheRemoveAllInterceptor.java
(original)
+++ commons/proper/jcs/trunk/commons-jcs-jcache/src/main/
java/org/apache/commons/jcs/jcache/cdi/CacheRemoveAllInterceptor.java Fri
Sep  1 15:41:07 2017
@@ -44,9 +44,9 @@ public class CacheRemoveAllInterceptor i
     {
         final CDIJCacheHelper.MethodMeta methodMeta = helper.findMeta(ic);

-        final String cacheName = methodMeta.getCacheResultCacheName();
+        final String cacheName = methodMeta.getCacheRemoveAllCacheName();

-        final CacheResolverFactory cacheResolverFactory = methodMeta.
getCacheResultResolverFactory();
+        final CacheResolverFactory cacheResolverFactory = methodMeta.
getCacheRemoveAllResolverFactory();
         final CacheKeyInvocationContext<CacheRemoveAll> context = new
CacheKeyInvocationContextImpl<CacheRemoveAll>(
                 ic, methodMeta.getCacheRemoveAll(), cacheName, methodMeta);
         final CacheResolver cacheResolver = cacheResolverFactory.
getCacheResolver(context);

Modified: commons/proper/jcs/trunk/commons-jcs-jcache/src/main/
java/org/apache/commons/jcs/jcache/cdi/CacheRemoveInterceptor.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/
commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/
CacheRemoveInterceptor.java?rev=1806984&r1=1806983&r2=1806984&view=diff
============================================================
==================
--- commons/proper/jcs/trunk/commons-jcs-jcache/src/main/
java/org/apache/commons/jcs/jcache/cdi/CacheRemoveInterceptor.java
(original)
+++ commons/proper/jcs/trunk/commons-jcs-jcache/src/main/
java/org/apache/commons/jcs/jcache/cdi/CacheRemoveInterceptor.java Fri Sep
1 15:41:07 2017
@@ -45,15 +45,15 @@ public class CacheRemoveInterceptor impl
     {
         final CDIJCacheHelper.MethodMeta methodMeta = helper.findMeta(ic);

-        final String cacheName = methodMeta.getCacheResultCacheName();
+        final String cacheName = methodMeta.getCacheRemoveCacheName();

-        final CacheResolverFactory cacheResolverFactory = methodMeta.
getCacheResultResolverFactory();
+        final CacheResolverFactory cacheResolverFactory = methodMeta.
getCacheRemoveResolverFactory();
         final CacheKeyInvocationContext<CacheRemove> context = new
CacheKeyInvocationContextImpl<CacheRemove>(
                 ic, methodMeta.getCacheRemove(), cacheName, methodMeta);
         final CacheResolver cacheResolver = cacheResolverFactory.
getCacheResolver(context);
         final Cache<Object, Object> cache = cacheResolver.resolveCache(
context);

-        final GeneratedCacheKey cacheKey = methodMeta.
getCacheResultKeyGenerator().generateCacheKey(context);
+        final GeneratedCacheKey cacheKey = methodMeta.
getCacheRemoveKeyGenerator().generateCacheKey(context);
         final CacheRemove cacheRemove = methodMeta.getCacheRemove();
         final boolean afterInvocation = methodMeta.isCacheRemoveAfter();