Package org.springmodules.cache

Examples of org.springmodules.cache.CachingModel


    String cacheName = "testCache";

    Element element = new DomElementStub("caching");
    element.setAttribute("cacheName", cacheName);

    CachingModel actual = parser.parseCachingModel(element);
    CachingModel expected = new EhCacheCachingModel(cacheName);

    assertEquals(expected, actual);
  }
View Full Code Here


    for (int i = 0; i < modelElementCount; i++) {
      Element modelElement = (Element) modelElements.get(i);
      String key = modelElement.getAttribute(cacheModelKey);

      CachingModel model = cacheModelParser.parseCachingModel(modelElement);
      models.put(key, model);
    }

    return models;
  }
View Full Code Here

    String cacheName = "testCache";

    Element element = new DomElementStub("caching");
    element.setAttribute("cacheName", cacheName);

    CachingModel actual = parser.parseCachingModel(element);
    CachingModel expected = new JcsCachingModel(cacheName);

    assertEquals(expected, actual);
  }
View Full Code Here

    String node = "testCache";

    Element element = new DomElementStub("caching");
    element.setAttribute("node", node);

    CachingModel actual = parser.parseCachingModel(element);
    CachingModel expected = new JbossCacheCachingModel(node);

    assertEquals(expected, actual);
  }
View Full Code Here

    Element element = new DomElementStub("caching");
    element.setAttribute("cacheName", cacheName);
    element.setAttribute("timeToLive", "2");

    CachingModel actual = parser.parseCachingModel(element);
    CoherenceCachingModel expected = new CoherenceCachingModel(cacheName);
    expected.setTimeToLive(2l);
   
    assertEquals(expected, actual);
  }
View Full Code Here

    Element element = new DomElementStub("caching");
    element.setAttribute("cacheName", cacheName);
    element.setAttribute("timeToLive", "2");
    element.setAttribute("waitForResponse", "2");
    CachingModel actual = parser.parseCachingModel(element);
    GigaSpacesCachingModel expected = new GigaSpacesCachingModel(cacheName);
    expected.setTimeToLive(2l);
    expected.setWaitForResponse(2l);

    assertEquals(expected, actual);
View Full Code Here

  }

  public void testAfterPropertiesSetWhenCacheModelValidatorThrowsException() {
    expectGetCacheModelValidator();

    CachingModel model = new MockCachingModel();
    Map models = new HashMap();
    models.put("key", model);

    InvalidCacheModelException expected = new InvalidCacheModelException("");
    validator.validateCachingModel(model);
View Full Code Here

      models.put(Integer.toString(i), new MockCachingModel());
    }

    for (Iterator i = models.entrySet().iterator(); i.hasNext();) {
      Map.Entry entry = (Map.Entry) i.next();
      CachingModel model = (CachingModel) entry.getValue();
      validator.validateCachingModel(model);
    }

    replay();
View Full Code Here

   *          the class declaring the method.
   * @return <code>true</code> if the return value of the intercepted method
   *         should be cached.
   */
  public final boolean matches(Method method, Class targetClass) {
    CachingModel model = cachingModelSource
        .model(method, targetClass);

    boolean matches = (model != null);
    return matches;
  }
View Full Code Here

      throws Throwable {
    setUpCachingListener();
    expectMethodInvocationReturnsCacheableMethod();

    Serializable key = "Luke Skywalker";
    CachingModel model = expectGetFromCache(key, null);

    invocationControl.expectAndReturn(invocation.proceed(), null);

    cacheProviderFacade.putInCache(key, model,
        AbstractCachingInterceptor.NULL_ENTRY);
View Full Code Here

TOP

Related Classes of org.springmodules.cache.CachingModel

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.