summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/test
diff options
context:
space:
mode:
authorOfir Sonsino <os0695@att.com>2017-09-20 14:08:19 +0300
committerOfir Sonsino <os0695@att.com>2017-09-20 14:14:56 +0300
commit1ba64a4a45f26e8bdb58e866e540aa58f32e2e52 (patch)
treedac3ada662bb141fe986526d13b2436032e5012e /vid-app-common/src/test
parentcbdd17f586a4914890bd2b26ee91be135568f38c (diff)
Change management and PNF support
Issue-ID: VID-44, VID-48, VID-49, VID-50, VID-51, VID-52 Change-Id: I83e940aad2e4e294a0927b546c4c08ca8e539a65 Signed-off-by: Ofir Sonsino <os0695@att.com>
Diffstat (limited to 'vid-app-common/src/test')
-rw-r--r--vid-app-common/src/test/java/org/opencomp/vid/controller/MsoControllerTest.java112
-rw-r--r--vid-app-common/src/test/java/org/opencomp/vid/controller/VidControllerTest.java16
-rw-r--r--vid-app-common/src/test/java/org/openecomp/vid/services/ChangeManagementServiceTest.java29
-rw-r--r--vid-app-common/src/test/resources/WEB-INF/conf/system.properties24
-rw-r--r--vid-app-common/src/test/resources/WEB-INF/jsp/serviceModels.jsp10
-rw-r--r--vid-app-common/src/test/resources/WEB-INF/jsp/welcome.jsp5
-rw-r--r--vid-app-common/src/test/resources/mso.properties16
-rw-r--r--vid-app-common/src/test/resources/msoRequest.json25
8 files changed, 227 insertions, 10 deletions
diff --git a/vid-app-common/src/test/java/org/opencomp/vid/controller/MsoControllerTest.java b/vid-app-common/src/test/java/org/opencomp/vid/controller/MsoControllerTest.java
new file mode 100644
index 000000000..9333ac9b0
--- /dev/null
+++ b/vid-app-common/src/test/java/org/opencomp/vid/controller/MsoControllerTest.java
@@ -0,0 +1,112 @@
+package org.opencomp.vid.controller;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import org.apache.commons.lang.StringEscapeUtils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.vid.controller.MsoConfig;
+import org.openecomp.vid.controller.MsoController;
+import org.openecomp.vid.domain.mso.RequestInfo;
+import org.openecomp.vid.factories.MsoRequestFactory;
+import org.openecomp.vid.mso.rest.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@WebAppConfiguration
+@ContextConfiguration(classes = {SystemProperties.class , MsoConfig.class})
+public class MsoControllerTest {
+
+ @Autowired
+ MsoRequestFactory msoRequestFactory;
+
+ @Test
+ public void testInstanceCreationNew() throws Exception {
+
+ RequestDetails requestDetails = msoRequestFactory.createMsoRequest("msoRequest.json");
+ MsoController msoController = new MsoController();
+ ResponseEntity<String> responseEntityNew = msoController.createSvcInstanceNew(null, requestDetails);
+ ResponseEntity<String> responseEntity = msoController.createSvcInstance(null, requestDetails);
+ assertEquals(responseEntityNew, responseEntity);
+
+ }
+
+ @Test
+ public void testInstanceCreationLocalWithRest() throws Exception {
+
+ RequestDetails requestDetails = msoRequestFactory.createMsoRequest("msoRequest.json");
+ MsoController msoController = new MsoController();
+ ResponseEntity<String> responseEntityNew = msoController.createSvcInstance(null, requestDetails);
+ ResponseEntity<String> responseEntityRest = msoController.createSvcInstanceNewRest(null, requestDetails);
+
+ assertEquals(responseEntityNew.getBody(), responseEntityRest.getBody());
+
+ }
+
+ @Test
+ public void testInstanceCreation() throws Exception {
+
+ RequestDetails requestDetails = msoRequestFactory.createMsoRequest("msoRequest.json");
+ MsoController msoController = new MsoController();
+ ResponseEntity<String> responseEntity = msoController.createSvcInstance(null, requestDetails);
+
+
+ assertEquals(responseEntity.getBody(), "{ \"status\": 200, \"entity\": {\n" +
+ " \"requestReferences\": {\n" +
+ " \"instanceId\": \"ba00de9b-3c3e-4b0a-a1ad-0c5489e711fb\",\n" +
+ " \"requestId\": \"311cc766-b673-4a50-b9c5-471f68914586\"\n" +
+ " }\n" +
+ "}}");
+
+ }
+
+ @Test
+ public void testGetOrchestrationRequestsForDashboard() throws Exception{
+ MsoController msoController = new MsoController();
+ List<Request> orchestrationRequestsForDashboard = msoController.getOrchestrationRequestsForDashboard();
+
+ assertEquals(orchestrationRequestsForDashboard.size() , 2);
+ }
+
+ @Test
+ public void testGetManualTasksByRequestId() throws Exception{
+ MsoController msoController = new MsoController();
+ List<Task> orchestrationRequestsForDashboard = msoController.getManualTasksByRequestId("za1234d1-5a33-55df-13ab-12abad84e335");
+
+ assertEquals(orchestrationRequestsForDashboard.get(0).getTaskId() , "daf4dd84-b77a-42da-a051-3239b7a9392c");
+ }
+
+
+ public void testCompleteManualTask() throws Exception{ // TODO not done yet
+ RequestInfo requestInfo = new RequestInfo();
+ requestInfo.setResponseValue("rollback");
+ requestInfo.setRequestorId("abc");
+ requestInfo.setSource("VID");
+ RequestDetails requestDetails = new RequestDetails();
+ requestDetails.setRequestInfo(requestInfo);
+ MsoController msoController = new MsoController();
+ ResponseEntity<String> responseEntity = msoController.manualTaskComplete("daf4dd84-b77a-42da-a051-3239b7a9392c" , requestDetails);
+ String assertString = "{ \\\"status\\\": 200, \\\"entity\\\": {\\n\" +\n" +
+ " \" \\\"taskRequestReference\\\": {\\n\" +\n" +
+ " \" \\\"taskId\\\": \\\"daf4dd84-b77a-42da-a051-3239b7a9392c\\\"\\n\" +\n" +
+ " \" }\\n\" +\n" +
+ " \"}\\n\" +\n" +
+ " \"}";
+ assertEquals(responseEntity.getBody() , StringEscapeUtils.unescapeJava(assertString));
+ }
+
+
+
+
+
+}
diff --git a/vid-app-common/src/test/java/org/opencomp/vid/controller/VidControllerTest.java b/vid-app-common/src/test/java/org/opencomp/vid/controller/VidControllerTest.java
index abf44bf77..f89d9cba0 100644
--- a/vid-app-common/src/test/java/org/opencomp/vid/controller/VidControllerTest.java
+++ b/vid-app-common/src/test/java/org/opencomp/vid/controller/VidControllerTest.java
@@ -11,6 +11,8 @@ import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper;
import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory;
import org.openecomp.sdc.tosca.parser.impl.SdcTypes;
+import org.openecomp.vid.aai.AaiClient;
+import org.openecomp.vid.aai.AaiResponse;
import org.openecomp.vid.asdc.AsdcCatalogException;
import org.openecomp.vid.asdc.AsdcClient;
import org.openecomp.vid.asdc.parser.ToscaParserImpl2;
@@ -41,6 +43,7 @@ public class VidControllerTest {
@Autowired
private AsdcClient asdcClient;
+
@Autowired
ServletContext context;
public class Constants{
@@ -55,6 +58,19 @@ public class VidControllerTest {
private ToscaParserImpl2 p2 = new ToscaParserImpl2();
private ObjectMapper om = new ObjectMapper();
+
+ @Test
+ public void test() {
+ AaiClient client = new AaiClient(context);
+ AaiResponse<?> response = client.getVNFData();
+ try {
+ System.out.println(new ObjectMapper().writeValueAsString(response));
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
@Test
public void checkPNFFieldsExist() throws SdcToscaParserException {
String serviceRoleString = "serviceRole";
diff --git a/vid-app-common/src/test/java/org/openecomp/vid/services/ChangeManagementServiceTest.java b/vid-app-common/src/test/java/org/openecomp/vid/services/ChangeManagementServiceTest.java
new file mode 100644
index 000000000..f770ab2ab
--- /dev/null
+++ b/vid-app-common/src/test/java/org/openecomp/vid/services/ChangeManagementServiceTest.java
@@ -0,0 +1,29 @@
+package org.openecomp.vid.services;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.openecomp.vid.changeManagement.ChangeManagementRequest;
+import org.openecomp.vid.changeManagement.ChangeManagementResponse;
+import org.springframework.http.ResponseEntity;
+
+import junit.framework.Assert;
+
+import static org.junit.Assert.*;
+
+
+public class ChangeManagementServiceTest {
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void doChangeManagement_requestTypeIsUpdateVnfNotFound_doUpdateAndReturnNull() throws Exception {
+
+ }
+
+} \ No newline at end of file
diff --git a/vid-app-common/src/test/resources/WEB-INF/conf/system.properties b/vid-app-common/src/test/resources/WEB-INF/conf/system.properties
index 4fbbe7cf7..6ec60859d 100644
--- a/vid-app-common/src/test/resources/WEB-INF/conf/system.properties
+++ b/vid-app-common/src/test/resources/WEB-INF/conf/system.properties
@@ -79,7 +79,7 @@ element_map_icon_path = app/fusionapp/icons/
#aai.oldserver.url=https://mtanjv9aaas40.aic.cip.att.com:8443/aai/servers/v3/
#ist servers
aai.server.url.base=https://aai-ext1.test.att.com:8443/aai/
-aai.server.url=https://aai-ext1.test.att.com:8443/aai/v10/
+aai.server.url=https://aai-ext1.test.att.com:8443/aai/v11/
aai.oldserver.url.base=https://aai-ext1.test.att.com:8443/aai/servers/
aai.oldserver.url=https://aai-ext1.test.att.com:8443/aai/servers/v3/
aai.truststore.filename=tomcat_keystore
@@ -88,6 +88,7 @@ aai.keystore.filename=aai-client-cert.p12
aai.keystore.passwd.x=OBF:1i9a1u2a1unz1lr61wn51wn11lss1unz1u301i6o
aai.use.client.cert=true
aai.vnf.provstatus=PREPROV,NVTPROV,PROV,CAPPED
+aai_get_version_by_invariant_id="service-design-and-creation/models?depth=2&model-invariant-id="
#Cron Schedules have 6 required fields and 1 optional field:
# Seconds Minutes Hours Day-of-Month Month Day-of-Week Year
@@ -139,17 +140,24 @@ mso.polling.interval.msecs=10000
mso.max.polls=10
mso.user.name=infraportal
mso.password.x=OBF:1ghz1kfx1j1w1m7w1i271e8q1eas1hzj1m4i1iyy1kch1gdz
-mso.restapi.svc.instance=/serviceInstances/v4
-mso.restapi.vnf.instance=/serviceInstances/v4/<service_instance_id>/vnfs
-mso.restapi.network.instance=/serviceInstances/v4/<service_instance_id>/networks
-mso.restapi.vf.module.instance=/serviceInstances/v4/<service_instance_id>/vnfs/<vnf_instance_id>/vfModules
-mso.restapi.volume.group.instance=/serviceInstances/v4/<service_instance_id>/vnfs/<vnf_instance_id>/volumeGroups
-mso.restapi.get.orc.req=/orchestrationRequests/v4
-mso.restapi.get.orc.reqs=/orchestrationRequests/v4?
+mso.restapi.svc.instance=/serviceInstances/v5
+mso.restapi.vnf.instance=/serviceInstances/v5/<service_instance_id>/vnfs
+mso.restapi.network.instance=/serviceInstances/v5/<service_instance_id>/networks
+mso.restapi.vf.module.instance=/serviceInstances/v5/<service_instance_id>/vnfs/<vnf_instance_id>/vfModules
+mso.restapi.volume.group.instance=/serviceInstances/v5/<service_instance_id>/vnfs/<vnf_instance_id>/volumeGroups
+mso.restapi.get.orc.req=/orchestrationRequests/v5
+mso.restapi.get.orc.reqs=/orchestrationRequests/v5?
+mso.restapi.get.man.tasks=/tasks/v1
vid.truststore.filename=/opt/app/vid/etc/vid_keystore.jks
mso.dme2.client.timeout=30000
mso.dme2.client.read.timeout=120000
+scheduler.server.url=http://mtanjv9sdlg10.aic.cip.att.com:8989/scheduler
+scheduler.create.new.vnf.change.instance=/v1/ChangeManagement/schedules/
+scheduler.get.time.slots=/v1/ChangeManagement/schedules/
+scheduler.get.schedules=/v1/ChangeManagement/schedules/scheduleDetails/
+
+
#vid.truststore.filename=/Users/Oren/Downloads/vid_keystore2.jks
vid.truststore.passwd.x=OBF:1wgg1wfq1uus1uui1x131x0r1x1v1x1j1uvo1uve1wg81wfi
diff --git a/vid-app-common/src/test/resources/WEB-INF/jsp/serviceModels.jsp b/vid-app-common/src/test/resources/WEB-INF/jsp/serviceModels.jsp
index 3280bc65a..9fdf75d64 100644
--- a/vid-app-common/src/test/resources/WEB-INF/jsp/serviceModels.jsp
+++ b/vid-app-common/src/test/resources/WEB-INF/jsp/serviceModels.jsp
@@ -6,6 +6,7 @@
<link rel="stylesheet" type="text/css" href="app/vid/styles/instantiate.css" />
<link rel="stylesheet" type="text/css" href="app/vid/styles/vidTree.css" />
<link rel="stylesheet" type="text/css" href="app/vid/styles/dialogs.css" />
+<link rel="stylesheet" type="text/css" href="app/vid/external/bootstrap/css/bootstrap.min.css" />
<script>
@@ -18,13 +19,19 @@
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
+<script src="app/vid/external/multiselect/angular-bootstrap-multiselect.min.js"></script>
<script src="app/vid/scripts/angular-ui-tree.js"></script>
+<script src="app/vid/external/lodash/lodash.min.js"></script>
<script src="app/vid/scripts/constants/componentConstants.js"></script>
<script src="app/vid/scripts/constants/fieldConstants.js"></script>
<script src="app/vid/scripts/constants/vidConfiguration.js"></script>
<script src="app/vid/scripts/constants/parameterConstants.js"></script>
+<script src="app/vid/scripts/filters/change-managements-by-statuses.filter.js"></script>
+<script src="app/vid/scripts/filters/date.filter.js"></script>
+<script src="app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.controller.js"></script>
+<script src="app/vid/scripts/modals/new-change-management/new-change-management.controller.js"></script>
<script src="app/vid/scripts/controller/aaiSubscriberController.js"></script>
<script src="app/vid/scripts/controller/creationDialogController.js"></script>
<script src="app/vid/scripts/controller/deletionDialogController.js"></script>
@@ -35,6 +42,8 @@
<script src="app/vid/scripts/controller/ServiceModelController.js"></script>
<script src="app/vid/scripts/controller/previousVersionDialogController.js"></script>
<script src="app/vid/scripts/controller/previousVersionContoller.js"></script>
+<script src="app/vid/scripts/controller/change-management.controller.js"></script>
+
<script src="app/vid/scripts/directives/extensionsDirective.js"></script>
<script src="app/vid/scripts/directives/parameterBlockDirective.js"></script>
<script src="app/vid/scripts/directives/popupWindowDirective.js"></script>
@@ -51,6 +60,7 @@
<script src="app/vid/scripts/services/propertyService.js"></script>
<script src="app/vid/scripts/services/utilityService.js"></script>
<script src="app/vid/scripts/services/vnfService.js"></script>
+<script src="app/vid/scripts/services/change-management.service.js"></script>
<%@ page import="org.openecomp.vid.mso.*"%>
<%@ page import="org.openecomp.portalsdk.core.util.SystemProperties"%>
diff --git a/vid-app-common/src/test/resources/WEB-INF/jsp/welcome.jsp b/vid-app-common/src/test/resources/WEB-INF/jsp/welcome.jsp
index dcd996892..1396819c7 100644
--- a/vid-app-common/src/test/resources/WEB-INF/jsp/welcome.jsp
+++ b/vid-app-common/src/test/resources/WEB-INF/jsp/welcome.jsp
@@ -1,4 +1,5 @@
+<script src="app/vid/external/multiselect/angular-bootstrap-multiselect.min.js"></script>
<div>
<h1 class="heading1">AT&T Domain 2.0 Network</h1>
<br>
@@ -19,8 +20,8 @@
VID was originally developed for the October 2016 release by an integrated IT and Labs team, under the
direction of Steve Smokowski and Vivian Pressley.
<br><br>
- <h1 class="heading1"><a href="mailto:DL-VIDDeliveryTeam@att.com" target="_top">Contact Us</a></h1>
- <a href="mailto:DL-VIDDeliveryTeam@att.com" target="_top">Please click here to contact us.</a>
+ <h1 class="heading1"><a href="mailto:VID-Tier4@ist.att.com" target="_top">Contact Us</a></h1>
+ <a href="mailto:VID-Tier4@ist.att.com" target="_top">Please click here to contact us.</a>
diff --git a/vid-app-common/src/test/resources/mso.properties b/vid-app-common/src/test/resources/mso.properties
new file mode 100644
index 000000000..8f2bb01a9
--- /dev/null
+++ b/vid-app-common/src/test/resources/mso.properties
@@ -0,0 +1,16 @@
+mso.server.url=http://mtanjv9moah01-eth0.aic.cip.att.com:8080/ecomp/mso/infra
+mso.polling.interval.msecs=2000
+mso.max.polls=3
+mso.user.name=infraportal
+mso.password.x=OBF:1ghz1kfx1j1w1m7w1i271e8q1eas1hzj1m4i1iyy1kch1gdz
+mso.restapi.svc.instance=/serviceInstances/v3
+mso.restapi.vnf.instance=/serviceInstances/v3/<service_instance_id>/vnfs
+mso.restapi.network.instance=/serviceInstances/v3/<service_instance_id>/networks
+mso.restapi.vf.module.instance=/serviceInstances/v3/<service_instance_id>/vnfs/<vnf_instance_id>/vfModules
+mso.restapi.volume.group.instance=/serviceInstances/v3/<service_instance_id>/vnfs/<vnf_instance_id>/volumeGroups
+mso.restapi.get.orc.req=/orchestrationRequests/v3
+mso.restapi.get.orc.reqs=/orchestrationRequests/v3?
+mso.restapi.get.man.tasks=/tasks/v1
+mso.dme2.client.timeout=30000
+mso.dme2.client.read.timeout=120000
+mso.dme2.server.url=http://mso-api-handler-anap-v1.mso.ecomp.att.com/services/ecomp/mso?version=1607&envContext=TEST&routeOffer=st_mtsnj \ No newline at end of file
diff --git a/vid-app-common/src/test/resources/msoRequest.json b/vid-app-common/src/test/resources/msoRequest.json
new file mode 100644
index 000000000..c9397f809
--- /dev/null
+++ b/vid-app-common/src/test/resources/msoRequest.json
@@ -0,0 +1,25 @@
+{
+ "requestDetails": {
+ "requestInfo": {
+ "instanceName": "KLKLKL",
+ "source": "VID",
+ "suppressRollback": false,
+ "requestorId": "1"
+ },
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "709d1be4-9a3f-4a29-8c4d-a20465e808a3",
+ "modelVersionId": "1de57bcf-365a-4ba7-8a51-7377b7144586",
+ "modelName": "1707vidnf",
+ "modelVersion": "2.0"
+ },
+ "requestParameters": {
+ "userParams": [],
+ "subscriptionServiceType": "HNGATEWAY",
+ "aLaCarte": true
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "21014aa2-9e71128cae7-jl319x"
+ }
+ }
+} \ No newline at end of file