diff options
author | r.bogacki <r.bogacki@samsung.com> | 2019-04-03 14:00:21 +0200 |
---|---|---|
committer | r.bogacki <r.bogacki@samsung.com> | 2019-04-05 07:37:33 +0200 |
commit | 608a077f8ea3b18dddbfeb4d8b486661e05561c7 (patch) | |
tree | e95628c8f3030f6d03b3d92d1ed030b9db9d27d2 /adapters/mso-adapter-utils/src/test | |
parent | f81920304c7b62637d32473e672a1e51275ce54b (diff) |
Fixed Sonar blocker issues
Fixed blockers according to Sonar analysis.
Added tests for fixed issues.
Change-Id: I8e259147082d722961048454fae9484cc0d8b0a8
Issue-ID: SO-1734
Signed-off-by: Robert Bogacki <r.bogacki@samsung.com>
Diffstat (limited to 'adapters/mso-adapter-utils/src/test')
-rw-r--r-- | adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java | 16 |
1 files changed, 14 insertions, 2 deletions
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 fbe532d1fe..41cb7746c0 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 @@ -4,8 +4,6 @@ * ================================================================================ * Copyright (C) 2019 Samsung Intellectual Property. All rights reserved. * ================================================================================ - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ * 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 @@ -23,6 +21,7 @@ package org.onap.so.openstack.utils; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.get; import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; import static org.junit.Assert.assertEquals; @@ -30,6 +29,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Mockito.when; +import static org.onap.so.openstack.utils.MsoMulticloudUtils.MULTICLOUD_QUERY_BODY_NULL; import java.io.IOException; import java.util.HashMap; @@ -96,6 +96,18 @@ public class MsoMulticloudUtilsTest extends BaseTest { assertTrue(HeatStatus.NOTFOUND == result.getStatus()); } + @Test + public void queryStackWithNullMulticloudQueryBody() throws MsoException { + wireMockServer.stubFor(get(urlPathEqualTo("/api/multicloud/v1/CloudOwner/MTN13/infra_workload/instanceId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(CREATE_STACK_RESPONSE) + .withStatus(HttpStatus.SC_OK))); + + StackInfo result = multicloudUtils.queryStack("MTN13", "CloudOwner", "TEST-tenant", "instanceId"); + assertTrue(HeatStatus.FAILED == result.getStatus()); + assertEquals(MULTICLOUD_QUERY_BODY_NULL, result.getStatusMessage()); + } + @Test(expected = VduException.class) public void updateVdu() throws MsoException { multicloudUtils.updateVdu(new CloudInfo(), "instanceId", new HashMap<>(), new VduModelInfo(), |