aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-03-14 02:07:32 -0400
committerRob Daugherty <rd472p@att.com>2018-03-14 04:08:41 -0400
commit38f720752af4d4aad8c4e467a288d9048659f688 (patch)
treee81066a8b5c77272e30fb57a64999573c4db4d86 /bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client
parentaee3d223f92a6f250f43e17558a2dfd576ff7294 (diff)
AT&T 1712 and 1802 release code
This is code from AT&T's 1712 and 1802 releases. Change-Id: Ie1e85851e94bc66c4d9514a0226c221939531a04 Issue-ID: SO-425 Signed-off-by: Rob Daugherty <rd472p@att.com>
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client')
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIPServerTest.java65
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIValidatorTest.java99
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClientTest.java146
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/RequestsDbAdapterClientTest.java (renamed from bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/EntitiesTest.java)51
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClientTest.java156
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerClientTest.java93
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestratorTest.java73
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerSupportTest.java97
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sndc/SDNCOrchTest.java82
9 files changed, 585 insertions, 277 deletions
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIPServerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIPServerTest.java
deleted file mode 100644
index bee0a828ea..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIPServerTest.java
+++ /dev/null
@@ -1,65 +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.openecomp.mso.client.aai;
-
-import java.io.File;
-import java.io.IOException;
-import java.security.NoSuchAlgorithmException;
-import java.util.List;
-import java.util.UUID;
-
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.onap.aai.domain.yang.Pserver;
-import static org.junit.Assert.assertEquals;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-public class AAIPServerTest {
-
- @BeforeClass
- public static void setUp() {
- System.setProperty("mso.config.path", "src/test/resources");
- System.setProperty("javax.net.ssl.keyStore", "C:/etc/ecomp/mso/config/msoClientKeyStore.jks");
- System.setProperty("javax.net.ssl.keyStorePassword", "mso4you");
- System.setProperty("javax.net.ssl.trustStore", "C:/etc/ecomp/mso/config/msoTrustStore.jks");
- System.setProperty("javax.net.ssl.trustStorePassword", "mso_Domain2.0_4you");
- }
-
- @Test
- @Ignore // IGNORED FOR 1710 MERGE TO ONAP
- public void pserverTest() throws JsonParseException, JsonMappingException, IOException, NoSuchAlgorithmException {
- AAIRestClientImpl client = new AAIRestClientImpl();
- File file = new File("src/test/resources/__files/AAI/pserver.json");
- List<Pserver> list = client.getListOfPservers(file);
-
- assertEquals("", list.get(0).getHostname(), "test");
- }
-
- @Test
- @Ignore // IGNORED FOR 1710 MERGE TO ONAP
- public void pserverActualTest() throws JsonParseException, JsonMappingException, IOException, NoSuchAlgorithmException {
- AAIRestClientImpl client = new AAIRestClientImpl();
- List<Pserver> list = client.getPhysicalServerByVnfId("d946afed-8ebe-4c5d-9665-54fcc043b8e7", UUID.randomUUID().toString());
- assertEquals("", list.size(), 0);
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIValidatorTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIValidatorTest.java
deleted file mode 100644
index 2272f31685..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIValidatorTest.java
+++ /dev/null
@@ -1,99 +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.openecomp.mso.client.aai;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.when;
-
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.onap.aai.domain.yang.GenericVnf;
-import org.onap.aai.domain.yang.Pserver;
-
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-
-@RunWith(MockitoJUnitRunner.class)
-public class AAIValidatorTest {
-
- @Mock
- protected AAIRestClient client;
- String vnfName = "testVnf";
- String uuid = "UUID";
- AAIValidatorImpl validator;
-
- @Before
- public void init(){
- validator = new AAIValidatorImpl();
- validator.setClient(client);
- }
-
- public List<Pserver> getPservers(boolean locked){
- Pserver pserver = new Pserver();
- pserver.setInMaint(locked);
- List<Pserver> pservers = new ArrayList<Pserver>();
- pservers.add(pserver);
- return pservers;
- }
-
- public GenericVnf createGenericVnfs(boolean locked){
- GenericVnf genericVnf = new GenericVnf();
- genericVnf.setInMaint(locked);
-
- return genericVnf;
- }
-
- @Test
- public void test_IsPhysicalServerLocked_True() throws IOException{
- when(client.getPhysicalServerByVnfId(vnfName,uuid)).thenReturn(getPservers(true));
- boolean locked = validator.isPhysicalServerLocked(vnfName, uuid);
- assertEquals(true, locked);
- }
-
- @Test
- public void test_IsPhysicalServerLocked_False() throws JsonParseException, JsonMappingException, UnsupportedEncodingException, IOException {
- when(client.getPhysicalServerByVnfId(vnfName,uuid)).thenReturn(getPservers(false));
- boolean locked = validator.isPhysicalServerLocked(vnfName, uuid);
- assertEquals(false, locked);
- }
-
- @Test
- public void test_IsVNFLocked_False() throws Exception{
- when(client.getVnfByName(vnfName,uuid)).thenReturn(createGenericVnfs(false));
- boolean locked = validator.isVNFLocked(vnfName, uuid);
- assertEquals(false, locked);
- }
-
- @Test
- public void test_IsVNFLocked_True() throws Exception{
- when(client.getVnfByName(vnfName,uuid)).thenReturn(createGenericVnfs(true));
- boolean locked = validator.isVNFLocked(vnfName, uuid);
- assertEquals(true,locked );
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClientTest.java
new file mode 100644
index 0000000000..0584bea012
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClientTest.java
@@ -0,0 +1,146 @@
+/*-
+ * ============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.openecomp.mso.client.adapter.network;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
+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.put;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.openecomp.mso.adapters.nwrest.CreateNetworkRequest;
+import org.openecomp.mso.adapters.nwrest.CreateNetworkResponse;
+import org.openecomp.mso.adapters.nwrest.DeleteNetworkRequest;
+import org.openecomp.mso.adapters.nwrest.DeleteNetworkResponse;
+import org.openecomp.mso.adapters.nwrest.QueryNetworkResponse;
+import org.openecomp.mso.adapters.nwrest.RollbackNetworkRequest;
+import org.openecomp.mso.adapters.nwrest.RollbackNetworkResponse;
+import org.openecomp.mso.adapters.nwrest.UpdateNetworkRequest;
+import org.openecomp.mso.adapters.nwrest.UpdateNetworkResponse;
+import org.openecomp.mso.openstack.beans.NetworkRollback;
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule;
+
+public class NetworkAdapterClientTest {
+
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(28090));
+
+ private static final String TESTING_ID = "___TESTING___";
+ private static final String AAI_NETWORK_ID = "test";
+ private static final String REST_ENDPOINT = "/networks/rest/v1/networks";
+
+ private NetworkAdapterClientImpl client = new NetworkAdapterClientImpl();
+
+ @BeforeClass
+ public static void setUp() {
+ System.setProperty("mso.config.path", "src/test/resources");
+ }
+
+ @Test
+ public void createNetworkTest() {
+ CreateNetworkRequest request = new CreateNetworkRequest();
+ request.setCloudSiteId(TESTING_ID);
+
+ CreateNetworkResponse mockResponse = new CreateNetworkResponse();
+ mockResponse.setNetworkCreated(true);
+ wireMockRule.stubFor(post(urlPathEqualTo(REST_ENDPOINT)).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withBody(mockResponse.toJsonString()).withStatus(200)));
+
+ CreateNetworkResponse response = client.createNetwork(request);
+ assertEquals("Testing CreateVfModule response", true, response.getNetworkCreated());
+ }
+
+ @Test
+ public void deleteNetworkTest() {
+ DeleteNetworkRequest request = new DeleteNetworkRequest();
+ request.setCloudSiteId(TESTING_ID);
+
+ DeleteNetworkResponse mockResponse = new DeleteNetworkResponse();
+ mockResponse.setNetworkDeleted(true);
+
+ wireMockRule.stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withBody(mockResponse.toJsonString()).withStatus(200)));
+
+ DeleteNetworkResponse response = client.deleteNetwork(AAI_NETWORK_ID, request);
+ assertEquals("Testing DeleteVfModule response", true, response.getNetworkDeleted());
+ }
+
+ @Test
+ public void rollbackNetworkTest() {
+ RollbackNetworkRequest request = new RollbackNetworkRequest();
+ NetworkRollback rollback = new NetworkRollback();
+ rollback.setCloudId(TESTING_ID);
+ request.setNetworkRollback(rollback);
+
+ RollbackNetworkResponse mockResponse = new RollbackNetworkResponse();
+ mockResponse.setNetworkRolledBack(true);
+
+ wireMockRule.stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withBody(mockResponse.toJsonString()).withStatus(200)));
+
+ RollbackNetworkResponse response = client.rollbackNetwork(AAI_NETWORK_ID, request);
+ assertEquals("Testing DeleteVfModule response", true, response.getNetworkRolledBack());
+ }
+
+ @Test
+ public void queryNetworkTest() {
+ QueryNetworkResponse mockResponse = new QueryNetworkResponse();
+ mockResponse.setNetworkExists(true);
+
+ wireMockRule.stubFor(get(urlPathEqualTo(REST_ENDPOINT))
+ .withQueryParam("cloudSiteId", equalTo(TESTING_ID))
+ .withQueryParam("tenantId", equalTo(TESTING_ID))
+ .withQueryParam("networkStackId", equalTo("networkStackId"))
+ .withQueryParam("skipAAI", equalTo("true"))
+ .withQueryParam("msoRequest.requestId", equalTo("testRequestId"))
+ .withQueryParam("msoRequest.serviceInstanceId", equalTo("serviceInstanceId"))
+ .willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withBody(mockResponse.toJsonString()).withStatus(200)));
+
+ QueryNetworkResponse response = client.queryNetwork(AAI_NETWORK_ID, TESTING_ID, TESTING_ID,
+ "networkStackId", true, "testRequestId", "serviceInstanceId");
+ assertEquals("Testing QueryVfModule response", true, response.getNetworkExists());
+ }
+
+ @Ignore
+ @Test
+ public void updateNetworkTest() {
+ UpdateNetworkRequest request = new UpdateNetworkRequest();
+ request.setCloudSiteId(TESTING_ID);
+ request.setNetworkId("test1");
+
+ UpdateNetworkResponse mockResponse = new UpdateNetworkResponse();
+ mockResponse.setNetworkId("test1");
+ wireMockRule.stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withBody(mockResponse.toJsonString()).withStatus(200)));
+
+ UpdateNetworkResponse response = client.updateNetwork(AAI_NETWORK_ID, request);
+ assertEquals("Testing UpdateVfModule response", "test1", response.getNetworkId());
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/EntitiesTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/RequestsDbAdapterClientTest.java
index 09c2ab5c30..2c35151895 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/EntitiesTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/requests/db/RequestsDbAdapterClientTest.java
@@ -18,24 +18,33 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
-
-import org.junit.Test;
-import com.openpojo.validation.Validator;
-import com.openpojo.validation.ValidatorBuilder;
-import com.openpojo.validation.rule.impl.GetterMustExistRule;
-import com.openpojo.validation.rule.impl.SetterMustExistRule;
-import com.openpojo.validation.test.impl.GetterTester;
-import com.openpojo.validation.test.impl.SetterTester;
-
-public class EntitiesTest {
-
- private String packageName = "org.openecomp.mso.client.aai.entities";
-
- @Test
- public void validate() {
- Validator validator = ValidatorBuilder.create().with(new SetterMustExistRule(), new GetterMustExistRule())
- .with(new SetterTester(), new GetterTester()).build();
- validator.validate(packageName);
- }
-}
+package org.openecomp.mso.client.adapter.requests.db;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class RequestsDbAdapterClientTest {
+
+ @BeforeClass
+ public static void setUp() {
+ System.setProperty("mso.config.path", "src/test/resources");
+ }
+
+ @Test
+ public void updateInfraRequestTest()
+ {
+
+ }
+
+ @Test
+ public void getInfraRequestTest()
+ {
+
+ }
+
+ @Test
+ public void getSiteStatusTest()
+ {
+
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClientTest.java
new file mode 100644
index 0000000000..21448256ed
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClientTest.java
@@ -0,0 +1,156 @@
+/*-
+ * ============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.openecomp.mso.client.adapter.vnf;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
+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.put;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.openecomp.mso.adapters.vnfrest.CreateVfModuleRequest;
+import org.openecomp.mso.adapters.vnfrest.CreateVfModuleResponse;
+import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleRequest;
+import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleResponse;
+import org.openecomp.mso.adapters.vnfrest.QueryVfModuleResponse;
+import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleRequest;
+import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleResponse;
+import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleRequest;
+import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleResponse;
+import org.openecomp.mso.adapters.vnfrest.VfModuleRollback;
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule;
+
+public class VnfAdapterClientTest {
+
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(28090));
+
+ private static final String TESTING_ID = "___TESTING___";
+ private static final String AAI_VNF_ID = "test";
+ private static final String AAI_VF_MODULE_ID = "test";
+ private static final String REST_ENDPOINT = "/vnfs/rest/v1/vnfs";
+
+ private VnfAdapterClientImpl client = new VnfAdapterClientImpl();
+
+ @BeforeClass
+ public static void setUp() {
+ System.setProperty("mso.config.path", "src/test/resources");
+ }
+
+ @Test
+ public void createVfModuleTest() {
+ CreateVfModuleRequest request = new CreateVfModuleRequest();
+ request.setCloudSiteId(TESTING_ID);
+
+ CreateVfModuleResponse mockResponse = new CreateVfModuleResponse();
+ mockResponse.setVfModuleCreated(true);
+ wireMockRule.stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mockResponse.toJsonString()).withStatus(200)));
+
+ CreateVfModuleResponse response = client.createVfModule(AAI_VNF_ID, request);
+ assertEquals("Testing CreateVfModule response", true, response.getVfModuleCreated());
+ }
+
+ @Test
+ public void rollbackVfModuleTest() {
+ RollbackVfModuleRequest request = new RollbackVfModuleRequest();
+ VfModuleRollback rollback = new VfModuleRollback();
+ rollback.setCloudSiteId(TESTING_ID);
+ request.setVfModuleRollback(rollback);
+
+ RollbackVfModuleResponse mockResponse = new RollbackVfModuleResponse();
+ mockResponse.setVfModuleRolledback(true);
+ wireMockRule.stubFor(
+ put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID + "/rollback"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mockResponse.toJsonString()).withStatus(200)));
+
+ RollbackVfModuleResponse response = client.rollbackVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request);
+ assertEquals("Testing RollbackVfModule response", true, response.getVfModuleRolledback());
+ }
+
+ @Test
+ public void deleteVfModuleTest() {
+ DeleteVfModuleRequest request = new DeleteVfModuleRequest();
+ request.setCloudSiteId(TESTING_ID);
+
+ DeleteVfModuleResponse mockResponse = new DeleteVfModuleResponse();
+ mockResponse.setVfModuleDeleted(true);
+ wireMockRule.stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mockResponse.toJsonString()).withStatus(200)));
+
+ DeleteVfModuleResponse response = client.deleteVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request);
+ assertEquals("Testing DeleteVfModule response", true, response.getVfModuleDeleted());
+ }
+
+ @Test
+ public void updateVfModuleTest() {
+ UpdateVfModuleRequest request = new UpdateVfModuleRequest();
+ request.setCloudSiteId(TESTING_ID);
+ request.setVfModuleId("test1");
+
+ UpdateVfModuleResponse mockResponse = new UpdateVfModuleResponse();
+ mockResponse.setVfModuleId("test1");
+ wireMockRule.stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mockResponse.toJsonString()).withStatus(200)));
+
+ UpdateVfModuleResponse response = client.updateVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request);
+ assertEquals("Testing UpdateVfModule response", "test1", response.getVfModuleId());
+ }
+
+ @Test
+ public void queryVfModuleTest() {
+ QueryVfModuleResponse mockResponse = new QueryVfModuleResponse();
+ mockResponse.setVnfId(AAI_VNF_ID);
+ mockResponse.setVfModuleId(AAI_VF_MODULE_ID);
+ wireMockRule.stubFor(get(urlPathEqualTo(REST_ENDPOINT))
+ .withQueryParam("cloudSiteId", equalTo(TESTING_ID))
+ .withQueryParam("tenantId", equalTo(TESTING_ID))
+ .withQueryParam("vfModuleName", equalTo("someName"))
+ .withQueryParam("skipAAI", equalTo("true"))
+ .withQueryParam("msoRequest.requestId", equalTo("testRequestId"))
+ .withQueryParam("msoRequest.serviceInstanceId", equalTo("serviceInstanceId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(mockResponse.toJsonString()).withStatus(200)));
+ QueryVfModuleResponse response = client.queryVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, TESTING_ID, TESTING_ID,
+ "someName", true, "testRequestId", "serviceInstanceId");
+ assertEquals("Testing QueryVfModule response", AAI_VF_MODULE_ID, response.getVfModuleId());
+ }
+
+ @Test
+ public void healthCheckTest() {
+ wireMockRule.stubFor(get(urlPathEqualTo("/vnfs/rest/v1/vnfs")).willReturn(
+ aResponse().withHeader("Content-Type", "text/plain").withBody("healthCheck").withStatus(200)));
+
+ String healthCheck = client.healthCheck();
+ assertEquals("HealthCheck is correct", "healthCheck", healthCheck);
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerClientTest.java
index 2b082f1b8d..7fe32880c6 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerClientTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerClientTest.java
@@ -25,74 +25,79 @@ import static org.junit.Assert.assertEquals;
import java.util.Properties;
import java.util.UUID;
-import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
-import org.openecomp.appc.client.lcm.model.Action;
-import org.openecomp.appc.client.lcm.model.ActionIdentifiers;
-import org.openecomp.appc.client.lcm.model.CheckLockInput;
-import org.openecomp.appc.client.lcm.model.Flags;
-import org.openecomp.appc.client.lcm.model.Status;
+import org.onap.appc.client.lcm.model.Action;
+import org.onap.appc.client.lcm.model.ActionIdentifiers;
+import org.onap.appc.client.lcm.model.CheckLockInput;
+import org.onap.appc.client.lcm.model.Status;
public class ApplicationControllerClientTest {
- private static ApplicationControllerClient client;
- private static ApplicationControllerSupport support;
-
@BeforeClass
public static void beforeClass() {
- client = new ApplicationControllerClient();
- support = new ApplicationControllerSupport();
- client.appCSupport = support;
System.setProperty("mso.config.path", "src/test/resources");
-
- }
-
- @AfterClass
- public static void afterClass() throws Exception {
- client.shutdownclient();
}
@Test
- @Ignore // IGNORED FOR 1710 MERGE TO ONAP
- public void createRequest_CheckLock_RequestBuilt() throws Exception {
-
- org.springframework.test.util.ReflectionTestUtils.setField(support, "lcmModelPackage",
- "org.openecomp.appc.client.lcm.model");
- Flags flags = new Flags();
+ public void createRequest_CheckLock_RequestBuilt() {
+ ApplicationControllerClient client = new ApplicationControllerClient();
ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
actionIdentifiers.setVnfId("vnfId");
- CheckLockInput checkLockInput = (CheckLockInput) client.createRequest(Action.CheckLock, actionIdentifiers,
- flags, null, "requestId");
+ CheckLockInput checkLockInput = (CheckLockInput) client.createRequest(Action.CheckLock, actionIdentifiers, null,
+ "requestId");
assertEquals(checkLockInput.getAction().name(), "CheckLock");
}
@Test
- @Ignore // IGNORED FOR 1710 MERGE TO ONAP
- public void runCommand_liveAppc() throws Exception {
- org.springframework.test.util.ReflectionTestUtils.setField(support, "lcmModelPackage",
- "org.openecomp.appc.client.lcm.model");
- Flags flags = new Flags();
+ @Ignore // 1802 merge
+ public void runCommand_liveAppc() {
+ ApplicationControllerClient client = new ApplicationControllerClient();
ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
- actionIdentifiers.setVnfId("ca522254-2ba4-4fbd-b15b-0ef0d9cfda5f");
-
- // CheckLockInput checkLockInput = (CheckLockInput)
- // client.createRequest(Action.CheckLock,actionIdentifiers,flags,null,"requestId");
- Status status = client.runCommand(Action.Lock, actionIdentifiers, flags, null, UUID.randomUUID().toString());
+ //actionIdentifiers.setVnfId("ca522254-2ba4-4fbd-b15b-0ef0d9cfda5f");
+ actionIdentifiers.setVnfId("2d2bf10e-81a5-");
+ Status status;
+ try {
+ status = client.runCommand(Action.Lock, actionIdentifiers, null, UUID.randomUUID().toString());
+ } catch (ApplicationControllerOrchestratorException e) {
+ status = new Status();
+ status.setCode(e.getAppcCode());
+ status.setMessage(e.getMessage());
+ }
assertEquals("Status of run command is correct", status.getCode(), 306);
}
@Test
- @Ignore // IGNORED FOR 1710 MERGE TO ONAP
- public void runCommand_CheckLock_RequestBuilt() throws Exception {
- org.springframework.test.util.ReflectionTestUtils.setField(support, "lcmModelPackage",
- "org.openecomp.appc.client.lcm.model");
- Flags flags = new Flags();
+ @Ignore // 1802 merge
+ public void runCommand_CheckLock_RequestBuilt() {
+ ApplicationControllerClient client = new ApplicationControllerClient();
ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
actionIdentifiers.setVnfId("fusion-vpp-vnf-001");
- Status status = client.runCommand(Action.CheckLock, actionIdentifiers, flags, null, "requestId");
- assertEquals("Status of run command is correct", status.getCode(), 400);
+ Status status;
+ try {
+ status = client.runCommand(Action.Unlock, actionIdentifiers, null, "requestId");
+ } catch (ApplicationControllerOrchestratorException e) {
+ status = new Status();
+ status.setCode(e.getAppcCode());
+ status.setMessage(e.getMessage());
+ }
+ assertEquals("Status of run command is correct", status.getCode(), 309);
}
-}
+
+ @Test
+ public void test_getLCMPropertiesHelper() {
+ ApplicationControllerClient client = new ApplicationControllerClient();
+ Properties properties = client.getLCMProperties();
+ assertEquals(properties.get("topic.write"), "APPC-TEST-AMDOCS1-DEV3");
+ assertEquals(properties.get("topic.read.timeout"), "120000");
+ assertEquals(properties.get("client.response.timeout"), "120000");
+ assertEquals(properties.get("topic.read"), "APPC-TEST-AMDOCS2");
+ assertEquals(properties.get("poolMembers"),
+ "uebsb93kcdc.it.att.com:3904,uebsb92kcdc.it.att.com:3904,uebsb91kcdc.it.att.com:3904");
+ assertEquals(properties.get("client.key"), "iaEMAfjsVsZnraBP");
+ assertEquals(properties.get("client.secret"), "wcivUjsjXzmGFBfxMmyJu9dz");
+ }
+
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestratorTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestratorTest.java
new file mode 100644
index 0000000000..bd026d0b6d
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestratorTest.java
@@ -0,0 +1,73 @@
+/*-
+ * ============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.openecomp.mso.client.appc;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Optional;
+import java.util.UUID;
+
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import org.onap.appc.client.lcm.model.Action;
+import org.onap.appc.client.lcm.model.Status;
+
+public class ApplicationControllerOrchestratorTest {
+
+ @BeforeClass
+ public static void beforeClass() {
+ System.setProperty("mso.config.path", "src/test/resources");
+ }
+
+ @Test
+ @Ignore
+ public void vnfCommandTest() {
+ ApplicationControllerOrchestrator client = new ApplicationControllerOrchestrator();
+ Status status;
+ try {
+ status = client.vnfCommand(Action.Lock, UUID.randomUUID().toString(),
+ "3ffdee3c-94d2-45fe-904d-fc1efa0f8b59", Optional.of(""));
+ } catch (ApplicationControllerOrchestratorException e) {
+ status = new Status();
+ status.setCode(e.getAppcCode());
+ status.setMessage(e.getMessage());
+ }
+ assertEquals("Status of vnfCommand is correct", status.getCode(), 306);
+ }
+
+ @Test
+ @Ignore
+ public void vnfCommandTest1() {
+ ApplicationControllerOrchestrator client = new ApplicationControllerOrchestrator();
+ Status status;
+ try {
+ status = client.vnfCommand(Action.Unlock, UUID.randomUUID().toString(),
+ "ca522254-2ba4-4fbd-b15b-0ef0d9cfda5f", Optional.of(""));
+ } catch (ApplicationControllerOrchestratorException e) {
+ status = new Status();
+ status.setCode(e.getAppcCode());
+ status.setMessage(e.getMessage());
+ }
+ assertEquals("Status of vnfCommand is correct", status.getCode(), 306);
+ }
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerSupportTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerSupportTest.java
index 0a323e43d8..d2d4f5002a 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerSupportTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerSupportTest.java
@@ -22,62 +22,63 @@ package org.openecomp.mso.client.appc;
import static org.assertj.core.api.Assertions.assertThat;
-import junitparams.JUnitParamsRunner;
-import junitparams.Parameters;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.openecomp.appc.client.lcm.model.Status;
+import org.onap.appc.client.lcm.model.Status;
import org.openecomp.mso.client.appc.ApplicationControllerSupport.StatusCategory;
+import junitparams.JUnitParamsRunner;
+import junitparams.Parameters;
+
@RunWith(JUnitParamsRunner.class)
public class ApplicationControllerSupportTest {
- public static Object[][] statusesAndCategories() {
- return new Object[][]{
- {100, StatusCategory.NORMAL},
- {200, StatusCategory.ERROR},
- {300, StatusCategory.ERROR},
- {400, StatusCategory.NORMAL},
- {401, StatusCategory.ERROR},
- {500, StatusCategory.NORMAL},
- {501, StatusCategory.ERROR},
- {502, StatusCategory.WARNING},
- {800, StatusCategory.WARNING},
- };
- }
+ public static Object[][] statusesAndCategories() {
+ return new Object[][]{
+ {100, StatusCategory.NORMAL},
+ {200, StatusCategory.ERROR},
+ {300, StatusCategory.ERROR},
+ {400, StatusCategory.NORMAL},
+ {401, StatusCategory.ERROR},
+ {500, StatusCategory.NORMAL},
+ {501, StatusCategory.ERROR},
+ {502, StatusCategory.WARNING},
+ {800, StatusCategory.WARNING},
+ };
+ }
- public static Object[][] statusesAndFinalities() {
- return new Object[][]{
- {100, false},
- {200, true},
- {300, true},
- {400, true},
- {500, false},
- {800, true},
- };
- }
+ public static Object[][] statusesAndFinalities() {
+ return new Object[][]{
+ {100, false},
+ {200, true},
+ {300, true},
+ {400, true},
+ {500, false},
+ {800, true},
+ };
+ }
- @Test
- @Parameters(method = "statusesAndCategories")
- public void shouldReturnCategoryForCode(int code, StatusCategory category) throws Exception {
- // when
- StatusCategory detectedCategory = ApplicationControllerSupport.getCategoryOf(createStatus(code));
- // then
- assertThat(detectedCategory).isEqualTo(category);
- }
+ @Test
+ @Parameters(method = "statusesAndCategories")
+ public void shouldReturnCategoryForCode(int code, StatusCategory category) throws Exception {
+ // when
+ StatusCategory detectedCategory = ApplicationControllerSupport.getCategoryOf(createStatus(code));
+ // then
+ assertThat(detectedCategory).isEqualTo(category);
+ }
- @Test
- @Parameters(method = "statusesAndFinalities")
- public void shouldReturnFinalityForCode(int code, boolean expectedFinality) throws Exception {
- // when
- boolean finality = ApplicationControllerSupport.getFinalityOf(createStatus(code));
- // then
- assertThat(finality).isEqualTo(expectedFinality);
- }
+ @Test
+ @Parameters(method = "statusesAndFinalities")
+ public void shouldReturnFinalityForCode(int code, boolean expectedFinality) throws Exception {
+ // when
+ boolean finality = ApplicationControllerSupport.getFinalityOf(createStatus(code));
+ // then
+ assertThat(finality).isEqualTo(expectedFinality);
+ }
- private Status createStatus(int code) {
- Status status = new Status();
- status.setCode(code);
- return status;
- }
-} \ No newline at end of file
+ private Status createStatus(int code) {
+ Status status = new Status();
+ status.setCode(code);
+ return status;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sndc/SDNCOrchTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sndc/SDNCOrchTest.java
new file mode 100644
index 0000000000..724ae4a90d
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sndc/SDNCOrchTest.java
@@ -0,0 +1,82 @@
+/*-
+ * ============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.openecomp.mso.client.sndc;
+
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.openecomp.mso.bpmn.core.domain.Customer;
+import org.openecomp.mso.bpmn.core.domain.ModelInfo;
+import org.openecomp.mso.bpmn.core.domain.Request;
+import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
+import org.openecomp.mso.bpmn.core.domain.ServiceInstance;
+import org.openecomp.mso.bpmn.core.json.JsonDecomposingException;
+import org.openecomp.mso.client.orchestration.SDNCOrchestrator;
+import org.openecomp.mso.client.sdnc.sync.SDNCSyncRpcClient;
+
+public class SDNCOrchTest {
+
+ @BeforeClass
+ public static void setup() {
+ System.setProperty("mso.config.path", "src/test/resources/");
+ }
+
+ @Ignore // 1802 merge
+ @Test
+ public void run () throws JsonDecomposingException {
+ ServiceDecomposition serviceDecomp = new ServiceDecomposition ("{\"serviceResources\":{}}","123");
+
+ ServiceInstance servInst = new ServiceInstance();
+ servInst.setInstanceId("RaaTest-1-id");
+ servInst.setServiceType("");
+ servInst.setInstanceName("some-junk-name");
+ servInst.setServiceId("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+
+ ModelInfo model = new ModelInfo();
+ model.setModelInvariantUuid("uuid-miu-svc-011-abcdef");
+ model.setModelName("SIModelName1");
+ model.setModelUuid("");
+ model.setModelVersion("2");
+
+ Request req = new Request();
+ req.setRequestId("RaaCSIRequestId-1");
+ req.setSdncRequestId("c0c5e8bf-d5c4-4d81-b2a9-78832c2c789e");
+ req.setModelInfo(model);
+
+ Customer cust = new Customer();
+ cust.setGlobalSubscriberId("MCBH-1610");
+ cust.setSubscriptionServiceType("viprsvc");
+
+ serviceDecomp.setCustomer(cust);
+ serviceDecomp.setRequest(req);
+ serviceDecomp.setCallbackURN("http://localhost:28080/mso/SDNCAdapterCallbackService");
+ serviceDecomp.setServiceInstance(servInst);
+
+ SDNCOrchestrator sdncO = new SDNCOrchestrator();
+ sdncO.createServiceInstance(serviceDecomp);
+ }
+
+ @Test
+ public void runValidateSdncResponse () {
+ SDNCSyncRpcClient client = new SDNCSyncRpcClient(null, null);
+ client.validateSDNCResponse("{\"v1:RequestData\": {\"output\": {\"svc-request-id\": \"0ca5bf8f-c944-4318-810b-6ddfbec13cc5\",\"response-code\": \"200\",\"response-message\": \"a\"}}}");
+ }
+}