You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ji...@apache.org on 2019/04/05 17:48:11 UTC
[geode] branch develop updated: GEODE-6505: move RegionShortcut and
ExpirationAction back to core (#3407)
This is an automated email from the ASF dual-hosted git repository.
jinmeiliao pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push:
new 50c3747 GEODE-6505: move RegionShortcut and ExpirationAction back to core (#3407)
50c3747 is described below
commit 50c37478f52aaeb5ccc45d595d604dffe87a16ec
Author: jinmeiliao <ji...@pivotal.io>
AuthorDate: Fri Apr 5 10:47:50 2019 -0700
GEODE-6505: move RegionShortcut and ExpirationAction back to core (#3407)
* use a different enum in geode-management module for recommended types
* move ExpirationAction back to core
* use string for expiration action in geode-management module and add validation
---
.../ManagementClientTestCreateRegion.java | 4 +-
...ClusterManagementLocatorReconnectDunitTest.java | 4 +-
.../rest/ManagementRequestLoggingDUnitTest.java | 4 +-
.../internal/rest/RegionManagementDunitTest.java | 6 +--
.../RegionManagementRestSecurityDUnitTest.java | 4 +-
.../integrationTest/resources/assembly_content.txt | 1 +
.../internal/CacheConfigDAODUnitTest.java | 4 +-
.../internal/api/RegionAPIDUnitTest.java | 6 +--
.../RegionConfigMutatorIntegrationTest.java | 4 +-
.../RegionConfigRealizerIntegrationTest.java | 4 +-
.../org/apache/geode/cache/ExpirationAction.java | 9 ++++-
.../org/apache/geode/cache/RegionShortcut.java | 0
.../internal/cli/commands/AlterRegionCommand.java | 15 +++++--
.../internal/cli/commands/CreateRegionCommand.java | 16 +++++---
.../validators/RegionConfigValidator.java | 4 +-
.../apache/geode/cache/ExpirationActionTest.java | 46 ++++++++++++++++++++++
.../geode/cache/configuration/CacheConfigTest.java | 5 +--
.../configuration/RegionAttributesTypeTest.java | 10 ++++-
.../cache/configuration/RegionConfigTest.java | 2 +-
...nternalConfigurationPersistenceServiceTest.java | 4 +-
.../geode/internal/config/JAXBServiceTest.java | 4 +-
.../cli/commands/AlterRegionCommandTest.java | 14 ++++---
.../realizers/RegionConfigRealizerTest.java | 4 +-
.../validators/RegionConfigValidatorTest.java | 4 +-
.../cache/configuration/RegionAttributesType.java | 23 ++++++-----
.../geode/cache/configuration/RegionConfig.java | 26 ++++++------
.../geode/cache/configuration/RegionType.java | 32 +++++++++++++++
.../ClientClusterManagementServiceDUnitTest.java | 4 +-
.../rest/RegionManagementIntegrationTest.java | 4 +-
.../RegionManagementSecurityIntegrationTest.java | 4 +-
30 files changed, 194 insertions(+), 77 deletions(-)
diff --git a/geode-assembly/src/acceptanceTest/resources/ManagementClientTestCreateRegion.java b/geode-assembly/src/acceptanceTest/resources/ManagementClientTestCreateRegion.java
index 2ddae41..0a8b8a5 100644
--- a/geode-assembly/src/acceptanceTest/resources/ManagementClientTestCreateRegion.java
+++ b/geode-assembly/src/acceptanceTest/resources/ManagementClientTestCreateRegion.java
@@ -15,8 +15,8 @@
import javax.net.ssl.SSLContext;
-import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.cache.configuration.RegionConfig;
+import org.apache.geode.cache.configuration.RegionType;
import org.apache.geode.management.api.ClusterManagementResult;
import org.apache.geode.management.api.ClusterManagementService;
import org.apache.geode.management.client.ClusterManagementServiceProvider;
@@ -37,7 +37,7 @@ public class ManagementClientCreateRegion {
RegionConfig config = new RegionConfig();
config.setName(regionName);
- config.setType(RegionShortcut.REPLICATE);
+ config.setType(RegionType.REPLICATE);
ClusterManagementResult result = cms.create(config, "cluster");
diff --git a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ClusterManagementLocatorReconnectDunitTest.java b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ClusterManagementLocatorReconnectDunitTest.java
index 6e22574..4dea93a 100644
--- a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ClusterManagementLocatorReconnectDunitTest.java
+++ b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ClusterManagementLocatorReconnectDunitTest.java
@@ -25,10 +25,10 @@ import org.junit.Rule;
import org.junit.Test;
import org.apache.geode.cache.Region;
-import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.cache.configuration.CacheConfig;
import org.apache.geode.cache.configuration.CacheElement;
import org.apache.geode.cache.configuration.RegionConfig;
+import org.apache.geode.cache.configuration.RegionType;
import org.apache.geode.management.api.ClusterManagementResult;
import org.apache.geode.test.dunit.IgnoredException;
import org.apache.geode.test.dunit.rules.ClusterStartupRule;
@@ -69,7 +69,7 @@ public class ClusterManagementLocatorReconnectDunitTest {
private void makeRestCallAndVerifyResult(String regionName) throws Exception {
RegionConfig regionConfig = new RegionConfig();
regionConfig.setName(regionName);
- regionConfig.setType(RegionShortcut.REPLICATE);
+ regionConfig.setType(RegionType.REPLICATE);
ObjectMapper mapper = new ObjectMapper();
String json = mapper.writeValueAsString(regionConfig);
diff --git a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ManagementRequestLoggingDUnitTest.java b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ManagementRequestLoggingDUnitTest.java
index 02d4685..8b2adcf 100644
--- a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ManagementRequestLoggingDUnitTest.java
+++ b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ManagementRequestLoggingDUnitTest.java
@@ -29,8 +29,8 @@ import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
-import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.cache.configuration.RegionConfig;
+import org.apache.geode.cache.configuration.RegionType;
import org.apache.geode.management.api.ClusterManagementResult;
import org.apache.geode.management.api.ClusterManagementService;
import org.apache.geode.management.client.ClusterManagementServiceProvider;
@@ -62,7 +62,7 @@ public class ManagementRequestLoggingDUnitTest {
RegionConfig regionConfig = new RegionConfig();
regionConfig.setName("customers");
- regionConfig.setType(RegionShortcut.REPLICATE);
+ regionConfig.setType(RegionType.REPLICATE);
ClusterManagementResult result = service.create(regionConfig);
assertThat(result.isSuccessful()).isTrue();
diff --git a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/RegionManagementDunitTest.java b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/RegionManagementDunitTest.java
index 937772b..60cdcc0 100644
--- a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/RegionManagementDunitTest.java
+++ b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/RegionManagementDunitTest.java
@@ -24,10 +24,10 @@ import org.junit.Test;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.Region;
-import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.cache.configuration.CacheConfig;
import org.apache.geode.cache.configuration.CacheElement;
import org.apache.geode.cache.configuration.RegionConfig;
+import org.apache.geode.cache.configuration.RegionType;
import org.apache.geode.management.api.ClusterManagementResult;
import org.apache.geode.test.dunit.IgnoredException;
import org.apache.geode.test.dunit.rules.ClusterStartupRule;
@@ -55,7 +55,7 @@ public class RegionManagementDunitTest {
public void createsRegion() throws Exception {
RegionConfig regionConfig = new RegionConfig();
regionConfig.setName("customers");
- regionConfig.setType(RegionShortcut.REPLICATE);
+ regionConfig.setType(RegionType.REPLICATE);
ObjectMapper mapper = new ObjectMapper();
String json = mapper.writeValueAsString(regionConfig);
@@ -85,7 +85,7 @@ public class RegionManagementDunitTest {
public void createsRegionUsingClusterManagementClient() throws Exception {
RegionConfig regionConfig = new RegionConfig();
regionConfig.setName("customers2");
- regionConfig.setType(RegionShortcut.REPLICATE);
+ regionConfig.setType(RegionType.REPLICATE);
ObjectMapper mapper = new ObjectMapper();
String json = mapper.writeValueAsString(regionConfig);
diff --git a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/RegionManagementRestSecurityDUnitTest.java b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/RegionManagementRestSecurityDUnitTest.java
index 3968421..2b28cc0 100644
--- a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/RegionManagementRestSecurityDUnitTest.java
+++ b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/RegionManagementRestSecurityDUnitTest.java
@@ -23,8 +23,8 @@ import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
-import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.cache.configuration.RegionConfig;
+import org.apache.geode.cache.configuration.RegionType;
import org.apache.geode.examples.SimpleSecurityManager;
import org.apache.geode.management.api.ClusterManagementResult;
import org.apache.geode.test.dunit.rules.ClusterStartupRule;
@@ -58,7 +58,7 @@ public class RegionManagementRestSecurityDUnitTest {
RegionConfig regionConfig = new RegionConfig();
regionConfig.setName("customers");
- regionConfig.setType(RegionShortcut.REPLICATE);
+ regionConfig.setType(RegionType.REPLICATE);
ObjectMapper mapper = new ObjectMapper();
json = mapper.writeValueAsString(regionConfig);
}
diff --git a/geode-assembly/src/integrationTest/resources/assembly_content.txt b/geode-assembly/src/integrationTest/resources/assembly_content.txt
index 9b8a35f..9b2a4a1 100644
--- a/geode-assembly/src/integrationTest/resources/assembly_content.txt
+++ b/geode-assembly/src/integrationTest/resources/assembly_content.txt
@@ -336,6 +336,7 @@ javadoc/org/apache/geode/cache/configuration/RegionAttributesType.html
javadoc/org/apache/geode/cache/configuration/RegionConfig.Entry.html
javadoc/org/apache/geode/cache/configuration/RegionConfig.Index.html
javadoc/org/apache/geode/cache/configuration/RegionConfig.html
+javadoc/org/apache/geode/cache/configuration/RegionType.html
javadoc/org/apache/geode/cache/configuration/ResourceManagerType.html
javadoc/org/apache/geode/cache/configuration/SerializationRegistrationType.Instantiator.html
javadoc/org/apache/geode/cache/configuration/SerializationRegistrationType.Serializer.html
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/CacheConfigDAODUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/CacheConfigDAODUnitTest.java
index e60252f..287737e 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/CacheConfigDAODUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/CacheConfigDAODUnitTest.java
@@ -22,8 +22,8 @@ import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Rule;
import org.junit.Test;
-import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.cache.configuration.RegionConfig;
+import org.apache.geode.cache.configuration.RegionType;
import org.apache.geode.distributed.ConfigurationPersistenceService;
import org.apache.geode.test.dunit.rules.ClusterStartupRule;
import org.apache.geode.test.dunit.rules.MemberVM;
@@ -46,7 +46,7 @@ public class CacheConfigDAODUnitTest {
ccService.updateCacheConfig("cluster", cc -> {
RegionConfig regionConfig = new RegionConfig();
regionConfig.setName("regionB");
- regionConfig.setType(RegionShortcut.REPLICATE);
+ regionConfig.setType(RegionType.REPLICATE);
cc.getRegions().add(regionConfig);
return cc;
});
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/api/RegionAPIDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/api/RegionAPIDUnitTest.java
index b7ea652..fb60da7 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/api/RegionAPIDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/api/RegionAPIDUnitTest.java
@@ -25,10 +25,10 @@ import org.junit.rules.TestName;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.Region;
-import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.cache.configuration.CacheConfig;
import org.apache.geode.cache.configuration.CacheElement;
import org.apache.geode.cache.configuration.RegionConfig;
+import org.apache.geode.cache.configuration.RegionType;
import org.apache.geode.management.api.ClusterManagementResult;
import org.apache.geode.test.dunit.rules.ClusterStartupRule;
import org.apache.geode.test.dunit.rules.MemberVM;
@@ -63,7 +63,7 @@ public class RegionAPIDUnitTest {
locator.invoke(() -> {
RegionConfig config = new RegionConfig();
config.setName(regionName);
- config.setType(RegionShortcut.PARTITION);
+ config.setType(RegionType.PARTITION);
ClusterManagementResult result = ClusterStartupRule.getLocator().getClusterManagementService()
.create(config, "cluster");
assertThat(result.isSuccessful()).isTrue();
@@ -88,7 +88,7 @@ public class RegionAPIDUnitTest {
locator.invoke(() -> {
RegionConfig config = new RegionConfig();
config.setName(regionName);
- config.setType(RegionShortcut.REPLICATE);
+ config.setType(RegionType.REPLICATE);
ClusterManagementResult result = ClusterStartupRule.getLocator().getClusterManagementService()
.create(config, "cluster");
assertThat(result.isSuccessful()).isTrue();
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/management/internal/configuration/mutators/RegionConfigMutatorIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/management/internal/configuration/mutators/RegionConfigMutatorIntegrationTest.java
index d7068a3..30d4140 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/management/internal/configuration/mutators/RegionConfigMutatorIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/management/internal/configuration/mutators/RegionConfigMutatorIntegrationTest.java
@@ -20,10 +20,10 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.cache.configuration.CacheConfig;
import org.apache.geode.cache.configuration.CacheElement;
import org.apache.geode.cache.configuration.RegionConfig;
+import org.apache.geode.cache.configuration.RegionType;
import org.apache.geode.test.junit.rules.LocatorStarterRule;
public class RegionConfigMutatorIntegrationTest {
@@ -42,7 +42,7 @@ public class RegionConfigMutatorIntegrationTest {
@Test
public void sanity() throws Exception {
- config.setType(RegionShortcut.REPLICATE);
+ config.setType(RegionType.REPLICATE);
config.setName("test");
CacheConfig cacheConfig =
locator.getLocator().getConfigurationPersistenceService().getCacheConfig("cluster", true);
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/management/internal/configuration/realizers/RegionConfigRealizerIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/management/internal/configuration/realizers/RegionConfigRealizerIntegrationTest.java
index c500fe0..26d6212 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/management/internal/configuration/realizers/RegionConfigRealizerIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/management/internal/configuration/realizers/RegionConfigRealizerIntegrationTest.java
@@ -22,9 +22,9 @@ import org.junit.Test;
import org.apache.geode.cache.DataPolicy;
import org.apache.geode.cache.Region;
-import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.cache.Scope;
import org.apache.geode.cache.configuration.RegionConfig;
+import org.apache.geode.cache.configuration.RegionType;
import org.apache.geode.test.junit.rules.ServerStarterRule;
public class RegionConfigRealizerIntegrationTest {
@@ -44,7 +44,7 @@ public class RegionConfigRealizerIntegrationTest {
@Test
public void sanityCheck() throws Exception {
config.setName("test");
- config.setType(RegionShortcut.REPLICATE);
+ config.setType(RegionType.REPLICATE);
realizer.create(config, server.getCache());
diff --git a/geode-common/src/main/java/org/apache/geode/cache/ExpirationAction.java b/geode-core/src/main/java/org/apache/geode/cache/ExpirationAction.java
similarity index 97%
rename from geode-common/src/main/java/org/apache/geode/cache/ExpirationAction.java
rename to geode-core/src/main/java/org/apache/geode/cache/ExpirationAction.java
index 7d3e67f..cf673af 100644
--- a/geode-common/src/main/java/org/apache/geode/cache/ExpirationAction.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/ExpirationAction.java
@@ -19,28 +19,33 @@ package org.apache.geode.cache;
import java.io.ObjectStreamException;
import java.io.Serializable;
+import org.apache.geode.annotations.Immutable;
+
/**
* Enumerated type for expiration actions.
*
*
*
- * @see ExpirationAttributes
* @since GemFire 3.0
*/
public class ExpirationAction implements Serializable {
private static final long serialVersionUID = 658925707882047900L;
/** When the region or cached object expires, it is invalidated. */
+ @Immutable
public static final ExpirationAction INVALIDATE = new ExpirationAction("INVALIDATE");
/** When expired, invalidated locally only. Not supported for partitioned regions. */
+ @Immutable
public static final ExpirationAction LOCAL_INVALIDATE = new ExpirationAction("LOCAL_INVALIDATE");
/** When the region or cached object expires, it is destroyed. */
+ @Immutable
public static final ExpirationAction DESTROY = new ExpirationAction("DESTROY");
/**
* When expired, destroyed locally only. Not supported for partitioned regions. Use DESTROY
* instead.
*/
+ @Immutable
public static final ExpirationAction LOCAL_DESTROY = new ExpirationAction("LOCAL_DESTROY");
/** The name of this action */
@@ -163,8 +168,10 @@ public class ExpirationAction implements Serializable {
}
// The 4 declarations below are necessary for serialization
+ @Immutable
private static int nextOrdinal = 0;
public final int ordinal = nextOrdinal++;
+ @Immutable
private static final ExpirationAction[] VALUES =
{INVALIDATE, LOCAL_INVALIDATE, DESTROY, LOCAL_DESTROY};
diff --git a/geode-management/src/main/java/org/apache/geode/cache/RegionShortcut.java b/geode-core/src/main/java/org/apache/geode/cache/RegionShortcut.java
similarity index 100%
rename from geode-management/src/main/java/org/apache/geode/cache/RegionShortcut.java
rename to geode-core/src/main/java/org/apache/geode/cache/RegionShortcut.java
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AlterRegionCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AlterRegionCommand.java
index 9717559..d7a3a6e 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AlterRegionCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AlterRegionCommand.java
@@ -138,14 +138,21 @@ public class AlterRegionCommand extends SingleGfshCommand {
RegionAttributesType regionAttributesType = new RegionAttributesType();
deltaConfig.setRegionAttributes(regionAttributesType);
regionAttributesType.setEntryIdleTime(ExpirationAttributesType.generate(entryExpirationIdleTime,
- entryExpirationIdleTimeAction, entryIdleTimeCustomExpiry));
+ (entryExpirationIdleTimeAction == null) ? null
+ : entryExpirationIdleTimeAction.toXmlString(),
+ entryIdleTimeCustomExpiry));
regionAttributesType.setEntryTimeToLive(ExpirationAttributesType.generate(entryExpirationTTL,
- entryExpirationTTLAction, entryTTLCustomExpiry));
+ (entryExpirationTTLAction == null) ? null : entryExpirationTTLAction.toXmlString(),
+ entryTTLCustomExpiry));
regionAttributesType.setRegionIdleTime(
- ExpirationAttributesType.generate(regionExpirationIdleTime, regionExpirationIdleTimeAction,
+ ExpirationAttributesType.generate(regionExpirationIdleTime,
+ (regionExpirationIdleTimeAction == null) ? null
+ : regionExpirationIdleTimeAction.toXmlString(),
null));
regionAttributesType.setRegionTimeToLive(
- ExpirationAttributesType.generate(regionExpirationTTL, regionExpirationTTLAction, null));
+ ExpirationAttributesType.generate(regionExpirationTTL,
+ (regionExpirationTTLAction == null) ? null : regionExpirationTTLAction.toXmlString(),
+ null));
if (cacheLoader != null) {
regionAttributesType.setCacheLoader(
new DeclarableType(cacheLoader.getClassName(), cacheLoader.getInitProperties()));
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommand.java
index 82dcabf..10b2d51 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommand.java
@@ -224,7 +224,7 @@ public class CreateRegionCommand extends SingleGfshCommand {
InternalConfigurationPersistenceService persistenceService =
getConfigurationPersistenceService();
if (regionShortcut != null) {
- regionConfig.setType(regionShortcut);
+ regionConfig.setType(regionShortcut.name());
}
// get the attributes from the template region
else {
@@ -434,13 +434,19 @@ public class CreateRegionCommand extends SingleGfshCommand {
regionAttributes.setDiskSynchronous(diskSynchronous);
}
- regionAttributes.updateEntryIdleTime(entryExpirationIdleTime, entryExpirationIdleTimeAction,
+ regionAttributes.updateEntryIdleTime(entryExpirationIdleTime,
+ (entryExpirationIdleTimeAction == null) ? null
+ : entryExpirationIdleTimeAction.toXmlString(),
entryIdleTimeCustomExpiry);
- regionAttributes.updateEntryTimeToLive(entryExpirationTTL, entryExpirationTTLAction,
+ regionAttributes.updateEntryTimeToLive(entryExpirationTTL,
+ (entryExpirationTTLAction == null) ? null : entryExpirationTTLAction.toXmlString(),
entryTTLCustomExpiry);
- regionAttributes.updateRegionIdleTime(regionExpirationIdleTime, regionExpirationIdleTimeAction,
+ regionAttributes.updateRegionIdleTime(regionExpirationIdleTime,
+ (regionExpirationIdleTimeAction == null) ? null
+ : regionExpirationIdleTimeAction.toXmlString(),
null);
- regionAttributes.updateRegionTimeToLive(regionExpirationTTL, regionExpirationTTLAction, null);
+ regionAttributes.updateRegionTimeToLive(regionExpirationTTL,
+ (regionExpirationTTLAction == null) ? null : regionExpirationTTLAction.toXmlString(), null);
// unlike expiration attributes, if any single eviction attributes is set, we will replace
// the template eviction attributes with this new eviction attributes. we do not combine
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/validators/RegionConfigValidator.java b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/validators/RegionConfigValidator.java
index 222ac05..63bc3c8 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/validators/RegionConfigValidator.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/validators/RegionConfigValidator.java
@@ -15,10 +15,10 @@
package org.apache.geode.management.internal.configuration.validators;
-import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.cache.configuration.CacheConfig;
import org.apache.geode.cache.configuration.CacheElement;
import org.apache.geode.cache.configuration.RegionConfig;
+import org.apache.geode.cache.configuration.RegionType;
import org.apache.geode.internal.cache.RegionNameValidation;
public class RegionConfigValidator implements ConfigurationValidator<RegionConfig> {
@@ -33,7 +33,7 @@ public class RegionConfigValidator implements ConfigurationValidator<RegionConfi
RegionNameValidation.validate(config.getName());
if (config.getType() == null) {
- RegionShortcut defaultRegion = RegionShortcut.PARTITION;
+ RegionType defaultRegion = RegionType.PARTITION;
config.setType(defaultRegion);
}
}
diff --git a/geode-core/src/test/java/org/apache/geode/cache/ExpirationActionTest.java b/geode-core/src/test/java/org/apache/geode/cache/ExpirationActionTest.java
new file mode 100644
index 0000000..d44b428
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/cache/ExpirationActionTest.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You 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.apache.geode.cache;
+
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import org.junit.Test;
+
+public class ExpirationActionTest {
+
+ @Test
+ public void toXmlString() throws Exception {
+ assertThat(ExpirationAction.LOCAL_DESTROY.toXmlString()).isEqualTo("local-destroy");
+ assertThat(ExpirationAction.DESTROY.toXmlString()).isEqualTo("destroy");
+ assertThat(ExpirationAction.LOCAL_INVALIDATE.toXmlString()).isEqualTo("local-invalidate");
+ assertThat(ExpirationAction.INVALIDATE.toXmlString()).isEqualTo("invalidate");
+ }
+
+ @Test
+ public void fromXmlString() throws Exception {
+ assertThat(ExpirationAction.fromXmlString("local-destroy"))
+ .isEqualTo(ExpirationAction.LOCAL_DESTROY);
+ assertThat(ExpirationAction.fromXmlString("destroy")).isEqualTo(ExpirationAction.DESTROY);
+ assertThat(ExpirationAction.fromXmlString("local-invalidate"))
+ .isEqualTo(ExpirationAction.LOCAL_INVALIDATE);
+ assertThat(ExpirationAction.fromXmlString("invalidate")).isEqualTo(ExpirationAction.INVALIDATE);
+ assertThatThrownBy(() -> ExpirationAction.fromXmlString("invalid"))
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageContaining("invalid expiration action: invalid");
+ }
+}
diff --git a/geode-core/src/test/java/org/apache/geode/cache/configuration/CacheConfigTest.java b/geode-core/src/test/java/org/apache/geode/cache/configuration/CacheConfigTest.java
index adb59ad..f81cdd2 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/configuration/CacheConfigTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/configuration/CacheConfigTest.java
@@ -23,7 +23,6 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.internal.config.JAXBService;
@@ -49,7 +48,7 @@ public class CacheConfigTest {
service.validateWithLocalCacheXSD();
regionConfig = new RegionConfig();
regionConfig.setName("regionA");
- regionConfig.setType(RegionShortcut.REPLICATE);
+ regionConfig.setType(RegionType.REPLICATE);
regionXml = "<region name=\"regionA\" refid=\"REPLICATE\">";
classNameTypeXml = "<class-name>my.className</class-name>";
@@ -173,7 +172,7 @@ public class CacheConfigTest {
cacheConfig = new CacheConfig("1.0");
RegionConfig regionConfig = new RegionConfig();
regionConfig.setName("test");
- regionConfig.setType(RegionShortcut.REPLICATE);
+ regionConfig.setType(RegionType.REPLICATE);
RegionAttributesType attributes = new RegionAttributesType();
attributes.setCacheLoader(new DeclarableType("abc.Foo"));
regionConfig.setRegionAttributes(attributes);
diff --git a/geode-core/src/test/java/org/apache/geode/cache/configuration/RegionAttributesTypeTest.java b/geode-core/src/test/java/org/apache/geode/cache/configuration/RegionAttributesTypeTest.java
index 8010c72..4a3a11e 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/configuration/RegionAttributesTypeTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/configuration/RegionAttributesTypeTest.java
@@ -46,7 +46,7 @@ public class RegionAttributesTypeTest {
@Test
public void expirationAttributesConstructor() {
expirationAttributes =
- new ExpirationAttributesType(null, ExpirationAction.DESTROY, null,
+ new ExpirationAttributesType(null, ExpirationAction.DESTROY.toXmlString(), null,
null);
assertThat(expirationAttributes.getAction()).isEqualTo("destroy");
assertThat(expirationAttributes.getTimeout()).isNull();
@@ -93,7 +93,7 @@ public class RegionAttributesTypeTest {
.isEqualToComparingFieldByFieldRecursively(expirationAttributes);
ExpirationAttributesType another =
- new ExpirationAttributesType(null, ExpirationAction.DESTROY, "abc", null);
+ new ExpirationAttributesType(null, ExpirationAction.DESTROY.toXmlString(), "abc", null);
expirationAttributes = ExpirationAttributesType.combine(expirationAttributes, another);
assertThat(expirationAttributes.getTimeout()).isEqualTo("8");
assertThat(expirationAttributes.getAction()).isEqualTo(ExpirationAction.DESTROY.toXmlString());
@@ -101,6 +101,12 @@ public class RegionAttributesTypeTest {
}
@Test
+ public void expirationAttributesDetail() throws Exception {
+ assertThatThrownBy(() -> new ExpirationAttributesType(8, "invalid", null, null))
+ .isInstanceOf(IllegalArgumentException.class);
+ }
+
+ @Test
public void generateEvictionAttributes() {
EvictionAttributes evictionAttributes = EvictionAttributes.generate(null, null, null, null);
assertThat(evictionAttributes).isNull();
diff --git a/geode-core/src/test/java/org/apache/geode/cache/configuration/RegionConfigTest.java b/geode-core/src/test/java/org/apache/geode/cache/configuration/RegionConfigTest.java
index 62dd8c3..c04739f 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/configuration/RegionConfigTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/configuration/RegionConfigTest.java
@@ -66,7 +66,7 @@ public class RegionConfigTest {
RegionShortcut[] shortcuts = RegionShortcut.values();
for (RegionShortcut shortcut : shortcuts) {
RegionConfig config = new RegionConfig();
- config.setType(shortcut);
+ config.setType(shortcut.name());
config.setName(shortcut.name());
RegionConfig masterRegion = CacheElement.findElement(master.getRegions(), shortcut.name());
assertThat(config).isEqualToComparingFieldByFieldRecursively(masterRegion);
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/InternalConfigurationPersistenceServiceTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/InternalConfigurationPersistenceServiceTest.java
index d2c2ddb..dc1cfb5 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/internal/InternalConfigurationPersistenceServiceTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/InternalConfigurationPersistenceServiceTest.java
@@ -43,10 +43,10 @@ import org.junit.runner.RunWith;
import org.w3c.dom.Document;
import org.apache.geode.cache.Region;
-import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.cache.configuration.CacheConfig;
import org.apache.geode.cache.configuration.JndiBindingsType;
import org.apache.geode.cache.configuration.RegionConfig;
+import org.apache.geode.cache.configuration.RegionType;
import org.apache.geode.internal.config.JAXBServiceTest;
import org.apache.geode.internal.config.JAXBServiceTest.ElementOne;
import org.apache.geode.internal.config.JAXBServiceTest.ElementTwo;
@@ -83,7 +83,7 @@ public class InternalConfigurationPersistenceServiceTest {
service.updateCacheConfig("cluster", cacheConfig -> {
RegionConfig regionConfig = new RegionConfig();
regionConfig.setName("regionA");
- regionConfig.setType(RegionShortcut.REPLICATE);
+ regionConfig.setType(RegionType.REPLICATE);
cacheConfig.getRegions().add(regionConfig);
return cacheConfig;
});
diff --git a/geode-core/src/test/java/org/apache/geode/internal/config/JAXBServiceTest.java b/geode-core/src/test/java/org/apache/geode/internal/config/JAXBServiceTest.java
index c86f63f..e67f085 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/config/JAXBServiceTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/config/JAXBServiceTest.java
@@ -31,10 +31,10 @@ import javax.xml.bind.annotation.XmlType;
import org.junit.Before;
import org.junit.Test;
-import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.cache.configuration.CacheConfig;
import org.apache.geode.cache.configuration.CacheElement;
import org.apache.geode.cache.configuration.RegionConfig;
+import org.apache.geode.cache.configuration.RegionType;
public class JAXBServiceTest {
@@ -219,7 +219,7 @@ public class JAXBServiceTest {
RegionConfig region = new RegionConfig();
region.setName("testRegion");
- region.setType(RegionShortcut.REPLICATE);
+ region.setType(RegionType.REPLICATE);
cache.getRegions().add(region);
}
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/AlterRegionCommandTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/AlterRegionCommandTest.java
index 8577f3b..6aaf4e1 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/AlterRegionCommandTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/AlterRegionCommandTest.java
@@ -78,7 +78,7 @@ public class AlterRegionCommandTest {
cacheConfig = new CacheConfig();
existingRegionConfig = new RegionConfig();
existingRegionConfig.setName("/regionA");
- existingRegionConfig.setType(RegionShortcut.REPLICATE);
+ existingRegionConfig.setType(RegionShortcut.REPLICATE.name());
cacheConfig.getRegions().add(existingRegionConfig);
when(ccService.getCacheConfig("cluster")).thenReturn(cacheConfig);
}
@@ -220,7 +220,8 @@ public class AlterRegionCommandTest {
// check that the combined the configuration is created as expected
RegionAttributesType existingAttributes = new RegionAttributesType();
RegionAttributesType.ExpirationAttributesType expirationAttributesType =
- new RegionAttributesType.ExpirationAttributesType(10, ExpirationAction.DESTROY, null, null);
+ new RegionAttributesType.ExpirationAttributesType(10,
+ ExpirationAction.DESTROY.toXmlString(), null, null);
existingAttributes.setEntryIdleTime(expirationAttributesType);
existingRegionConfig.setRegionAttributes(existingAttributes);
@@ -247,7 +248,8 @@ public class AlterRegionCommandTest {
// check that the combined the configuration is created as expected
RegionAttributesType existingAttributes = new RegionAttributesType();
RegionAttributesType.ExpirationAttributesType expirationAttributesType =
- new RegionAttributesType.ExpirationAttributesType(10, ExpirationAction.INVALIDATE, null,
+ new RegionAttributesType.ExpirationAttributesType(10,
+ ExpirationAction.INVALIDATE.toXmlString(), null,
null);
existingAttributes.setEntryIdleTime(expirationAttributesType);
existingRegionConfig.setRegionAttributes(existingAttributes);
@@ -274,7 +276,8 @@ public class AlterRegionCommandTest {
// check that the combined the configuration is created as expected
RegionAttributesType existingAttributes = new RegionAttributesType();
RegionAttributesType.ExpirationAttributesType expirationAttributesType =
- new RegionAttributesType.ExpirationAttributesType(10, ExpirationAction.INVALIDATE, null,
+ new RegionAttributesType.ExpirationAttributesType(10,
+ ExpirationAction.INVALIDATE.toXmlString(), null,
null);
existingAttributes.setEntryIdleTime(expirationAttributesType);
existingRegionConfig.setRegionAttributes(existingAttributes);
@@ -301,7 +304,8 @@ public class AlterRegionCommandTest {
// check that the combined the configuration is created as expected
RegionAttributesType existingAttributes = new RegionAttributesType();
RegionAttributesType.ExpirationAttributesType expirationAttributesType =
- new RegionAttributesType.ExpirationAttributesType(10, ExpirationAction.INVALIDATE, null,
+ new RegionAttributesType.ExpirationAttributesType(10,
+ ExpirationAction.INVALIDATE.toXmlString(), null,
null);
existingAttributes.setEntryIdleTime(expirationAttributesType);
existingRegionConfig.setRegionAttributes(existingAttributes);
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/realizers/RegionConfigRealizerTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/realizers/RegionConfigRealizerTest.java
index bb7a4ae..3451d89 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/realizers/RegionConfigRealizerTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/realizers/RegionConfigRealizerTest.java
@@ -48,7 +48,7 @@ public class RegionConfigRealizerTest {
public void createsPartitionedInCache() {
RegionConfig config = new RegionConfig();
config.setName("regionName");
- config.setType(RegionShortcut.PARTITION);
+ config.setType(RegionShortcut.PARTITION.name());
realizer.create(config, cache);
@@ -63,7 +63,7 @@ public class RegionConfigRealizerTest {
public void createsReplicateInCache() {
RegionConfig config = new RegionConfig();
config.setName("regionName");
- config.setType(RegionShortcut.REPLICATE);
+ config.setType(RegionShortcut.REPLICATE.name());
realizer.create(config, cache);
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/validators/RegionConfigValidatorTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/validators/RegionConfigValidatorTest.java
index bc27140..c586a2a 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/validators/RegionConfigValidatorTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/validators/RegionConfigValidatorTest.java
@@ -23,8 +23,8 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
import org.junit.Before;
import org.junit.Test;
-import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.cache.configuration.RegionConfig;
+import org.apache.geode.cache.configuration.RegionType;
public class RegionConfigValidatorTest {
@@ -40,7 +40,7 @@ public class RegionConfigValidatorTest {
@Test
public void noChangesWhenTypeIsSet() {
config.setName("regionName");
- config.setType(RegionShortcut.REPLICATE);
+ config.setType(RegionType.REPLICATE);
validator.validate(config);
assertThat(config.getType()).isEqualTo("REPLICATE");
}
diff --git a/geode-management/src/main/java/org/apache/geode/cache/configuration/RegionAttributesType.java b/geode-management/src/main/java/org/apache/geode/cache/configuration/RegionAttributesType.java
index cbabd08..63d72e7 100644
--- a/geode-management/src/main/java/org/apache/geode/cache/configuration/RegionAttributesType.java
+++ b/geode-management/src/main/java/org/apache/geode/cache/configuration/RegionAttributesType.java
@@ -36,7 +36,6 @@ import javax.xml.bind.annotation.XmlType;
import org.apache.commons.lang3.StringUtils;
import org.apache.geode.annotations.Experimental;
-import org.apache.geode.cache.ExpirationAction;
import org.apache.geode.management.internal.cli.domain.ClassName;
@@ -509,7 +508,7 @@ public class RegionAttributesType implements Serializable {
* @param expiry could be null
*/
public void updateRegionTimeToLive(Integer timeout,
- ExpirationAction action, ClassName expiry) {
+ String action, ClassName expiry) {
regionTimeToLive = ExpirationAttributesType.combine(regionTimeToLive,
ExpirationAttributesType.generate(timeout, action, expiry));
}
@@ -545,7 +544,7 @@ public class RegionAttributesType implements Serializable {
* @param expiry could be null
*/
public void updateRegionIdleTime(Integer timeout,
- ExpirationAction action, ClassName expiry) {
+ String action, ClassName expiry) {
regionIdleTime = ExpirationAttributesType.combine(regionIdleTime,
ExpirationAttributesType.generate(timeout, action, expiry));
}
@@ -582,7 +581,7 @@ public class RegionAttributesType implements Serializable {
* @param expiry could be null
*/
public void updateEntryTimeToLive(Integer timeout,
- ExpirationAction action, ClassName expiry) {
+ String action, ClassName expiry) {
entryTimeToLive = ExpirationAttributesType.combine(entryTimeToLive,
ExpirationAttributesType.generate(timeout, action, expiry));
}
@@ -618,7 +617,7 @@ public class RegionAttributesType implements Serializable {
* @param expiry could be null
*/
public void updateEntryIdleTime(Integer timeout,
- ExpirationAction action, ClassName expiry) {
+ String action, ClassName expiry) {
entryIdleTime = ExpirationAttributesType.combine(entryIdleTime,
ExpirationAttributesType.generate(timeout, action, expiry));
}
@@ -1771,11 +1770,11 @@ public class RegionAttributesType implements Serializable {
public ExpirationAttributesType() {}
- public ExpirationAttributesType(Integer timeout, ExpirationAction action, String expiry,
+ public ExpirationAttributesType(Integer timeout, String action, String expiry,
Properties iniProps) {
expirationAttributes.setTimeout(Objects.toString(timeout, null));
if (action != null) {
- expirationAttributes.setAction(action.toXmlString());
+ expirationAttributes.setAction(action);
}
if (expiry != null) {
expirationAttributes.setCustomExpiry(new DeclarableType(expiry, iniProps));
@@ -1783,7 +1782,7 @@ public class RegionAttributesType implements Serializable {
}
public static ExpirationAttributesType generate(Integer timeout,
- ExpirationAction action, ClassName expiry) {
+ String action, ClassName expiry) {
if (timeout == null && action == null && expiry == null) {
return null;
}
@@ -1804,7 +1803,7 @@ public class RegionAttributesType implements Serializable {
if (existing == null) {
existing = new ExpirationAttributesType();
- existing.setAction(ExpirationAction.INVALIDATE.toXmlString());
+ existing.setAction("invalidate");
existing.setTimeout("0");
}
@@ -1914,6 +1913,9 @@ public class RegionAttributesType implements Serializable {
@XmlAttribute(name = "timeout", required = true)
protected String timeout;
+ private static List<String> ALLOWED_ACTIONS =
+ Arrays.asList("invalidate", "destroy", "local-invalidate", "local-destroy");
+
/**
* Gets the value of the customExpiry property.
*
@@ -1955,6 +1957,9 @@ public class RegionAttributesType implements Serializable {
*
*/
public void setAction(String value) {
+ if (!ALLOWED_ACTIONS.contains(value)) {
+ throw new IllegalArgumentException("invalid expiration action: " + value);
+ }
this.action = value;
}
diff --git a/geode-management/src/main/java/org/apache/geode/cache/configuration/RegionConfig.java b/geode-management/src/main/java/org/apache/geode/cache/configuration/RegionConfig.java
index 43ea718..d339cc9 100644
--- a/geode-management/src/main/java/org/apache/geode/cache/configuration/RegionConfig.java
+++ b/geode-management/src/main/java/org/apache/geode/cache/configuration/RegionConfig.java
@@ -32,7 +32,6 @@ import javax.xml.bind.annotation.XmlType;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.apache.geode.annotations.Experimental;
-import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.management.api.RestfulEndpoint;
@@ -362,9 +361,15 @@ public class RegionConfig implements CacheElement, RestfulEndpoint {
* {@link String }
*
*/
- public void setType(RegionShortcut regionShortcut) {
- if (regionShortcut != null) {
- this.type = regionShortcut.name();
+ public void setType(RegionType regionType) {
+ if (regionType != null) {
+ setType(regionType.name());
+ }
+ }
+
+ public void setType(String regionType) {
+ if (regionType != null) {
+ this.type = regionType.toUpperCase();
setShortcutAttributes();
}
}
@@ -379,6 +384,11 @@ public class RegionConfig implements CacheElement, RestfulEndpoint {
regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PARTITION);
break;
}
+ case "REPLICATE": {
+ regionAttributes.setDataPolicy(RegionAttributesDataPolicy.REPLICATE);
+ regionAttributes.setScope(RegionAttributesScope.DISTRIBUTED_ACK);
+ break;
+ }
case "PARTITION_REDUNDANT": {
regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PARTITION);
regionAttributes.setRedundantCopy("1");
@@ -408,14 +418,12 @@ public class RegionConfig implements CacheElement, RestfulEndpoint {
regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PERSISTENT_PARTITION);
regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.OVERFLOW_TO_DISK);
break;
-
}
case "PARTITION_REDUNDANT_PERSISTENT_OVERFLOW": {
regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PERSISTENT_PARTITION);
regionAttributes.setRedundantCopy("1");
regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.OVERFLOW_TO_DISK);
break;
-
}
case "PARTITION_HEAP_LRU": {
regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PARTITION);
@@ -429,11 +437,7 @@ public class RegionConfig implements CacheElement, RestfulEndpoint {
regionAttributes.setLruHeapPercentage(EnumActionDestroyOverflow.LOCAL_DESTROY);
break;
}
- case "REPLICATE": {
- regionAttributes.setDataPolicy(RegionAttributesDataPolicy.REPLICATE);
- regionAttributes.setScope(RegionAttributesScope.DISTRIBUTED_ACK);
- break;
- }
+
case "REPLICATE_PERSISTENT": {
regionAttributes.setDataPolicy(RegionAttributesDataPolicy.PERSISTENT_REPLICATE);
regionAttributes.setScope(RegionAttributesScope.DISTRIBUTED_ACK);
diff --git a/geode-management/src/main/java/org/apache/geode/cache/configuration/RegionType.java b/geode-management/src/main/java/org/apache/geode/cache/configuration/RegionType.java
new file mode 100644
index 0000000..5a382f0
--- /dev/null
+++ b/geode-management/src/main/java/org/apache/geode/cache/configuration/RegionType.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You 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.apache.geode.cache.configuration;
+
+/**
+ * Cluster Management V2 API supports all region shortcuts and attributes, but these are the
+ * recommended types by the Cluster Management V2 API
+ */
+public enum RegionType {
+ /**
+ * Same as RegionShortCut.PARTITION
+ */
+ PARTITION,
+
+ /**
+ * Same as RegionShortCut.REPLICATE
+ */
+ REPLICATE,
+}
diff --git a/geode-web-management/src/distributedTest/java/org/apache/geode/management/client/ClientClusterManagementServiceDUnitTest.java b/geode-web-management/src/distributedTest/java/org/apache/geode/management/client/ClientClusterManagementServiceDUnitTest.java
index f8be9de..bbf3e73 100644
--- a/geode-web-management/src/distributedTest/java/org/apache/geode/management/client/ClientClusterManagementServiceDUnitTest.java
+++ b/geode-web-management/src/distributedTest/java/org/apache/geode/management/client/ClientClusterManagementServiceDUnitTest.java
@@ -29,8 +29,8 @@ import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.web.context.WebApplicationContext;
-import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.cache.configuration.RegionConfig;
+import org.apache.geode.cache.configuration.RegionType;
import org.apache.geode.management.api.ClusterManagementResult;
import org.apache.geode.management.api.ClusterManagementService;
import org.apache.geode.management.internal.rest.LocatorWebContext;
@@ -67,7 +67,7 @@ public class ClientClusterManagementServiceDUnitTest {
public void createRegion() {
RegionConfig region = new RegionConfig();
region.setName("customer");
- region.setType(RegionShortcut.REPLICATE);
+ region.setType(RegionType.REPLICATE);
ClusterManagementResult result = client.create(region);
diff --git a/geode-web-management/src/integrationTest/java/org/apache/geode/management/internal/rest/RegionManagementIntegrationTest.java b/geode-web-management/src/integrationTest/java/org/apache/geode/management/internal/rest/RegionManagementIntegrationTest.java
index 07de9c2..713d6a4 100644
--- a/geode-web-management/src/integrationTest/java/org/apache/geode/management/internal/rest/RegionManagementIntegrationTest.java
+++ b/geode-web-management/src/integrationTest/java/org/apache/geode/management/internal/rest/RegionManagementIntegrationTest.java
@@ -33,8 +33,8 @@ import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.web.context.WebApplicationContext;
-import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.cache.configuration.RegionConfig;
+import org.apache.geode.cache.configuration.RegionType;
@RunWith(SpringRunner.class)
@ContextConfiguration(locations = {"classpath*:WEB-INF/geode-management-servlet.xml"},
@@ -58,7 +58,7 @@ public class RegionManagementIntegrationTest {
public void sanityCheck() throws Exception {
RegionConfig regionConfig = new RegionConfig();
regionConfig.setName("customers");
- regionConfig.setType(RegionShortcut.REPLICATE);
+ regionConfig.setType(RegionType.REPLICATE);
ObjectMapper mapper = new ObjectMapper();
String json = mapper.writeValueAsString(regionConfig);
diff --git a/geode-web-management/src/integrationTest/java/org/apache/geode/management/internal/rest/RegionManagementSecurityIntegrationTest.java b/geode-web-management/src/integrationTest/java/org/apache/geode/management/internal/rest/RegionManagementSecurityIntegrationTest.java
index 1dc1a81..8e90922 100644
--- a/geode-web-management/src/integrationTest/java/org/apache/geode/management/internal/rest/RegionManagementSecurityIntegrationTest.java
+++ b/geode-web-management/src/integrationTest/java/org/apache/geode/management/internal/rest/RegionManagementSecurityIntegrationTest.java
@@ -32,8 +32,8 @@ import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.web.context.WebApplicationContext;
-import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.cache.configuration.RegionConfig;
+import org.apache.geode.cache.configuration.RegionType;
@RunWith(SpringRunner.class)
@ContextConfiguration(locations = {"classpath*:WEB-INF/geode-management-servlet.xml"},
@@ -53,7 +53,7 @@ public class RegionManagementSecurityIntegrationTest {
public void before() throws JsonProcessingException {
regionConfig = new RegionConfig();
regionConfig.setName("customers");
- regionConfig.setType(RegionShortcut.REPLICATE);
+ regionConfig.setType(RegionType.REPLICATE);
ObjectMapper mapper = new ObjectMapper();
json = mapper.writeValueAsString(regionConfig);
context = new LocatorWebContext(webApplicationContext);