DATAGEODE-337 - Polish.
Resolves gh-41. Resolves gh-389.
This commit is contained in:
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@@ -28,6 +27,9 @@ import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.CacheListener;
|
||||
import org.apache.geode.cache.CacheLoader;
|
||||
import org.apache.geode.cache.CacheLoaderException;
|
||||
@@ -47,23 +49,21 @@ import org.apache.geode.cache.RegionEvent;
|
||||
import org.apache.geode.cache.asyncqueue.AsyncEvent;
|
||||
import org.apache.geode.cache.asyncqueue.AsyncEventListener;
|
||||
import org.apache.geode.cache.util.CacheListenerAdapter;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* The LookupRegionMutationIntegrationTest class is a test suite of test cases testing the contract and integrated
|
||||
* functionality between natively-defined GemFire Cache Regions and SDG's Region lookup functionality combined with
|
||||
* Region attribute(s) mutation.
|
||||
* Integration Tests for {@link DataPolicy#PARTITION} {@link Region} {@link Region#getAttributesMutator() mutation}
|
||||
* using SDG's {@literal lookup} {@link Region} functionality.
|
||||
*
|
||||
* @author Udo Kohlmeyer
|
||||
* @author John Blum
|
||||
* @see Test
|
||||
* @see RunWith
|
||||
* @see LookupRegionFactoryBean
|
||||
* @see ContextConfiguration
|
||||
* @see org.junit.Test
|
||||
* @see org.springframework.data.gemfire.LookupRegionFactoryBean
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
|
||||
* @since 1.7.0
|
||||
*/
|
||||
@@ -75,7 +75,8 @@ public class LookupPartitionRegionMutationIntegrationTest {
|
||||
@Resource(name = "Example")
|
||||
private Region<?, ?> example;
|
||||
|
||||
private void assertCacheListeners(CacheListener[] cacheListeners, Collection<String> expectedCacheListenerNames) {
|
||||
private void assertCacheListeners(CacheListener<?, ?>[] cacheListeners,
|
||||
Collection<String> expectedCacheListenerNames) {
|
||||
|
||||
if (!expectedCacheListenerNames.isEmpty()) {
|
||||
assertNotNull("CacheListeners must not be null!", cacheListeners);
|
||||
@@ -85,7 +86,7 @@ public class LookupPartitionRegionMutationIntegrationTest {
|
||||
}
|
||||
|
||||
private void assertEvictionAttributes(EvictionAttributes evictionAttributes, EvictionAction expectedAction,
|
||||
EvictionAlgorithm expectedAlgorithm, int expectedMaximum) {
|
||||
EvictionAlgorithm expectedAlgorithm, int expectedMaximum) {
|
||||
|
||||
assertNotNull("EvictionAttributes must not be null!", evictionAttributes);
|
||||
assertEquals(expectedAction, evictionAttributes.getAction());
|
||||
@@ -94,8 +95,7 @@ public class LookupPartitionRegionMutationIntegrationTest {
|
||||
}
|
||||
|
||||
private void assertExpirationAttributes(ExpirationAttributes expirationAttributes,
|
||||
|
||||
String description, int expectedTimeout, ExpirationAction expectedAction) {
|
||||
String description, int expectedTimeout, ExpirationAction expectedAction) {
|
||||
|
||||
assertNotNull(String.format("ExpirationAttributes for '%1$s' must not be null!", description),
|
||||
expirationAttributes);
|
||||
@@ -124,7 +124,7 @@ public class LookupPartitionRegionMutationIntegrationTest {
|
||||
}
|
||||
|
||||
private void assertRegionAttributes(Region<?, ?> region, String expectedName, String expectedFullPath,
|
||||
DataPolicy expectedDataPolicy) {
|
||||
DataPolicy expectedDataPolicy) {
|
||||
|
||||
assertNotNull(String.format("'%1$s' Region was not properly initialized!", region));
|
||||
assertEquals(expectedName, region.getName());
|
||||
@@ -170,6 +170,7 @@ public class LookupPartitionRegionMutationIntegrationTest {
|
||||
String getName();
|
||||
|
||||
void setName(String name);
|
||||
|
||||
}
|
||||
|
||||
static abstract class AbstractNameable implements Nameable {
|
||||
@@ -205,8 +206,8 @@ public class LookupPartitionRegionMutationIntegrationTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
}
|
||||
public void close() { }
|
||||
|
||||
}
|
||||
|
||||
public static final class TestCacheListener<K, V> extends CacheListenerAdapter<K, V> implements Nameable {
|
||||
@@ -242,35 +243,30 @@ public class LookupPartitionRegionMutationIntegrationTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
}
|
||||
public void close() { }
|
||||
|
||||
}
|
||||
|
||||
public static final class TestCacheWriter<K, V> extends AbstractNameable implements CacheWriter<K, V> {
|
||||
|
||||
@Override
|
||||
public void beforeUpdate(EntryEvent<K, V> event) throws CacheWriterException {
|
||||
}
|
||||
public void beforeUpdate(EntryEvent<K, V> event) throws CacheWriterException { }
|
||||
|
||||
@Override
|
||||
public void beforeCreate(EntryEvent<K, V> event) throws CacheWriterException {
|
||||
}
|
||||
public void beforeCreate(EntryEvent<K, V> event) throws CacheWriterException { }
|
||||
|
||||
@Override
|
||||
public void beforeDestroy(EntryEvent<K, V> event) throws CacheWriterException {
|
||||
}
|
||||
public void beforeDestroy(EntryEvent<K, V> event) throws CacheWriterException { }
|
||||
|
||||
@Override
|
||||
public void beforeRegionDestroy(RegionEvent<K, V> event) throws CacheWriterException {
|
||||
}
|
||||
public void beforeRegionDestroy(RegionEvent<K, V> event) throws CacheWriterException { }
|
||||
|
||||
@Override
|
||||
public void beforeRegionClear(RegionEvent<K, V> event) throws CacheWriterException {
|
||||
}
|
||||
public void beforeRegionClear(RegionEvent<K, V> event) throws CacheWriterException { }
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
}
|
||||
public void close() { }
|
||||
|
||||
}
|
||||
|
||||
public static final class TestCustomExpiry<K, V> extends AbstractNameable implements CustomExpiry<K, V> {
|
||||
@@ -281,7 +277,7 @@ public class LookupPartitionRegionMutationIntegrationTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
}
|
||||
public void close() { }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@@ -28,6 +27,9 @@ import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.CacheListener;
|
||||
import org.apache.geode.cache.CacheLoader;
|
||||
import org.apache.geode.cache.CacheLoaderException;
|
||||
@@ -48,25 +50,21 @@ import org.apache.geode.cache.asyncqueue.AsyncEvent;
|
||||
import org.apache.geode.cache.asyncqueue.AsyncEventListener;
|
||||
import org.apache.geode.cache.util.CacheListenerAdapter;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* The LookupRegionMutationIntegrationTest class is a test suite of test cases testing the contract and integrated
|
||||
* functionality between natively-defined GemFire Cache Regions and SDG's Region lookup functionality combined with
|
||||
* Region attribute(s) mutation.
|
||||
* Integration Tests for {@link LookupRegionFactoryBean} testing the contract and integrated functionality between
|
||||
* natively-defined GemFire/Geode cache {@link Region Regions} and SDG's {@link Region} lookup functionality
|
||||
* combined with {@link org.apache.geode.cache.RegionAttributes} {@link Region#getAttributesMutator() mutation}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.springframework.data.gemfire.LookupRegionFactoryBean
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.7.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@@ -77,7 +75,7 @@ public class LookupRegionMutationIntegrationTest {
|
||||
@Resource(name = "Example")
|
||||
private Region<?, ?> example;
|
||||
|
||||
private void assertCacheListeners(CacheListener[] cacheListeners, Collection<String> expectedCacheListenerNames) {
|
||||
private void assertCacheListeners(CacheListener<?, ?>[] cacheListeners, Collection<String> expectedCacheListenerNames) {
|
||||
|
||||
if (!expectedCacheListenerNames.isEmpty()) {
|
||||
assertNotNull("CacheListeners must not be null!", cacheListeners);
|
||||
@@ -204,11 +202,14 @@ public class LookupRegionMutationIntegrationTest {
|
||||
|
||||
public static final class TestAsyncEventListener extends AbstractNameable implements AsyncEventListener {
|
||||
|
||||
@Override public boolean processEvents(List<AsyncEvent> events) {
|
||||
@Override
|
||||
public boolean processEvents(List<AsyncEvent> events) {
|
||||
throw new UnsupportedOperationException("Not Implemented!");
|
||||
}
|
||||
|
||||
@Override public void close() { }
|
||||
@Override
|
||||
public void close() { }
|
||||
|
||||
}
|
||||
|
||||
public static final class TestCacheListener<K, V> extends CacheListenerAdapter<K, V> implements Nameable {
|
||||
@@ -245,21 +246,29 @@ public class LookupRegionMutationIntegrationTest {
|
||||
|
||||
@Override
|
||||
public void close() { }
|
||||
|
||||
}
|
||||
|
||||
public static final class TestCacheWriter<K, V> extends AbstractNameable implements CacheWriter<K, V> {
|
||||
|
||||
@Override public void beforeUpdate(EntryEvent<K, V> event) throws CacheWriterException { }
|
||||
@Override
|
||||
public void beforeUpdate(EntryEvent<K, V> event) throws CacheWriterException { }
|
||||
|
||||
@Override public void beforeCreate(EntryEvent<K, V> event) throws CacheWriterException { }
|
||||
@Override
|
||||
public void beforeCreate(EntryEvent<K, V> event) throws CacheWriterException { }
|
||||
|
||||
@Override public void beforeDestroy(EntryEvent<K, V> event) throws CacheWriterException { }
|
||||
@Override
|
||||
public void beforeDestroy(EntryEvent<K, V> event) throws CacheWriterException { }
|
||||
|
||||
@Override public void beforeRegionDestroy(RegionEvent<K, V> event) throws CacheWriterException { }
|
||||
@Override
|
||||
public void beforeRegionDestroy(RegionEvent<K, V> event) throws CacheWriterException { }
|
||||
|
||||
@Override public void beforeRegionClear(RegionEvent<K, V> event) throws CacheWriterException { }
|
||||
@Override
|
||||
public void beforeRegionClear(RegionEvent<K, V> event) throws CacheWriterException { }
|
||||
|
||||
@Override
|
||||
public void close() { }
|
||||
|
||||
@Override public void close() { }
|
||||
}
|
||||
|
||||
public static final class TestCustomExpiry<K, V> extends AbstractNameable implements CustomExpiry<K, V> {
|
||||
@@ -271,5 +280,6 @@ public class LookupRegionMutationIntegrationTest {
|
||||
|
||||
@Override
|
||||
public void close() { }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
">
|
||||
|
||||
<util:properties id="gemfireProperties">
|
||||
<prop key="name">LookupRegionMutationIntegrationTest</prop>
|
||||
<prop key="name">LookupPartitionRegionMutationIntegrationTest</prop>
|
||||
<prop key="log-level">error</prop>
|
||||
</util:properties>
|
||||
|
||||
|
||||
@@ -43,8 +43,7 @@
|
||||
<gfe:gateway-sender name="GWS" remote-distributed-system-id="123" manual-start="true"/>
|
||||
<gfe:async-event-queue name="AEQ" persistent="false" parallel="false">
|
||||
<gfe:async-event-listener>
|
||||
<bean
|
||||
class="org.springframework.data.gemfire.LookupRegionMutationIntegrationTest$TestAsyncEventListener"
|
||||
<bean class="org.springframework.data.gemfire.LookupRegionMutationIntegrationTest$TestAsyncEventListener"
|
||||
p:name="F"/>
|
||||
</gfe:async-event-listener>
|
||||
</gfe:async-event-queue>
|
||||
|
||||
Reference in New Issue
Block a user