This is an automated email from the ASF dual-hosted git repository.
adoroszlai pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push:
new f95bb41 AMBARI-23453. Integrate ConfigurationService to Swagger (#883)
f95bb41 is described below
commit f95bb41621580311b305feab8af66d9393517c2d
Author: Gabor Boros <[email protected]>
AuthorDate: Thu Apr 5 08:27:48 2018 +0200
AMBARI-23453. Integrate ConfigurationService to Swagger (#883)
---
.../server/api/services/ConfigurationService.java | 56 +++++++++++++++++--
.../server/controller/ConfigurationRequest.java | 12 +++++
.../server/controller/ConfigurationResponse.java | 12 +++++
.../internal/AbstractProviderModule.java | 12 ++---
.../internal/ConfigGroupResourceProvider.java | 6 +--
.../internal/ConfigurationResourceProvider.java | 63 ++++++++++++----------
.../server/state/configgroup/ConfigGroupImpl.java | 6 +--
.../ConfigurationResourceProviderTest.java | 36 ++++++-------
8 files changed, 139 insertions(+), 64 deletions(-)
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ConfigurationService.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ConfigurationService.java
index 0eb8bd6..81ce705 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ConfigurationService.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ConfigurationService.java
@@ -27,17 +27,31 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
-import org.apache.ambari.annotations.ApiIgnore;
import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.controller.ConfigurationResponse;
import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.http.HttpStatus;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+
/**
* Service responsible for services resource requests.
*/
+@Api(value = "Configurations", description = "Endpoint for
configuration-specific operations")
public class ConfigurationService extends BaseService {
+
+ public static final String CONFIGURATION_REQUEST_TYPE =
"org.apache.ambari.server.controller.ConfigurationRequest";
+
/**
* Parent cluster name.
*/
@@ -65,8 +79,26 @@ public class ConfigurationService extends BaseService {
* @param ui uri info
* @return service collection resource representation
*/
- @GET @ApiIgnore // until documented
- @Produces("text/plain")
+ @GET
+ @Path("") // This is needed if class level path is not present otherwise no
Swagger docs will be generated for this method
+ @Produces(MediaType.TEXT_PLAIN)
+ @ApiOperation(value = "Get all configurations", response =
ConfigurationResponse.class, responseContainer =
+ RESPONSE_CONTAINER_LIST)
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION,
dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY),
+ @ApiImplicitParam(name = QUERY_SORT, value = QUERY_SORT_DESCRIPTION,
dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY),
+ @ApiImplicitParam(name = QUERY_PAGE_SIZE, value =
QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE, dataType =
DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY),
+ @ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION,
allowableValues = QUERY_FROM_VALUES, defaultValue = DEFAULT_FROM, dataType =
DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY),
+ @ApiImplicitParam(name = QUERY_TO, value = QUERY_TO_DESCRIPTION,
allowableValues = QUERY_TO_VALUES, dataType = DATA_TYPE_INT, paramType =
PARAM_TYPE_QUERY),
+ })
+ @ApiResponses({
+ @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION),
+ @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message =
MSG_CLUSTER_OR_HOST_NOT_FOUND),
+ @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message =
MSG_NOT_AUTHENTICATED),
+ @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message =
MSG_PERMISSION_DENIED),
+ @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message =
MSG_SERVER_ERROR),
+ @ApiResponse(code = HttpStatus.SC_BAD_REQUEST, message =
MSG_INVALID_ARGUMENTS),
+ })
public Response getConfigurations(String body, @Context HttpHeaders headers,
@Context UriInfo ui) {
return handleRequest(headers, body, ui, Request.Type.GET,
createConfigurationResource(m_clusterName));
}
@@ -93,8 +125,22 @@ public class ConfigurationService extends BaseService {
* @param ui uri info
* @return status code only, 201 if successful
*/
- @POST @ApiIgnore // until documented
- @Produces("text/plain")
+ @POST
+ @Path("") // This is needed if class level path is not present otherwise no
Swagger docs will be generated for this method
+ @Produces(MediaType.TEXT_PLAIN)
+ @ApiOperation(value = "Create new configurations")
+ @ApiImplicitParams({
+ @ApiImplicitParam(dataType = CONFIGURATION_REQUEST_TYPE, paramType =
PARAM_TYPE_BODY, allowMultiple = true)
+ })
+ @ApiResponses(value = {
+ @ApiResponse(code = HttpStatus.SC_CREATED, message =
MSG_SUCCESSFUL_OPERATION),
+ @ApiResponse(code = HttpStatus.SC_ACCEPTED, message =
MSG_REQUEST_ACCEPTED),
+ @ApiResponse(code = HttpStatus.SC_BAD_REQUEST, message =
MSG_INVALID_ARGUMENTS),
+ @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message =
MSG_CLUSTER_NOT_FOUND),
+ @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message =
MSG_NOT_AUTHENTICATED),
+ @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message =
MSG_PERMISSION_DENIED),
+ @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message =
MSG_SERVER_ERROR),
+ })
public Response createConfigurations(String body,@Context HttpHeaders
headers, @Context UriInfo ui) {
return handleRequest(headers, body, ui, Request.Type.POST,
createConfigurationResource(m_clusterName));
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java
index cf035b0..fddc674 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java
@@ -20,6 +20,10 @@ package org.apache.ambari.server.controller;
import java.util.HashMap;
import java.util.Map;
+import
org.apache.ambari.server.controller.internal.ConfigurationResourceProvider;
+
+import io.swagger.annotations.ApiModelProperty;
+
/**
* This class encapsulates a configuration update request.
* The configuration properties are grouped at service level. It is assumed
that
@@ -60,6 +64,7 @@ public class ConfigurationRequest {
/**
* @return the type
*/
+ @ApiModelProperty(name = ConfigurationResourceProvider.TYPE_PROPERTY_ID)
public String getType() {
return type;
}
@@ -74,6 +79,7 @@ public class ConfigurationRequest {
/**
* @return the versionTag
*/
+ @ApiModelProperty(name = ConfigurationResourceProvider.TAG_PROPERTY_ID)
public String getVersionTag() {
return tag;
}
@@ -88,6 +94,7 @@ public class ConfigurationRequest {
/**
* @return the configs
*/
+ @ApiModelProperty(name =
ConfigurationResourceProvider.PROPERTIES_PROPERTY_ID)
public Map<String, String> getProperties() {
return configs;
}
@@ -102,6 +109,7 @@ public class ConfigurationRequest {
/**
* @return the clusterName
*/
+ @ApiModelProperty(name = ConfigurationResourceProvider.CLUSTER_NAME)
public String getClusterName() {
return clusterName;
}
@@ -126,6 +134,7 @@ public class ConfigurationRequest {
* Gets if the configuration is to be selected.
* @return <code>true</code> if the configuration is selected.
*/
+ @ApiModelProperty(hidden = true)
public boolean isSelected() {
return selected;
}
@@ -151,6 +160,7 @@ public class ConfigurationRequest {
/**
* @return Attributes of configs
*/
+ @ApiModelProperty(name =
ConfigurationResourceProvider.PROPERTIES_ATTRIBUTES_PROPERTY_ID)
public Map<String, Map<String, String>> getPropertiesAttributes() {
return configsAttributes;
}
@@ -160,6 +170,7 @@ public class ConfigurationRequest {
this.configsAttributes = configsAttributes;
}
+ @ApiModelProperty(name = ConfigurationResourceProvider.VERSION_PROPERTY_ID)
public Long getVersion() {
return version;
}
@@ -168,6 +179,7 @@ public class ConfigurationRequest {
this.version = version;
}
+ @ApiModelProperty(hidden = true)
public String getServiceConfigVersionNote() {
return serviceConfigVersionNote;
}
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationResponse.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationResponse.java
index abf2096..37290b8 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationResponse.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationResponse.java
@@ -21,11 +21,14 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import
org.apache.ambari.server.controller.internal.ConfigurationResourceProvider;
import org.apache.ambari.server.state.Config;
import org.apache.ambari.server.state.PropertyInfo;
import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.utils.SecretReference;
+import io.swagger.annotations.ApiModelProperty;
+
/**
* This class encapsulates a configuration update request.
* The configuration properties are grouped at service level. It is assumed
that
@@ -99,6 +102,7 @@ public class ConfigurationResponse {
/**
* @return the versionTag
*/
+ @ApiModelProperty(name = ConfigurationResourceProvider.TAG_PROPERTY_ID)
public String getVersionTag() {
return versionTag;
}
@@ -113,6 +117,7 @@ public class ConfigurationResponse {
/**
* @return the configs
*/
+ @ApiModelProperty(name =
ConfigurationResourceProvider.PROPERTIES_PROPERTY_ID)
public Map<String, String> getConfigs() {
return configs;
}
@@ -124,6 +129,7 @@ public class ConfigurationResponse {
this.configs = configs;
}
+ @ApiModelProperty(name =
ConfigurationResourceProvider.PROPERTIES_ATTRIBUTES_PROPERTY_ID)
public Map<String, Map<String, String>> getConfigAttributes() {
return configAttributes;
}
@@ -135,6 +141,7 @@ public class ConfigurationResponse {
/**
* @return the type
*/
+ @ApiModelProperty(name = ConfigurationResourceProvider.TYPE_PROPERTY_ID)
public String getType() {
return type;
}
@@ -142,10 +149,12 @@ public class ConfigurationResponse {
/**
* @return the clusterName
*/
+ @ApiModelProperty(name = ConfigurationResourceProvider.CLUSTER_NAME)
public String getClusterName() {
return clusterName;
}
+ @ApiModelProperty(name = ConfigurationResourceProvider.VERSION_PROPERTY_ID)
public Long getVersion() {
return version;
}
@@ -159,6 +168,7 @@ public class ConfigurationResponse {
*
* @return
*/
+ @ApiModelProperty(name = ConfigurationResourceProvider.STACK_ID, dataType =
"String")
public StackId getStackId() {
return stackId;
}
@@ -202,6 +212,7 @@ public class ConfigurationResponse {
return result;
}
+ @ApiModelProperty(hidden = true)
public List<Long> getServiceConfigVersions() {
return serviceConfigVersions;
}
@@ -210,6 +221,7 @@ public class ConfigurationResponse {
this.serviceConfigVersions = serviceConfigVersions;
}
+ @ApiModelProperty(hidden = true)
public Map<PropertyInfo.PropertyType, Set<String>> getPropertiesTypes() {
return propertiesTypes;
}
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
index 4486410..104528a 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
@@ -948,15 +948,15 @@ public abstract class AbstractProviderModule implements
ProviderModule,
// Get desired configs based on the tag
ResourceProvider configResourceProvider =
getResourceProvider(Resource.Type.Configuration);
Predicate configPredicate = new PredicateBuilder().property
-
(ConfigurationResourceProvider.CONFIGURATION_CLUSTER_NAME_PROPERTY_ID).equals(clusterName).and()
-
.property(ConfigurationResourceProvider.CONFIGURATION_CONFIG_TYPE_PROPERTY_ID).equals(configType).and()
-
.property(ConfigurationResourceProvider.CONFIGURATION_CONFIG_TAG_PROPERTY_ID).equals(versionTag).toPredicate();
+ (ConfigurationResourceProvider.CLUSTER_NAME).equals(clusterName).and()
+ .property(ConfigurationResourceProvider.TYPE).equals(configType).and()
+
.property(ConfigurationResourceProvider.TAG).equals(versionTag).toPredicate();
Set<Resource> configResources;
try {
configResources = configResourceProvider.getResources
-
(PropertyHelper.getReadRequest(ConfigurationResourceProvider.CONFIGURATION_CLUSTER_NAME_PROPERTY_ID,
-
ConfigurationResourceProvider.CONFIGURATION_CONFIG_TYPE_PROPERTY_ID,
-
ConfigurationResourceProvider.CONFIGURATION_CONFIG_TAG_PROPERTY_ID),
configPredicate);
+
(PropertyHelper.getReadRequest(ConfigurationResourceProvider.CLUSTER_NAME,
+ ConfigurationResourceProvider.TYPE,
+ ConfigurationResourceProvider.TAG), configPredicate);
} catch (NoSuchResourceException e) {
LOG.info("Resource for the desired config not found. " + e);
return Collections.emptyMap();
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
index 33430a5..2e193dc 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
@@ -814,10 +814,8 @@ public class ConfigGroupResourceProvider extends
try {
Set<Map<String, Object>> configSet = (Set<Map<String, Object>>)
configObj;
for (Map<String, Object> configMap : configSet) {
- String type = (String) configMap.get(ConfigurationResourceProvider
- .CONFIGURATION_CONFIG_TYPE_PROPERTY_ID);
- String tag = (String) configMap.get(ConfigurationResourceProvider
- .CONFIGURATION_CONFIG_TAG_PROPERTY_ID);
+ String type = (String)
configMap.get(ConfigurationResourceProvider.TYPE);
+ String tag = (String)
configMap.get(ConfigurationResourceProvider.TAG);
Map<String, String> configProperties = new HashMap<>();
Map<String, Map<String, String>> configAttributes = new HashMap<>();
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProvider.java
index 1ac7563..c924a62 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProvider.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProvider.java
@@ -47,21 +47,30 @@ import
org.apache.ambari.server.security.authorization.RoleAuthorization;
/**
* Resource provider for configuration resources.
*/
-public class ConfigurationResourceProvider extends
- AbstractControllerResourceProvider {
+public class ConfigurationResourceProvider extends
AbstractControllerResourceProvider {
private static final Pattern PROPERTIES_ATTRIBUTES_PATTERN =
Pattern.compile("^"
+ PROPERTIES_ATTRIBUTES_REGEX);
+ public static final String CONFIG = "Config";
+
+ public static final String CLUSTER_NAME_PROPERTY_ID = "cluster_name";
+ public static final String STACK_ID_PROPERTY_ID = "stack_id";
+ public static final String TYPE_PROPERTY_ID = "type";
+ public static final String TAG_PROPERTY_ID = "tag";
+ public static final String VERSION_PROPERTY_ID = "version";
+ public static final String PROPERTIES_PROPERTY_ID = "properties";
+ public static final String PROPERTIES_ATTRIBUTES_PROPERTY_ID =
"properties_attributes";
+
// ----- Property ID constants ---------------------------------------------
- protected static final String CONFIGURATION_CLUSTER_NAME_PROPERTY_ID =
PropertyHelper.getPropertyId("Config", "cluster_name");
- protected static final String CONFIGURATION_STACK_ID_PROPERTY_ID =
PropertyHelper.getPropertyId("Config", "stack_id");
+ public static final String CLUSTER_NAME = CONFIG +
PropertyHelper.EXTERNAL_PATH_SEP + CLUSTER_NAME_PROPERTY_ID;
+ public static final String STACK_ID = CONFIG +
PropertyHelper.EXTERNAL_PATH_SEP + STACK_ID_PROPERTY_ID;
// !!! values are part of query strings and body post, so they
// don't have defined categories (like Config)
- public static final String CONFIGURATION_CONFIG_TYPE_PROPERTY_ID =
PropertyHelper.getPropertyId(null, "type");
- public static final String CONFIGURATION_CONFIG_TAG_PROPERTY_ID =
PropertyHelper.getPropertyId(null, "tag");
- public static final String CONFIGURATION_CONFIG_VERSION_PROPERTY_ID =
PropertyHelper.getPropertyId(null, "version");
+ public static final String TYPE = PropertyHelper.getPropertyId(null,
TYPE_PROPERTY_ID);
+ public static final String TAG = PropertyHelper.getPropertyId(null,
TAG_PROPERTY_ID);
+ public static final String VERSION = PropertyHelper.getPropertyId(null,
VERSION_PROPERTY_ID);
/**
* The property ids for a configuration resource.
@@ -75,15 +84,15 @@ public class ConfigurationResourceProvider extends
static {
// properties
- PROPERTY_IDS.add(CONFIGURATION_CLUSTER_NAME_PROPERTY_ID);
- PROPERTY_IDS.add(CONFIGURATION_STACK_ID_PROPERTY_ID);
- PROPERTY_IDS.add(CONFIGURATION_CONFIG_TYPE_PROPERTY_ID);
- PROPERTY_IDS.add(CONFIGURATION_CONFIG_TAG_PROPERTY_ID);
- PROPERTY_IDS.add(CONFIGURATION_CONFIG_VERSION_PROPERTY_ID);
+ PROPERTY_IDS.add(CLUSTER_NAME);
+ PROPERTY_IDS.add(STACK_ID);
+ PROPERTY_IDS.add(TYPE);
+ PROPERTY_IDS.add(TAG);
+ PROPERTY_IDS.add(VERSION);
// keys
-
KEY_PROPERTY_IDS.put(Resource.Type.Configuration,CONFIGURATION_CONFIG_TYPE_PROPERTY_ID);
-
KEY_PROPERTY_IDS.put(Resource.Type.Cluster,CONFIGURATION_CLUSTER_NAME_PROPERTY_ID);
+ KEY_PROPERTY_IDS.put(Resource.Type.Configuration, TYPE);
+ KEY_PROPERTY_IDS.put(Resource.Type.Cluster, CLUSTER_NAME);
}
/**
@@ -91,8 +100,8 @@ public class ConfigurationResourceProvider extends
*/
private static Set<String> pkPropertyIds =
new HashSet<>(Arrays.asList(new String[]{
- CONFIGURATION_CLUSTER_NAME_PROPERTY_ID,
- CONFIGURATION_CONFIG_TYPE_PROPERTY_ID}));
+ CLUSTER_NAME,
+ TYPE}));
// ----- Constructors ------------------------------------------------------
@@ -123,9 +132,9 @@ public class ConfigurationResourceProvider extends
NoSuchParentResourceException {
for (Map<String, Object> map : request.getProperties()) {
- String cluster = (String)
map.get(CONFIGURATION_CLUSTER_NAME_PROPERTY_ID);
- String type = (String) map.get(CONFIGURATION_CONFIG_TYPE_PROPERTY_ID);
- String tag = (String) map.get(CONFIGURATION_CONFIG_TAG_PROPERTY_ID);
+ String cluster = (String) map.get(CLUSTER_NAME);
+ String type = (String) map.get(TYPE);
+ String tag = (String) map.get(TAG);
Map<String, String> configMap = new HashMap<>();
Map<String, Map<String, String>> configAttributesMap = null;
@@ -188,11 +197,11 @@ public class ConfigurationResourceProvider extends
String stackId = response.getStackId().getStackId();
Resource resource = new ResourceImpl(Resource.Type.Configuration);
- resource.setProperty(CONFIGURATION_CLUSTER_NAME_PROPERTY_ID,
response.getClusterName());
- resource.setProperty(CONFIGURATION_STACK_ID_PROPERTY_ID, stackId);
- resource.setProperty(CONFIGURATION_CONFIG_TYPE_PROPERTY_ID,
response.getType());
- resource.setProperty(CONFIGURATION_CONFIG_TAG_PROPERTY_ID,
response.getVersionTag());
- resource.setProperty(CONFIGURATION_CONFIG_VERSION_PROPERTY_ID,
response.getVersion());
+ resource.setProperty(CLUSTER_NAME, response.getClusterName());
+ resource.setProperty(STACK_ID, stackId);
+ resource.setProperty(TYPE, response.getType());
+ resource.setProperty(TAG, response.getVersionTag());
+ resource.setProperty(VERSION, response.getVersion());
if (null != response.getConfigs() && response.getConfigs().size() > 0) {
Map<String, String> configs = response.getConfigs();
@@ -279,11 +288,11 @@ public class ConfigurationResourceProvider extends
* @return a configuration request
*/
private ConfigurationRequest getRequest(Request request, Map<String, Object>
properties) {
- String type = (String)
properties.get(CONFIGURATION_CONFIG_TYPE_PROPERTY_ID);
- String tag = (String)
properties.get(CONFIGURATION_CONFIG_TAG_PROPERTY_ID);
+ String type = (String) properties.get(TYPE);
+ String tag = (String) properties.get(TAG);
ConfigurationRequest configRequest = new ConfigurationRequest(
- (String) properties.get(CONFIGURATION_CLUSTER_NAME_PROPERTY_ID),
+ (String) properties.get(CLUSTER_NAME),
type, tag, new HashMap<>(), new HashMap<>());
Set<String> requestedIds = request.getPropertyIds();
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
index d1fbf1d..9760915 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
@@ -491,10 +491,8 @@ public class ConfigGroupImpl implements ConfigGroup {
for (Config config : m_configurations.values()) {
Map<String, Object> configMap = new HashMap<>();
-
configMap.put(ConfigurationResourceProvider.CONFIGURATION_CONFIG_TYPE_PROPERTY_ID,
- config.getType());
-
configMap.put(ConfigurationResourceProvider.CONFIGURATION_CONFIG_TAG_PROPERTY_ID,
- config.getTag());
+ configMap.put(ConfigurationResourceProvider.TYPE, config.getType());
+ configMap.put(ConfigurationResourceProvider.TAG, config.getTag());
configObjMap.add(configMap);
}
diff --git
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProviderTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProviderTest.java
index 17bc127..2073693 100644
---
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProviderTest.java
+++
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProviderTest.java
@@ -86,9 +86,9 @@ public class ConfigurationResourceProviderTest {
Map<String, Object> properties = new LinkedHashMap<>();
-
properties.put(ConfigurationResourceProvider.CONFIGURATION_CLUSTER_NAME_PROPERTY_ID,
"Cluster100");
-
properties.put(ConfigurationResourceProvider.CONFIGURATION_CONFIG_TAG_PROPERTY_ID,
"tag");
-
properties.put(ConfigurationResourceProvider.CONFIGURATION_CONFIG_TYPE_PROPERTY_ID,
"type");
+ properties.put(ConfigurationResourceProvider.CLUSTER_NAME, "Cluster100");
+ properties.put(ConfigurationResourceProvider.TAG, "tag");
+ properties.put(ConfigurationResourceProvider.TYPE, "type");
propertySet.add(properties);
@@ -133,9 +133,9 @@ public class ConfigurationResourceProviderTest {
Map<String, Object> properties = new LinkedHashMap<>();
-
properties.put(ConfigurationResourceProvider.CONFIGURATION_CLUSTER_NAME_PROPERTY_ID,
"Cluster100");
-
properties.put(ConfigurationResourceProvider.CONFIGURATION_CONFIG_TAG_PROPERTY_ID,
"tag");
-
properties.put(ConfigurationResourceProvider.CONFIGURATION_CONFIG_TYPE_PROPERTY_ID,
"type");
+ properties.put(ConfigurationResourceProvider.CLUSTER_NAME, "Cluster100");
+ properties.put(ConfigurationResourceProvider.TAG, "tag");
+ properties.put(ConfigurationResourceProvider.TYPE, "type");
properties.put("properties/a", "b");
properties.put("properties_attributes/final/a", "true");
@@ -192,12 +192,12 @@ public class ConfigurationResourceProviderTest {
Set<String> propertyIds = new HashSet<>();
-
propertyIds.add(ConfigurationResourceProvider.CONFIGURATION_CLUSTER_NAME_PROPERTY_ID);
-
propertyIds.add(ConfigurationResourceProvider.CONFIGURATION_CONFIG_TAG_PROPERTY_ID);
+ propertyIds.add(ConfigurationResourceProvider.CLUSTER_NAME);
+ propertyIds.add(ConfigurationResourceProvider.TAG);
// equals predicate
Predicate predicate = new PredicateBuilder().property(
-
ConfigurationResourceProvider.CONFIGURATION_CLUSTER_NAME_PROPERTY_ID).equals("Cluster100").toPredicate();
+
ConfigurationResourceProvider.CLUSTER_NAME).equals("Cluster100").toPredicate();
Request request = PropertyHelper.getReadRequest(propertyIds);
Set<Resource> resources = provider.getResources(request, predicate);
@@ -215,14 +215,14 @@ public class ConfigurationResourceProviderTest {
for (Resource resource : resources) {
String clusterName = (String) resource.getPropertyValue(
-
ConfigurationResourceProvider.CONFIGURATION_CLUSTER_NAME_PROPERTY_ID);
+ ConfigurationResourceProvider.CLUSTER_NAME);
- String stackIdProperty = (String)
resource.getPropertyValue(ConfigurationResourceProvider.CONFIGURATION_STACK_ID_PROPERTY_ID);
+ String stackIdProperty = (String)
resource.getPropertyValue(ConfigurationResourceProvider.STACK_ID);
Assert.assertEquals("Cluster100", clusterName);
Assert.assertEquals(stackId.getStackId(), stackIdProperty);
String tag = (String) resource.getPropertyValue(
- ConfigurationResourceProvider.CONFIGURATION_CONFIG_TAG_PROPERTY_ID);
+ ConfigurationResourceProvider.TAG);
if (tag.equals("tag1")) {
containsResource1 = true;
@@ -238,8 +238,8 @@ public class ConfigurationResourceProviderTest {
// OR predicate
predicate = new PredicateBuilder().property(
-
ConfigurationResourceProvider.CONFIGURATION_CONFIG_TAG_PROPERTY_ID).equals("tag1").or().
-
property(ConfigurationResourceProvider.CONFIGURATION_CONFIG_TAG_PROPERTY_ID).equals("tag2").toPredicate();
+ ConfigurationResourceProvider.TAG).equals("tag1").or().
+
property(ConfigurationResourceProvider.TAG).equals("tag2").toPredicate();
request = PropertyHelper.getReadRequest(propertyIds);
resources = provider.getResources(request, predicate);
@@ -265,10 +265,10 @@ public class ConfigurationResourceProviderTest {
for (Resource resource : resources) {
String clusterName = (String) resource.getPropertyValue(
-
ConfigurationResourceProvider.CONFIGURATION_CLUSTER_NAME_PROPERTY_ID);
+ ConfigurationResourceProvider.CLUSTER_NAME);
Assert.assertEquals("Cluster100", clusterName);
String tag = (String) resource.getPropertyValue(
- ConfigurationResourceProvider.CONFIGURATION_CONFIG_TAG_PROPERTY_ID);
+ ConfigurationResourceProvider.TAG);
if (tag.equals("tag1")) {
containsResource1 = true;
@@ -304,7 +304,7 @@ public class ConfigurationResourceProviderTest {
Request request = PropertyHelper.getUpdateRequest(properties, null);
Predicate predicate = new PredicateBuilder().property(
-
ConfigurationResourceProvider.CONFIGURATION_CONFIG_TAG_PROPERTY_ID).equals("Configuration100").toPredicate();
+
ConfigurationResourceProvider.TAG).equals("Configuration100").toPredicate();
try {
provider.updateResources(request, predicate);
@@ -331,7 +331,7 @@ public class ConfigurationResourceProviderTest {
managementController);
Predicate predicate = new PredicateBuilder().property(
-
ConfigurationResourceProvider.CONFIGURATION_CONFIG_TAG_PROPERTY_ID).equals("Configuration100").toPredicate();
+
ConfigurationResourceProvider.TAG).equals("Configuration100").toPredicate();
try {
provider.deleteResources(new RequestImpl(null, null, null, null),
predicate);
Assert.fail("Expected an UnsupportedOperationException");
--
To stop receiving notification emails like this one, please contact
[email protected].