Updating docs in progress and changed default bean names to camelCase

This commit is contained in:
David Turanski
2012-08-05 14:07:28 -04:00
parent a067ddbf48
commit 5bf6e2f15a
54 changed files with 763 additions and 311 deletions

View File

@@ -45,6 +45,7 @@ public class SubRegionTest extends RecreatingContextTest {
@SuppressWarnings({ "rawtypes", "unchecked" })
private void testBasic() throws Exception {
CacheFactoryBean cfb = new CacheFactoryBean();
cfb.setBeanName("gemfireCache");
cfb.setUseBeanFactoryLocator(false);
cfb.afterPropertiesSet();
GemFireCache cache = cfb.getObject();

View File

@@ -58,8 +58,11 @@ public class CacheNamespaceTest extends RecreatingContextTest {
}
private void testBasicCache() throws Exception {
assertTrue(ctx.containsBean("gemfireCache"));
//Check alias is registered
assertTrue(ctx.containsBean("gemfire-cache"));
CacheFactoryBean cfb = (CacheFactoryBean) ctx.getBean("&gemfire-cache");
//
CacheFactoryBean cfb = (CacheFactoryBean) ctx.getBean("&gemfireCache");
assertNull(TestUtils.readField("cacheXml", cfb));
assertNull(TestUtils.readField("properties", cfb));
}

View File

@@ -21,6 +21,10 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.FilenameFilter;
import org.junit.AfterClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -64,6 +68,20 @@ public class ClientRegionNamespaceTest {
testOverflowToDisk();
}
@AfterClass
public static void tearDown() {
for (String name : new File(".").list(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.startsWith("BACKUP");
}
})) {
new File(name).delete();
}
}
private void testBasicClient() throws Exception {
assertTrue(context.containsBean("simple"));
}

View File

@@ -22,6 +22,7 @@ import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.FilenameFilter;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -80,6 +81,16 @@ public class DiskStoreAndEvictionRegionParsingTest {
file.delete();
}
diskStoreDir.delete();
for (String name : new File(".").list(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.startsWith("BACKUPds");
}
})) {
new File(name).delete();
}
}
@Test
@@ -98,7 +109,7 @@ public class DiskStoreAndEvictionRegionParsingTest {
assertEquals(9999, diskStore1.getTimeInterval());
assertEquals(10, diskStore1.getMaxOplogSize());
assertEquals(diskStoreDir, diskStore1.getDiskDirs()[0]);
Cache cache = context.getBean("gemfire-cache", Cache.class);
Cache cache = context.getBean("gemfireCache", Cache.class);
assertSame(diskStore1, cache.findDiskStore("diskStore1"));
}

View File

@@ -44,7 +44,7 @@ public class DynamicRegionNamespaceTest extends RecreatingContextTest {
DynamicRegionFactory drf = DynamicRegionFactory.get();
assertFalse(drf.isOpen());
assertNull(drf.getConfig());
ctx.getBean("gemfire-cache", Cache.class);
ctx.getBean("gemfireCache", Cache.class);
assertTrue(drf.isOpen());
DynamicRegionFactory.Config config = drf.getConfig();
assertFalse(config.persistBackup);

View File

@@ -80,7 +80,7 @@ public class GemfireV6GatewayNamespaceTest extends RecreatingContextTest {
@SuppressWarnings("rawtypes")
private void testGatewaysInGemfire() {
Cache cache = ctx.getBean("gemfire-cache", Cache.class);
Cache cache = ctx.getBean("gemfireCache", Cache.class);
GatewayHub gwh = cache.getGatewayHub("gateway-hub");
assertNotNull(gwh);

View File

@@ -19,11 +19,14 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.FilenameFilter;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
import java.util.Set;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Test;
import org.springframework.data.gemfire.RecreatingContextTest;
@@ -74,6 +77,19 @@ public class GemfireV7GatewayNamespaceTest extends RecreatingContextTest {
}
}
@AfterClass
public static void tearDown() {
for (String name : new File(".").list(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.startsWith("BACKUP");
}
})) {
new File(name).delete();
}
}
/**
*
*/

View File

@@ -45,7 +45,7 @@ public class IndexNamespaceTest {
@Before
public void setUp() throws Exception {
Cache cache = (Cache) context.getBean("gemfire-cache");
Cache cache = (Cache) context.getBean("gemfireCache");
if (cache.getRegion(name) == null) {
cache.createRegionFactory().create("test-index");
}

View File

@@ -37,7 +37,7 @@ public class JndiBindingsTest extends RecreatingContextTest {
@Test
public void testJndiBindings() throws Exception {
Cache cache = ctx.getBean("gemfire-cache", Cache.class);
Cache cache = ctx.getBean("gemfireCache", Cache.class);
assertNotNull(cache.getJNDIContext().lookup("java:/SimpleDataSource"));
GemFireBasicDataSource ds = (GemFireBasicDataSource) cache.getJNDIContext().lookup("java:/SimpleDataSource");
assertEquals("org.apache.derby.jdbc.EmbeddedDriver", ds.getJDBCDriver());

View File

@@ -52,9 +52,12 @@ public class PoolNamespaceTest {
}
private void testBasicClient() throws Exception {
assertTrue(context.containsBean("gemfirePool"));
//Check old style alias also registered
assertTrue(context.containsBean("gemfire-pool"));
assertEquals(context.getBean("gemfire-pool"), PoolManager.find("gemfire-pool"));
PoolFactoryBean pfb = (PoolFactoryBean) context.getBean("&gemfire-pool");
assertEquals(context.getBean("gemfirePool"), PoolManager.find("gemfirePool"));
PoolFactoryBean pfb = (PoolFactoryBean) context.getBean("&gemfirePool");
Collection<PoolConnection> locators = TestUtils.readField("locators", pfb);
assertEquals(1, locators.size());
PoolConnection locator = locators.iterator().next();

View File

@@ -49,7 +49,7 @@ public class TxEventHandlersTest {
@Autowired
TestWriter txWriter;
@Resource(name = "gemfire-cache")
@Resource(name = "gemfireCache")
Cache cache;
@SuppressWarnings("rawtypes")

View File

@@ -35,8 +35,11 @@ public class TxManagerNamespaceTest extends RecreatingContextTest {
@Test
public void testBasicCache() throws Exception {
assertTrue(ctx.containsBean("gemfireTransactionManager"));
//Check old style alias also registered
assertTrue(ctx.containsBean("gemfire-transaction-manager"));
GemfireTransactionManager tx = ctx.getBean("gemfire-transaction-manager", GemfireTransactionManager.class);
GemfireTransactionManager tx = ctx.getBean("gemfireTransactionManager", GemfireTransactionManager.class);
assertFalse(tx.isCopyOnRead());
}
}

View File

@@ -54,7 +54,7 @@ public class ContainerXmlSetupTest {
ContinuousQueryListenerContainer container = ctx.getBean(ContinuousQueryListenerContainer.class);
assertTrue(container.isRunning());
Cache cache = ctx.getBean("gemfire-cache", Cache.class);
Cache cache = ctx.getBean("gemfireCache", Cache.class);
Pool pool = ctx.getBean("client", Pool.class);
CqQuery[] cqs = cache.getQueryService().getCqs();

View File

@@ -15,14 +15,16 @@
*/
package org.springframework.data.gemfire.mapping;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import java.io.File;
import java.io.FilenameFilter;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Test;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.data.gemfire.mapping.GemfireMappingContext;
import org.springframework.data.gemfire.mapping.MappingPdxSerializer;
import org.springframework.data.gemfire.repository.sample.Address;
import org.springframework.data.gemfire.repository.sample.Person;
@@ -41,6 +43,8 @@ public class MappingPdxSerializerIntegrationTest {
Region<Object, Object> region;
static Cache cache;
@Before
public void setUp() {
@@ -50,8 +54,7 @@ public class MappingPdxSerializerIntegrationTest {
CacheFactory factory = new CacheFactory();
factory.setPdxSerializer(serializer);
factory.setPdxPersistent(true);
Cache cache = factory.create();
cache = factory.create();
RegionFactory<Object, Object> regionFactory = cache.createRegionFactory();
regionFactory.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);
@@ -78,4 +81,22 @@ public class MappingPdxSerializerIntegrationTest {
assertThat(reference.getLastname(), is(person.getLastname()));
assertThat(reference.address, is(person.address));
}
@AfterClass
public static void tearDown() {
try {
cache.close();
}
catch (Exception e) {
}
for (String name : new File(".").list(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.startsWith("BACKUP");
}
})) {
new File(name).delete();
}
}
}

View File

@@ -15,10 +15,13 @@
*/
package org.springframework.data.gemfire.support;
import java.io.File;
import java.io.FilenameFilter;
import java.util.HashMap;
import java.util.Map;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Test;
import org.springframework.data.gemfire.CacheFactoryBean;
@@ -38,7 +41,7 @@ public abstract class AbstractRegionFactoryBeanTest {
@Before
public void setUp() throws Exception {
CacheFactoryBean cfb = new CacheFactoryBean();
cfb.setBeanName("gemfire-cache");
cfb.setBeanName("gemfireCache");
cfb.setUseBeanFactoryLocator(false);
cfb.afterPropertiesSet();
cache = cfb.getObject();
@@ -52,6 +55,19 @@ public abstract class AbstractRegionFactoryBeanTest {
}
}
@AfterClass
public static void cleanUp() {
for (String name : new File(".").list(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.startsWith("BACKUP");
}
})) {
new File(name).delete();
}
}
protected void addRFBConfig(RegionFactoryBeanConfig rfbc) {
if (regionFactoryBeanConfigs.containsKey(rfbc.regionName)) {
throw new RuntimeException("duplicate region name " + rfbc.regionName);

View File

@@ -6,7 +6,7 @@ log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
log4j.category.org.springframework.data.gemfire.listener=TRACE
log4j.category.org.springframework.data.gemfire=DEBUG
log4j.category.org.springframework.beans.=DEBUG
log4j.category.org.springframework.beans=DEBUG
# for debugging datasource initialization
# log4j.category.test.jdbc=DEBUG

View File

@@ -9,7 +9,7 @@
<gfe:cache/>
<bean id="replicate-persistent-region" class="org.springframework.data.gemfire.RegionFactoryBean">
<property name="cache" ref="gemfire-cache"/>
<property name="cache" ref="gemfireCache"/>
<property name="dataPolicy" value="REPLICATE_PERSISTENT"/>
</bean>
</beans>

View File

@@ -1,17 +1,10 @@
<?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.1.xsd
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.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<!--
<gfe:client-cache use-bean-factory-locator="false" pool-name="gemfire-pool"/>
<gfe:pool subscription-enabled="false">
<gfe:server host="localhost" port="40404"/>
</gfe:pool>
-->
<gfe:client-cache/>
<gfe:client-region data-policy="NORMAL" name="ChallengeQuestions" id="challengeQuestionsRegion"/>
</beans>

View File

@@ -7,5 +7,5 @@
<gfe:cache />
<gfe:transaction-manager cache-ref="gemfire-cache" copy-on-read="false" />
<gfe:transaction-manager cache-ref="gemfireCache" copy-on-read="false" />
</beans>

View File

@@ -24,7 +24,7 @@
<task:executor id="testTaskExecutor" />
<gfe:cq-listener-container cache="gemfire-cache" pool-name="client">
<gfe:cq-listener-container cache="gemfireCache" pool-name="client">
<!-- default handle method -->
<gfe:listener ref="testBean1" query="SELECT * from /test-cq"/>
<gfe:listener ref="testBean1" query="SELECT * from /test-cq" name="test-bean-1" method="handleQuery"/>