diff options
Diffstat (limited to 'adapters/mso-openstack-adapters/src/test/java')
6 files changed, 323 insertions, 24 deletions
diff --git a/adapters/mso-openstack-adapters/src/test/java/db/migration/CloudConfigMigrationTest.java b/adapters/mso-openstack-adapters/src/test/java/db/migration/CloudConfigMigrationTest.java new file mode 100644 index 0000000000..b29e1f57a7 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/java/db/migration/CloudConfigMigrationTest.java @@ -0,0 +1,107 @@ +package db.migration; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.adapters.vnf.BaseRestTestUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; + +import javax.sql.DataSource; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; + +public class CloudConfigMigrationTest extends BaseRestTestUtils { + + @Qualifier("dataSource") + @Autowired + DataSource dataSource; + + R__CloudConfigMigration cloudConfigMigration; + + @Before + public void setup() { + cloudConfigMigration = new R__CloudConfigMigration(); + } + + @Test + public void testMigrate() throws Exception { + System.setProperty("spring.profiles.active", "test"); + cloudConfigMigration.migrate(dataSource.getConnection()); + assertMigratedIdentityServiceData(); + assertMigratedCloudSiteData(); + assertMigratedCloudManagerData(); + } + + @Test + public void testMigrateNoData() throws Exception { + System.setProperty("spring.profiles.active", "nomigrate"); + int identityCount = getDataCount("identity_services"); + int cloudSiteCount = getDataCount("cloud_sites"); + int cloudManagerCount = getDataCount("cloudify_managers"); + + cloudConfigMigration.migrate(dataSource.getConnection()); + + Assert.assertEquals(identityCount, getDataCount("identity_services")); + Assert.assertEquals(cloudSiteCount, getDataCount("cloud_sites")); + Assert.assertEquals(cloudManagerCount, getDataCount("cloudify_managers")); + } + + + private int getDataCount(String tableName) throws Exception { + try (Connection con = dataSource.getConnection(); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select count(1) from " + tableName)) { + while (rs.next()) { + return rs.getInt(1); + } + } + return 0; + } + + private void assertMigratedIdentityServiceData() throws Exception { + try (Connection con = dataSource.getConnection(); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select * from identity_services where id='MTKEYSTONE'")) { + boolean dataAvailable = false; + while (rs.next()) { + dataAvailable = true; + Assert.assertEquals("MTKEYSTONE", rs.getString("id")); + Assert.assertEquals("http://localhost:5000/v2.0", rs.getString("identity_url")); + Assert.assertEquals("john", rs.getString("mso_id")); + Assert.assertEquals("313DECE408AF7759D442D7B06DD9A6AA", rs.getString("mso_pass")); + Assert.assertEquals("admin", rs.getString("admin_tenant")); + Assert.assertEquals("_member_", rs.getString("member_role")); + Assert.assertEquals("KEYSTONE", rs.getString("identity_server_type")); + Assert.assertEquals("USERNAME_PASSWORD", rs.getString("identity_authentication_type")); + } + Assert.assertTrue("Expected data in identity_services table post migration but didnt find any!!!", dataAvailable); + } + } + + private void assertMigratedCloudSiteData() throws Exception { + try (Connection con = dataSource.getConnection(); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select * from cloud_sites where id='regionOne'")) { + boolean dataAvailable = false; + while (rs.next()) { + dataAvailable = true; + Assert.assertEquals("regionOne", rs.getString("id")); + Assert.assertEquals("regionOne", rs.getString("region_id")); + Assert.assertEquals("MT2", rs.getString("clli")); + Assert.assertEquals("2.5", rs.getString("cloud_version")); + Assert.assertEquals("MTKEYSTONE", rs.getString("identity_service_id")); + } + Assert.assertTrue("Expected data in identity_services table post migration but didnt find any!!!", dataAvailable); + } + } + + private void assertMigratedCloudManagerData() throws Exception { + try (Connection con = dataSource.getConnection(); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select * from cloudify_managers where id='manager'")) { + boolean dataAvailable = false; + while (rs.next()) { + dataAvailable = true; + Assert.assertEquals("http://localhost:8080", rs.getString("cloudify_url")); + Assert.assertEquals("user", rs.getString("username")); + Assert.assertEquals("password", rs.getString("password")); + Assert.assertEquals("2.0", rs.getString("version")); + } + Assert.assertTrue("Expected data in identity_services table post migration but didnt find any!!!", dataAvailable); + } + } +} 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 acfe6568af..ea21687bc5 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 @@ -75,7 +75,7 @@ public class TenantAdapterRestTest extends BaseRestTestUtils { cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0"); 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"; @@ -127,7 +127,7 @@ public class TenantAdapterRestTest extends BaseRestTestUtils { cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0"); 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/vdu/mapper/VfModuleCustomizationToVduMapperTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java new file mode 100644 index 0000000000..c982f8beb1 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java @@ -0,0 +1,146 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Nokia + * ================================================================================ + * 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.so.adapters.vdu.mapper; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.google.common.collect.Lists; +import java.util.List; +import org.junit.Test; +import org.onap.so.adapters.vdu.VduArtifact; +import org.onap.so.adapters.vdu.VduArtifact.ArtifactType; +import org.onap.so.adapters.vdu.VduModelInfo; +import org.onap.so.db.catalog.beans.HeatEnvironment; +import org.onap.so.db.catalog.beans.HeatFiles; +import org.onap.so.db.catalog.beans.HeatTemplate; +import org.onap.so.db.catalog.beans.VfModule; +import org.onap.so.db.catalog.beans.VfModuleCustomization; + +public class VfModuleCustomizationToVduMapperTest { + + private static final String MODEL_CUSTOMIZATION_UUID = "modelCustomizationUUID"; + private static final String HEAT_ENV_NAME = "heatEnvName"; + private static final String HEAT_ENV_CONTENT = "heatEnvContent"; + private static final String MODULE_HEAT_TEMPLATE_NAME = "moduleHeatTemplateName"; + private static final String MODULE_HEAT_TEMPLATE_BODY = "moduleHeatTemplateBody"; + private static final String NESTED_TEMPLATE_NAME = "nestedTemplateName"; + private static final String NESTED_TEMPLATE_BODY = "nestedTemplateBody"; + private static final int TIMEOUT_IN_MIN = 66; + private static final String VF_MODULE_MODEL_INVARIANT_UUID = "vfModuleModelInvariantUUID"; + private static final String CLOUD_FILE_NAME = "cloudFileName"; + private static final String CLOUD_FILE_BODY = "cloudFileBody"; + + + @Test + public void mapVfModuleCustomizationToVdu_successful() { + // GIVEN + VfModuleCustomization vfModuleCustomization = createVfModuleCustomization(); + vfModuleCustomization.setHeatEnvironment(createHeatEnvironment(HEAT_ENV_NAME, HEAT_ENV_CONTENT)); + VfModule vfModule = createVfModule(); + vfModule.setModuleHeatTemplate(createHeatTemplate( + MODULE_HEAT_TEMPLATE_NAME, MODULE_HEAT_TEMPLATE_BODY, + NESTED_TEMPLATE_NAME, NESTED_TEMPLATE_BODY)); + vfModuleCustomization.setVfModule(vfModule); + + // WHEN + VduModelInfo vduModelInfo = new VfModuleCustomizationToVduMapper() + .mapVfModuleCustomizationToVdu(vfModuleCustomization); + + // THEN + assertThat(vduModelInfo.getModelCustomizationUUID()).isEqualTo(MODEL_CUSTOMIZATION_UUID); + assertThat(vduModelInfo.getTimeoutMinutes()).isEqualTo(TIMEOUT_IN_MIN); + assertThat(vduModelInfo.getArtifacts()).containsExactlyElementsOf(createExpectedVduArtifacts()); + } + + @Test + public void mapVfModuleCustVolumeToVdu_successful() { + // GIVEN + VfModuleCustomization vfModuleCustomization = createVfModuleCustomization(); + vfModuleCustomization.setVolumeHeatEnv(createHeatEnvironment(HEAT_ENV_NAME, HEAT_ENV_CONTENT)); + VfModule vfModule = createVfModule(); + vfModule.setVolumeHeatTemplate(createHeatTemplate( + MODULE_HEAT_TEMPLATE_NAME, MODULE_HEAT_TEMPLATE_BODY, + NESTED_TEMPLATE_NAME, NESTED_TEMPLATE_BODY)); + vfModuleCustomization.setVfModule(vfModule); + + // WHEN + VduModelInfo vduModelInfo = new VfModuleCustomizationToVduMapper() + .mapVfModuleCustVolumeToVdu(vfModuleCustomization); + + // THEN + assertThat(vduModelInfo.getModelCustomizationUUID()).isEqualTo(MODEL_CUSTOMIZATION_UUID); + assertThat(vduModelInfo.getTimeoutMinutes()).isEqualTo(TIMEOUT_IN_MIN); + assertThat(vduModelInfo.getArtifacts()).containsExactlyElementsOf(createExpectedVduArtifacts()); + } + + private VfModuleCustomization createVfModuleCustomization() { + VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); + vfModuleCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID); + return vfModuleCustomization; + } + + private HeatEnvironment createHeatEnvironment(String volHeatEnvName, String volHeatEnvContent) { + HeatEnvironment heatEnvironment = new HeatEnvironment(); + heatEnvironment.setName(volHeatEnvName); + heatEnvironment.setEnvironment(volHeatEnvContent); + return heatEnvironment; + } + + private VfModule createVfModule() { + VfModule vfModule = new VfModule(); + vfModule.setModelInvariantUUID(VF_MODULE_MODEL_INVARIANT_UUID); + vfModule.setHeatFiles(createHeatFiles(CLOUD_FILE_NAME, CLOUD_FILE_BODY)); + return vfModule; + } + + private List<HeatFiles> createHeatFiles(String fileName, String fileBody) { + HeatFiles heatFiles = new HeatFiles(); + heatFiles.setFileName(fileName); + heatFiles.setFileBody(fileBody); + return Lists.newArrayList(heatFiles); + } + + private HeatTemplate createHeatTemplate(String moduleHeatTemplateName, String moduleHeatTemplateBody, + String childTemplateName, String childTemplateBody) { + HeatTemplate heatTemplate = new HeatTemplate(); + heatTemplate.setTemplateName(moduleHeatTemplateName); + heatTemplate.setTemplateBody(moduleHeatTemplateBody); + heatTemplate.setTimeoutMinutes(TIMEOUT_IN_MIN); + heatTemplate.setChildTemplates(createChildHeatTemplate(childTemplateName, childTemplateBody)); + return heatTemplate; + } + + private List<HeatTemplate> createChildHeatTemplate(String moduleHeatTemplateName, String moduleHeatTemplateBody) { + HeatTemplate heatTemplate = new HeatTemplate(); + heatTemplate.setTemplateName(moduleHeatTemplateName); + heatTemplate.setTemplateBody(moduleHeatTemplateBody); + return Lists.newArrayList(heatTemplate); + } + + private List<VduArtifact> createExpectedVduArtifacts() { + return Lists.newArrayList( + new VduArtifact(MODULE_HEAT_TEMPLATE_NAME, MODULE_HEAT_TEMPLATE_BODY.getBytes(), + ArtifactType.MAIN_TEMPLATE), + new VduArtifact(NESTED_TEMPLATE_NAME, NESTED_TEMPLATE_BODY.getBytes(), ArtifactType.NESTED_TEMPLATE), + new VduArtifact(CLOUD_FILE_NAME, CLOUD_FILE_BODY.getBytes(), ArtifactType.TEXT_FILE), + new VduArtifact(HEAT_ENV_NAME, HEAT_ENV_CONTENT.getBytes(), ArtifactType.ENVIRONMENT)); + } +} 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 a2faaaff78..d2b6d4f633 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 @@ -24,10 +24,15 @@ import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +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.db.catalog.beans.AuthenticationType; +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; @@ -36,16 +41,20 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; import org.springframework.http.HttpHeaders; -import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; +import javax.ws.rs.core.MediaType; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; +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.reset; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; @RunWith(SpringRunner.class) @SpringBootTest(classes = MsoOpenstackAdaptersApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @@ -63,6 +72,9 @@ public class BaseRestTestUtils { @LocalServerPort private int port; + + public ObjectMapper mapper; + protected String readJsonFileAsString(String fileLocation) throws JsonParseException, JsonMappingException, IOException{ ObjectMapper mapper = new ObjectMapper(); @@ -87,10 +99,53 @@ public class BaseRestTestUtils { return sb.toString(); } } - + + /*** + * Before each test execution, updating IdentityUrl port value to the ramdom wireMockPort + * Since URL will be used as a rest call and required to be mocked in unit tests + */ @Before - public void setUp(){ + public void setUp() throws Exception { reset(); + mapper = new ObjectMapper(); + + CloudIdentity identity = new CloudIdentity(); + identity.setId("MTN13"); + identity.setMsoId("m93945"); + identity.setMsoPass("93937EA01B94A10A49279D4572B48369"); + identity.setAdminTenant("admin"); + identity.setMemberRole("admin"); + identity.setTenantMetadata(new Boolean(true)); + identity.setIdentityUrl("http://localhost:"+wireMockPort+"/v2.0"); + identity.setIdentityAuthenticationType(AuthenticationType.USERNAME_PASSWORD); + + CloudSite cloudSite = new CloudSite(); + cloudSite.setId("MTN13"); + cloudSite.setCloudVersion("3.0"); + cloudSite.setClli("MDT13"); + cloudSite.setRegionId("mtn13"); + cloudSite.setOrchestrator("orchestrator" + + ""); + identity.setIdentityServerType(ServerType.KEYSTONE); + cloudSite.setIdentityService(identity); + + + 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))); + 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))); + 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))); + } + + protected static String getBody(String body, int port, String urlPath) throws IOException { + return body.replaceAll("port", "http://localhost:" + port + urlPath); } @Test 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 0ce3683a1e..005586e3ad 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 @@ -81,9 +81,10 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { String vnfName = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"; @Before - public void before() { + public void before() throws Exception { MockitoAnnotations.initMocks(this); WireMock.reset(); + setUp(); } @Test @@ -105,7 +106,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.createVfModule("MTN13", "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>()); @@ -510,7 +511,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { vfModuleCustomization.getVfModule().getModuleHeatTemplate().setParameters(new HashSet<>()); Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); - instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.updateVfModule("MTN13", "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/MsoVnfCloudifyAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java index 6f2c6cf86d..6674c7171f 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java @@ -22,14 +22,13 @@ package org.onap.so.adapters.vnf; import org.apache.http.HttpStatus; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.onap.so.adapters.vnf.exceptions.VnfException; import org.onap.so.cloud.CloudConfig; -import org.onap.so.cloud.CloudifyManager; +import org.onap.so.db.catalog.beans.CloudifyManager; import org.onap.so.entity.MsoRequest; import org.onap.so.openstack.beans.VnfRollback; import org.springframework.beans.factory.annotation.Autowired; @@ -38,11 +37,7 @@ import javax.xml.ws.Holder; import java.util.HashMap; import java.util.Map; -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.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.*; public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { @@ -56,23 +51,18 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { private CloudConfig cloudConfig; @Before - public void before(){ + public void before() throws Exception { super.setUp(); CloudifyManager cloudifyManager = new CloudifyManager(); cloudifyManager.setId("mtn13"); cloudifyManager.setCloudifyUrl("http://localhost:"+wireMockPort+"/v2.0"); cloudifyManager.setUsername("m93945"); cloudifyManager.setPassword("93937EA01B94A10A49279D4572B48369"); - cloudConfig.getCloudifyManagers().put("mtn13",cloudifyManager); } - @After - public void after(){ - cloudConfig.getCloudifyManagers().clear(); - } - - @Test - public void queryVnfNullPointerExceptionTest() throws Exception { + @Test + public void queryVnfExceptionTest() throws Exception { + reset(); expectedException.expect(VnfException.class); MsoRequest msoRequest = new MsoRequest(); msoRequest.setRequestId("12345"); |