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/06/27 03:20:39 UTC
[geode] branch develop updated: GEODE-6861: Have CacheElement
support multi groups by default (#3749)
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 55e1b83 GEODE-6861: Have CacheElement support multi groups by default (#3749)
55e1b83 is described below
commit 55e1b8323f79138a252beddcd758b3c7d7a0c946
Author: Jinmei Liao <ji...@pivotal.io>
AuthorDate: Wed Jun 26 20:20:19 2019 -0700
GEODE-6861: Have CacheElement support multi groups by default (#3749)
Co-authored-by: Joris Melchior <jo...@gmail.com>
* Remove MultiGroupCacheElement and RuntimeIndex
* does not allow create element in multiple groups at a time
---
.../rest/ListIndexManagementDUnitTest.java | 21 ++++----
.../integrationTest/resources/assembly_content.txt | 2 -
.../api/LocatorClusterManagementService.java | 60 +++++++++-------------
.../validators/CacheElementValidator.java | 4 ++
.../sanctioned-geode-management-serializables.txt | 1 -
.../validators/CacheElementValidatorTest.java | 11 ++++
.../validators/RegionConfigValidatorTest.java | 1 -
.../geode/cache/configuration/CacheElement.java | 10 ++++
.../geode/cache/configuration/RegionConfig.java | 3 +-
.../configuration/MultiGroupCacheElement.java | 46 -----------------
.../management/configuration/RuntimeIndex.java | 33 ------------
.../configuration/RuntimeMemberConfig.java | 6 +--
.../configuration/RuntimeRegionConfig.java | 19 +++----
.../configuration/CacheElementJsonMappingTest.java | 7 ++-
.../cache/configuration/CacheElementTest.java | 5 +-
.../controllers/RegionManagementController.java | 13 +++--
16 files changed, 78 insertions(+), 164 deletions(-)
diff --git a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ListIndexManagementDUnitTest.java b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ListIndexManagementDUnitTest.java
index 296acf7..36f295c 100644
--- a/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ListIndexManagementDUnitTest.java
+++ b/geode-assembly/src/distributedTest/java/org/apache/geode/management/internal/rest/ListIndexManagementDUnitTest.java
@@ -31,7 +31,6 @@ 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.ClusterManagementServiceBuilder;
-import org.apache.geode.management.configuration.RuntimeIndex;
import org.apache.geode.management.configuration.RuntimeRegionConfig;
import org.apache.geode.test.dunit.rules.ClusterStartupRule;
import org.apache.geode.test.dunit.rules.MemberVM;
@@ -107,8 +106,8 @@ public class ListIndexManagementDUnitTest {
public void listIndexForOneRegion() throws Exception {
RegionConfig.Index index = new RegionConfig.Index();
index.setRegionName("region1");
- ClusterManagementResult<RuntimeIndex> list = cms.list(index);
- List<RuntimeIndex> result = list.getResult();
+ ClusterManagementResult<RegionConfig.Index> list = cms.list(index);
+ List<RegionConfig.Index> result = list.getResult();
assertThat(result).hasSize(2);
}
@@ -117,10 +116,10 @@ public class ListIndexManagementDUnitTest {
RegionConfig.Index index = new RegionConfig.Index();
index.setRegionName("region1");
index.setName("index1");
- ClusterManagementResult<RuntimeIndex> list = cms.get(index);
- List<RuntimeIndex> result = list.getResult();
+ ClusterManagementResult<RegionConfig.Index> list = cms.get(index);
+ List<RegionConfig.Index> result = list.getResult();
assertThat(result).hasSize(1);
- RuntimeIndex runtimeIndex = result.get(0);
+ RegionConfig.Index runtimeIndex = result.get(0);
assertThat(runtimeIndex.getRegionName()).isEqualTo("region1");
assertThat(runtimeIndex.getName()).isEqualTo("index1");
assertThat(runtimeIndex.getFromClause()).isEqualTo("/region1");
@@ -148,10 +147,10 @@ public class ListIndexManagementDUnitTest {
RegionConfig.Index index = new RegionConfig.Index();
index.setRegionName("region1");
index.setName("index1");
- ClusterManagementResult<RuntimeIndex> list = cms.list(index);
- List<RuntimeIndex> result = list.getResult();
+ ClusterManagementResult<RegionConfig.Index> list = cms.list(index);
+ List<RegionConfig.Index> result = list.getResult();
assertThat(result).hasSize(1);
- RuntimeIndex runtimeIndex = result.get(0);
+ RegionConfig.Index runtimeIndex = result.get(0);
assertThat(runtimeIndex.getRegionName()).isEqualTo("region1");
assertThat(runtimeIndex.getName()).isEqualTo("index1");
assertThat(runtimeIndex.getFromClause()).isEqualTo("/region1");
@@ -172,8 +171,8 @@ public class ListIndexManagementDUnitTest {
RegionConfig.Index index = new RegionConfig.Index();
index.setRegionName("region1");
index.setName("index333");
- ClusterManagementResult<RuntimeIndex> list = cms.list(index);
- List<RuntimeIndex> result = list.getResult();
+ ClusterManagementResult<RegionConfig.Index> list = cms.list(index);
+ List<RegionConfig.Index> result = list.getResult();
assertThat(result).hasSize(0);
assertThat(list.isSuccessful()).isTrue();
}
diff --git a/geode-assembly/src/integrationTest/resources/assembly_content.txt b/geode-assembly/src/integrationTest/resources/assembly_content.txt
index 99e9c04..be4ab26 100644
--- a/geode-assembly/src/integrationTest/resources/assembly_content.txt
+++ b/geode-assembly/src/integrationTest/resources/assembly_content.txt
@@ -716,8 +716,6 @@ javadoc/org/apache/geode/management/client/package-frame.html
javadoc/org/apache/geode/management/client/package-summary.html
javadoc/org/apache/geode/management/client/package-tree.html
javadoc/org/apache/geode/management/configuration/MemberConfig.html
-javadoc/org/apache/geode/management/configuration/MultiGroupCacheElement.html
-javadoc/org/apache/geode/management/configuration/RuntimeIndex.html
javadoc/org/apache/geode/management/configuration/RuntimeMemberConfig.CacheServerConfig.html
javadoc/org/apache/geode/management/configuration/RuntimeMemberConfig.html
javadoc/org/apache/geode/management/configuration/RuntimeRegionConfig.html
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/api/LocatorClusterManagementService.java b/geode-core/src/main/java/org/apache/geode/management/internal/api/LocatorClusterManagementService.java
index a8da348..119b980 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/api/LocatorClusterManagementService.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/api/LocatorClusterManagementService.java
@@ -50,7 +50,6 @@ import org.apache.geode.management.api.ClusterManagementService;
import org.apache.geode.management.api.RealizationResult;
import org.apache.geode.management.api.RespondsWith;
import org.apache.geode.management.configuration.MemberConfig;
-import org.apache.geode.management.configuration.MultiGroupCacheElement;
import org.apache.geode.management.internal.CacheElementOperation;
import org.apache.geode.management.internal.cli.functions.UpdateCacheFunction;
import org.apache.geode.management.internal.configuration.mutators.ConfigurationManager;
@@ -260,12 +259,8 @@ public class LocatorClusterManagementService implements ClusterManagementService
CacheConfig currentPersistedConfig = persistenceService.getCacheConfig(group, true);
List<R> listInGroup = manager.list(filter, currentPersistedConfig);
for (R element : listInGroup) {
- if (filter.getGroup() == null || // if listing all groups
- group.equals(filter.getGroup()) || // if filter group matches this group
- element instanceof MultiGroupCacheElement) { // if element can span multi groups
- element.setGroup(group);
- resultList.add(element);
- }
+ element.setGroup(group);
+ resultList.add(element);
}
}
@@ -276,38 +271,31 @@ public class LocatorClusterManagementService implements ClusterManagementService
// right now the list contains [{regionA, group1}, {regionA, group2}...], if the elements are
// MultiGroupCacheElement, we need to consolidate the list into [{regionA, [group1, group2]}
- if (resultList.get(0) instanceof MultiGroupCacheElement) {
- List<R> multiGroupList = new ArrayList<>();
- for (R element : resultList) {
- int index = multiGroupList.indexOf(element);
- if (index >= 0) {
- MultiGroupCacheElement exist = (MultiGroupCacheElement) multiGroupList.get(index);
- exist.getGroups().add(element.getGroup());
- } else {
- multiGroupList.add(element);
- }
- }
- if (StringUtils.isNotBlank(filter.getGroup())) {
- multiGroupList = multiGroupList.stream()
- .filter(e -> ((MultiGroupCacheElement) e).getGroups().contains(filter.getConfigGroup()))
- .collect(Collectors.toList());
- }
- // if "cluster" is the only group, clear it
- for (R elem : multiGroupList) {
- MultiGroupCacheElement element = (MultiGroupCacheElement) elem;
- if (element.getGroups().size() == 1 && CacheElement.CLUSTER.equals(element.getGroup())) {
- element.getGroups().clear();
- }
+
+ List<R> consolidatedConfigList = new ArrayList<>();
+ for (R element : resultList) {
+ int index = consolidatedConfigList.indexOf(element);
+ if (index >= 0) {
+ R exist = consolidatedConfigList.get(index);
+ exist.getGroups().add(element.getGroup());
+ } else {
+ consolidatedConfigList.add(element);
}
- resultList = multiGroupList;
- } else {
- // for non-MultiGroup CacheElement, just clear out the "cluster" group
- for (R element : resultList) {
- if (CacheElement.CLUSTER.equals(element.getGroup())) {
- element.setGroup(null);
- }
+ }
+ if (StringUtils.isNotBlank(filter.getGroup())) {
+ consolidatedConfigList = consolidatedConfigList.stream()
+ .filter(e -> (e.getGroups().contains(filter.getConfigGroup())))
+ .collect(Collectors.toList());
+ }
+ // if "cluster" is the only group, clear it
+ for (R element : consolidatedConfigList) {
+ if (element.getGroups().size() == 1 && CacheElement.CLUSTER.equals(element.getGroup())) {
+ element.getGroups().clear();
}
}
+ resultList = consolidatedConfigList;
+
+
result.setResult(resultList);
return result;
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/validators/CacheElementValidator.java b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/validators/CacheElementValidator.java
index 7f025fb..47ba178 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/validators/CacheElementValidator.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/validators/CacheElementValidator.java
@@ -43,6 +43,10 @@ public class CacheElementValidator implements ConfigurationValidator<CacheElemen
}
private void validateCreate(CacheElement config) {
+ if (config.getGroups().size() > 1) {
+ throw new IllegalArgumentException("Can only create element in one group at a time.");
+ }
+
String group = config.getGroup();
if (CacheElement.CLUSTER.equalsIgnoreCase(group)) {
throw new IllegalArgumentException("'"
diff --git a/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-management-serializables.txt b/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-management-serializables.txt
index 43a05b7..658e281 100644
--- a/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-management-serializables.txt
+++ b/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-management-serializables.txt
@@ -34,7 +34,6 @@ org/apache/geode/cache/configuration/RegionType,false
org/apache/geode/management/api/ClusterManagementResult$StatusCode,false
org/apache/geode/management/api/RealizationResult,false,memberName:java/lang/String,message:java/lang/String,success:boolean
org/apache/geode/management/configuration/MemberConfig,false,id:java/lang/String
-org/apache/geode/management/configuration/RuntimeIndex,false
org/apache/geode/management/configuration/RuntimeMemberConfig,false,cacheServers:java/util/List,clientConnections:int,host:java/lang/String,initialHeap:long,isCoordinator:boolean,isLocator:boolean,logFile:java/lang/String,maxHeap:long,pid:int,port:java/lang/Integer,status:java/lang/String,usedHeap:long,workingDirectory:java/lang/String
org/apache/geode/management/configuration/RuntimeRegionConfig,false,entryCount:long
org/apache/geode/management/internal/cli/domain/ClassName,true,1,className:java/lang/String,initProperties:java/util/Properties
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/validators/CacheElementValidatorTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/validators/CacheElementValidatorTest.java
index 7486cbe..4ee0846 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/validators/CacheElementValidatorTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/validators/CacheElementValidatorTest.java
@@ -66,4 +66,15 @@ public class CacheElementValidatorTest {
.hasMessageContaining(
"Group name should not contain comma");
}
+
+ @Test
+ public void multipleGroups() throws Exception {
+ config.setName("name");
+ config.addGroup("group1");
+ config.addGroup("group2");
+ assertThatThrownBy(() -> validator.validate(CacheElementOperation.CREATE, config)).isInstanceOf(
+ IllegalArgumentException.class)
+ .hasMessageContaining(
+ "Can only create element in one group at a time");
+ }
}
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 3ca00a5..aca148d 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
@@ -221,5 +221,4 @@ public class RegionConfigValidatorTest {
validator.validate(CacheElementOperation.CREATE, config);
assertThat(attributes.getPartitionAttributes().getLocalMaxMemory()).isEqualTo("0");
}
-
}
diff --git a/geode-management/src/main/java/org/apache/geode/cache/configuration/CacheElement.java b/geode-management/src/main/java/org/apache/geode/cache/configuration/CacheElement.java
index bb6e673..246acf2 100644
--- a/geode-management/src/main/java/org/apache/geode/cache/configuration/CacheElement.java
+++ b/geode-management/src/main/java/org/apache/geode/cache/configuration/CacheElement.java
@@ -69,6 +69,7 @@ public abstract class CacheElement implements Identifiable<String>, Serializable
* if no group is set, this returns null
*/
@XmlTransient
+ @JsonIgnore
public String getGroup() {
if (groups.size() == 0) {
return null;
@@ -85,4 +86,13 @@ public abstract class CacheElement implements Identifiable<String>, Serializable
}
groups.add(group);
}
+
+ @XmlTransient
+ public List<String> getGroups() {
+ return groups;
+ }
+
+ public void addGroup(String group) {
+ groups.add(group);
+ }
}
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 b5cc0f4..bc371d8 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
@@ -39,7 +39,6 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.geode.annotations.Experimental;
import org.apache.geode.management.api.RespondsWith;
import org.apache.geode.management.api.RestfulEndpoint;
-import org.apache.geode.management.configuration.RuntimeIndex;
import org.apache.geode.management.configuration.RuntimeRegionConfig;
@@ -539,7 +538,7 @@ public class RegionConfig extends CacheElement implements RestfulEndpoint,
@XmlAccessorType(XmlAccessType.FIELD)
@JsonIgnoreProperties(value = {"uri"}, allowGetters = true)
public static class Index extends CacheElement
- implements RestfulEndpoint, RespondsWith<RuntimeIndex> {
+ implements RestfulEndpoint, RespondsWith<Index> {
@XmlAttribute(name = "name", required = true)
protected String name;
@XmlAttribute(name = "expression")
diff --git a/geode-management/src/main/java/org/apache/geode/management/configuration/MultiGroupCacheElement.java b/geode-management/src/main/java/org/apache/geode/management/configuration/MultiGroupCacheElement.java
deleted file mode 100644
index aa9f634..0000000
--- a/geode-management/src/main/java/org/apache/geode/management/configuration/MultiGroupCacheElement.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.management.configuration;
-
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlTransient;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-import org.apache.geode.annotations.Experimental;
-
-/**
- * Implement this interface only when the CacheElement can span multiple groups.
- *
- * The implementation of getGroup should already be implemented by CacheElement
- *
- * If implementation of getGroups should be simply "return groups" if the object is already a
- * CacheElement.
- *
- * When implementing this interface, the CacheElement also needs to specifically implement
- * Object.equals() method
- */
-@Experimental
-public interface MultiGroupCacheElement {
- @XmlTransient
- List<String> getGroups();
-
- // this is needed to hide "group" attribute in json serialization
- @XmlTransient
- @JsonIgnore
- String getGroup();
-}
diff --git a/geode-management/src/main/java/org/apache/geode/management/configuration/RuntimeIndex.java b/geode-management/src/main/java/org/apache/geode/management/configuration/RuntimeIndex.java
deleted file mode 100644
index 51ef2ff..0000000
--- a/geode-management/src/main/java/org/apache/geode/management/configuration/RuntimeIndex.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.management.configuration;
-
-import java.util.List;
-
-import org.apache.geode.cache.configuration.RegionConfig;
-
-public class RuntimeIndex extends RegionConfig.Index implements MultiGroupCacheElement {
- @Override
- public List<String> getGroups() {
- return groups;
- }
-
- public RuntimeIndex() {};
-
- public RuntimeIndex(RegionConfig.Index index) {
- super(index);
- }
-}
diff --git a/geode-management/src/main/java/org/apache/geode/management/configuration/RuntimeMemberConfig.java b/geode-management/src/main/java/org/apache/geode/management/configuration/RuntimeMemberConfig.java
index ea0866a..2806065 100644
--- a/geode-management/src/main/java/org/apache/geode/management/configuration/RuntimeMemberConfig.java
+++ b/geode-management/src/main/java/org/apache/geode/management/configuration/RuntimeMemberConfig.java
@@ -23,7 +23,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import org.apache.geode.annotations.Experimental;
@Experimental
-public class RuntimeMemberConfig extends MemberConfig implements MultiGroupCacheElement {
+public class RuntimeMemberConfig extends MemberConfig {
private boolean isLocator;
private boolean isCoordinator;
private String host;
@@ -130,10 +130,6 @@ public class RuntimeMemberConfig extends MemberConfig implements MultiGroupCache
cacheServers.add(cacheServer);
}
- public List<String> getGroups() {
- return groups;
- }
-
public void setGroups(List<String> groups) {
this.groups = groups;
}
diff --git a/geode-management/src/main/java/org/apache/geode/management/configuration/RuntimeRegionConfig.java b/geode-management/src/main/java/org/apache/geode/management/configuration/RuntimeRegionConfig.java
index 1043883..a76bfc0 100644
--- a/geode-management/src/main/java/org/apache/geode/management/configuration/RuntimeRegionConfig.java
+++ b/geode-management/src/main/java/org/apache/geode/management/configuration/RuntimeRegionConfig.java
@@ -26,7 +26,7 @@ import org.apache.geode.annotations.Experimental;
import org.apache.geode.cache.configuration.RegionConfig;
@Experimental
-public class RuntimeRegionConfig extends RegionConfig implements MultiGroupCacheElement {
+public class RuntimeRegionConfig extends RegionConfig {
private long entryCount;
public RuntimeRegionConfig() {}
@@ -43,21 +43,14 @@ public class RuntimeRegionConfig extends RegionConfig implements MultiGroupCache
this.entryCount = entrySize;
}
- public List<String> getGroups() {
- return groups;
- }
-
- public List<RuntimeIndex> getRuntimeIndexes(String indexId) {
+ public List<Index> getIndexes(String indexId) {
Stream<Index> stream = getIndexes().stream();
if (StringUtils.isNotBlank(indexId)) {
stream = stream.filter(i -> i.getId().equals(indexId));
}
- return stream
- .map(e -> {
- RuntimeIndex index = new RuntimeIndex(e);
- index.setRegionName(getName());
- return index;
- })
- .collect(Collectors.toList());
+ return stream.map(index -> {
+ index.setRegionName(getName());
+ return index;
+ }).collect(Collectors.toList());
}
}
diff --git a/geode-management/src/test/java/org/apache/geode/cache/configuration/CacheElementJsonMappingTest.java b/geode-management/src/test/java/org/apache/geode/cache/configuration/CacheElementJsonMappingTest.java
index ee5cc5c..0f1b2fd 100644
--- a/geode-management/src/test/java/org/apache/geode/cache/configuration/CacheElementJsonMappingTest.java
+++ b/geode-management/src/test/java/org/apache/geode/cache/configuration/CacheElementJsonMappingTest.java
@@ -26,7 +26,6 @@ import org.junit.Test;
import org.apache.geode.management.api.ClusterManagementResult;
import org.apache.geode.management.configuration.MemberConfig;
-import org.apache.geode.management.configuration.RuntimeIndex;
import org.apache.geode.management.configuration.RuntimeMemberConfig;
import org.apache.geode.management.configuration.RuntimeRegionConfig;
import org.apache.geode.util.internal.GeodeJsonMapper;
@@ -137,7 +136,7 @@ public class CacheElementJsonMappingTest {
String json = mapper.writeValueAsString(config);
System.out.println(json);
assertThat(json)
- .contains("\"group\":\"group1\"");
+ .contains("\"groups\":[\"group1\"]");
}
@Test
@@ -169,7 +168,7 @@ public class CacheElementJsonMappingTest {
runtimeConfig = mapper.readValue(json, RuntimeRegionConfig.class);
assertThat(runtimeConfig.getGroups()).containsExactly("group1");
- List<RuntimeIndex> runtimeIndexes = runtimeConfig.getRuntimeIndexes(null);
+ List<RegionConfig.Index> runtimeIndexes = runtimeConfig.getIndexes(null);
assertThat(runtimeIndexes).hasSize(1);
assertThat(runtimeIndexes.get(0).getRegionName()).isEqualTo("region1");
}
@@ -181,6 +180,6 @@ public class CacheElementJsonMappingTest {
config.setGroup("cluster");
String json = mapper.writeValueAsString(config);
System.out.println(json);
- assertThat(json).contains("\"group\":\"cluster\"");
+ assertThat(json).contains("\"groups\":[\"cluster\"]");
}
}
diff --git a/geode-management/src/test/java/org/apache/geode/cache/configuration/CacheElementTest.java b/geode-management/src/test/java/org/apache/geode/cache/configuration/CacheElementTest.java
index 58b82ed..6df10c6 100644
--- a/geode-management/src/test/java/org/apache/geode/cache/configuration/CacheElementTest.java
+++ b/geode-management/src/test/java/org/apache/geode/cache/configuration/CacheElementTest.java
@@ -22,14 +22,13 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.apache.geode.management.configuration.MultiGroupCacheElement;
import org.apache.geode.management.configuration.RuntimeRegionConfig;
import org.apache.geode.util.internal.GeodeJsonMapper;
public class CacheElementTest {
private CacheElement element;
- private MultiGroupCacheElement runtime;
+ private RuntimeRegionConfig runtime;
private static ObjectMapper mapper;
private String json;
@@ -71,7 +70,7 @@ public class CacheElementTest {
assertThat(element.getConfigGroup()).isEqualTo("group1");
json = mapper.writeValueAsString(element);
System.out.println(json);
- assertThat(json).contains("\"group\":\"group1\"").doesNotContain("groups");
+ assertThat(json).contains("\"groups\":[\"group1\"]").doesNotContain("group:");
}
@Test
diff --git a/geode-web-management/src/main/java/org/apache/geode/management/internal/rest/controllers/RegionManagementController.java b/geode-web-management/src/main/java/org/apache/geode/management/internal/rest/controllers/RegionManagementController.java
index 1c58c1c..e98e203 100644
--- a/geode-web-management/src/main/java/org/apache/geode/management/internal/rest/controllers/RegionManagementController.java
+++ b/geode-web-management/src/main/java/org/apache/geode/management/internal/rest/controllers/RegionManagementController.java
@@ -37,7 +37,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.apache.geode.cache.configuration.RegionConfig;
import org.apache.geode.management.api.ClusterManagementResult;
-import org.apache.geode.management.configuration.RuntimeIndex;
import org.apache.geode.management.configuration.RuntimeRegionConfig;
import org.apache.geode.management.internal.exceptions.EntityNotFoundException;
import org.apache.geode.security.ResourcePermission.Operation;
@@ -106,7 +105,7 @@ public class RegionManagementController extends AbstractManagementController {
@RequestMapping(method = RequestMethod.GET,
value = REGION_CONFIG_ENDPOINT + "/{regionName}/indexes")
@ResponseBody
- public ClusterManagementResult<RuntimeIndex> listIndex(
+ public ClusterManagementResult<RegionConfig.Index> listIndex(
@PathVariable String regionName,
@RequestParam(required = false) String id) {
@@ -114,8 +113,8 @@ public class RegionManagementController extends AbstractManagementController {
RuntimeRegionConfig runtimeRegion = result0.getResult().get(0);
// only send the index information back
- List<RuntimeIndex> runtimeIndexes = runtimeRegion.getRuntimeIndexes(id);
- ClusterManagementResult<RuntimeIndex> result = new ClusterManagementResult<>();
+ List<RegionConfig.Index> runtimeIndexes = runtimeRegion.getIndexes(id);
+ ClusterManagementResult<RegionConfig.Index> result = new ClusterManagementResult<>();
result.setResult(runtimeIndexes);
return result;
@@ -124,11 +123,11 @@ public class RegionManagementController extends AbstractManagementController {
@RequestMapping(method = RequestMethod.GET,
value = REGION_CONFIG_ENDPOINT + "/{regionName}/indexes/{id}")
@ResponseBody
- public ClusterManagementResult<RuntimeIndex> getIndex(
+ public ClusterManagementResult<RegionConfig.Index> getIndex(
@PathVariable String regionName,
@PathVariable String id) {
- ClusterManagementResult<RuntimeIndex> result = listIndex(regionName, id);
- List<RuntimeIndex> indexList = result.getResult();
+ ClusterManagementResult<RegionConfig.Index> result = listIndex(regionName, id);
+ List<RegionConfig.Index> indexList = result.getResult();
if (indexList.size() == 0) {
throw new EntityNotFoundException("Index " + id + " not found.");