aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSmokowski, Steven <steve.smokowski@att.com>2019-05-31 16:12:39 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-05-31 16:12:54 -0400
commitbe81900287dfc6680357fe9caa08e182d72dc176 (patch)
tree4d6f5c4937c80349dadf685ce53fe8dc96f9afff
parent89b396152a7f5ca62175d13342c1b3a1a9067ccb (diff)
issue encoding openstack errors
Fix setting of port to fix unit test issues Fix formatting error on the file causing build issue Properly revert change that was made previously Fix issue where base java library not encoding properly Change-Id: I2bfa46825d9a99998195dbd7bd422f88fa76ef09 Issue-ID: SO-1965 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java12
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java13
2 files changed, 23 insertions, 2 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
index 31cb1248d6..858216fd27 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -77,8 +77,12 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Before
public void initialize() {
client.wiremockPort = String.valueOf(port);
+ client.setEndpoint(getEndpoint(port));
}
+ protected String getEndpoint(int port) {
+ return "http://localhost:" + port;
+ }
@Test
public void testGetRainyDayHandler_Regex() {
@@ -88,6 +92,14 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
}
@Test
+ public void testGetRainyDayHandler__Encoding_Regex() {
+ RainyDayHandlerStatus rainyDayHandlerStatus = client.getRainyDayHandlerStatus("AssignServiceInstanceBB", "*",
+ "*", "*", "*",
+ "resources.lba_0_dmz_vmi_0: Unknown id: Error: oper 1 url /fqname-to-id body {\"fq_name\": [\"zrdm6bvota05-dmz_sec_group\"], \"type\": \"security-group\"} response Name ['zrdm6bvota05-dmz_sec_group'] not found");
+ Assert.assertEquals("Rollback", rainyDayHandlerStatus.getPolicy());
+ }
+
+ @Test
public void testGetCloudSiteHappyPath() throws Exception {
CloudSite cloudSite = client.getCloudSite(MTN13);
Assert.assertNotNull(cloudSite);
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index a1f926e25f..e5f2758be7 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
@@ -73,6 +73,7 @@ import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
+import org.springframework.web.util.UriComponentsBuilder;
import uk.co.blackpepper.bowman.Client;
import uk.co.blackpepper.bowman.ClientFactory;
import uk.co.blackpepper.bowman.Configuration;
@@ -639,10 +640,10 @@ public class CatalogDbClient {
"Get Rainy Day Status - Flow Name {}, Service Type: {} , vnfType {} , errorCode {}, workStep {}, errorMessage {}",
flowName, serviceType, vnfType, errorCode, workStep, errorMessage);
return this.getSingleResource(rainyDayHandlerStatusClient,
- getUri(UriBuilder.fromUri(endpoint + RAINY_DAY_HANDLER_MACRO + SEARCH + findRainyDayHandler)
+ UriComponentsBuilder.fromUriString(endpoint + RAINY_DAY_HANDLER_MACRO + SEARCH + findRainyDayHandler)
.queryParam(FLOW_NAME, flowName).queryParam(SERVICE_TYPE, serviceType)
.queryParam(VNF_TYPE, vnfType).queryParam(ERROR_CODE, errorCode).queryParam(WORK_STEP, workStep)
- .queryParam(ERROR_MESSAGE, errorMessage).build().toString()));
+ .queryParam(ERROR_MESSAGE, errorMessage).build().encode().toUri());
}
public ServiceRecipe getFirstByServiceModelUUIDAndAction(String modelUUID, String action) {
@@ -880,4 +881,12 @@ public class CatalogDbClient {
return this.getMultipleResources(workflowClient, getUri(UriBuilder.fromUri(findWorkflowByModelUUID)
.queryParam(VNF_RESOURCE_MODEL_UUID, vnfResourceModelUUID).build().toString()));
}
+
+ public String getEndpoint() {
+ return endpoint;
+ }
+
+ public void setEndpoint(String endpoint) {
+ this.endpoint = endpoint;
+ }
}