Unit tests
[vid.git] / vid-app-common / src / test / java / org / onap / vid / controllers / ChangeManagementControllerTest.java
1 package org.onap.vid.controllers;
2
3 import java.util.Collection;
4
5 import javax.servlet.http.HttpServletRequest;
6
7 import org.codehaus.jackson.map.ObjectMapper;
8 import org.json.simple.JSONArray;
9 import org.junit.Test;
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;
20
21 public class ChangeManagementControllerTest {
22
23     private ChangeManagementController createTestSubject() {
24         return new ChangeManagementController(new WorkflowServiceImpl(), new ChangeManagementServiceImpl(null, null),
25                 null);
26     }
27
28     @Test
29     public void testGetWorkflow() throws Exception {
30         ChangeManagementController testSubject;
31         Collection<String> vnfs = null;
32         ResponseEntity<Collection<String>> result;
33
34         // default test
35         testSubject = createTestSubject();
36         try {
37             result = testSubject.getWorkflow(vnfs);
38         } catch (
39
40         Exception e) {
41         }
42     }
43
44     @Test
45     public void testGetMSOChangeManagements() throws Exception {
46         ChangeManagementController testSubject;
47
48         // default test
49         testSubject = createTestSubject();
50         try {
51             testSubject.getMSOChangeManagements();
52         } catch (
53
54         Exception e) {
55         }
56     }
57
58     @Test
59     public void testChangeManagement() throws Exception {
60         ChangeManagementController testSubject;
61         String vnfName = "";
62         HttpServletRequest request = null;
63         ChangeManagementRequest changeManagmentRequest = null;
64         ResponseEntity<String> result;
65
66         // default test
67         testSubject = createTestSubject();
68         result = testSubject.changeManagement(vnfName, request, changeManagmentRequest);
69     }
70
71     @Test
72     public void testUploadConfigUpdateFile() throws Exception {
73         ChangeManagementController testSubject;
74         MultipartFile file = null;
75         ResponseEntity result;
76
77         // default test
78         testSubject = createTestSubject();
79         result = testSubject.uploadConfigUpdateFile(file);
80     }
81
82     @Test
83     public void testGetSchedulerChangeManagements() throws Exception {
84         ChangeManagementController testSubject;
85         ResponseEntity<JSONArray> result;
86
87         // default test
88         testSubject = createTestSubject();
89         result = testSubject.getSchedulerChangeManagements();
90     }
91
92     @Test
93     public void testDeleteSchedule() throws Exception {
94         ChangeManagementController testSubject;
95         String scheduleId = "";
96         ResponseEntity result;
97
98         // default test
99         testSubject = createTestSubject();
100         result = testSubject.deleteSchedule(scheduleId);
101     }
102
103     @Test
104     public void testGetWorkflows() throws Exception {
105         ChangeManagementController testSubject;
106         GetVnfWorkflowRelationRequest getVnfWorkflowRelationRequest = null;
107         ResponseEntity result;
108
109         // default test
110         testSubject = createTestSubject();
111         result = testSubject.getWorkflows(getVnfWorkflowRelationRequest);
112     }
113
114     @Test
115     public void testCreateWorkflowRelation() throws Exception {
116         ChangeManagementController testSubject;
117         VnfWorkflowRelationRequest vnfWorkflowRelationRequest = null;
118         ResponseEntity result;
119
120         // default test
121         testSubject = createTestSubject();
122         result = testSubject.createWorkflowRelation(vnfWorkflowRelationRequest);
123     }
124
125     @Test
126     public void testGetAllWorkflowRelation() throws Exception {
127         ChangeManagementController testSubject;
128         ResponseEntity result;
129
130         // default test
131         testSubject = createTestSubject();
132         result = testSubject.getAllWorkflowRelation();
133     }
134
135     @Test
136     public void testDeleteWorkflowRelation() throws Exception {
137         ChangeManagementController testSubject;
138         VnfWorkflowRelationRequest vnfWorkflowRelationRequest = null;
139         ResponseEntity result;
140
141         // default test
142         testSubject = createTestSubject();
143         result = testSubject.deleteWorkflowRelation(vnfWorkflowRelationRequest);
144     }
145
146     @Test
147     public void testClientDerivedExceptionAsBadRequest() throws Exception {
148         ChangeManagementController testSubject;
149         Exception e = null;
150         MsoResponseWrapperInterface result;
151
152         // default test
153         try {
154             testSubject = createTestSubject();
155             result = testSubject.clientDerivedExceptionAsBadRequest(e);
156         } catch (
157
158         Exception ex) {
159         }
160     }
161 }