Merge branch 'client-cache'

This commit is contained in:
Costin Leau
2011-08-24 21:24:48 +03:00
11 changed files with 383 additions and 49 deletions

View File

@@ -0,0 +1,15 @@
package org.springframework.data.gemfire.client;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("client-cache.xml")
public class ClientCacheTest {
@Test
public void test() {
}
}

View File

@@ -27,6 +27,7 @@ import org.springframework.data.gemfire.CacheFactoryBean;
import org.springframework.data.gemfire.GemfireBeanFactoryLocator;
import org.springframework.data.gemfire.RecreatingContextTest;
import org.springframework.data.gemfire.TestUtils;
import org.springframework.data.gemfire.client.ClientCacheFactoryBean;
/**
* @author Costin Leau
@@ -76,4 +77,19 @@ public class CacheNamespaceTest extends RecreatingContextTest {
}
}
@Test
public void testBasicClientCache() throws Exception {
assertTrue(ctx.containsBean("client-cache"));
ClientCacheFactoryBean cfb = (ClientCacheFactoryBean) ctx.getBean("&client-cache");
assertNull(TestUtils.readField("cacheXml", cfb));
assertNull(TestUtils.readField("properties", cfb));
}
@Test
public void testBasicClientCacheWithXml() throws Exception {
assertTrue(ctx.containsBean("client-cache-with-xml"));
ClientCacheFactoryBean cfb = (ClientCacheFactoryBean) ctx.getBean("&client-cache-with-xml");
Resource res = TestUtils.readField("cacheXml", cfb);
assertEquals("gemfire-client-cache.xml", res.getFilename());
}
}

View File

@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE client-cache PUBLIC
"-//GemStone Systems, Inc.//GemFire Declarative Caching 6.5//EN"
"http://www.gemstone.com/dtd/cache6_5.dtd">
<client-cache>
<region name="myRegion" refid="PROXY"/>
<!-- you can override or add to the PROXY attributes by adding
a region-attributes sub element here -->
</client-cache>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gfe="http://www.springframework.org/schema/gemfire"
xsi:schemaLocation="http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire-1.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean class="org.springframework.data.gemfire.client.ClientCacheFactoryBean"/>
<property name="pool" ref="pool"/>
</bean>
<gfe:pool id="pool">
<gfe:locator host="localhost" port="12345"/>
</gfe:pool>
</beans>

View File

@@ -23,4 +23,8 @@
</util:properties>
<gfe:cache id="no-bl" use-bean-factory-locator="false" />
<gfe:client-cache id="client-cache"/>
<gfe:client-cache id="client-cache-with-xml" cache-xml-location="classpath:gemfire-client-cache.xml"/>
</beans>