summaryrefslogtreecommitdiffstats
path: root/asdctool/src
diff options
context:
space:
mode:
Diffstat (limited to 'asdctool/src')
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/RestUtils.java38
1 files changed, 16 insertions, 22 deletions
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/RestUtils.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/RestUtils.java
index 27ef49ac15..aaafdd2367 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/RestUtils.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/RestUtils.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.
@@ -20,13 +20,12 @@
package org.openecomp.sdc.asdctool.impl;
+import java.util.Properties;
import org.apache.http.HttpStatus;
import org.openecomp.sdc.common.http.client.api.HttpRequest;
import org.openecomp.sdc.common.http.client.api.HttpResponse;
import org.openecomp.sdc.common.log.wrappers.Logger;
-import java.util.Properties;
-
/**
* Created by mlando on 2/23/2016.
*/
@@ -34,31 +33,26 @@ public class RestUtils {
static final String DELETE_PRODUCT = "http://%s:%s/sdc2/rest/v1/catalog/products/%s";
- private static Logger log = Logger.getLogger(RestUtils.class.getName());
+ private static Logger log = Logger.getLogger(RestUtils.class.getName());
- public RestUtils() {
- }
+ public Integer deleteProduct(String productUid, String beHost, String bePort, String adminUser) {
+ String url = String.format(DELETE_PRODUCT, beHost, bePort, productUid);
- public Integer deleteProduct(String productUid, String beHost, String bePort, String adminUser) {
- String url = String.format(DELETE_PRODUCT, beHost, bePort, productUid);
-
- Properties headers = new Properties();
- headers.put("USER_ID", adminUser);
- try {
- HttpResponse<String> httpResponse = HttpRequest.delete(url, headers);
+ Properties headers = new Properties();
+ headers.put("USER_ID", adminUser);
+ try {
+ HttpResponse<String> httpResponse = HttpRequest.delete(url, headers);
int status = httpResponse.getStatusCode();
if (status == HttpStatus.SC_OK) {
log.debug("Product uid:{} successfully deleted", productUid);
- }
- else {
+ } else {
log.error("Product uid:{} delete failed status {}", productUid, status);
}
return status;
- }
- catch(Exception e) {
- log.error("Product uid:{} delete failed with exception",productUid, e);
- }
- return null;
- }
+ } catch (Exception e) {
+ log.error("Product uid:{} delete failed with exception", productUid, e);
+ }
+ return null;
+ }
}