diff options
Diffstat (limited to 'adapters/mso-openstack-adapters/src/test')
5 files changed, 18 insertions, 184 deletions
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java index 3a82dd5b72..94d9a28b76 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java @@ -4,10 +4,7 @@ import static org.junit.Assert.assertEquals; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; -import java.util.HashMap; -import java.util.Map; import java.util.Optional; -import javax.xml.ws.Holder; import org.camunda.bpm.client.task.ExternalTask; import org.camunda.bpm.client.task.ExternalTaskService; import org.junit.Test; @@ -16,13 +13,10 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; -import org.onap.so.adapters.tasks.orchestration.RollbackService; import org.onap.so.adapters.vnf.MsoVnfAdapterImpl; import org.onap.so.adapters.vnf.VnfAdapterUtils; import org.onap.so.adapters.vnf.exceptions.VnfException; -import org.onap.so.entity.MsoRequest; import org.onap.so.logging.tasks.AuditMDCSetup; -import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.exceptions.MsoException; import org.onap.so.openstack.utils.MsoHeatUtils; import com.woorea.openstack.heat.model.Stack; @@ -73,14 +67,14 @@ public class RollbackServiceTest { Mockito.when(vnfAdapterUtils.isMulticloudMode(Mockito.any(), Mockito.any())).thenReturn(false); Mockito.when(mockExternalTask.getVariable("openstackAdapterTaskRequest")).thenReturn(payload); Mockito.doNothing().when(vnfAdapterImpl).deleteVfModule(Mockito.any(), Mockito.any(), Mockito.any(), - Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any()); + Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any()); Mockito.doNothing().when(mockExternalTaskService).complete(Mockito.any(), Mockito.any()); rollbackService.executeExternalTask(mockExternalTask, mockExternalTaskService); Mockito.verify(vnfAdapterImpl, Mockito.times(1)).deleteVfModule(Mockito.eq("regionOne"), Mockito.eq("CloudOwner"), Mockito.eq("0422ffb57ba042c0800a29dc85ca70f8"), Mockito.eq("dummy_id"), - Mockito.any(String.class), Mockito.any(String.class), Mockito.any(), Mockito.any(), Mockito.any()); + Mockito.any(String.class), Mockito.any(), Mockito.any()); Mockito.verify(mockExternalTaskService).complete(Mockito.eq(mockExternalTask), Mockito.any()); } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java index 7a00cfe145..77d1be5b2f 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java @@ -69,7 +69,7 @@ public class StackServiceTest { Mockito.doNothing().when(vnfAdapterImpl).createVfModule(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), - Mockito.any(), Mockito.any(), Mockito.any()); + Mockito.any()); Mockito.doNothing().when(mockExternalTaskService).complete(Mockito.any(), Mockito.any()); stackService.executeExternalTask(mockExternalTask, mockExternalTaskService); @@ -106,8 +106,7 @@ public class StackServiceTest { Mockito.eq("1.0"), Mockito.eq("6640feba-55f6-4946-9694-4d9558c8870a"), Mockito.eq("dummy_id"), Mockito.eq("985a468b-328b-4c2b-ad0e-b8f1e19501c4"), Mockito.eq(null), Mockito.eq(null), Mockito.eq(null), Mockito.eq("074c64d0-7e13-4bcc-8bdb-ea922331102d"), Mockito.eq(paramsMap), - Mockito.eq(false), Mockito.eq(false), Mockito.eq(null), Mockito.any(), Mockito.any(), Mockito.any(), - Mockito.any()); + Mockito.eq(false), Mockito.eq(false), Mockito.eq(null), Mockito.any(), Mockito.any()); Mockito.verify(mockExternalTaskService).complete(Mockito.eq(mockExternalTask), Mockito.eq(variables)); } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java deleted file mode 100644 index 883009216f..0000000000 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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.vnf; - -import static org.junit.Assert.assertEquals; -import javax.inject.Provider; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.boot.web.server.LocalServerPort; - -public class BpelRestClientTest extends BaseRestTestUtils { - - - @LocalServerPort - private int port; - @Autowired - private Provider<BpelRestClient> clientProvider; - - @Test - public void verifyPropertiesRead() { - BpelRestClient client = clientProvider.get(); - - assertEquals(5, client.getRetryCount()); - assertEquals(30, client.getConnectTimeout()); - assertEquals("test:test", client.getCredentials()); - assertEquals(30, client.getSocketTimeout()); - assertEquals("408, 429, 500, 502, 503, 504, 900", client.getRetryList()); - assertEquals(-15, client.getRetryInterval()); - - } - -} diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java deleted file mode 100644 index 92761c8453..0000000000 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java +++ /dev/null @@ -1,97 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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.vnf; - - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.containing; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess; -import java.util.HashMap; -import org.apache.http.HttpStatus; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.onap.so.entity.MsoRequest; -import org.springframework.beans.factory.annotation.Autowired; -import static org.junit.Assert.assertNotNull; - -public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils { - - @Autowired - MsoVnfAdapterAsyncImpl instance; - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - @Test - public void healthCheckVNFTest() { - instance.healthCheckA(); - } - - @Test - public void createVNFTest() throws Exception { - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - - mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetStackVfModule_200(wireMockServer); - wireMockServer.stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")) - .withRequestBody(containing("messageId")).willReturn(aResponse().withStatus(HttpStatus.SC_OK))); - - String vnfName = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"; - String notificationUrl = - "http://localhost:" + wireMockPort + "/notify/adapterNotify/updateVnfNotificationRequest"; - instance.createVnfA("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", - "volumeGroupHeatStackId|1", new HashMap<String, Object>(), Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, - "messageId", msoRequest, notificationUrl); - - wireMockServer.verify(1, postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest"))); - } - - @Test - public void createVNFTest_Exception() throws Exception { - String notificationUrl = - "http://localhost:" + wireMockPort + "/notify/adapterNotify/updateVnfNotificationRequest"; - instance.createVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", - "volumeGroupHeatStackId|1", new HashMap<String, Object>(), Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, - "messageId", null, notificationUrl); - - wireMockServer.verify(1, postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest"))); - - } - - @Test - public void deleteVnfTest() { - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - instance.deleteVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", "messageId", - msoRequest, "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest"); - assertNotNull(msoRequest); - } - -} 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 909a558cff..2b842d3f52 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 @@ -25,6 +25,7 @@ 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.patch; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static org.junit.Assert.assertNotNull; import static org.mockito.Mockito.when; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_404; @@ -57,7 +58,6 @@ import org.onap.so.openstack.utils.MsoHeatUtils; import org.springframework.beans.factory.annotation.Autowired; import com.github.tomakehurst.wiremock.WireMockServer; import com.github.tomakehurst.wiremock.stubbing.Scenario; -import static org.junit.Assert.assertNotNull; public class MsoVnfAdapterImplTest extends BaseRestTestUtils { @@ -85,8 +85,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { map.put("key1", "value1"); instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", null, null, "b4ea86b4-253f-11e7-93ae-92361f002671", map, Boolean.TRUE, Boolean.TRUE, - Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); + Boolean.FALSE, msoRequest, new Holder<>()); assertNotNull(map); } @@ -102,7 +101,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { map.put("key1", "value1"); instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", null, null, "b4ea86b4-253f-11e7-93ae-92361f002671", map, null, Boolean.TRUE, Boolean.FALSE, - msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + msoRequest, new Holder<>()); assertNotNull(map); } @@ -133,8 +132,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { map.put("key1", "value1"); instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", null, null, "b4ea86b4-253f-11e7-93ae-92361f002671", map, Boolean.FALSE, Boolean.TRUE, - Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); + Boolean.FALSE, msoRequest, new Holder<>()); assertNotNull(map); } @@ -151,8 +149,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { map.put("key1", "value1"); instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", null, null, "b4ea86b4-253f-11e7-93ae-92361f002671", map, Boolean.TRUE, Boolean.TRUE, - Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); + Boolean.FALSE, msoRequest, new Holder<>()); assertNotNull(map); } @@ -169,8 +166,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { map.put("key1", "value1"); instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), - new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>()); } @Test @@ -188,8 +184,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { map.put("key1", "value1"); instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), - new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>()); } @Test @@ -207,8 +202,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { map.put("key1", "value1"); instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), - new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>()); } @Test @@ -228,8 +222,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { map.put("key1", "value1"); instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), - new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>()); } @Test @@ -263,8 +256,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { map.put("key1", "value1"); instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), - new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>()); } @Test @@ -303,8 +295,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { map.put("key1", "value1"); instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "XVFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", null, map, Boolean.FALSE, Boolean.TRUE, - Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); + Boolean.FALSE, msoRequest, new Holder<>()); } @Test @@ -324,8 +315,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { map.put("key1", "value1"); instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), - new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>()); } private MsoRequest getMsoRequest() { @@ -499,9 +489,8 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { MsoVnfAdapterImpl instance = new MsoVnfAdapterImpl(); MsoRequest msoRequest = getMsoRequest(); try { - instance.deleteVfModule("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", - "5aae1e49-805c-4f9f-bd78-055bf7451157", "11420693-3f69-4c61-b3ee-9787c744e760", null, msoRequest, - new Holder<Map<String, String>>()); + instance.deleteVfModule("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", null, + msoRequest, new Holder<Map<String, String>>()); } catch (Exception e) { } |