Package org.springframework.data.gemfire

Examples of org.springframework.data.gemfire.CacheFactoryBean$PdxOptions


  static class Config {

    @Bean
    public GemFireCache cache() throws Exception {

      CacheFactoryBean factory = new MockCacheFactoryBean();
      return factory.getObject();
    }
View Full Code Here


    fail(String.format("ConfigProperty with name [%1$s] was not found!", expectedPropertyName));
  }

  @Test
  public void testCacheJndiDataSourceConfiguration() {
    CacheFactoryBean factory = context.getBean("&gemfireCache", CacheFactoryBean.class);

    List<CacheFactoryBean.JndiDataSource> jndiDataSources = factory.getJndiDataSources();

    assertNotNull(jndiDataSources);
    assertEquals(1, jndiDataSources.size());

    CacheFactoryBean.JndiDataSource dataSource = jndiDataSources.get(0);
View Full Code Here

public class CacheEagerInitTest{
  @Autowired ApplicationContext ctx;

  @Test
  public void testEagerInit() throws Exception {
    CacheFactoryBean cfb = (CacheFactoryBean) ctx.getBean("&gemfireCache");
    cfb.afterPropertiesSet();
    assertTrue(!cfb.isLazyInitialize());
  }
View Full Code Here

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

    CacheFactoryBean cacheFactoryBean = context.getBean("&gemfireCache", CacheFactoryBean.class);

    assertNull(TestUtils.readField("cacheXml", cacheFactoryBean));

    Properties gemfireProperties = cacheFactoryBean.getProperties();

    assertNotNull(gemfireProperties);
    assertTrue(gemfireProperties.containsKey("disable-auto-reconnect"));
    assertTrue(Boolean.parseBoolean(gemfireProperties.getProperty("disable-auto-reconnect")));
    assertFalse(cacheFactoryBean.getEnableAutoReconnect());
  }
View Full Code Here

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

    Properties gemfireProperties = cacheFactoryBean.getProperties();

    assertNotNull(gemfireProperties);
    assertTrue(gemfireProperties.containsKey("disable-auto-reconnect"));
    assertTrue(Boolean.parseBoolean(gemfireProperties.getProperty("disable-auto-reconnect")));
    assertFalse(cacheFactoryBean.getEnableAutoReconnect());
  }
View Full Code Here

  @Test
  public void testCacheWithXmlAndProperties() throws Exception {
    assertTrue(context.containsBean("cache-with-xml-and-props"));

    CacheFactoryBean cacheFactoryBean = context.getBean("&cache-with-xml-and-props", CacheFactoryBean.class);
    Resource cacheXmlResource = TestUtils.readField("cacheXml", cacheFactoryBean);

    assertEquals("gemfire-cache.xml", cacheXmlResource.getFilename());
    assertTrue(context.containsBean("gemfireProperties"));
    assertEquals(context.getBean("gemfireProperties"), TestUtils.readField("properties", cacheFactoryBean));
View Full Code Here

    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

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

    assertTrue(cacheFactoryBean.getEnableAutoReconnect());
  }
View Full Code Here

  @Test
  public void testHeapTunedCache() throws Exception {
    assertTrue(context.containsBean("heap-tuned-cache"));

    CacheFactoryBean cacheFactoryBean = context.getBean("&heap-tuned-cache", CacheFactoryBean.class);

    Float criticalHeapPercentage = TestUtils.readField("criticalHeapPercentage", cacheFactoryBean);
    Float evictionHeapPercentage = TestUtils.readField("evictionHeapPercentage", cacheFactoryBean);

    assertEquals(70.0f, criticalHeapPercentage, 0.0001);
View Full Code Here

  @Test(expected = IllegalArgumentException.class)
  public void testNoBeanFactoryLocator() throws Exception {
    assertTrue(context.containsBean("no-bean-factory-locator"));

    CacheFactoryBean cacheFactoryBean = context.getBean("&no-bean-factory-locator", CacheFactoryBean.class);

    assertThat(ReflectionTestUtils.getField(cacheFactoryBean, "factoryLocator"), is(nullValue()));

    GemfireBeanFactoryLocator beanFactoryLocator = new GemfireBeanFactoryLocator();
View Full Code Here

TOP

Related Classes of org.springframework.data.gemfire.CacheFactoryBean$PdxOptions

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.