diff options
author | Smokowski, Steven <steve.smokowski@att.com> | 2019-05-15 14:19:49 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-05-15 14:19:58 -0400 |
commit | e4687eeb77d9fddf14935894026aec0b1c9e3ac9 (patch) | |
tree | 47c85cd95c71d36a404da6c83fbbb5d11fb0fb2c /adapters/mso-openstack-adapters/src/test | |
parent | f9c309fb9e789225ccd6b02ec9ab4777bbd4021c (diff) |
store openstack request status in requestdb
Openstack request status now stored in request db
Change-Id: Ida8f4f613d406c2b834ab190e01d5aaf2f16dd3d
Issue-ID: SO-1867
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'adapters/mso-openstack-adapters/src/test')
6 files changed, 12 insertions, 32 deletions
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java index e481f0d03f..1a44934187 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java @@ -67,7 +67,7 @@ public class TenantAdapterRestTest extends BaseRestTestUtils { public void testCreateTenantCreated() throws JsonParseException, JsonMappingException, IOException { CreateTenantRequest request = new CreateTenantRequest(); - String cloudSiteId = "MTN13"; + String cloudSiteId = "mtn13"; String requestId = "62265093-277d-4388-9ba6-449838ade586"; String serviceInstanceId = "4147e06f-1b89-49c5-b21f-4faf8dc9805a"; String tenantName = "testingTenantName"; @@ -117,7 +117,7 @@ public class TenantAdapterRestTest extends BaseRestTestUtils { public void testCreateTenantExists() throws JsonParseException, JsonMappingException, IOException { CreateTenantRequest request = new CreateTenantRequest(); - String cloudSiteId = "MTN13"; + String cloudSiteId = "mtn13"; String requestId = "62265093-277d-4388-9ba6-449838ade586"; String serviceInstanceId = "4147e06f-1b89-49c5-b21f-4faf8dc9805a"; String tenantName = "testingTenantName"; diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java index 102d748d56..92bac7a14b 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java @@ -30,7 +30,6 @@ import java.io.IOException; import javax.ws.rs.core.MediaType; import org.apache.http.HttpStatus; import org.junit.Before; -import org.junit.Test; import org.junit.runner.RunWith; import org.onap.so.adapters.openstack.MsoOpenstackAdaptersApplication; import org.onap.so.cloud.CloudConfig; @@ -39,7 +38,6 @@ import org.onap.so.db.catalog.beans.CloudIdentity; import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.db.catalog.beans.ServerType; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; @@ -70,7 +68,6 @@ public abstract class BaseRestTestUtils { CloudConfig cloudConfig; @Autowired - @Qualifier("JettisonStyle") protected TestRestTemplate restTemplate; protected HttpHeaders headers = new HttpHeaders(); @@ -118,9 +115,10 @@ public abstract class BaseRestTestUtils { wireMockServer.resetAll(); mapper = new ObjectMapper(); CloudIdentity identity = new CloudIdentity(); - identity.setId("MTN13"); + identity.setId("DEFAULT"); identity.setMsoId("m93945"); - identity.setMsoPass("93937EA01B94A10A49279D4572B48369"); + identity.setMsoPass( + "89C9F27833AC49FE4164F3608CADE7BCF40357977607A7E4B899F9A046C0071C75F7347A47308EF9FB6620214264B1"); identity.setAdminTenant("admin"); identity.setMemberRole("admin"); identity.setTenantMetadata(new Boolean(true)); @@ -137,29 +135,14 @@ public abstract class BaseRestTestUtils { identity.setIdentityServerType(ServerType.KEYSTONE); cloudSite.setIdentityService(identity); - wireMockServer.stubFor(get(urlPathEqualTo("/cloudSite/MTN13")) - .willReturn(aResponse().withBody(getBody(mapper.writeValueAsString(cloudSite), wireMockPort, "")) - .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) - .withStatus(HttpStatus.SC_OK))); wireMockServer.stubFor(get(urlPathEqualTo("/cloudSite/DEFAULT")) .willReturn(aResponse().withBody(getBody(mapper.writeValueAsString(cloudSite), wireMockPort, "")) .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); - wireMockServer.stubFor(get(urlPathEqualTo("/cloudIdentity/MTN13")) - .willReturn(aResponse().withBody(getBody(mapper.writeValueAsString(identity), wireMockPort, "")) - .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) - .withStatus(HttpStatus.SC_OK))); - cloudConfig.getCloudSite("MTN13").get().getIdentityService() - .setIdentityUrl("http://localhost:" + wireMockPort + cloudEndpoint); } protected static String getBody(String body, int port, String urlPath) throws IOException { return body.replaceAll("port", "http://localhost:" + port + urlPath); } - @Test - public void testNothing() { - - } - } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java index 0c56222558..651e2c9a73 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java @@ -36,12 +36,10 @@ import java.util.Map; import java.util.Set; import javax.xml.ws.Holder; import org.apache.http.HttpStatus; -import org.junit.Before; import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.mockito.MockitoAnnotations; import org.onap.so.adapters.vnf.exceptions.VnfAlreadyExists; import org.onap.so.adapters.vnf.exceptions.VnfException; import org.onap.so.adapters.vnf.exceptions.VnfNotFound; @@ -58,7 +56,6 @@ import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.exceptions.MsoException; import org.onap.so.openstack.utils.MsoHeatUtils; import org.springframework.beans.factory.annotation.Autowired; -import com.github.tomakehurst.wiremock.client.WireMock; public class MsoVnfAdapterImplTest extends BaseRestTestUtils { @@ -92,7 +89,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("MTN13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", + instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -514,7 +511,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { vfModuleCustomization.getVfModule().getModuleHeatTemplate().setParameters(new HashSet<>()); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - instance.updateVfModule("MTN13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", "b4ea86b4-253f-11e7-93ae-92361f002671", map, msoRequest, new Holder<Map<String, String>>(), new Holder<VnfRollback>()); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java index be565deb9e..7ec8e51892 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java @@ -93,7 +93,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - msoVnfPluginAdapter.createVfModule("MTN13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", + msoVnfPluginAdapter.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", null, "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json index b78f700fd9..934e075220 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json +++ b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json @@ -1,11 +1,11 @@ { "createTenantResponse": { - "cloudSiteId": "MTN13", + "cloudSiteId": "mtn13", "tenantId": "tenantId", "tenantCreated": true, "tenantRollback": { "tenantId": "tenantId", - "cloudId": "MTN13", + "cloudId": "mtn13", "tenantCreated": true, "msoRequest": { "requestId": "62265093-277d-4388-9ba6-449838ade586", diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json index 977aa542b3..6f81ebcd36 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json +++ b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json @@ -1,10 +1,10 @@ { "createTenantResponse": { - "cloudSiteId": "MTN13", + "cloudSiteId": "mtn13", "tenantId": "tenantId", "tenantCreated": false, "tenantRollback": { - "cloudId": "MTN13", + "cloudId": "mtn13", "tenantCreated": false, "msoRequest": { "requestId": "62265093-277d-4388-9ba6-449838ade586", |