Package org.springmodules.cache.config

Examples of org.springmodules.cache.config.DomElementStub


  }

  public void testParseCachingModel() {
    String cacheName = "testCache";

    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);
   
View Full Code Here


  public void testDoParseFlushingModel() {
    String cacheNames = "testCache";
    boolean flushBeforeMethodExecution = true;

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

    FlushingModel actual = parser.doParseFlushingModel(element,
        flushBeforeMethodExecution);
    GigaSpacesFlushingModel expected = new GigaSpacesFlushingModel(cacheNames);
    expected.setFlushBeforeMethodExecution(flushBeforeMethodExecution);
View Full Code Here

  }

  public void testParseCachingModel() {
    String cacheName = "testCache";

    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);
View Full Code Here

  public void testDoParseFlushingModel() {
    String groups = "pojos,services";
    boolean flushBeforeMethodExecution = true;

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

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

  public void testParseCachingModel() {
    String cronExpression = "* 0 * * *";
    String groups = "pojos,web";
    String refreshPeriod = "2";

    Element element = new DomElementStub("caching");
    element.setAttribute("cronExpression", cronExpression);
    element.setAttribute("groups", groups);
    element.setAttribute("refreshPeriod", refreshPeriod);

    CachingModel actual = parser.parseCachingModel(element);
    CachingModel expected = new OsCacheCachingModel(groups, Integer
        .parseInt(refreshPeriod), cronExpression);

View Full Code Here

    return createCachingElement(cronExpression, groups, null);
  }

  private Element createCachingElement(String cronExpression, String groups,
      String refreshPeriod) {
    Element element = new DomElementStub("caching");
    element.setAttribute("cronExpression", cronExpression);
    element.setAttribute("groups", groups);

    if (StringUtils.hasText(refreshPeriod)) {
      element.setAttribute("refreshPeriod", refreshPeriod);
    }

    return element;
  }
View Full Code Here

TOP

Related Classes of org.springmodules.cache.config.DomElementStub

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.