You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by ji...@apache.org on 2020/04/23 19:27:56 UTC
[helix] 10/23: rename custmized state aggregation config to
customized state config (#885)
This is an automated email from the ASF dual-hosted git repository.
jiajunwang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git
commit 21a47c5473f14f70d9e1419ffb522aa3905bb49a
Author: zhangmeng916 <56...@users.noreply.github.com>
AuthorDate: Tue Mar 10 22:45:05 2020 -0700
rename custmized state aggregation config to customized state config (#885)
Rename customized state aggregation config to customized state config for future extendibility.
Co-authored-by: Meng Zhang <mn...@mnzhang-mn1.linkedin.biz>
---
.../main/java/org/apache/helix/ConfigAccessor.java | 10 +--
.../src/main/java/org/apache/helix/HelixAdmin.java | 22 +++----
.../main/java/org/apache/helix/HelixConstants.java | 2 +-
.../main/java/org/apache/helix/HelixManager.java | 10 +--
.../main/java/org/apache/helix/PropertyKey.java | 6 +-
...va => CustomizedStateConfigChangeListener.java} | 8 +--
.../helix/common/caches/CustomizedStateCache.java | 6 +-
.../org/apache/helix/manager/zk/ZKHelixAdmin.java | 56 ++++++++--------
.../apache/helix/manager/zk/ZKHelixManager.java | 10 +--
...ationConfig.java => CustomizedStateConfig.java} | 58 ++++++++---------
.../controller/stages/DummyClusterManager.java | 4 +-
.../apache/helix/manager/zk/TestZkHelixAdmin.java | 9 ++-
.../java/org/apache/helix/mock/MockHelixAdmin.java | 12 ++--
.../java/org/apache/helix/mock/MockManager.java | 4 +-
...nConfig.java => TestCustomizedStateConfig.java} | 74 +++++++++++-----------
.../helix/participant/MockZKHelixManager.java | 4 +-
.../server/resources/helix/ClusterAccessor.java | 36 +++++------
.../helix/rest/server/TestClusterAccessor.java | 5 +-
18 files changed, 168 insertions(+), 168 deletions(-)
diff --git a/helix-core/src/main/java/org/apache/helix/ConfigAccessor.java b/helix-core/src/main/java/org/apache/helix/ConfigAccessor.java
index 63f232e..30a9a8f 100644
--- a/helix-core/src/main/java/org/apache/helix/ConfigAccessor.java
+++ b/helix-core/src/main/java/org/apache/helix/ConfigAccessor.java
@@ -33,7 +33,7 @@ import org.apache.helix.manager.zk.ZKUtil;
import org.apache.helix.model.ClusterConfig;
import org.apache.helix.model.CloudConfig;
import org.apache.helix.model.ConfigScope;
-import org.apache.helix.model.CustomizedStateAggregationConfig;
+import org.apache.helix.model.CustomizedStateConfig;
import org.apache.helix.model.HelixConfigScope;
import org.apache.helix.model.HelixConfigScope.ConfigScopeProperty;
import org.apache.helix.model.InstanceConfig;
@@ -589,11 +589,11 @@ public class ConfigAccessor {
}
/**
- * Get CustomizedStateAggregationConfig of the given cluster.
+ * Get CustomizedStateConfig of the given cluster.
* @param clusterName
- * @return The instance of {@link CustomizedStateAggregationConfig}
+ * @return The instance of {@link CustomizedStateConfig}
*/
- public CustomizedStateAggregationConfig getCustomizedStateAggregationConfig(String clusterName) {
+ public CustomizedStateConfig getCustomizedStateConfig(String clusterName) {
if (!ZKUtil.isClusterSetup(clusterName, _zkClient)) {
throw new HelixException(String.format("Failed to get config. cluster: %s is not setup.", clusterName));
}
@@ -606,7 +606,7 @@ public class ConfigAccessor {
return null;
}
- return new CustomizedStateAggregationConfig.Builder(record).build();
+ return new CustomizedStateConfig.Builder(record).build();
}
/**
diff --git a/helix-core/src/main/java/org/apache/helix/HelixAdmin.java b/helix-core/src/main/java/org/apache/helix/HelixAdmin.java
index 985d00f..11b8667 100644
--- a/helix-core/src/main/java/org/apache/helix/HelixAdmin.java
+++ b/helix-core/src/main/java/org/apache/helix/HelixAdmin.java
@@ -26,7 +26,7 @@ import org.apache.helix.model.CloudConfig;
import org.apache.helix.model.ClusterConstraints;
import org.apache.helix.model.ClusterConstraints.ConstraintType;
import org.apache.helix.model.ConstraintItem;
-import org.apache.helix.model.CustomizedStateAggregationConfig;
+import org.apache.helix.model.CustomizedStateConfig;
import org.apache.helix.model.ExternalView;
import org.apache.helix.model.HelixConfigScope;
import org.apache.helix.model.IdealState;
@@ -106,30 +106,30 @@ public interface HelixAdmin {
*/
void addClusterToGrandCluster(String clusterName, String grandCluster);
- /** Add a CustomizedStateAggregationConfig to a cluster
+ /** Add a CustomizedStateConfig to a cluster
* @param clusterName
- * @param customizedStateAggregationConfig
+ * @param customizedStateConfig
*/
- void addCustomizedStateAggregationConfig(String clusterName,
- CustomizedStateAggregationConfig customizedStateAggregationConfig);
+ void addCustomizedStateConfig(String clusterName,
+ CustomizedStateConfig customizedStateConfig);
/**
- * Remove CustomizedStateAggregationConfig from specific cluster
+ * Remove CustomizedStateConfig from specific cluster
* @param clusterName
*/
- void removeCustomizedStateAggregationConfig(String clusterName);
+ void removeCustomizedStateConfig(String clusterName);
/**
- * Add a type to CustomizedStateAggregationConfig of specific cluster
+ * Add a type to CustomizedStateConfig of specific cluster
* @param clusterName
*/
- void addTypeToCustomizedStateAggregationConfig(String clusterName, String type);
+ void addTypeToCustomizedStateConfig(String clusterName, String type);
/**
- * Remove a type from CustomizedStateAggregationConfig of specific cluster
+ * Remove a type from CustomizedStateConfig of specific cluster
* @param clusterName
*/
- void removeTypeFromCustomizedStateAggregationConfig(String clusterName, String type);
+ void removeTypeFromCustomizedStateConfig(String clusterName, String type);
/**
* Add a resource to a cluster, using the default ideal state mode AUTO
diff --git a/helix-core/src/main/java/org/apache/helix/HelixConstants.java b/helix-core/src/main/java/org/apache/helix/HelixConstants.java
index 27f82c6..c71f340 100644
--- a/helix-core/src/main/java/org/apache/helix/HelixConstants.java
+++ b/helix-core/src/main/java/org/apache/helix/HelixConstants.java
@@ -30,7 +30,7 @@ public interface HelixConstants {
CONFIG (PropertyType.CONFIGS),
INSTANCE_CONFIG (PropertyType.CONFIGS),
RESOURCE_CONFIG (PropertyType.CONFIGS),
- CUSTOMIZED_STATE_AGGREGATION_CONFIG (PropertyType.CONFIGS),
+ CUSTOMIZED_STATE_CONFIG (PropertyType.CONFIGS),
CLUSTER_CONFIG (PropertyType.CONFIGS),
LIVE_INSTANCE (PropertyType.LIVEINSTANCES),
CURRENT_STATE (PropertyType.CURRENTSTATES),
diff --git a/helix-core/src/main/java/org/apache/helix/HelixManager.java b/helix-core/src/main/java/org/apache/helix/HelixManager.java
index a499b14..30f6126 100644
--- a/helix-core/src/main/java/org/apache/helix/HelixManager.java
+++ b/helix-core/src/main/java/org/apache/helix/HelixManager.java
@@ -26,7 +26,7 @@ import org.apache.helix.api.listeners.ClusterConfigChangeListener;
import org.apache.helix.api.listeners.ConfigChangeListener;
import org.apache.helix.api.listeners.ControllerChangeListener;
import org.apache.helix.api.listeners.CurrentStateChangeListener;
-import org.apache.helix.api.listeners.CustomizedStateAggregationConfigChangeListener;
+import org.apache.helix.api.listeners.CustomizedStateConfigChangeListener;
import org.apache.helix.api.listeners.CustomizedStateChangeListener;
import org.apache.helix.api.listeners.ExternalViewChangeListener;
import org.apache.helix.api.listeners.CustomizedViewChangeListener;
@@ -41,7 +41,7 @@ import org.apache.helix.controller.pipeline.Pipeline;
import org.apache.helix.healthcheck.ParticipantHealthReportCollector;
import org.apache.helix.manager.zk.ZKHelixManager;
import org.apache.helix.model.ClusterConfig;
-import org.apache.helix.model.CustomizedStateAggregationConfig;
+import org.apache.helix.model.CustomizedStateConfig;
import org.apache.helix.model.HelixConfigScope.ConfigScopeProperty;
import org.apache.helix.participant.HelixStateMachineEngine;
import org.apache.helix.participant.StateMachineEngine;
@@ -161,13 +161,13 @@ public interface HelixManager {
void addResourceConfigChangeListener(ResourceConfigChangeListener listener) throws Exception;
/**
- * @see CustomizedStateAggregationConfigChangeListener#onCustomizedStateAggregationConfigChange(CustomizedStateAggregationConfig,
+ * @see CustomizedStateConfigChangeListener#onCustomizedStateConfigChange(CustomizedStateConfig,
* NotificationContext)
* @param listener
*/
- void addCustomizedStateAggregationConfigChangeListener(
- CustomizedStateAggregationConfigChangeListener listener) throws Exception;
+ void addCustomizedStateConfigChangeListener(
+ CustomizedStateConfigChangeListener listener) throws Exception;
/**
* @see ClusterConfigChangeListener#onClusterConfigChange(ClusterConfig, NotificationContext)
diff --git a/helix-core/src/main/java/org/apache/helix/PropertyKey.java b/helix-core/src/main/java/org/apache/helix/PropertyKey.java
index fc343a8..29e8d65 100644
--- a/helix-core/src/main/java/org/apache/helix/PropertyKey.java
+++ b/helix-core/src/main/java/org/apache/helix/PropertyKey.java
@@ -27,7 +27,7 @@ import org.apache.helix.model.ClusterConfig;
import org.apache.helix.model.ClusterConstraints;
import org.apache.helix.model.ControllerHistory;
import org.apache.helix.model.CurrentState;
-import org.apache.helix.model.CustomizedStateAggregationConfig;
+import org.apache.helix.model.CustomizedStateConfig;
import org.apache.helix.model.CustomizedState;
import org.apache.helix.model.CustomizedView;
import org.apache.helix.model.Error;
@@ -254,9 +254,9 @@ public class PropertyKey {
* Get a property key associated with this customized state aggregation configuration
* @return {@link PropertyKey}
*/
- public PropertyKey customizedStateAggregationConfig() {
+ public PropertyKey customizedStateConfig() {
return new PropertyKey(CONFIGS, ConfigScopeProperty.CUSTOMIZED_STATE_AGGREGATION,
- CustomizedStateAggregationConfig.class, _clusterName,
+ CustomizedStateConfig.class, _clusterName,
ConfigScopeProperty.CUSTOMIZED_STATE_AGGREGATION.name(), _clusterName);
}
diff --git a/helix-core/src/main/java/org/apache/helix/api/listeners/CustomizedStateAggregationConfigChangeListener.java b/helix-core/src/main/java/org/apache/helix/api/listeners/CustomizedStateConfigChangeListener.java
similarity index 79%
rename from helix-core/src/main/java/org/apache/helix/api/listeners/CustomizedStateAggregationConfigChangeListener.java
rename to helix-core/src/main/java/org/apache/helix/api/listeners/CustomizedStateConfigChangeListener.java
index 2617ef3..4d31d87 100644
--- a/helix-core/src/main/java/org/apache/helix/api/listeners/CustomizedStateAggregationConfigChangeListener.java
+++ b/helix-core/src/main/java/org/apache/helix/api/listeners/CustomizedStateConfigChangeListener.java
@@ -20,17 +20,17 @@ package org.apache.helix.api.listeners;
*/
import org.apache.helix.NotificationContext;
-import org.apache.helix.model.CustomizedStateAggregationConfig;
+import org.apache.helix.model.CustomizedStateConfig;
/**
* Interface to implement to listen for changes to customized state aggregation configurations.
*/
-public interface CustomizedStateAggregationConfigChangeListener {
+public interface CustomizedStateConfigChangeListener {
/**
* Invoked when customized state aggregation config changes
- * @param customizedStateAggregationConfig
+ * @param customizedStateConfig
* @param context
*/
- void onCustomizedStateAggregationConfigChange(CustomizedStateAggregationConfig customizedStateAggregationConfig,
+ void onCustomizedStateConfigChange(CustomizedStateConfig customizedStateConfig,
NotificationContext context);
}
\ No newline at end of file
diff --git a/helix-core/src/main/java/org/apache/helix/common/caches/CustomizedStateCache.java b/helix-core/src/main/java/org/apache/helix/common/caches/CustomizedStateCache.java
index 1f33948..2964b13 100644
--- a/helix-core/src/main/java/org/apache/helix/common/caches/CustomizedStateCache.java
+++ b/helix-core/src/main/java/org/apache/helix/common/caches/CustomizedStateCache.java
@@ -27,7 +27,7 @@ import org.apache.helix.HelixDataAccessor;
import org.apache.helix.PropertyKey;
import org.apache.helix.common.controllers.ControlContextProvider;
import org.apache.helix.model.CustomizedState;
-import org.apache.helix.model.CustomizedStateAggregationConfig;
+import org.apache.helix.model.CustomizedStateConfig;
import org.apache.helix.model.LiveInstance;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -50,9 +50,9 @@ public class CustomizedStateCache extends ParticipantStateCache<CustomizedState>
Set<PropertyKey> participantStateKeys = new HashSet<>();
PropertyKey.Builder keyBuilder = accessor.keyBuilder();
Set<String> restrictedKeys = new HashSet<>(
- accessor.getProperty(accessor.keyBuilder().customizedStateAggregationConfig()).getRecord()
+ accessor.getProperty(accessor.keyBuilder().customizedStateConfig()).getRecord()
.getListFields().get(
- CustomizedStateAggregationConfig.CustomizedStateAggregationProperty.AGGREGATION_ENABLED_TYPES
+ CustomizedStateConfig.CustomizedStateProperty.AGGREGATION_ENABLED_TYPES
.name()));
for (String instanceName : liveInstanceMap.keySet()) {
for (String customizedStateType : restrictedKeys) {
diff --git a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
index 3eb4d55..7ece2c7 100644
--- a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
+++ b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
@@ -63,7 +63,7 @@ import org.apache.helix.model.ClusterConstraints.ConstraintType;
import org.apache.helix.model.ConstraintItem;
import org.apache.helix.model.ControllerHistory;
import org.apache.helix.model.CurrentState;
-import org.apache.helix.model.CustomizedStateAggregationConfig;
+import org.apache.helix.model.CustomizedStateConfig;
import org.apache.helix.model.ExternalView;
import org.apache.helix.model.HelixConfigScope;
import org.apache.helix.model.IdealState;
@@ -1217,84 +1217,84 @@ public class ZKHelixAdmin implements HelixAdmin {
}
@Override
- public void addCustomizedStateAggregationConfig(String clusterName,
- CustomizedStateAggregationConfig customizedStateAggregationConfig) {
+ public void addCustomizedStateConfig(String clusterName,
+ CustomizedStateConfig customizedStateConfig) {
logger.info(
- "Add CustomizedStateAggregationConfig to cluster {}, CustomizedStateAggregationConfig is {}",
- clusterName, customizedStateAggregationConfig.toString());
+ "Add CustomizedStateConfig to cluster {}, CustomizedStateConfig is {}",
+ clusterName, customizedStateConfig.toString());
if (!ZKUtil.isClusterSetup(clusterName, _zkClient)) {
throw new HelixException("cluster " + clusterName + " is not setup yet");
}
- CustomizedStateAggregationConfig.Builder builder =
- new CustomizedStateAggregationConfig.Builder(customizedStateAggregationConfig);
- CustomizedStateAggregationConfig customizedStateAggregationConfigFromBuilder = builder.build();
+ CustomizedStateConfig.Builder builder =
+ new CustomizedStateConfig.Builder(customizedStateConfig);
+ CustomizedStateConfig customizedStateConfigFromBuilder = builder.build();
ZKHelixDataAccessor accessor =
new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient));
Builder keyBuilder = accessor.keyBuilder();
- accessor.setProperty(keyBuilder.customizedStateAggregationConfig(),
- customizedStateAggregationConfigFromBuilder);
+ accessor.setProperty(keyBuilder.customizedStateConfig(),
+ customizedStateConfigFromBuilder);
}
@Override
- public void removeCustomizedStateAggregationConfig(String clusterName) {
+ public void removeCustomizedStateConfig(String clusterName) {
logger.info(
- "Remove CustomizedStateAggregationConfig from cluster {}.", clusterName);
+ "Remove CustomizedStateConfig from cluster {}.", clusterName);
ZKHelixDataAccessor accessor =
new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient));
Builder keyBuilder = accessor.keyBuilder();
- accessor.removeProperty(keyBuilder.customizedStateAggregationConfig());
+ accessor.removeProperty(keyBuilder.customizedStateConfig());
}
@Override
- public void addTypeToCustomizedStateAggregationConfig(String clusterName, String type) {
- logger.info("Add type {} to CustomizedStateAggregationConfig of cluster {}", type, clusterName);
+ public void addTypeToCustomizedStateConfig(String clusterName, String type) {
+ logger.info("Add type {} to CustomizedStateConfig of cluster {}", type, clusterName);
if (!ZKUtil.isClusterSetup(clusterName, _zkClient)) {
throw new HelixException("cluster " + clusterName + " is not setup yet");
}
- CustomizedStateAggregationConfig.Builder builder =
- new CustomizedStateAggregationConfig.Builder();
+ CustomizedStateConfig.Builder builder =
+ new CustomizedStateConfig.Builder();
builder.addAggregationEnabledType(type);
- CustomizedStateAggregationConfig customizedStateAggregationConfigFromBuilder = builder.build();
+ CustomizedStateConfig customizedStateConfigFromBuilder = builder.build();
ZKHelixDataAccessor accessor =
new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient));
Builder keyBuilder = accessor.keyBuilder();
- accessor.updateProperty(keyBuilder.customizedStateAggregationConfig(),
- customizedStateAggregationConfigFromBuilder);
+ accessor.updateProperty(keyBuilder.customizedStateConfig(),
+ customizedStateConfigFromBuilder);
}
@Override
- public void removeTypeFromCustomizedStateAggregationConfig(String clusterName, String type) {
- logger.info("Remove type {} to CustomizedStateAggregationConfig of cluster {}", type,
+ public void removeTypeFromCustomizedStateConfig(String clusterName, String type) {
+ logger.info("Remove type {} to CustomizedStateConfig of cluster {}", type,
clusterName);
if (!ZKUtil.isClusterSetup(clusterName, _zkClient)) {
throw new HelixException("cluster " + clusterName + " is not setup yet");
}
- CustomizedStateAggregationConfig.Builder builder = new CustomizedStateAggregationConfig.Builder(
- _configAccessor.getCustomizedStateAggregationConfig(clusterName));
+ CustomizedStateConfig.Builder builder = new CustomizedStateConfig.Builder(
+ _configAccessor.getCustomizedStateConfig(clusterName));
if (!builder.getAggregationEnabledTypes().contains(type)) {
throw new HelixException("Type " + type
- + " is missing from the CustomizedStateAggregationConfig of cluster " + clusterName);
+ + " is missing from the CustomizedStateConfig of cluster " + clusterName);
}
builder.removeAggregationEnabledType(type);
- CustomizedStateAggregationConfig customizedStateAggregationConfigFromBuilder = builder.build();
+ CustomizedStateConfig customizedStateConfigFromBuilder = builder.build();
ZKHelixDataAccessor accessor =
new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient));
Builder keyBuilder = accessor.keyBuilder();
- accessor.setProperty(keyBuilder.customizedStateAggregationConfig(),
- customizedStateAggregationConfigFromBuilder);
+ accessor.setProperty(keyBuilder.customizedStateConfig(),
+ customizedStateConfigFromBuilder);
}
@Override
diff --git a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java
index a6425fa..b731635 100644
--- a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java
+++ b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java
@@ -58,7 +58,7 @@ import org.apache.helix.api.listeners.ConfigChangeListener;
import org.apache.helix.api.listeners.ControllerChangeListener;
import org.apache.helix.api.listeners.CurrentStateChangeListener;
import org.apache.helix.api.listeners.CustomizedViewChangeListener;
-import org.apache.helix.api.listeners.CustomizedStateAggregationConfigChangeListener;
+import org.apache.helix.api.listeners.CustomizedStateConfigChangeListener;
import org.apache.helix.api.listeners.CustomizedStateChangeListener;
import org.apache.helix.api.listeners.ExternalViewChangeListener;
import org.apache.helix.api.listeners.IdealStateChangeListener;
@@ -489,10 +489,10 @@ public class ZKHelixManager implements HelixManager, IZkStateListener {
}
@Override
- public void addCustomizedStateAggregationConfigChangeListener(
- CustomizedStateAggregationConfigChangeListener listener) throws Exception {
- addListener(listener, new Builder(_clusterName).customizedStateAggregationConfig(),
- ChangeType.CUSTOMIZED_STATE_AGGREGATION_CONFIG, new EventType[] {
+ public void addCustomizedStateConfigChangeListener(
+ CustomizedStateConfigChangeListener listener) throws Exception {
+ addListener(listener, new Builder(_clusterName).customizedStateConfig(),
+ ChangeType.CUSTOMIZED_STATE_CONFIG, new EventType[] {
EventType.NodeDataChanged
});
}
diff --git a/helix-core/src/main/java/org/apache/helix/model/CustomizedStateAggregationConfig.java b/helix-core/src/main/java/org/apache/helix/model/CustomizedStateConfig.java
similarity index 60%
rename from helix-core/src/main/java/org/apache/helix/model/CustomizedStateAggregationConfig.java
rename to helix-core/src/main/java/org/apache/helix/model/CustomizedStateConfig.java
index 4acd0e6..0b13db1 100644
--- a/helix-core/src/main/java/org/apache/helix/model/CustomizedStateAggregationConfig.java
+++ b/helix-core/src/main/java/org/apache/helix/model/CustomizedStateConfig.java
@@ -30,33 +30,33 @@ import org.apache.helix.zookeeper.datamodel.ZNRecord;
/**
* CustomizedStateAggregation configurations
*/
-public class CustomizedStateAggregationConfig extends HelixProperty {
+public class CustomizedStateConfig extends HelixProperty {
- public static final String CUSTOMIZED_STATE_AGGREGATION_CONFIG_KW =
- "CustomizedStateAggregationConfig";
+ public static final String CUSTOMIZED_STATE_CONFIG_KW =
+ "CustomizedStateConfig";
/**
* Indicate which customized states will be aggregated.
* NOTE: Do NOT use this field name directly, use its corresponding getter/setter in the
- * CustomizedStateAggregationConfig.
+ * CustomizedStateConfig.
*/
- public enum CustomizedStateAggregationProperty {
+ public enum CustomizedStateProperty {
AGGREGATION_ENABLED_TYPES,
}
/**
- * Instantiate the CustomizedStateAggregationConfig
+ * Instantiate the CustomizedStateConfig
*/
- public CustomizedStateAggregationConfig() {
- super(CUSTOMIZED_STATE_AGGREGATION_CONFIG_KW);
+ public CustomizedStateConfig() {
+ super(CUSTOMIZED_STATE_CONFIG_KW);
}
/**
* Instantiate with a pre-populated record
- * @param record a ZNRecord corresponding to a CustomizedStateAggregationConfig
+ * @param record a ZNRecord corresponding to a CustomizedStateConfig
*/
- public CustomizedStateAggregationConfig(ZNRecord record) {
- super(CUSTOMIZED_STATE_AGGREGATION_CONFIG_KW);
+ public CustomizedStateConfig(ZNRecord record) {
+ super(CUSTOMIZED_STATE_CONFIG_KW);
_record.setSimpleFields(record.getSimpleFields());
_record.setListFields(record.getListFields());
_record.setMapFields(record.getMapFields());
@@ -67,7 +67,7 @@ public class CustomizedStateAggregationConfig extends HelixProperty {
* @param aggregationEnabledTypes
*/
public void setAggregationEnabledTypes(List<String> aggregationEnabledTypes) {
- _record.setListField(CustomizedStateAggregationProperty.AGGREGATION_ENABLED_TYPES.name(),
+ _record.setListField(CustomizedStateProperty.AGGREGATION_ENABLED_TYPES.name(),
aggregationEnabledTypes);
}
@@ -77,22 +77,22 @@ public class CustomizedStateAggregationConfig extends HelixProperty {
*/
public List<String> getAggregationEnabledTypes() {
return _record
- .getListField(CustomizedStateAggregationProperty.AGGREGATION_ENABLED_TYPES.name());
+ .getListField(CustomizedStateProperty.AGGREGATION_ENABLED_TYPES.name());
}
public static class Builder {
private ZNRecord _record;
- public CustomizedStateAggregationConfig build() {
- return new CustomizedStateAggregationConfig(_record);
+ public CustomizedStateConfig build() {
+ return new CustomizedStateConfig(_record);
}
/**
* Default constructor
*/
public Builder() {
- _record = new ZNRecord(CUSTOMIZED_STATE_AGGREGATION_CONFIG_KW);
+ _record = new ZNRecord(CUSTOMIZED_STATE_CONFIG_KW);
}
/**
@@ -104,43 +104,43 @@ public class CustomizedStateAggregationConfig extends HelixProperty {
}
/**
- * Constructor with CustomizedStateAggregationConfig as input
- * @param customizedStateAggregationConfig
+ * Constructor with CustomizedStateConfig as input
+ * @param customizedStateConfig
*/
- public Builder(CustomizedStateAggregationConfig customizedStateAggregationConfig) {
- _record = customizedStateAggregationConfig.getRecord();
+ public Builder(CustomizedStateConfig customizedStateConfig) {
+ _record = customizedStateConfig.getRecord();
}
public Builder setAggregationEnabledTypes(List<String> aggregationEnabledTypes) {
- _record.setListField(CustomizedStateAggregationProperty.AGGREGATION_ENABLED_TYPES.name(), aggregationEnabledTypes);
+ _record.setListField(CustomizedStateProperty.AGGREGATION_ENABLED_TYPES.name(), aggregationEnabledTypes);
return this;
}
public Builder addAggregationEnabledType(String type) {
if (_record.getListField(
- CustomizedStateAggregationProperty.AGGREGATION_ENABLED_TYPES.name()) == null) {
- _record.setListField(CustomizedStateAggregationProperty.AGGREGATION_ENABLED_TYPES.name(), new ArrayList<String>());
+ CustomizedStateProperty.AGGREGATION_ENABLED_TYPES.name()) == null) {
+ _record.setListField(CustomizedStateProperty.AGGREGATION_ENABLED_TYPES.name(), new ArrayList<String>());
}
- List<String> aggregationEnabledTypes = _record.getListField(CustomizedStateAggregationProperty.AGGREGATION_ENABLED_TYPES.name());
+ List<String> aggregationEnabledTypes = _record.getListField(CustomizedStateProperty.AGGREGATION_ENABLED_TYPES.name());
aggregationEnabledTypes.add(type);
- _record.setListField(CustomizedStateAggregationProperty.AGGREGATION_ENABLED_TYPES.name(), aggregationEnabledTypes);
+ _record.setListField(CustomizedStateProperty.AGGREGATION_ENABLED_TYPES.name(), aggregationEnabledTypes);
return this;
}
public Builder removeAggregationEnabledType(String type) {
- if (!_record.getListField(CustomizedStateAggregationProperty.AGGREGATION_ENABLED_TYPES.name())
+ if (!_record.getListField(CustomizedStateProperty.AGGREGATION_ENABLED_TYPES.name())
.contains(type)) {
throw new HelixException(
- "Type " + type + " is missing from the CustomizedStateAggregationConfig");
+ "Type " + type + " is missing from the CustomizedStateConfig");
}
- _record.getListField(CustomizedStateAggregationProperty.AGGREGATION_ENABLED_TYPES.name())
+ _record.getListField(CustomizedStateProperty.AGGREGATION_ENABLED_TYPES.name())
.remove(type);
return this;
}
public List<String> getAggregationEnabledTypes() {
return _record
- .getListField(CustomizedStateAggregationProperty.AGGREGATION_ENABLED_TYPES.name());
+ .getListField(CustomizedStateProperty.AGGREGATION_ENABLED_TYPES.name());
}
}
}
diff --git a/helix-core/src/test/java/org/apache/helix/controller/stages/DummyClusterManager.java b/helix-core/src/test/java/org/apache/helix/controller/stages/DummyClusterManager.java
index 84d413b..772c0fa 100644
--- a/helix-core/src/test/java/org/apache/helix/controller/stages/DummyClusterManager.java
+++ b/helix-core/src/test/java/org/apache/helix/controller/stages/DummyClusterManager.java
@@ -37,7 +37,7 @@ import org.apache.helix.api.listeners.ClusterConfigChangeListener;
import org.apache.helix.api.listeners.ConfigChangeListener;
import org.apache.helix.api.listeners.ControllerChangeListener;
import org.apache.helix.api.listeners.CurrentStateChangeListener;
-import org.apache.helix.api.listeners.CustomizedStateAggregationConfigChangeListener;
+import org.apache.helix.api.listeners.CustomizedStateConfigChangeListener;
import org.apache.helix.api.listeners.CustomizedStateChangeListener;
import org.apache.helix.api.listeners.ExternalViewChangeListener;
import org.apache.helix.api.listeners.CustomizedViewChangeListener;
@@ -302,7 +302,7 @@ public class DummyClusterManager implements HelixManager {
}
@Override
- public void addCustomizedStateAggregationConfigChangeListener(CustomizedStateAggregationConfigChangeListener listener)
+ public void addCustomizedStateConfigChangeListener(CustomizedStateConfigChangeListener listener)
throws Exception {
// TODO Auto-generated method stub
diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkHelixAdmin.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkHelixAdmin.java
index da2145b..f36d66c 100644
--- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkHelixAdmin.java
+++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkHelixAdmin.java
@@ -54,7 +54,6 @@ import org.apache.helix.model.ClusterConstraints;
import org.apache.helix.model.ClusterConstraints.ConstraintAttribute;
import org.apache.helix.model.ClusterConstraints.ConstraintType;
import org.apache.helix.model.ConstraintItem;
-import org.apache.helix.model.CustomizedStateAggregationConfig;
import org.apache.helix.model.ExternalView;
import org.apache.helix.model.HelixConfigScope;
import org.apache.helix.model.HelixConfigScope.ConfigScopeProperty;
@@ -548,12 +547,12 @@ public class TestZkHelixAdmin extends ZkUnitTestBase {
instanceConfig.setInstanceEnabledForPartition(testResourcePrefix, "2", false);
Assert.assertEquals(instanceConfig.getDisabledPartitions(testResourcePrefix).size(), 3);
Assert.assertEquals(instanceConfig.getRecord()
- .getListField(InstanceConfig.InstanceConfigProperty.HELIX_DISABLED_PARTITION.name()).size(),
+ .getListField(InstanceConfig.InstanceConfigProperty.HELIX_DISABLED_PARTITION.name()).size(),
3);
instanceConfig.setInstanceEnabledForPartition(testResourcePrefix, "2", true);
Assert.assertEquals(instanceConfig.getDisabledPartitions(testResourcePrefix).size(), 2);
Assert.assertEquals(instanceConfig.getRecord()
- .getListField(InstanceConfig.InstanceConfigProperty.HELIX_DISABLED_PARTITION.name()).size(),
+ .getListField(InstanceConfig.InstanceConfigProperty.HELIX_DISABLED_PARTITION.name()).size(),
2);
}
@@ -600,7 +599,6 @@ public class TestZkHelixAdmin extends ZkUnitTestBase {
// OK since resourceConfig is empty
}
-<<<<<<< HEAD
// Set PARTITION_CAPACITY_MAP
Map<String, String> capacityDataMap =
ImmutableMap.of("WCU", "1", "RCU", "2", "STORAGE", "3");
@@ -686,6 +684,7 @@ public class TestZkHelixAdmin extends ZkUnitTestBase {
Assert.assertEquals(cloudConfigFromZk.getCloudInfoProcessorName(), "TestProcessor");
}
+
@Test
public void testRemoveCloudConfig() throws Exception {
String className = TestHelper.getTestClassName();
@@ -811,4 +810,4 @@ public class TestZkHelixAdmin extends ZkUnitTestBase {
Assert.assertEquals(listTypesFromZk.get(0), "mockType2");
Assert.assertEquals(listTypesFromZk.get(1), "mockType3");
}
-}
\ No newline at end of file
+}
diff --git a/helix-core/src/test/java/org/apache/helix/mock/MockHelixAdmin.java b/helix-core/src/test/java/org/apache/helix/mock/MockHelixAdmin.java
index 02bd639..29e64f6 100644
--- a/helix-core/src/test/java/org/apache/helix/mock/MockHelixAdmin.java
+++ b/helix-core/src/test/java/org/apache/helix/mock/MockHelixAdmin.java
@@ -35,7 +35,7 @@ import org.apache.helix.model.CloudConfig;
import org.apache.helix.model.ClusterConfig;
import org.apache.helix.model.ClusterConstraints;
import org.apache.helix.model.ConstraintItem;
-import org.apache.helix.model.CustomizedStateAggregationConfig;
+import org.apache.helix.model.CustomizedStateConfig;
import org.apache.helix.model.ExternalView;
import org.apache.helix.model.HelixConfigScope;
import org.apache.helix.model.IdealState;
@@ -145,23 +145,23 @@ public class MockHelixAdmin implements HelixAdmin {
}
@Override
- public void addCustomizedStateAggregationConfig(String clusterName,
- CustomizedStateAggregationConfig customizedStateAggregationConfig) {
+ public void addCustomizedStateConfig(String clusterName,
+ CustomizedStateConfig customizedStateConfig) {
}
@Override
- public void removeCustomizedStateAggregationConfig(String clusterName) {
+ public void removeCustomizedStateConfig(String clusterName) {
}
@Override
- public void addTypeToCustomizedStateAggregationConfig(String clusterName, String type) {
+ public void addTypeToCustomizedStateConfig(String clusterName, String type) {
}
@Override
- public void removeTypeFromCustomizedStateAggregationConfig(String clusterName, String type) {
+ public void removeTypeFromCustomizedStateConfig(String clusterName, String type) {
}
diff --git a/helix-core/src/test/java/org/apache/helix/mock/MockManager.java b/helix-core/src/test/java/org/apache/helix/mock/MockManager.java
index f32160b..6b744b7 100644
--- a/helix-core/src/test/java/org/apache/helix/mock/MockManager.java
+++ b/helix-core/src/test/java/org/apache/helix/mock/MockManager.java
@@ -40,7 +40,7 @@ import org.apache.helix.api.listeners.ConfigChangeListener;
import org.apache.helix.api.listeners.ControllerChangeListener;
import org.apache.helix.api.listeners.CurrentStateChangeListener;
import org.apache.helix.api.listeners.CustomizedViewChangeListener;
-import org.apache.helix.api.listeners.CustomizedStateAggregationConfigChangeListener;
+import org.apache.helix.api.listeners.CustomizedStateConfigChangeListener;
import org.apache.helix.api.listeners.CustomizedStateChangeListener;
import org.apache.helix.api.listeners.ExternalViewChangeListener;
import org.apache.helix.api.listeners.IdealStateChangeListener;
@@ -173,7 +173,7 @@ public class MockManager implements HelixManager {
}
@Override
- public void addCustomizedStateAggregationConfigChangeListener(CustomizedStateAggregationConfigChangeListener listener)
+ public void addCustomizedStateConfigChangeListener(CustomizedStateConfigChangeListener listener)
throws Exception {
}
diff --git a/helix-core/src/test/java/org/apache/helix/model/TestCustomizedStateAggregationConfig.java b/helix-core/src/test/java/org/apache/helix/model/TestCustomizedStateConfig.java
similarity index 56%
rename from helix-core/src/test/java/org/apache/helix/model/TestCustomizedStateAggregationConfig.java
rename to helix-core/src/test/java/org/apache/helix/model/TestCustomizedStateConfig.java
index bda6a50..13948e4 100644
--- a/helix-core/src/test/java/org/apache/helix/model/TestCustomizedStateAggregationConfig.java
+++ b/helix-core/src/test/java/org/apache/helix/model/TestCustomizedStateConfig.java
@@ -31,70 +31,70 @@ import org.apache.helix.manager.zk.ZkBaseDataAccessor;
import org.testng.Assert;
import org.testng.annotations.Test;
-public class TestCustomizedStateAggregationConfig extends ZkUnitTestBase {
+public class TestCustomizedStateConfig extends ZkUnitTestBase {
@Test(expectedExceptions = HelixException.class)
- public void TestCustomizedStateAggregationConfigNonExistentCluster() {
+ public void TestCustomizedStateConfigNonExistentCluster() {
String className = getShortClassName();
String clusterName = "CLUSTER_" + className;
- // Read CustomizedStateAggregationConfig from Zookeeper and get exception since cluster in not setup yet
+ // Read CustomizedStateConfig from Zookeeper and get exception since cluster in not setup yet
ConfigAccessor _configAccessor = new ConfigAccessor(ZK_ADDR);
- CustomizedStateAggregationConfig customizedStateAggregationConfig =
- _configAccessor.getCustomizedStateAggregationConfig(clusterName);
+ CustomizedStateConfig customizedStateConfig =
+ _configAccessor.getCustomizedStateConfig(clusterName);
}
- @Test(dependsOnMethods = "TestCustomizedStateAggregationConfigNonExistentCluster")
- public void testCustomizedStateAggregationConfigNull() {
+ @Test(dependsOnMethods = "TestCustomizedStateConfigNonExistentCluster")
+ public void testCustomizedStateConfigNull() {
String className = getShortClassName();
String clusterName = "CLUSTER_" + className;
TestHelper.setupEmptyCluster(_gZkClient, clusterName);
- // Read CustomizedStateAggregationConfig from Zookeeper
+ // Read CustomizedStateConfig from Zookeeper
ConfigAccessor _configAccessor = new ConfigAccessor(ZK_ADDR);
- CustomizedStateAggregationConfig customizedStateAggregationConfigFromZk =
- _configAccessor.getCustomizedStateAggregationConfig(clusterName);
- Assert.assertNull(customizedStateAggregationConfigFromZk);
+ CustomizedStateConfig customizedStateConfigFromZk =
+ _configAccessor.getCustomizedStateConfig(clusterName);
+ Assert.assertNull(customizedStateConfigFromZk);
}
- @Test(dependsOnMethods = "testCustomizedStateAggregationConfigNull")
- public void testCustomizedStateAggregationConfig() {
+ @Test(dependsOnMethods = "testCustomizedStateConfigNull")
+ public void testCustomizedStateConfig() {
String className = getShortClassName();
String clusterName = "CLUSTER_" + className;
TestHelper.setupEmptyCluster(_gZkClient, clusterName);
- // Create dummy CustomizedStateAggregationConfig object
- CustomizedStateAggregationConfig.Builder customizedStateAggregationConfigBuilder =
- new CustomizedStateAggregationConfig.Builder();
+ // Create dummy CustomizedStateConfig object
+ CustomizedStateConfig.Builder customizedStateConfigBuilder =
+ new CustomizedStateConfig.Builder();
List<String> aggregationEnabledTypes = new ArrayList<String>();
aggregationEnabledTypes.add("mockType1");
aggregationEnabledTypes.add("mockType2");
- customizedStateAggregationConfigBuilder.setAggregationEnabledTypes(aggregationEnabledTypes);
- CustomizedStateAggregationConfig customizedStateAggregationConfig =
- customizedStateAggregationConfigBuilder.build();
+ customizedStateConfigBuilder.setAggregationEnabledTypes(aggregationEnabledTypes);
+ CustomizedStateConfig customizedStateConfig =
+ customizedStateConfigBuilder.build();
- // Write the CustomizedStateAggregationConfig to Zookeeper
+ // Write the CustomizedStateConfig to Zookeeper
ZKHelixDataAccessor accessor =
new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor(ZK_ADDR));
Builder keyBuilder = accessor.keyBuilder();
- accessor.setProperty(keyBuilder.customizedStateAggregationConfig(),
- customizedStateAggregationConfig);
+ accessor.setProperty(keyBuilder.customizedStateConfig(),
+ customizedStateConfig);
- // Read CustomizedStateAggregationConfig from Zookeeper and check the content
+ // Read CustomizedStateConfig from Zookeeper and check the content
ConfigAccessor _configAccessor = new ConfigAccessor(ZK_ADDR);
- CustomizedStateAggregationConfig customizedStateAggregationConfigFromZk =
- _configAccessor.getCustomizedStateAggregationConfig(clusterName);
- Assert.assertEquals(customizedStateAggregationConfigFromZk.getAggregationEnabledTypes().size(),
+ CustomizedStateConfig customizedStateConfigFromZk =
+ _configAccessor.getCustomizedStateConfig(clusterName);
+ Assert.assertEquals(customizedStateConfigFromZk.getAggregationEnabledTypes().size(),
2);
Assert.assertEquals(aggregationEnabledTypes.get(0), "mockType1");
Assert.assertEquals(aggregationEnabledTypes.get(1), "mockType2");
}
- @Test(dependsOnMethods = "testCustomizedStateAggregationConfig")
- public void testCustomizedStateAggregationConfigBuilder() {
+ @Test(dependsOnMethods = "testCustomizedStateConfig")
+ public void testCustomizedStateConfigBuilder() {
String className = getShortClassName();
String clusterName = "CLUSTER_" + className;
TestHelper.setupEmptyCluster(_gZkClient, clusterName);
- CustomizedStateAggregationConfig.Builder builder =
- new CustomizedStateAggregationConfig.Builder();
+ CustomizedStateConfig.Builder builder =
+ new CustomizedStateConfig.Builder();
builder.addAggregationEnabledType("mockType1");
builder.addAggregationEnabledType("mockType2");
@@ -104,20 +104,20 @@ public class TestCustomizedStateAggregationConfig extends ZkUnitTestBase {
Assert.assertEquals(aggregationEnabledTypes.get(0), "mockType1");
Assert.assertEquals(aggregationEnabledTypes.get(1), "mockType2");
- CustomizedStateAggregationConfig customizedStateAggregationConfig = builder.build();
+ CustomizedStateConfig customizedStateConfig = builder.build();
ZKHelixDataAccessor accessor =
new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor(ZK_ADDR));
Builder keyBuilder = accessor.keyBuilder();
- accessor.setProperty(keyBuilder.customizedStateAggregationConfig(),
- customizedStateAggregationConfig);
+ accessor.setProperty(keyBuilder.customizedStateConfig(),
+ customizedStateConfig);
- // Read CustomizedStateAggregationConfig from Zookeeper and check the content
+ // Read CustomizedStateConfig from Zookeeper and check the content
ConfigAccessor _configAccessor = new ConfigAccessor(ZK_ADDR);
- CustomizedStateAggregationConfig customizedStateAggregationConfigFromZk =
- _configAccessor.getCustomizedStateAggregationConfig(clusterName);
+ CustomizedStateConfig customizedStateConfigFromZk =
+ _configAccessor.getCustomizedStateConfig(clusterName);
List<String> aggregationEnabledTypesFromZk =
- customizedStateAggregationConfigFromZk.getAggregationEnabledTypes();
+ customizedStateConfigFromZk.getAggregationEnabledTypes();
Assert.assertEquals(aggregationEnabledTypesFromZk.get(0), "mockType1");
Assert.assertEquals(aggregationEnabledTypesFromZk.get(1), "mockType2");
}
diff --git a/helix-core/src/test/java/org/apache/helix/participant/MockZKHelixManager.java b/helix-core/src/test/java/org/apache/helix/participant/MockZKHelixManager.java
index 4abe7c6..9e50c2a 100644
--- a/helix-core/src/test/java/org/apache/helix/participant/MockZKHelixManager.java
+++ b/helix-core/src/test/java/org/apache/helix/participant/MockZKHelixManager.java
@@ -39,7 +39,7 @@ import org.apache.helix.api.listeners.ConfigChangeListener;
import org.apache.helix.api.listeners.ControllerChangeListener;
import org.apache.helix.api.listeners.CurrentStateChangeListener;
import org.apache.helix.api.listeners.CustomizedViewChangeListener;
-import org.apache.helix.api.listeners.CustomizedStateAggregationConfigChangeListener;
+import org.apache.helix.api.listeners.CustomizedStateConfigChangeListener;
import org.apache.helix.api.listeners.CustomizedStateChangeListener;
import org.apache.helix.api.listeners.ExternalViewChangeListener;
import org.apache.helix.api.listeners.IdealStateChangeListener;
@@ -126,7 +126,7 @@ public class MockZKHelixManager implements HelixManager {
}
@Override
- public void addCustomizedStateAggregationConfigChangeListener(CustomizedStateAggregationConfigChangeListener listener)
+ public void addCustomizedStateConfigChangeListener(CustomizedStateConfigChangeListener listener)
throws Exception {
// TODO Auto-generated method stub
diff --git a/helix-rest/src/main/java/org/apache/helix/rest/server/resources/helix/ClusterAccessor.java b/helix-rest/src/main/java/org/apache/helix/rest/server/resources/helix/ClusterAccessor.java
index 07838e3..ca3c757 100644
--- a/helix-rest/src/main/java/org/apache/helix/rest/server/resources/helix/ClusterAccessor.java
+++ b/helix-rest/src/main/java/org/apache/helix/rest/server/resources/helix/ClusterAccessor.java
@@ -48,7 +48,7 @@ import org.apache.helix.manager.zk.ZKUtil;
import org.apache.helix.model.CloudConfig;
import org.apache.helix.model.ClusterConfig;
import org.apache.helix.model.ControllerHistory;
-import org.apache.helix.model.CustomizedStateAggregationConfig;
+import org.apache.helix.model.CustomizedStateConfig;
import org.apache.helix.model.HelixConfigScope;
import org.apache.helix.model.LiveInstance;
import org.apache.helix.model.MaintenanceSignal;
@@ -300,7 +300,7 @@ public class ClusterAccessor extends AbstractHelixResource {
@PUT
@Path("{clusterId}/customized-state-aggregation-config")
- public Response addCustomizedStateAggregationConfig(@PathParam("clusterId") String clusterId,
+ public Response addCustomizedStateConfig(@PathParam("clusterId") String clusterId,
String content) {
if (!doesClusterExist(clusterId)) {
return notFound(String.format("Cluster %s does not exist", clusterId));
@@ -315,11 +315,11 @@ public class ClusterAccessor extends AbstractHelixResource {
}
try {
- CustomizedStateAggregationConfig customizedStateAggregationConfig =
- new CustomizedStateAggregationConfig.Builder(record).build();
- admin.addCustomizedStateAggregationConfig(clusterId, customizedStateAggregationConfig);
+ CustomizedStateConfig customizedStateConfig =
+ new CustomizedStateConfig.Builder(record).build();
+ admin.addCustomizedStateConfig(clusterId, customizedStateConfig);
} catch (Exception ex) {
- _logger.error("Cannot add CustomizedStateAggregationConfig to cluster: {} Exception: {}",
+ _logger.error("Cannot add CustomizedStateConfig to cluster: {} Exception: {}",
clusterId, ex);
return serverError(ex);
}
@@ -329,17 +329,17 @@ public class ClusterAccessor extends AbstractHelixResource {
@DELETE
@Path("{clusterId}/customized-state-aggregation-config")
- public Response removeCustomizedStateAggregationConfig(@PathParam("clusterId") String clusterId) {
+ public Response removeCustomizedStateConfig(@PathParam("clusterId") String clusterId) {
if (!doesClusterExist(clusterId)) {
return notFound(String.format("Cluster %s does not exist", clusterId));
}
HelixAdmin admin = getHelixAdmin();
try {
- admin.removeCustomizedStateAggregationConfig(clusterId);
+ admin.removeCustomizedStateConfig(clusterId);
} catch (Exception ex) {
_logger.error(
- "Cannot remove CustomizedStateAggregationConfig from cluster: {}, Exception: {}",
+ "Cannot remove CustomizedStateConfig from cluster: {}, Exception: {}",
clusterId, ex);
return serverError(ex);
}
@@ -349,17 +349,17 @@ public class ClusterAccessor extends AbstractHelixResource {
@GET
@Path("{clusterId}/customized-state-aggregation-config")
- public Response getCustomizedStateAggregationConfig(@PathParam("clusterId") String clusterId) {
+ public Response getCustomizedStateConfig(@PathParam("clusterId") String clusterId) {
if (!doesClusterExist(clusterId)) {
return notFound(String.format("Cluster %s does not exist", clusterId));
}
ConfigAccessor configAccessor = getConfigAccessor();
- CustomizedStateAggregationConfig customizedStateAggregationConfig =
- configAccessor.getCustomizedStateAggregationConfig(clusterId);
+ CustomizedStateConfig customizedStateConfig =
+ configAccessor.getCustomizedStateConfig(clusterId);
- if (customizedStateAggregationConfig != null) {
- return JSONRepresentation(customizedStateAggregationConfig.getRecord());
+ if (customizedStateConfig != null) {
+ return JSONRepresentation(customizedStateConfig.getRecord());
}
return notFound();
@@ -367,7 +367,7 @@ public class ClusterAccessor extends AbstractHelixResource {
@POST
@Path("{clusterId}/customized-state-aggregation-config")
- public Response updateCustomizedStateAggregationConfig(@PathParam("clusterId") String clusterId,
+ public Response updateCustomizedStateConfig(@PathParam("clusterId") String clusterId,
@QueryParam("command") String commandStr, @QueryParam("type") String type) {
if (!doesClusterExist(clusterId)) {
return notFound(String.format("Cluster %s does not exist", clusterId));
@@ -389,16 +389,16 @@ public class ClusterAccessor extends AbstractHelixResource {
try {
switch (command) {
case delete:
- admin.removeTypeFromCustomizedStateAggregationConfig(clusterId, type);
+ admin.removeTypeFromCustomizedStateConfig(clusterId, type);
break;
case add:
- admin.addTypeToCustomizedStateAggregationConfig(clusterId, type);
+ admin.addTypeToCustomizedStateConfig(clusterId, type);
break;
default:
return badRequest("Unsupported command " + commandStr);
}
} catch (Exception ex) {
- _logger.error("Failed to {} CustomizedStateAggregationConfig for cluster {} new type: {}, Exception: {}", command, clusterId, type, ex);
+ _logger.error("Failed to {} CustomizedStateConfig for cluster {} new type: {}, Exception: {}", command, clusterId, type, ex);
return serverError(ex);
}
return OK();
diff --git a/helix-rest/src/test/java/org/apache/helix/rest/server/TestClusterAccessor.java b/helix-rest/src/test/java/org/apache/helix/rest/server/TestClusterAccessor.java
index fd343ae..a39140d 100644
--- a/helix-rest/src/test/java/org/apache/helix/rest/server/TestClusterAccessor.java
+++ b/helix-rest/src/test/java/org/apache/helix/rest/server/TestClusterAccessor.java
@@ -47,7 +47,6 @@ import org.apache.helix.integration.manager.ClusterDistributedController;
import org.apache.helix.manager.zk.ZKHelixDataAccessor;
import org.apache.helix.manager.zk.ZKUtil;
import org.apache.helix.model.ClusterConfig;
-import org.apache.helix.model.CustomizedStateAggregationConfig;
import org.apache.helix.model.ExternalView;
import org.apache.helix.model.IdealState;
import org.apache.helix.model.InstanceConfig;
@@ -784,6 +783,7 @@ public class TestClusterAccessor extends AbstractTestClass {
Assert.assertEquals(cloudConfigFromZk.getCloudProvider(), CloudProvider.AZURE.name());
}
+
@Test(dependsOnMethods = "testAddClusterWithCloudConfigDisabledCloud")
public void testAddCloudConfigNonExistedCluster() throws IOException {
System.out.println("Start test :" + TestHelper.getTestMethodName());
@@ -898,6 +898,7 @@ public class TestClusterAccessor extends AbstractTestClass {
System.out.println("End test :" + TestHelper.getTestMethodName());
}
+
@Test(dependsOnMethods = "testDeleteCloudConfig")
public void testPartialDeleteCloudConfig() throws IOException {
System.out.println("Start test :" + TestHelper.getTestMethodName());
@@ -1213,4 +1214,4 @@ public class TestClusterAccessor extends AbstractTestClass {
Assert.assertEquals(auditLog.getResponseCode(), statusCode);
Assert.assertEquals(auditLog.getResponseEntity(), responseEntity);
}
-}
+}
\ No newline at end of file