aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapter-utils/src
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-adapter-utils/src')
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java2
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java1
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java3
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java6
4 files changed, 5 insertions, 7 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
index 1df5fe36ab..be42ff10bb 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
@@ -212,7 +212,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
if (response.hasEntity()) {
multicloudResponseBody = getCreateBody((java.io.InputStream) response.getEntity());
}
- if (response.getStatus() == Response.Status.CREATED.getStatusCode() && response.hasEntity()) {
+ if (response.getStatus() == Response.Status.CREATED.getStatusCode() && multicloudResponseBody != null) {
String canonicalName = stackName + "/";
if (multicloudResponseBody != null) {
canonicalName = canonicalName + multicloudResponseBody.getWorkloadId();
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
index f20f6f1448..5ee4987e38 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
@@ -439,6 +439,7 @@ public class MsoHeatUtilsTest extends MsoHeatUtils {
String requestId = getRequestId();
doReturn(heatClient).when(heatUtils).getHeatClient(cloudSiteId, tenantId);
+ doNothing().when(heatUtils).saveStackRequest(eq(createStackParam), isNull(), eq("stackName"));
doReturn(stackResource).when(heatClient).getStacks();
doReturn(mockCreateStack).when(stackResource).create(createStackParam);
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java
index acd42dd8da..c6111a16cb 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java
@@ -95,7 +95,6 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup {
StackInfo expectedStackInfo = new StackInfo("stackName", HeatStatus.UPDATED, "stackStatusReason", null);
expectedStackInfo.setCanonicalName("stackName/id");
- doReturn(Optional.of(cloudSite)).when(cloudConfig).getCloudSite(isA(String.class));
doReturn(heatClient).when(heatUtils).getHeatClient(isA(String.class), isA(String.class));
doReturn(null).when(heatUtils).executeAndRecordOpenstackRequest(isA(OpenStackRequest.class));
doReturn("0").when(environment).getProperty(isA(String.class), isA(String.class));
@@ -120,7 +119,6 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup {
StackInfo expectedStackInfo = new StackInfo("stackName", HeatStatus.UPDATED, "stackStatusReason", null);
expectedStackInfo.setCanonicalName("stackName/id");
- doReturn(Optional.of(cloudSite)).when(cloudConfig).getCloudSite(isA(String.class));
doReturn(heatClient).when(heatUtils).getHeatClient(isA(String.class), isA(String.class));
doReturn(null).when(heatUtils).executeAndRecordOpenstackRequest(isA(OpenStackRequest.class));
@@ -147,7 +145,6 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup {
StackInfo expectedStackInfo = new StackInfo("stackName", HeatStatus.UPDATED, "stackStatusReason", null);
expectedStackInfo.setCanonicalName("stackName/id");
- doReturn(Optional.of(cloudSite)).when(cloudConfig).getCloudSite(isA(String.class));
doReturn(heatClient).when(heatUtils).getHeatClient(isA(String.class), isA(String.class));
doReturn(null).when(heatUtils).executeAndRecordOpenstackRequest(isA(OpenStackRequest.class));
doReturn("0").when(environment).getProperty(isA(String.class), isA(String.class));
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
index 44a9bc3e10..7adfe091d3 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
@@ -181,12 +181,12 @@ public class MsoMulticloudUtilsTest extends BaseTest {
@Test
public void createStackEmptyResponseEntity() throws MsoException {
- wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_CREATE_PATH)).willReturn(
- aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_CREATED)));
+ wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_CREATE_PATH)).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_CREATED).withBody("{}")));
StackInfo result = multicloudUtils.createStack("MTN14", "CloudOwner", "TEST-tenant", "TEST-stack",
new VduModelInfo(), "TEST-heat", new HashMap<>(), false, 200, "TEST-env", new HashMap<>(),
new HashMap<>(), false, false);
assertNotNull(result);
- assertEquals("TEST-stack/", result.getName());
+ assertEquals("TEST-stack", result.getName());
}
}