Package com.gemstone.gemfire.cache

Examples of com.gemstone.gemfire.cache.Cache


    assertEquals(true, diskStore1.getAutoCompact());
    assertEquals(DiskStoreFactory.DEFAULT_COMPACTION_THRESHOLD, diskStore1.getCompactionThreshold());
    assertEquals(9999, diskStore1.getTimeInterval());
    assertEquals(1, diskStore1.getMaxOplogSize());
    assertEquals(diskStoreDirectory, diskStore1.getDiskDirs()[0]);
    Cache cache = context.getBean("gemfireCache", Cache.class);
    assertSame(diskStore1, cache.findDiskStore("diskStore1"));
  }
View Full Code Here


  @Test
  public void testNamedCache() throws Exception {
    assertTrue(context.containsBean("cache-with-name"));

    Cache gemfireCache = context.getBean("gemfireCache", Cache.class);

    assertTrue(Boolean.parseBoolean(gemfireCache.getDistributedSystem().getProperties()
      .getProperty("disable-auto-reconnect")));

    CacheFactoryBean cacheFactoryBean = context.getBean("&cache-with-name", CacheFactoryBean.class);

    assertNull(TestUtils.readField("cacheXml", cacheFactoryBean));
View Full Code Here

  }

  @Test
  public void testCacheWithGatewayConflictResolver() {
    Cache cache = context.getBean("cache-with-gateway-conflict-resolver", Cache.class);

    assertTrue(cache.getGatewayConflictResolver() instanceof TestGatewayConflictResolver);
  }
View Full Code Here

  @Test
  public void testCacheWithAutoReconnectDisabled() {
    assertTrue(context.containsBean("cache-with-auto-reconnect-disabled"));

    Cache gemfireCache = context.getBean("cache-with-auto-reconnect-disabled", Cache.class);

    assertTrue(Boolean.parseBoolean(gemfireCache.getDistributedSystem().getProperties()
      .getProperty("disable-auto-reconnect")));

    CacheFactoryBean cacheFactoryBean = context.getBean("&cache-with-auto-reconnect-disabled", CacheFactoryBean.class);

    assertFalse(cacheFactoryBean.getEnableAutoReconnect());
View Full Code Here

  @Test
  public void testCacheWithAutoReconnectEnabled() {
    assertTrue(context.containsBean("cache-with-auto-reconnect-enabled"));

    Cache gemfireCache = context.getBean("cache-with-auto-reconnect-enabled", Cache.class);

    boolean expected = Boolean.getBoolean("org.springframework.data.gemfire.test.GemfireTestRunner.nomock");
    boolean actual = Boolean.parseBoolean(gemfireCache.getDistributedSystem().getProperties()
      .getProperty("disable-auto-reconnect"));

    assertEquals(String.format("Expected 'disable-auto-reconnect' to be %1$s!", expected), expected, actual);

    CacheFactoryBean cacheFactoryBean = context.getBean("&cache-with-auto-reconnect-enabled", CacheFactoryBean.class);
View Full Code Here

  }

  @Test
  @SuppressWarnings("rawtypes")
  public void testRegionLookup() throws Exception {
    Cache cache = context.getBean(Cache.class);
    Region existing = cache.createRegionFactory().create("existing");

    assertTrue(context.containsBean("lookup"));

    RegionLookupFactoryBean localRegionFactoryBean = context.getBean("&lookup", RegionLookupFactoryBean.class);
View Full Code Here

    return applicationContext.getBean(GemfireConstants.DEFAULT_GEMFIRE_CACHE_NAME, Cache.class);
  }

  @Test
  public void testAutoReconnectDisabled() {
    Cache cache = getCache("cacheAutoReconnectDisabledIntegrationTests.xml");
    assertNotNull(cache.getDistributedSystem());
    assertNotNull(cache.getDistributedSystem().getProperties());
    assertTrue(Boolean.valueOf(cache.getDistributedSystem().getProperties().getProperty("disable-auto-reconnect")));
  }
View Full Code Here

    assertTrue(Boolean.valueOf(cache.getDistributedSystem().getProperties().getProperty("disable-auto-reconnect")));
  }

  @Test
  public void testAutoReconnectEnabled() {
    Cache cache = getCache("cacheAutoReconnectEnabledIntegrationTests.xml");
    assertNotNull(cache.getDistributedSystem());
    assertNotNull(cache.getDistributedSystem().getProperties());
    assertFalse(Boolean.valueOf(cache.getDistributedSystem().getProperties().getProperty("disable-auto-reconnect")));
  }
View Full Code Here

    props.setProperty("name", "FunctionServer");
    props.setProperty("log-level", "config");
    props.setProperty("groups","g1,g2,g3");
    
    
    Cache cache = new CacheFactory(props).create();

    // Create region.
    RegionFactory<Object,Object> factory = cache.createRegionFactory();
    factory.setDataPolicy(DataPolicy.REPLICATE);
    factory.setScope(Scope.DISTRIBUTED_ACK);
    testRegion = factory.create("test-function");
    System.out.println("Test region, " + testRegion.getFullPath() + ", created in cache.");

    // Start Cache Server.
    CacheServer server = cache.addCacheServer();
    server.setPort(40404);
    server.start();
    System.out.println("Server started");

    
View Full Code Here

    CacheFactoryBean cacheFactoryBean = new CacheFactoryBean();

    cacheFactoryBean.setBeanName("gemfireCache");
    cacheFactoryBean.setUseBeanFactoryLocator(false);

    Cache cache = cacheFactoryBean.getObject();

    assertNotNull(cache);

    RegionFactoryBean regionFactory = new ReplicatedRegionFactoryBean();

    regionFactory.setCache(cache);
    regionFactory.setName("Outer");
    regionFactory.afterPropertiesSet();

    Region outer = regionFactory.getObject();

    assertNotNull(outer);
    assertEquals("Outer", outer.getName());
    assertEquals("/Outer", outer.getFullPath());
    assertSame(outer, cache.getRegion("/Outer"));

    RegionFactoryBean subRegionFactory = new RegionFactoryBean();

    subRegionFactory.setCache(cache);
    subRegionFactory.setParent(outer);
    subRegionFactory.setName("/Outer/Inner");
    subRegionFactory.setRegionName("Inner");
    subRegionFactory.afterPropertiesSet();

    Region inner = subRegionFactory.getObject();

    assertNotNull(inner);
    assertSame(inner, outer.getSubregion("Inner"));
    assertSame(inner, cache.getRegion("/Outer/Inner"));
  }
View Full Code Here

TOP

Related Classes of com.gemstone.gemfire.cache.Cache

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.