From 8deda7804c684e83263be8a80a71b1ee5c45a66d Mon Sep 17 00:00:00 2001 From: John Blum Date: Thu, 10 Oct 2013 11:41:07 -0700 Subject: [PATCH] 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. --- .../PartitionAttributesFactoryBeanTest.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/springframework/data/gemfire/PartitionAttributesFactoryBeanTest.java b/src/test/java/org/springframework/data/gemfire/PartitionAttributesFactoryBeanTest.java index b562a588..d78ade57 100644 --- a/src/test/java/org/springframework/data/gemfire/PartitionAttributesFactoryBeanTest.java +++ b/src/test/java/org/springframework/data/gemfire/PartitionAttributesFactoryBeanTest.java @@ -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(); + } + }