Package javax.cache.annotation

Examples of javax.cache.annotation.CacheResult


      assertEquals(cacheName, "bar-cache");
   }

   public void testGetCacheNameWithoutMethodCacheNameWithoutDefaultAnnotation() throws Exception {
      final Method fooMethod = Foo.class.getMethod("fooMethod", String.class, String.class);
      final CacheResult cacheResultAnnotation = fooMethod.getAnnotation(CacheResult.class);
      final String cacheName = getCacheName(fooMethod, cacheResultAnnotation.cacheName(), null, false);

      assertEquals(cacheName, "");
   }
View Full Code Here


      assertEquals(cacheName, "");
   }

   public void testGetCacheNameWithoutMethodCacheNameWithoutDefaultAndGenerate() throws Exception {
      final Method fooMethod = Foo.class.getMethod("fooMethod", String.class, String.class);
      final CacheResult cacheResultAnnotation = fooMethod.getAnnotation(CacheResult.class);
      final String cacheName = getCacheName(fooMethod, cacheResultAnnotation.cacheName(), null, true);

      assertEquals(cacheName, Foo.class.getName() + ".fooMethod(java.lang.String,java.lang.String)");
   }
View Full Code Here

      assertEquals(cacheName, Foo.class.getName() + ".fooMethod(java.lang.String,java.lang.String)");
   }

   public void testGetCacheNameWithoutMethodCacheNameAndDefault() throws Exception {
      final Method fooMethod = Foo.class.getMethod("fooMethod", String.class, String.class);
      final CacheResult cacheResultAnnotation = fooMethod.getAnnotation(CacheResult.class);
      final CacheDefaults cacheDefaultsAnnotation = Foo.class.getAnnotation(CacheDefaults.class);
      final String cacheName = getCacheName(fooMethod, cacheResultAnnotation.cacheName(), cacheDefaultsAnnotation, false);

      assertEquals(cacheName, "default-cache");
   }
View Full Code Here

      assertEquals(cacheName, "default-cache");
   }

   public void testGetCacheNameWithMethodCacheNameAndDefault() throws Exception {
      final Method barMethod = Foo.class.getMethod("barMethod");
      final CacheResult cacheResultAnnotation = barMethod.getAnnotation(CacheResult.class);
      final CacheDefaults cacheDefaultsAnnotation = Foo.class.getAnnotation(CacheDefaults.class);
      final String cacheName = getCacheName(barMethod, cacheResultAnnotation.cacheName(), cacheDefaultsAnnotation, false);

      assertEquals(cacheName, "bar-cache");
   }
View Full Code Here

      assertEquals(cacheName, "");
   }

   public void testGetCacheNameWithMethodCacheNameWithoutDefault() throws Exception {
      final Method barMethod = Bar.class.getMethod("barMethod");
      final CacheResult cacheResultAnnotation = barMethod.getAnnotation(CacheResult.class);
      final CacheDefaults cacheDefaultsAnnotation = Bar.class.getAnnotation(CacheDefaults.class);
      final String cacheName = getCacheName(barMethod, cacheResultAnnotation.cacheName(), cacheDefaultsAnnotation, false);

      assertEquals(cacheName, "bar-cache");
   }
View Full Code Here

      getCacheKeyGenerator(null, null, null);
   }

   public void testGetCacheKeyGeneratorWithoutMethodCacheKeyGeneratorWithoutDefaultAnnotation() throws Exception {
      final Method fooMethod = Foo.class.getMethod("fooMethod", String.class, String.class);
      final CacheResult cacheResultAnnotation = fooMethod.getAnnotation(CacheResult.class);
      final CacheKeyGenerator cacheKeyGenerator = getCacheKeyGenerator(beanManager, cacheResultAnnotation.cacheKeyGenerator(), null);

      assertTrue(cacheKeyGenerator instanceof DefaultCacheKeyGenerator);
   }
View Full Code Here

      assertTrue(cacheKeyGenerator instanceof DefaultCacheKeyGenerator);
   }

   public void testGetCacheKeyGeneratorWithoutMethodCacheKeyGeneratorAndDefault() throws Exception {
      final Method fooMethod = Foo.class.getMethod("fooMethod", String.class, String.class);
      final CacheResult cacheResultAnnotation = fooMethod.getAnnotation(CacheResult.class);
      final CacheDefaults cacheDefaultsAnnotation = Foo.class.getAnnotation(CacheDefaults.class);
      final CacheKeyGenerator cacheKeyGenerator = getCacheKeyGenerator(beanManager, cacheResultAnnotation.cacheKeyGenerator(), cacheDefaultsAnnotation);

      assertTrue(cacheKeyGenerator instanceof FooCacheKeyGenerator);
   }
View Full Code Here

      assertTrue(cacheKeyGenerator instanceof FooCacheKeyGenerator);
   }

   public void testCacheKeyGeneratorWithMethodCacheKeyGeneratorAndDefault() throws Exception {
      final Method barMethod = Foo.class.getMethod("barMethod");
      final CacheResult cacheResultAnnotation = barMethod.getAnnotation(CacheResult.class);
      final CacheDefaults cacheDefaultsAnnotation = Foo.class.getAnnotation(CacheDefaults.class);
      final CacheKeyGenerator cacheKeyGenerator = getCacheKeyGenerator(beanManager, cacheResultAnnotation.cacheKeyGenerator(), cacheDefaultsAnnotation);

      assertTrue(cacheKeyGenerator instanceof BarCacheKeyGenerator);
   }
View Full Code Here

      assertTrue(cacheKeyGenerator instanceof BarCacheKeyGenerator);
   }

   public void testCacheKeyGeneratorNameWithoutMethodCacheKeyGeneratorWithoutDefault() throws Exception {
      final Method fooMethod = Bar.class.getMethod("fooMethod");
      final CacheResult cacheResultAnnotation = fooMethod.getAnnotation(CacheResult.class);
      final CacheDefaults cacheDefaultsAnnotation = Bar.class.getAnnotation(CacheDefaults.class);
      final CacheKeyGenerator cacheKeyGenerator = getCacheKeyGenerator(beanManager, cacheResultAnnotation.cacheKeyGenerator(), cacheDefaultsAnnotation);

      assertTrue(cacheKeyGenerator instanceof DefaultCacheKeyGenerator);
   }
View Full Code Here

      assertTrue(cacheKeyGenerator instanceof DefaultCacheKeyGenerator);
   }

   public void testGetCacheKeyGeneratorWithMethodCacheKeyGeneratorWithoutDefault() throws Exception {
      final Method barMethod = Bar.class.getMethod("barMethod");
      final CacheResult cacheResultAnnotation = barMethod.getAnnotation(CacheResult.class);
      final CacheDefaults cacheDefaultsAnnotation = Bar.class.getAnnotation(CacheDefaults.class);
      final CacheKeyGenerator cacheKeyGenerator = getCacheKeyGenerator(beanManager, cacheResultAnnotation.cacheKeyGenerator(), cacheDefaultsAnnotation);

      assertTrue(cacheKeyGenerator instanceof BarCacheKeyGenerator);
   }
View Full Code Here

TOP

Related Classes of javax.cache.annotation.CacheResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.