From 523f562b3651a07e39a96cf7d93f758b1b1feac4 Mon Sep 17 00:00:00 2001 From: John Blum Date: Sat, 9 Jun 2018 18:59:04 -0700 Subject: [PATCH] DATAGEODE-110 - Polish. --- .../data/gemfire/client/KeyInterest.java | 6 +- .../data/gemfire/client/RegexInterest.java | 2 +- .../gemfire/client/RegionIntegrationTest.java | 125 ------------------ .../data/gemfire/client/basic-region.xml | 64 --------- 4 files changed, 4 insertions(+), 193 deletions(-) delete mode 100644 src/test/java/org/springframework/data/gemfire/client/RegionIntegrationTest.java delete mode 100644 src/test/resources/org/springframework/data/gemfire/client/basic-region.xml diff --git a/src/main/java/org/springframework/data/gemfire/client/KeyInterest.java b/src/main/java/org/springframework/data/gemfire/client/KeyInterest.java index 96a690d7..e1b5a07f 100644 --- a/src/main/java/org/springframework/data/gemfire/client/KeyInterest.java +++ b/src/main/java/org/springframework/data/gemfire/client/KeyInterest.java @@ -41,8 +41,8 @@ public class KeyInterest extends Interest { super(key, policy, durable); } - public KeyInterest(K key, InterestResultPolicy policy, boolean durable, boolean recieveValues) { - super(key, policy, durable, recieveValues); + public KeyInterest(K key, InterestResultPolicy policy, boolean durable, boolean receiveValues) { + super(key, policy, durable, receiveValues); } /** @@ -58,7 +58,7 @@ public class KeyInterest extends Interest { */ @Override public void setType(Type type) { - logger.warn(String.format("Setting the Type [%1$s] of interest on [%2$s] is ignored", + logger.warn(String.format("Setting the Type [%1$s] of Interest on [%2$s] is ignored", type, getClass().getName())); } } diff --git a/src/main/java/org/springframework/data/gemfire/client/RegexInterest.java b/src/main/java/org/springframework/data/gemfire/client/RegexInterest.java index db517667..04ed5378 100644 --- a/src/main/java/org/springframework/data/gemfire/client/RegexInterest.java +++ b/src/main/java/org/springframework/data/gemfire/client/RegexInterest.java @@ -78,7 +78,7 @@ public class RegexInterest extends Interest { */ @Override public void setType(Type type) { - logger.warn(String.format("Setting the Type [%1$s] of interest on [%2$s] is ignored", + logger.warn(String.format("Setting the Type [%1$s] of Interest on [%2$s] is ignored", type, getClass().getName())); } } diff --git a/src/test/java/org/springframework/data/gemfire/client/RegionIntegrationTest.java b/src/test/java/org/springframework/data/gemfire/client/RegionIntegrationTest.java deleted file mode 100644 index a3ce5929..00000000 --- a/src/test/java/org/springframework/data/gemfire/client/RegionIntegrationTest.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright 2010-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.data.gemfire.client; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertSame; - -import java.util.Arrays; - -import org.apache.geode.cache.CacheListener; -import org.apache.geode.cache.CacheLoader; -import org.apache.geode.cache.CacheLoaderException; -import org.apache.geode.cache.LoaderHelper; -import org.apache.geode.cache.PartitionAttributes; -import org.apache.geode.cache.Region; -import org.apache.geode.cache.RegionAttributes; -import org.apache.geode.cache.util.CacheListenerAdapter; -import org.apache.geode.cache.util.CacheWriterAdapter; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.support.BeanDefinitionRegistry; -import org.springframework.context.ApplicationContext; -import org.springframework.data.gemfire.test.GemfireTestApplicationContextInitializer; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -/** - * @author Costin Leau - * @author David Turanski - */ -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { "basic-region.xml" }, - initializers=GemfireTestApplicationContextInitializer.class) -public class RegionIntegrationTest { - - private static class CacheList extends CacheListenerAdapter { - } - - private static class CacheLoad implements CacheLoader { - - @Override - public V load(LoaderHelper arg0) throws CacheLoaderException { - return null; - } - - @Override - public void close() { - } - } - - private static class CacheWrite extends CacheWriterAdapter { - } - - @Autowired - private ApplicationContext ctx; - - - @Test - public void testBasicRegion() throws Exception { - @SuppressWarnings("rawtypes") - Region region = ctx.getBean("basic", Region.class); - assertEquals("basic", region.getName()); - } - - @Test - public void testExistingRegion() throws Exception { - @SuppressWarnings("rawtypes") - Region region = ctx.getBean("root", Region.class); - // the name property seems to be ignored - assertEquals("root", region.getName()); - } - - @SuppressWarnings("rawtypes") - @Test - public void testRegionWithListeners() throws Exception { - Region region = ctx.getBean("listeners", Region.class); - assertEquals("listeners", region.getName()); - CacheListener[] listeners = region.getAttributes().getCacheListeners(); - assertEquals(2, listeners.length); - assertSame(CacheList.class, listeners[0].getClass()); - assertSame(CacheLoad.class, region.getAttributes().getCacheLoader().getClass()); - assertSame(CacheWrite.class, region.getAttributes().getCacheWriter().getClass()); - } - - // @Test - // TODO: disabled since the interest registration requires a proper pool to - // be created, which requires another JVM to run with the server/locator - @SuppressWarnings("rawtypes") - public void testRegionInterest() throws Exception { - ClientRegionFactoryBean regionFB = (ClientRegionFactoryBean) ctx.getBean("&basic-client"); - System.out.println("**** interests are " + Arrays.toString(regionFB.getInterests())); - BeanDefinition bd = ((BeanDefinitionRegistry) ctx.getAutowireCapableBeanFactory()) - .getBeanDefinition("basic-client"); - System.out.println(bd.getPropertyValues().getPropertyValue("interests").getValue()); - } - - @SuppressWarnings("rawtypes") - @Test - public void testRegionAttributes() throws Exception { - Region region = ctx.getBean("attr-region", Region.class); - assertEquals("attr-region", region.getName()); - RegionAttributes attr = region.getAttributes(); - assertEquals(1024, attr.getInitialCapacity()); - - PartitionAttributes pa = attr.getPartitionAttributes(); - assertEquals(512, pa.getLocalMaxMemory()); - assertEquals(1, pa.getRedundantCopies()); - } -} diff --git a/src/test/resources/org/springframework/data/gemfire/client/basic-region.xml b/src/test/resources/org/springframework/data/gemfire/client/basic-region.xml deleted file mode 100644 index d15c0ff0..00000000 --- a/src/test/resources/org/springframework/data/gemfire/client/basic-region.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - BasicRegionConfig - 0 - warning - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -