SGF-364 - Move EvictionAttributesFactoryBean and SubscriptionAttributesFactoryBean along with supporting enum types from the ..data.gemfire.config package to ..data.gemfire.
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.config;
|
||||
package org.springframework.data.gemfire;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
@@ -37,7 +37,7 @@ import com.gemstone.gemfire.cache.util.ObjectSizer;
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.springframework.data.gemfire.config.EvictionAttributesFactoryBean
|
||||
* @see org.springframework.data.gemfire.EvictionAttributesFactoryBean
|
||||
* @see com.gemstone.gemfire.cache.EvictionAttributes
|
||||
* @since 1.3.4
|
||||
*/
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* The EvictionTypeConverterTest class is a test suite of test cases testing the contract and functionality
|
||||
* of the EvictionTypeConverter class.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.springframework.data.gemfire.EvictionTypeConverter
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public class EvictionTypeConverterTest {
|
||||
|
||||
private final EvictionTypeConverter converter = new EvictionTypeConverter();
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
converter.setValue(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConvert() {
|
||||
assertEquals(EvictionType.ENTRY_COUNT, converter.convert("entry_count"));
|
||||
assertEquals(EvictionType.HEAP_PERCENTAGE, converter.convert("Heap_Percentage"));
|
||||
assertEquals(EvictionType.MEMORY_SIZE, converter.convert("MEMorY_SiZe"));
|
||||
assertEquals(EvictionType.NONE, converter.convert("NONE"));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testConvertWithIllegalValue() {
|
||||
try {
|
||||
converter.convert("LIFO_MEMORY");
|
||||
}
|
||||
catch (IllegalArgumentException expected) {
|
||||
assertEquals("Source (LIFO_MEMORY) is not a valid EvictionType!", expected.getMessage());
|
||||
throw expected;
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetAsText() {
|
||||
assertNull(converter.getValue());
|
||||
converter.setAsText("heap_percentage");
|
||||
assertEquals(EvictionType.HEAP_PERCENTAGE, converter.getValue());
|
||||
converter.setAsText("NOne");
|
||||
assertEquals(EvictionType.NONE, converter.getValue());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testSetAsTextWithIllegalValue() {
|
||||
try {
|
||||
converter.setAsText("LRU_COUNT");
|
||||
}
|
||||
catch (IllegalArgumentException expected) {
|
||||
assertEquals("Source (LRU_COUNT) is not a valid EvictionType!", expected.getMessage());
|
||||
throw expected;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.gemstone.gemfire.cache.EvictionAlgorithm;
|
||||
|
||||
/**
|
||||
* The EvictionTypeTest class is a test suite of test cases testing the contract and functionality
|
||||
* of the EvictionType enum.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.springframework.data.gemfire.EvictionType
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public class EvictionTypeTest {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testValueOfEvictionAlgorithms() {
|
||||
assertEquals(EvictionType.ENTRY_COUNT, EvictionType.valueOf(EvictionAlgorithm.LRU_ENTRY));
|
||||
assertEquals(EvictionType.HEAP_PERCENTAGE, EvictionType.valueOf(EvictionAlgorithm.LRU_HEAP));
|
||||
assertEquals(EvictionType.MEMORY_SIZE, EvictionType.valueOf(EvictionAlgorithm.LRU_MEMORY));
|
||||
assertEquals(EvictionType.NONE, EvictionType.valueOf(EvictionAlgorithm.NONE));
|
||||
assertNull(EvictionType.valueOf(EvictionAlgorithm.LIFO_ENTRY));
|
||||
assertNull(EvictionType.valueOf(EvictionAlgorithm.LIFO_MEMORY));
|
||||
assertNull(EvictionType.valueOf((EvictionAlgorithm) null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValueOfIgnoreCase() {
|
||||
assertEquals(EvictionType.ENTRY_COUNT, EvictionType.valueOfIgnoreCase("entry_count"));
|
||||
assertEquals(EvictionType.HEAP_PERCENTAGE, EvictionType.valueOfIgnoreCase("Heap_Percentage"));
|
||||
assertEquals(EvictionType.MEMORY_SIZE, EvictionType.valueOfIgnoreCase("MEMorY_SiZe"));
|
||||
assertEquals(EvictionType.NONE, EvictionType.valueOfIgnoreCase("NONE"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValueOfIgnoreCaseWithInvalidValues() {
|
||||
assertNull(EvictionType.valueOfIgnoreCase("heap_%"));
|
||||
assertNull(EvictionType.valueOfIgnoreCase("mem_size"));
|
||||
assertNull(EvictionType.valueOfIgnoreCase("memory_space"));
|
||||
assertNull(EvictionType.valueOfIgnoreCase(" "));
|
||||
assertNull(EvictionType.valueOfIgnoreCase(""));
|
||||
assertNull(EvictionType.valueOfIgnoreCase(null));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.gemstone.gemfire.cache.InterestPolicy;
|
||||
import com.gemstone.gemfire.cache.SubscriptionAttributes;
|
||||
|
||||
/**
|
||||
* The SubscriptionAttributesFactoryBeanTest class is a test suite of test cases testing the contract and functionality
|
||||
* of the SubscriptionAttributesFactoryBean class.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.springframework.data.gemfire.SubscriptionAttributesFactoryBean
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public class SubscriptionAttributesFactoryBeanTest {
|
||||
|
||||
@Test
|
||||
public void testIsSingleton() {
|
||||
assertTrue(new SubscriptionAttributesFactoryBean().isSingleton());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetObjectAndObjectTypeForSubscriptionType() throws Exception {
|
||||
SubscriptionAttributesFactoryBean factoryBean = new SubscriptionAttributesFactoryBean();
|
||||
|
||||
factoryBean.setType(SubscriptionType.CACHE_CONTENT);
|
||||
factoryBean.afterPropertiesSet();
|
||||
|
||||
assertEquals(SubscriptionType.CACHE_CONTENT, factoryBean.getType());
|
||||
assertEquals(InterestPolicy.CACHE_CONTENT, factoryBean.getPolicy());
|
||||
|
||||
SubscriptionAttributes subscriptionAttributes = factoryBean.getObject();
|
||||
|
||||
assertNotNull(subscriptionAttributes);
|
||||
assertEquals(InterestPolicy.CACHE_CONTENT, subscriptionAttributes.getInterestPolicy());
|
||||
assertTrue(SubscriptionAttributes.class.isAssignableFrom(factoryBean.getObjectType()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetObjectAndObjectTypeForDefaultSubscriptionType() throws Exception {
|
||||
SubscriptionAttributesFactoryBean factoryBean = new SubscriptionAttributesFactoryBean();
|
||||
|
||||
factoryBean.setType(null);
|
||||
factoryBean.afterPropertiesSet();
|
||||
|
||||
assertEquals(SubscriptionType.DEFAULT, factoryBean.getType());
|
||||
assertEquals(InterestPolicy.DEFAULT, factoryBean.getPolicy());
|
||||
|
||||
SubscriptionAttributes subscriptionAttributes = factoryBean.getObject();
|
||||
|
||||
assertNotNull(subscriptionAttributes);
|
||||
assertEquals(InterestPolicy.DEFAULT, subscriptionAttributes.getInterestPolicy());
|
||||
assertTrue(SubscriptionAttributes.class.isAssignableFrom(factoryBean.getObjectType()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetObjectAndObjectTypeForInterestPolicy() throws Exception {
|
||||
SubscriptionAttributesFactoryBean factoryBean = new SubscriptionAttributesFactoryBean();
|
||||
|
||||
factoryBean.setPolicy(InterestPolicy.ALL);
|
||||
factoryBean.afterPropertiesSet();
|
||||
|
||||
assertEquals(SubscriptionType.ALL, factoryBean.getType());
|
||||
assertEquals(InterestPolicy.ALL, factoryBean.getPolicy());
|
||||
|
||||
SubscriptionAttributes subscriptionAttributes = factoryBean.getObject();
|
||||
|
||||
assertNotNull(subscriptionAttributes);
|
||||
assertEquals(InterestPolicy.ALL, subscriptionAttributes.getInterestPolicy());
|
||||
assertTrue(SubscriptionAttributes.class.isAssignableFrom(factoryBean.getObjectType()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetObjectAndObjectTypeForNullInterestPolicy() throws Exception {
|
||||
SubscriptionAttributesFactoryBean factoryBean = new SubscriptionAttributesFactoryBean();
|
||||
|
||||
factoryBean.setPolicy(null);
|
||||
factoryBean.afterPropertiesSet();
|
||||
|
||||
assertEquals(SubscriptionType.DEFAULT, factoryBean.getType());
|
||||
assertEquals(InterestPolicy.DEFAULT, factoryBean.getPolicy());
|
||||
|
||||
SubscriptionAttributes subscriptionAttributes = factoryBean.getObject();
|
||||
|
||||
assertNotNull(subscriptionAttributes);
|
||||
assertEquals(InterestPolicy.DEFAULT, subscriptionAttributes.getInterestPolicy());
|
||||
assertTrue(SubscriptionAttributes.class.isAssignableFrom(factoryBean.getObjectType()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* The SubscriptionTypeConverterTest class is a test suite of test cases testing the contract and functionality
|
||||
* of the SubscriptionTypeConverter class.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.springframework.data.gemfire.SubscriptionTypeConverter
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public class SubscriptionTypeConverterTest {
|
||||
|
||||
private SubscriptionTypeConverter converter = new SubscriptionTypeConverter();
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
converter.setValue(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConvert() {
|
||||
assertEquals(SubscriptionType.ALL, converter.convert("all"));
|
||||
assertEquals(SubscriptionType.CACHE_CONTENT, converter.convert("Cache_Content"));
|
||||
assertEquals(SubscriptionType.DEFAULT, converter.convert("DeFault"));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testConvertWithInvalidValue() {
|
||||
try {
|
||||
converter.convert("invalid");
|
||||
}
|
||||
catch (IllegalArgumentException expected) {
|
||||
assertEquals("Source (invalid) is not a valid SubscriptionType!", expected.getMessage());
|
||||
throw expected;
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetAsText() {
|
||||
converter.setAsText("aLl");
|
||||
assertEquals(SubscriptionType.ALL, converter.getValue());
|
||||
converter.setAsText("CACHE_content");
|
||||
assertEquals(SubscriptionType.CACHE_CONTENT, converter.getValue());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testSetAsTextWithInvalidValue() {
|
||||
try {
|
||||
converter.setAsText("none");
|
||||
}
|
||||
catch (IllegalArgumentException expected) {
|
||||
assertEquals("Source (none) is not a valid SubscriptionType!", expected.getMessage());
|
||||
throw expected;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.gemstone.gemfire.cache.InterestPolicy;
|
||||
|
||||
/**
|
||||
* The SubscriptionTypeTest class is a test suite of test cases testing the contract and functionality
|
||||
* of the SubscriptionType enumerated type.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.springframework.data.gemfire.SubscriptionType
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public class SubscriptionTypeTest {
|
||||
|
||||
@Test
|
||||
public void testValueOfInterestPolicies() {
|
||||
try {
|
||||
for (byte ordinal = 0; ordinal < Byte.MAX_VALUE; ordinal++) {
|
||||
InterestPolicy interestPolicy = InterestPolicy.fromOrdinal(ordinal);
|
||||
SubscriptionType subscriptionType = SubscriptionType.valueOf(interestPolicy);
|
||||
assertNotNull(subscriptionType);
|
||||
assertEquals(interestPolicy, subscriptionType.getInterestPolicy());
|
||||
}
|
||||
}
|
||||
catch (ArrayIndexOutOfBoundsException ignore) {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValueOfIgnoreCase() {
|
||||
assertEquals(SubscriptionType.ALL, SubscriptionType.valueOfIgnoreCase("all"));
|
||||
assertEquals(SubscriptionType.CACHE_CONTENT, SubscriptionType.valueOfIgnoreCase("Cache_Content"));
|
||||
assertEquals(SubscriptionType.DEFAULT, SubscriptionType.valueOfIgnoreCase("DeFault"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValueOfIgnoreCaseWithInvalidValue() {
|
||||
assertNull(SubscriptionType.valueOfIgnoreCase(null));
|
||||
assertNull(SubscriptionType.valueOfIgnoreCase(""));
|
||||
assertNull(SubscriptionType.valueOfIgnoreCase(" "));
|
||||
assertNull(SubscriptionType.valueOfIgnoreCase("@11"));
|
||||
assertNull(SubscriptionType.valueOfIgnoreCase("CACHE_KEYS"));
|
||||
assertNull(SubscriptionType.valueOfIgnoreCase("invalid"));
|
||||
assertNull(SubscriptionType.valueOfIgnoreCase("test"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
package org.springframework.data.gemfire.config;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
@@ -36,45 +37,60 @@ import com.gemstone.gemfire.cache.SubscriptionAttributes;
|
||||
* Test to ensure subscription policy can be applied to server regions.
|
||||
*
|
||||
* @author Lyndon Adams
|
||||
* @since 13 March 2013
|
||||
* @author John Blum
|
||||
* @since 1.3.0
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("/org/springframework/data/gemfire/config/subscription-ns.xml")
|
||||
@ContextConfiguration("subscription-ns.xml")
|
||||
@SuppressWarnings("unused")
|
||||
public class CacheSubscriptionTest{
|
||||
|
||||
@Autowired ApplicationContext context;
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Test
|
||||
public void testRRSubscriptionAllPolicy() throws Exception {
|
||||
public void testReplicatedRegionSubscriptionAllPolicy() throws Exception {
|
||||
assertTrue(context.containsBean("replicALL"));
|
||||
RegionFactoryBean fb = context.getBean("&replicALL", RegionFactoryBean.class);
|
||||
RegionAttributes attrs = TestUtils.readField("attributes", fb);
|
||||
|
||||
SubscriptionAttributes sa = attrs.getSubscriptionAttributes();
|
||||
assertEquals(InterestPolicy.ALL, sa.getInterestPolicy() );
|
||||
|
||||
RegionFactoryBean regionFactoryBean = context.getBean("&replicALL", RegionFactoryBean.class);
|
||||
RegionAttributes regionAttributes = TestUtils.readField("attributes", regionFactoryBean);
|
||||
|
||||
assertNotNull(regionAttributes);
|
||||
|
||||
SubscriptionAttributes subscriptionAttributes = regionAttributes.getSubscriptionAttributes();
|
||||
|
||||
assertNotNull(subscriptionAttributes);
|
||||
assertEquals(InterestPolicy.ALL, subscriptionAttributes.getInterestPolicy());
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Test
|
||||
public void testPRSubscriptionCacheContentPolicy() throws Exception {
|
||||
public void testPartitionRegionSubscriptionCacheContentPolicy() throws Exception {
|
||||
assertTrue(context.containsBean("partCACHE_CONTENT"));
|
||||
RegionFactoryBean fb = context.getBean("&partCACHE_CONTENT", RegionFactoryBean.class);
|
||||
RegionAttributes attrs = TestUtils.readField("attributes", fb);
|
||||
|
||||
SubscriptionAttributes sa = attrs.getSubscriptionAttributes();
|
||||
assertEquals(InterestPolicy.CACHE_CONTENT, sa.getInterestPolicy() );
|
||||
|
||||
RegionFactoryBean regionFactoryBean = context.getBean("&partCACHE_CONTENT", RegionFactoryBean.class);
|
||||
RegionAttributes regionAttributes = TestUtils.readField("attributes", regionFactoryBean);
|
||||
|
||||
assertNotNull(regionAttributes);
|
||||
|
||||
SubscriptionAttributes subscriptionAttributes = regionAttributes.getSubscriptionAttributes();
|
||||
|
||||
assertNotNull(subscriptionAttributes);
|
||||
assertEquals(InterestPolicy.CACHE_CONTENT, subscriptionAttributes.getInterestPolicy());
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Test
|
||||
public void testPRSubscriptionDefaultPolicy() throws Exception {
|
||||
public void testPartitionRegionSubscriptionDefaultPolicy() throws Exception {
|
||||
assertTrue(context.containsBean("partDEFAULT"));
|
||||
RegionFactoryBean fb = context.getBean("&partDEFAULT", RegionFactoryBean.class);
|
||||
RegionAttributes attrs = TestUtils.readField("attributes", fb);
|
||||
|
||||
SubscriptionAttributes sa = attrs.getSubscriptionAttributes();
|
||||
assertEquals(InterestPolicy.ALL, sa.getInterestPolicy() );
|
||||
|
||||
RegionFactoryBean regionFactoryBean = context.getBean("&partDEFAULT", RegionFactoryBean.class);
|
||||
RegionAttributes regionAttributes = TestUtils.readField("attributes", regionFactoryBean);
|
||||
|
||||
assertNotNull(regionAttributes);
|
||||
|
||||
SubscriptionAttributes subscriptionAttributes = regionAttributes.getSubscriptionAttributes();
|
||||
|
||||
assertNotNull(subscriptionAttributes);
|
||||
assertEquals(InterestPolicy.DEFAULT, subscriptionAttributes.getInterestPolicy());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user