diff options
9 files changed, 206 insertions, 114 deletions
diff --git a/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java b/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java index 0aca8fb1..16c18ae0 100644 --- a/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java +++ b/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java @@ -49,8 +49,8 @@ public class DcaeDispatcherServices { protected static final EELFLogger logger = EELFManager.getInstance().getLogger(DcaeDispatcherServices.class);
protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
- @Autowired
- private ClampProperties refProp;
+ private final ClampProperties refProp;
+ private final DcaeHttpConnectionManager dcaeHttpConnectionManager;
private static final String STATUS_URL_LOG = "Status URL extracted: ";
private static final String DCAE_URL_PREFIX = "/dcae-deployments/";
private static final String DCAE_URL_PROPERTY_NAME = "dcae.dispatcher.url";
@@ -58,33 +58,13 @@ public class DcaeDispatcherServices { private static final String DCAE_LINK_FIELD = "links";
private static final String DCAE_STATUS_FIELD = "status";
- /**
- * Delete the deployment on DCAE.
- *
- * @param deploymentId
- * The deployment ID
- * @return Return the URL Status
- */
- public String deleteDeployment(String deploymentId) {
- Date startTime = new Date();
- LoggingUtils.setTargetContext("DCAE", "deleteDeployment");
- try {
- String url = refProp.getStringValue(DCAE_URL_PROPERTY_NAME) + DCAE_URL_PREFIX + deploymentId;
- String statusUrl = getDcaeResponse(url, "DELETE", null, null, DCAE_LINK_FIELD, DCAE_STATUS_FIELD);
- logger.info(STATUS_URL_LOG + statusUrl);
- LoggingUtils.setResponseContext("0", "Delete deployments success", this.getClass().getName());
- return statusUrl;
- } catch (Exception e) {
- LoggingUtils.setResponseContext("900", "Delete deployments failed", this.getClass().getName());
- LoggingUtils.setErrorContext("900", "Delete deployments error");
- logger.error("Exception occurred during Delete Deployment Operation with DCAE", e);
- throw new DcaeDeploymentException("Exception occurred during Delete Deployment Operation with DCAE", e);
- } finally {
- LoggingUtils.setTimeContext(startTime, new Date());
- metricsLogger.info("deleteDeployment complete");
- }
+ @Autowired
+ public DcaeDispatcherServices(ClampProperties refProp, DcaeHttpConnectionManager dcaeHttpConnectionManager) {
+ this.refProp = refProp;
+ this.dcaeHttpConnectionManager = dcaeHttpConnectionManager;
}
+
public String getOperationStatusWithRetry(String operationStatusUrl) throws InterruptedException {
String operationStatus = "";
for (int i = 0; i < Integer.valueOf(refProp.getStringValue("dcae.dispatcher.retry.limit")); i++) {
@@ -114,7 +94,7 @@ public class DcaeDispatcherServices { Date startTime = new Date();
LoggingUtils.setTargetContext("DCAE", "getOperationStatus");
try {
- String responseStr = DcaeHttpConnectionManager.doDcaeHttpQuery(statusUrl, "GET", null, null);
+ String responseStr = dcaeHttpConnectionManager.doDcaeHttpQuery(statusUrl, "GET", null, null);
JSONObject jsonObj = parseResponse(responseStr);
String operationType = (String) jsonObj.get("operationType");
String status = (String) jsonObj.get(DCAE_STATUS_FIELD);
@@ -140,7 +120,7 @@ public class DcaeDispatcherServices { LoggingUtils.setTargetContext("DCAE", "getDeployments");
try {
String url = refProp.getStringValue(DCAE_URL_PROPERTY_NAME) + DCAE_URL_PREFIX;
- DcaeHttpConnectionManager.doDcaeHttpQuery(url, "GET", null, null);
+ dcaeHttpConnectionManager.doDcaeHttpQuery(url, "GET", null, null);
LoggingUtils.setResponseContext("0", "Get deployments success", this.getClass().getName());
} catch (Exception e) {
LoggingUtils.setResponseContext("900", "Get deployments failed", this.getClass().getName());
@@ -228,7 +208,7 @@ public class DcaeDispatcherServices { String nodeAttr) throws IOException, ParseException {
Date startTime = new Date();
try {
- String responseStr = DcaeHttpConnectionManager.doDcaeHttpQuery(url, requestMethod, payload, contentType);
+ String responseStr = dcaeHttpConnectionManager.doDcaeHttpQuery(url, requestMethod, payload, contentType);
JSONObject jsonObj = parseResponse(responseStr);
JSONObject linksObj = (JSONObject) jsonObj.get(node);
String statusUrl = (String) linksObj.get(nodeAttr);
diff --git a/src/main/java/org/onap/clamp/clds/client/DcaeHttpConnectionManager.java b/src/main/java/org/onap/clamp/clds/client/DcaeHttpConnectionManager.java index bebb6703..059cc2b2 100644 --- a/src/main/java/org/onap/clamp/clds/client/DcaeHttpConnectionManager.java +++ b/src/main/java/org/onap/clamp/clds/client/DcaeHttpConnectionManager.java @@ -17,6 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END============================================ + * Modifications copyright (c) 2018 Nokia * =================================================================== * */ @@ -38,22 +39,22 @@ import javax.ws.rs.BadRequestException; import org.apache.commons.io.IOUtils; import org.onap.clamp.clds.util.LoggingUtils; +import org.springframework.stereotype.Component; /** * * This class manages the HTTP and HTTPS connections to DCAE. * */ +@Component public class DcaeHttpConnectionManager { protected static final EELFLogger logger = EELFManager.getInstance() .getLogger(DcaeHttpConnectionManager.class); protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); private static final String DCAE_REQUEST_FAILED_LOG = "Request Failed - response payload="; - private DcaeHttpConnectionManager() { - } - private static String doHttpsQuery(URL url, String requestMethod, String payload, String contentType) + private String doHttpsQuery(URL url, String requestMethod, String payload, String contentType) throws IOException { logger.info("Using HTTPS URL to contact DCAE:" + url.toString()); HttpsURLConnection secureConnection = (HttpsURLConnection) url.openConnection(); @@ -86,7 +87,7 @@ public class DcaeHttpConnectionManager { } } - private static String doHttpQuery(URL url, String requestMethod, String payload, String contentType) + private String doHttpQuery(URL url, String requestMethod, String payload, String contentType) throws IOException { LoggingUtils utils = new LoggingUtils (logger); logger.info("Using HTTP URL to contact DCAE:" + url); @@ -138,7 +139,7 @@ public class DcaeHttpConnectionManager { * @throws IOException * In case of issue with the streams */ - public static String doDcaeHttpQuery(String url, String requestMethod, String payload, String contentType) + public String doDcaeHttpQuery(String url, String requestMethod, String payload, String contentType) throws IOException { URL urlObj = new URL(url); if (url.contains("https://")) { // Support for HTTPS diff --git a/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java b/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java index 5f215968..b63bb646 100644 --- a/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java +++ b/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java @@ -17,6 +17,7 @@ * See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END============================================
+ * Modifications copyright (c) 2018 Nokia
* ===================================================================
*
*/
@@ -60,15 +61,22 @@ public class DcaeInventoryServices { protected static final EELFLogger logger = EELFManager.getInstance().getLogger(DcaeInventoryServices.class);
protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
- public static final String DCAE_INVENTORY_URL = "dcae.inventory.url";
- public static final String DCAE_INVENTORY_RETRY_INTERVAL = "dcae.intentory.retry.interval";
- public static final String DCAE_INVENTORY_RETRY_LIMIT = "dcae.intentory.retry.limit";
+ private static final String DCAE_INVENTORY_URL = "dcae.inventory.url";
+ private static final String DCAE_INVENTORY_RETRY_INTERVAL = "dcae.intentory.retry.interval";
+ private static final String DCAE_INVENTORY_RETRY_LIMIT = "dcae.intentory.retry.limit";
public static final String DCAE_TYPE_NAME = "typeName";
public static final String DCAE_TYPE_ID = "typeId";
+ private final ClampProperties refProp;
+ private final CldsDao cldsDao;
+ private final DcaeHttpConnectionManager dcaeHttpConnectionManager;
+
@Autowired
- private ClampProperties refProp;
- @Autowired
- private CldsDao cldsDao;
+ public DcaeInventoryServices(ClampProperties refProp, CldsDao cldsDao, DcaeHttpConnectionManager dcaeHttpConnectionManager) {
+ this.refProp = refProp;
+ this.cldsDao = cldsDao;
+ this.dcaeHttpConnectionManager = dcaeHttpConnectionManager;
+ }
+
/**
* Set the event inventory.
@@ -203,7 +211,7 @@ public class DcaeInventoryServices { }
for (int i = 0; i < retryLimit; i++) {
metricsLogger.info("Attempt n°" + i + " to contact DCAE inventory");
- String response = DcaeHttpConnectionManager.doDcaeHttpQuery(fullUrl, "GET", null, null);
+ String response = dcaeHttpConnectionManager.doDcaeHttpQuery(fullUrl, "GET", null, null);
int totalCount = getTotalCountFromDcaeInventoryResponse(response);
metricsLogger.info("getDcaeInformation complete: totalCount returned=" + totalCount);
if (totalCount > 0) {
@@ -254,7 +262,7 @@ public class DcaeInventoryServices { String apiBodyString = dcaeServiceTypeRequest.toString();
logger.info("Dcae api Body String - " + apiBodyString);
String url = refProp.getStringValue(DCAE_INVENTORY_URL) + "/dcae-service-types";
- String responseStr = DcaeHttpConnectionManager.doDcaeHttpQuery(url, "POST", apiBodyString,
+ String responseStr = dcaeHttpConnectionManager.doDcaeHttpQuery(url, "POST", apiBodyString,
"application/json");
// If the DCAEServiceTypeRequest is created successfully it will
// return a json object responce containing a node for newly created
@@ -305,7 +313,7 @@ public class DcaeInventoryServices { if (inventoryResponse != null && inventoryResponse.getTypeId() != null) {
String fullUrl = refProp.getStringValue(DCAE_INVENTORY_URL) + "/dcae-service-types/"
+ inventoryResponse.getTypeId();
- DcaeHttpConnectionManager.doDcaeHttpQuery(fullUrl, "DELETE", null, null);
+ dcaeHttpConnectionManager.doDcaeHttpQuery(fullUrl, "DELETE", null, null);
}
result = true;
} catch (IOException | ParseException e) {
diff --git a/src/main/java/org/onap/clamp/clds/exception/CldsDelegateException.java b/src/main/java/org/onap/clamp/clds/exception/CldsDelegateException.java deleted file mode 100644 index 22b7e3fd..00000000 --- a/src/main/java/org/onap/clamp/clds/exception/CldsDelegateException.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * =================================================================== - * - */ - -package org.onap.clamp.clds.exception; - -/** - * New exception to CldsDelegate errors. - */ -public class CldsDelegateException extends RuntimeException { - - /** - * - */ - private static final long serialVersionUID = -2705212640916671093L; - - /** - * This constructor can be used to create a new CldsDelegateException. - * - * @param message - * A string message detailing the problem - * @param e - * The exception sent by the code - */ - public CldsDelegateException(String message, Throwable e) { - super(message, e); - } - - /** - * This constructor can be used to create a new CldsDelegateException. Use - * this constructor only if you are creating a new exception stack, not if - * an exception was already raised by another code. - * - * @param message - * A string message detailing the problem - */ - public CldsDelegateException(String message) { - super(message); - } -} diff --git a/src/test/java/org/onap/clamp/clds/client/DcaeDispatcherServicesTest.java b/src/test/java/org/onap/clamp/clds/client/DcaeDispatcherServicesTest.java new file mode 100644 index 00000000..c828f78a --- /dev/null +++ b/src/test/java/org/onap/clamp/clds/client/DcaeDispatcherServicesTest.java @@ -0,0 +1,153 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2018 Nokia Intellectual Property. All rights + * reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +package org.onap.clamp.clds.client; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.collect.ImmutableMap; +import java.io.IOException; +import org.assertj.core.api.Assertions; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Matchers; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.clamp.clds.config.ClampProperties; + + + +@RunWith(MockitoJUnitRunner.class) +public class DcaeDispatcherServicesTest { + + private static final String DEPLOYMENT_STATUS_URL = "http://portal.api.simpledemo.onap.org:30297/dcae-deployments/" + + "closedLoop_c9c8b281-6fbd-4702-ba13-affa90411152_deploymentId/" + + "operation/a97b46f6-d77c-42a1-9449-d5ae71e8f688"; + private static final String DCAE_URL = "dcae_url"; + private static final String DEPLOY_RESPONSE_STRING = "{\"links\":" + + "{\"status\":\"http://deployment-handler.onap:8443/dcae-deployments/" + + "closedLoop_152367c8-b172-47b3-9e58-c53add75d869_deploymentId/" + + "operation/366eb098-7977-4966-ae82-abd2087edb10\"}}"; + + @Mock + private ClampProperties clampProperties; + + @Mock + DcaeHttpConnectionManager dcaeHttpConnectionManager; + + @InjectMocks + DcaeDispatcherServices dcaeDispatcherServices; + + private final String STATUS_RESPONSE_PROCESSING = "{\"operationType\": \"deploy\",\"status\": \"processing\"}"; + private final String STATUS_RESPONSE_ACTIVE = "{\"operationType\": \"deploy\",\"status\": \"succeeded\"}"; + + @Before + public void setUp() { + ImmutableMap.<String, String>builder() + .put("dcae.dispatcher.retry.limit", "3") + .put("dcae.dispatcher.retry.interval", "0") + .put("dcae.dispatcher.url", DCAE_URL) + .build() + .forEach((property, value) -> { + Mockito.when(clampProperties.getStringValue(Matchers.matches(property), Matchers.any())) + .thenReturn(value); + Mockito.when(clampProperties.getStringValue(Matchers.matches(property))).thenReturn(value); + }); + } + + @Test + public void shouldReturnDcaeOperationSataus() throws IOException { + //given + Mockito.when(dcaeHttpConnectionManager.doDcaeHttpQuery(DEPLOYMENT_STATUS_URL, "GET", null, null)) + .thenReturn(STATUS_RESPONSE_PROCESSING); + //when + String operationStatus = dcaeDispatcherServices.getOperationStatus(DEPLOYMENT_STATUS_URL); + + //then + Assertions.assertThat(operationStatus).isEqualTo("processing"); + } + + @Test + public void shouldTryMultipleTimesWhenProcessing() throws IOException, InterruptedException { + //given + Mockito.when(dcaeHttpConnectionManager.doDcaeHttpQuery(DEPLOYMENT_STATUS_URL, "GET", + null, null)) + .thenReturn(STATUS_RESPONSE_PROCESSING, STATUS_RESPONSE_PROCESSING, STATUS_RESPONSE_ACTIVE); + //when + String operationStatus = dcaeDispatcherServices.getOperationStatusWithRetry(DEPLOYMENT_STATUS_URL); + + //then + Assertions.assertThat(operationStatus).isEqualTo("succeeded"); + Mockito.verify(dcaeHttpConnectionManager, Mockito.times(3)) + .doDcaeHttpQuery(DEPLOYMENT_STATUS_URL, "GET", null, null); + + } + + @Test + public void shouldTryOnlyAsManyTimesAsConfigured() throws IOException, InterruptedException { + //given + Mockito.when(dcaeHttpConnectionManager + .doDcaeHttpQuery(DEPLOYMENT_STATUS_URL, "GET", null, null)) + .thenReturn(STATUS_RESPONSE_PROCESSING, STATUS_RESPONSE_PROCESSING, STATUS_RESPONSE_PROCESSING, + STATUS_RESPONSE_PROCESSING, STATUS_RESPONSE_PROCESSING); + //when + String operationStatus = dcaeDispatcherServices.getOperationStatusWithRetry(DEPLOYMENT_STATUS_URL); + + //then + Assertions.assertThat(operationStatus).isEqualTo("processing"); + Mockito.verify(dcaeHttpConnectionManager, Mockito.times(3)) + .doDcaeHttpQuery(DEPLOYMENT_STATUS_URL, "GET", null, null); + + } + + @Test + public void shouldTriggerDeploymentCreation() throws IOException { + //given + String deploymentID = "closedLoop_152367c8-b172-47b3-9e58-c53add75d869_deploymentId"; + String serviceTypeId = "e2ba40f7-bf42-41e7-acd7-48fd07586d90"; + Mockito.when(clampProperties.getJsonTemplate("dcae.deployment.template")) + .thenReturn(new ObjectMapper().readTree("{}")); + + Mockito.when(dcaeHttpConnectionManager + .doDcaeHttpQuery(DCAE_URL + + "/dcae-deployments/closedLoop_152367c8-b172-47b3-9e58-c53add75d869_deploymentId", + "PUT", + "{\"serviceTypeId\":\"e2ba40f7-bf42-41e7-acd7-48fd07586d90\",\"inputs\":{}}", + "application/json")) + .thenReturn(DEPLOY_RESPONSE_STRING); + JsonNode blueprintInputJson = new ObjectMapper().readTree("{}"); + + //when + String operationStatus = dcaeDispatcherServices + .createNewDeployment(deploymentID, serviceTypeId, blueprintInputJson); + + //then + Assertions.assertThat(operationStatus).isEqualTo("http://deployment-handler.onap:8443/" + + "dcae-deployments/closedLoop_152367c8-b172-47b3-9e58-c53add75d869_deploymentId/" + + "operation/366eb098-7977-4966-ae82-abd2087edb10"); + + } +}
\ No newline at end of file diff --git a/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java b/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java index 7a37a9dc..baf4673c 100644 --- a/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java @@ -38,7 +38,6 @@ import java.security.GeneralSecurityException; import java.util.LinkedList; import java.util.List; import java.util.Properties; - import javax.servlet.http.HttpServletRequest; import javax.ws.rs.NotFoundException; import javax.xml.transform.TransformerException; @@ -69,9 +68,10 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; -import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.context.SecurityContext; +import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; diff --git a/src/test/java/org/onap/clamp/clds/it/DcaeHttpConnectionManagerItCase.java b/src/test/java/org/onap/clamp/clds/it/DcaeHttpConnectionManagerItCase.java index 264853cd..12e8dd90 100644 --- a/src/test/java/org/onap/clamp/clds/it/DcaeHttpConnectionManagerItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/DcaeHttpConnectionManagerItCase.java @@ -17,6 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END============================================ + * Modifications copyright (c) 2018 Nokia * =================================================================== * */ @@ -45,6 +46,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.onap.clamp.clds.client.DcaeHttpConnectionManager; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; @@ -63,6 +65,10 @@ public class DcaeHttpConnectionManagerItCase { private String httpsPort; @Value("${server.http-to-https-redirection.port}") private String httpPort; + + @Autowired + DcaeHttpConnectionManager dcaeHttpConnectionManager; + private static TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { @@ -103,7 +109,7 @@ public class DcaeHttpConnectionManagerItCase { @Test public void testHttpGet() throws Exception { - String response = DcaeHttpConnectionManager + String response = dcaeHttpConnectionManager .doDcaeHttpQuery("http://localhost:" + this.httpPort + "/designer/index.html", "GET", null, null); assertNotNull(response); // Should be a redirection so 302, so empty @@ -112,7 +118,7 @@ public class DcaeHttpConnectionManagerItCase { @Test public void testHttpsGet() throws Exception { - String response = DcaeHttpConnectionManager + String response = dcaeHttpConnectionManager .doDcaeHttpQuery("https://localhost:" + this.httpsPort + "/designer/index.html", "GET", null, null); assertNotNull(response); // Should contain something @@ -121,21 +127,21 @@ public class DcaeHttpConnectionManagerItCase { @Test(expected = BadRequestException.class) public void testHttpsGet404() throws IOException { - DcaeHttpConnectionManager.doDcaeHttpQuery("https://localhost:" + this.httpsPort + "/designer/index1.html", + dcaeHttpConnectionManager.doDcaeHttpQuery("https://localhost:" + this.httpsPort + "/designer/index1.html", "GET", null, null); fail("Should have raised an BadRequestException"); } @Test(expected = BadRequestException.class) public void testHttpsPost404() throws IOException { - DcaeHttpConnectionManager.doDcaeHttpQuery("https://localhost:" + this.httpsPort + "/designer/index1.html", + dcaeHttpConnectionManager.doDcaeHttpQuery("https://localhost:" + this.httpsPort + "/designer/index1.html", "POST", "", "application/json"); fail("Should have raised an BadRequestException"); } @Test(expected = BadRequestException.class) public void testHttpException() throws IOException { - DcaeHttpConnectionManager.doDcaeHttpQuery("http://localhost:" + this.httpsPort + "/designer/index.html", "GET", + dcaeHttpConnectionManager.doDcaeHttpQuery("http://localhost:" + this.httpsPort + "/designer/index.html", "GET", null, null); fail("Should have raised an BadRequestException"); } diff --git a/src/test/java/org/onap/clamp/clds/it/HttpsItCase.java b/src/test/java/org/onap/clamp/clds/it/HttpsItCase.java index 0da267de..81b6b835 100644 --- a/src/test/java/org/onap/clamp/clds/it/HttpsItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/HttpsItCase.java @@ -133,7 +133,8 @@ public class HttpsItCase { .getForEntity("https://localhost:" + this.httpsPort + "/restservices/clds/v1/api-doc", String.class); assertThat(httpsEntity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(httpsEntity.getBody()).contains("swagger"); - FileUtils.writeStringToFile(new File("docs/swagger/swagger.json"), httpsEntity.getBody(),Charset.defaultCharset()); + FileUtils.writeStringToFile( + new File("docs/swagger/swagger.json"), httpsEntity.getBody(), Charset.defaultCharset()); } /** diff --git a/src/test/java/org/onap/clamp/clds/it/SdcReqItCase.java b/src/test/java/org/onap/clamp/clds/it/SdcReqItCase.java index 36cbc590..f05b33e1 100644 --- a/src/test/java/org/onap/clamp/clds/it/SdcReqItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/SdcReqItCase.java @@ -89,9 +89,11 @@ public class SdcReqItCase { @Test public void formatSdcReqTest() throws JSONException { - String jsonResult = sdcReq.formatSdcReq("payload", "artifactName", "artifactLabel", "artifactType"); + String jsonResult = sdcReq.formatSdcReq("payload", "artifactName", + "artifactLabel", "artifactType"); JSONAssert.assertEquals( - "{\"payloadData\" : \"cGF5bG9hZA==\",\"artifactLabel\" : \"artifactLabel\",\"artifactName\" :\"artifactName\",\"artifactType\" : \"artifactType\"," + "{\"payloadData\" : \"cGF5bG9hZA==\",\"artifactLabel\" : \"artifactLabel\"," + + "\"artifactName\" :\"artifactName\",\"artifactType\" : \"artifactType\"," + "\"artifactGroupType\" : \"DEPLOYMENT\",\"description\" : \"from CLAMP Cockpit\"}", jsonResult, true); } @@ -102,6 +104,6 @@ public class SdcReqItCase { assertNotNull(listUrls); assertTrue(listUrls.size() == 1); assertTrue(listUrls.get(0).contains( - "/sdc/v1/catalog/services/56441b4b-0467-41dc-9a0e-e68613838219/resourceInstances/vpacketgen0/artifacts")); + "/sdc/v1/catalog/services/56441b4b-0467-41dc-9a0e-e68613838219/resourceInstances/vpacketgen0/artifacts")); } } |