Package org.springmodules.cache

Examples of org.springmodules.cache.FlushingModel


    boolean flushBeforeMethodExecution = true;

    Element element = new DomElementStub("flushing");
    element.setAttribute("cacheNames", cacheNames);

    FlushingModel actual = parser.doParseFlushingModel(element,
        flushBeforeMethodExecution);
    EhCacheFlushingModel expected = new EhCacheFlushingModel(cacheNames);
    expected.setFlushBeforeMethodExecution(flushBeforeMethodExecution);

    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);

      FlushingModel model = cacheModelParser.parseFlushingModel(modelElement);
      models.put(key, model);
    }

    return models;
  }
View Full Code Here

    JcsFlushingModel expected = new JcsFlushingModel();
    expected.setCacheStructs(cacheStructs);
    expected.setFlushBeforeMethodExecution(true);

    FlushingModel actual = parser.doParseFlushingModel(element,
        flushBeforeMethodExecution);

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

    boolean flushBeforeMethodExecution = true;

    Element element = new DomElementStub("flushing");
    element.appendChild(createCacheElement(cacheName, groups));

    FlushingModel actual = parser.doParseFlushingModel(element,
        flushBeforeMethodExecution);
    JcsFlushingModel expected = new JcsFlushingModel();
    expected.setCacheStruct(new CacheStruct(cacheName, groups));
    expected.setFlushBeforeMethodExecution(flushBeforeMethodExecution);
View Full Code Here

  public void testDoParseFlushingModelWithoutCacheSubelements() {
    boolean flushBeforeMethodExecution = true;

    Element element = new DomElementStub("flushing");

    FlushingModel actual = parser.doParseFlushingModel(element,
        flushBeforeMethodExecution);
    JcsFlushingModel expected = new JcsFlushingModel();
    expected.setFlushBeforeMethodExecution(flushBeforeMethodExecution);

    assertEquals(expected, actual);
View Full Code Here

    boolean flushBeforeMethodExecution = true;

    Element element = new DomElementStub("flushing");
    element.setAttribute("nodes", nodes);

    FlushingModel actual = parser.doParseFlushingModel(element,
        flushBeforeMethodExecution);
    JbossCacheFlushingModel expected = new JbossCacheFlushingModel(nodes);
    expected.setFlushBeforeMethodExecution(flushBeforeMethodExecution);

    assertEquals(expected, actual);
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) {
    FlushingModel model = flushingModelSource.getFlushingModel(method,
        targetClass);

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

      String key = null;
      try {
        for (Iterator i = flushingModels.keySet().iterator(); i.hasNext();) {
          key = (String) i.next();
          FlushingModel model = (FlushingModel) flushingModels.get(key);
          newSource.addModel(model, key);
        }
      } catch (Exception exception) {
        throw new FatalCacheException(
            "Unable to add model stored under the key "
View Full Code Here

   * @throws Throwable
   *           any exception thrown when executing the intercepted method
   */
  public final Object invoke(MethodInvocation methodInvocation)
      throws Throwable {
    FlushingModel model = getModel(methodInvocation);

    if (null == model) {
      logger.info("Unable to flush cache. "
          + "No model is associated to the intercepted method");
      return methodInvocation.proceed();
    }

    Object proceedReturnValue = null;

    if (model.flushBeforeMethodExecution()) {
      cacheProviderFacade.flushCache(model);
      proceedReturnValue = methodInvocation.proceed();

    } else {
      proceedReturnValue = methodInvocation.proceed();
View Full Code Here

    boolean flushBeforeMethodExecution = true;

    Element element = new DomElementStub("flushing");
    element.setAttribute("cacheNames", cacheNames);

    FlushingModel actual = parser.doParseFlushingModel(element,
        flushBeforeMethodExecution);
    CoherenceFlushingModel expected = new CoherenceFlushingModel(cacheNames);
    expected.setFlushBeforeMethodExecution(flushBeforeMethodExecution);

    assertEquals(expected, actual);
View Full Code Here

TOP

Related Classes of org.springmodules.cache.FlushingModel

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.