1 package org.onap.vid.controllers;
3 import java.util.Collection;
5 import javax.servlet.http.HttpServletRequest;
7 import org.codehaus.jackson.map.ObjectMapper;
8 import org.json.simple.JSONArray;
10 import org.onap.vid.changeManagement.ChangeManagementRequest;
11 import org.onap.vid.changeManagement.GetVnfWorkflowRelationRequest;
12 import org.onap.vid.changeManagement.VnfWorkflowRelationRequest;
13 import org.onap.vid.mso.MsoResponseWrapperInterface;
14 import org.onap.vid.services.ChangeManagementService;
15 import org.onap.vid.services.ChangeManagementServiceImpl;
16 import org.onap.vid.services.WorkflowService;
17 import org.onap.vid.services.WorkflowServiceImpl;
18 import org.springframework.http.ResponseEntity;
19 import org.springframework.web.multipart.MultipartFile;
21 public class ChangeManagementControllerTest {
23 private ChangeManagementController createTestSubject() {
24 return new ChangeManagementController(new WorkflowServiceImpl(), new ChangeManagementServiceImpl(null, null),
29 public void testGetWorkflow() throws Exception {
30 ChangeManagementController testSubject;
31 Collection<String> vnfs = null;
32 ResponseEntity<Collection<String>> result;
35 testSubject = createTestSubject();
37 result = testSubject.getWorkflow(vnfs);
45 public void testGetMSOChangeManagements() throws Exception {
46 ChangeManagementController testSubject;
49 testSubject = createTestSubject();
51 testSubject.getMSOChangeManagements();
59 public void testChangeManagement() throws Exception {
60 ChangeManagementController testSubject;
62 HttpServletRequest request = null;
63 ChangeManagementRequest changeManagmentRequest = null;
64 ResponseEntity<String> result;
67 testSubject = createTestSubject();
68 result = testSubject.changeManagement(vnfName, request, changeManagmentRequest);
72 public void testUploadConfigUpdateFile() throws Exception {
73 ChangeManagementController testSubject;
74 MultipartFile file = null;
75 ResponseEntity result;
78 testSubject = createTestSubject();
79 result = testSubject.uploadConfigUpdateFile(file);
83 public void testGetSchedulerChangeManagements() throws Exception {
84 ChangeManagementController testSubject;
85 ResponseEntity<JSONArray> result;
88 testSubject = createTestSubject();
89 result = testSubject.getSchedulerChangeManagements();
93 public void testDeleteSchedule() throws Exception {
94 ChangeManagementController testSubject;
95 String scheduleId = "";
96 ResponseEntity result;
99 testSubject = createTestSubject();
100 result = testSubject.deleteSchedule(scheduleId);
104 public void testGetWorkflows() throws Exception {
105 ChangeManagementController testSubject;
106 GetVnfWorkflowRelationRequest getVnfWorkflowRelationRequest = null;
107 ResponseEntity result;
110 testSubject = createTestSubject();
111 result = testSubject.getWorkflows(getVnfWorkflowRelationRequest);
115 public void testCreateWorkflowRelation() throws Exception {
116 ChangeManagementController testSubject;
117 VnfWorkflowRelationRequest vnfWorkflowRelationRequest = null;
118 ResponseEntity result;
121 testSubject = createTestSubject();
122 result = testSubject.createWorkflowRelation(vnfWorkflowRelationRequest);
126 public void testGetAllWorkflowRelation() throws Exception {
127 ChangeManagementController testSubject;
128 ResponseEntity result;
131 testSubject = createTestSubject();
132 result = testSubject.getAllWorkflowRelation();
136 public void testDeleteWorkflowRelation() throws Exception {
137 ChangeManagementController testSubject;
138 VnfWorkflowRelationRequest vnfWorkflowRelationRequest = null;
139 ResponseEntity result;
142 testSubject = createTestSubject();
143 result = testSubject.deleteWorkflowRelation(vnfWorkflowRelationRequest);
147 public void testClientDerivedExceptionAsBadRequest() throws Exception {
148 ChangeManagementController testSubject;
150 MsoResponseWrapperInterface result;
154 testSubject = createTestSubject();
155 result = testSubject.clientDerivedExceptionAsBadRequest(e);