Merged pull request #30 from dturanski/SGF-211. In addition, added additional test cases to verify that the underlying GemFire PartitionAttributesFactory validates the value of the 'redundantCopies' property before creating the PartitionAttributes instance given the type for the 'copies' attribute on the basePartitionedRegionType in the SDG XML Schema was changed from a byte to a string and the type restrictions (0-3) on the value were lifted.

This commit is contained in:
John Blum
2013-10-10 11:41:07 -07:00
parent f21df49608
commit 8deda7804c

View File

@@ -16,8 +16,10 @@
package org.springframework.data.gemfire;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.junit.Test;
@@ -71,4 +73,18 @@ public class PartitionAttributesFactoryBeanTest {
assertEquals(42, partitionAttributes.getTotalNumBuckets());
}
@Test(expected = IllegalStateException.class)
public void testValidationOnRedundantCopiesWhenExceedsBound() throws Exception {
PartitionAttributesFactoryBean partitionAttributesFactoryBean = new PartitionAttributesFactoryBean();
partitionAttributesFactoryBean.setRedundantCopies(4);
partitionAttributesFactoryBean.getObject();
}
@Test(expected = IllegalStateException.class)
public void testValidationOnRedundantCopiesWhenPrecedesBound() throws Exception {
PartitionAttributesFactoryBean partitionAttributesFactoryBean = new PartitionAttributesFactoryBean();
partitionAttributesFactoryBean.setRedundantCopies(-1);
partitionAttributesFactoryBean.getObject();
}
}