summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/rest/MSORestClient.java
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/rest/MSORestClient.java')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/rest/MSORestClient.java33
1 files changed, 16 insertions, 17 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/rest/MSORestClient.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/rest/MSORestClient.java
index fb0310bf7c..92ece131a8 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/rest/MSORestClient.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/rest/MSORestClient.java
@@ -7,9 +7,9 @@
* Licensed 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.
@@ -17,11 +17,11 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.be.components.distribution.engine.rest;
import com.google.common.annotations.VisibleForTesting;
import com.google.gson.Gson;
+import java.util.Properties;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.eclipse.jetty.util.URIUtil;
@@ -39,40 +39,40 @@ import org.openecomp.sdc.common.http.config.HttpClientConfig;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.springframework.stereotype.Component;
-import java.util.Properties;
-
@Component
public class MSORestClient {
- private static final Logger logger = Logger.getLogger(MSORestClient.class.getName());
- private static final Gson gson = new Gson();
@VisibleForTesting
static final String DISTRIBUTIONS_RESOURCE_CONFIG_PARAM = "distributions";
-
+ private static final Logger logger = Logger.getLogger(MSORestClient.class.getName());
+ private static final Gson gson = new Gson();
private ExternalServiceConfig serviceConfig = ConfigurationManager.getConfigurationManager().getDistributionEngineConfiguration().getMsoConfig();
public MSORestClient() {
HttpClientConfig httpClientConfig = serviceConfig.getHttpClientConfig();
- int numOfRetries = httpClientConfig.getNumOfRetries();
- if ( numOfRetries > 0 ) {
+ int numOfRetries = httpClientConfig.getNumOfRetries();
+ if (numOfRetries > 0) {
httpClientConfig.setRetryHandler(RetryHandlers.getDefault(numOfRetries));
}
serviceConfig.getHttpClientConfig().setEnableMetricLogging(true);
}
- public HttpResponse<String> notifyDistributionComplete(String distributionId, DistributionStatusNotificationEnum distributionStatusEnum, String errReason) {
+ public HttpResponse<String> notifyDistributionComplete(String distributionId, DistributionStatusNotificationEnum distributionStatusEnum,
+ String errReason) {
try {
return doNotifyDistributionComplete(distributionId, distributionStatusEnum, errReason);
- }
- catch(HttpExecuteException e) {
+ } catch (HttpExecuteException e) {
logger.debug("The request to mso failed with exception ", e);
return Responses.INTERNAL_SERVER_ERROR;
}
}
- private HttpResponse<String> doNotifyDistributionComplete(String distributionId, DistributionStatusNotificationEnum distributionStatusEnum, String errReason) throws HttpExecuteException {
- StringEntity entity = new StringEntity(gson.toJson(new DistributionStatusRequest(distributionStatusEnum.name(), errReason)), ContentType.APPLICATION_JSON);
- HttpResponse<String> response = HttpRequest.patch(buildMsoDistributionUrl(distributionId), buildReqHeader(), entity, serviceConfig.getHttpClientConfig());
+ private HttpResponse<String> doNotifyDistributionComplete(String distributionId, DistributionStatusNotificationEnum distributionStatusEnum,
+ String errReason) throws HttpExecuteException {
+ StringEntity entity = new StringEntity(gson.toJson(new DistributionStatusRequest(distributionStatusEnum.name(), errReason)),
+ ContentType.APPLICATION_JSON);
+ HttpResponse<String> response = HttpRequest
+ .patch(buildMsoDistributionUrl(distributionId), buildReqHeader(), entity, serviceConfig.getHttpClientConfig());
return response;
}
@@ -89,5 +89,4 @@ public class MSORestClient {
String distributionsApiPath = distributionsPath + URIUtil.SLASH + distributionId;
return msoBaseUrl + distributionsApiPath;
}
-
}