7819b4c9f4aa7e171f6fffb35e093e2017784dc9
[vid.git] / vid-app-common / src / test / java / org / onap / vid / services / ChangeManagementServiceImplTest.java
1 package org.onap.vid.services;
2
3 import static org.junit.Assert.*;
4 import java.util.*;
5
6 import org.json.simple.JSONArray;
7 import org.junit.Assert;
8 import org.junit.Test;
9 import org.onap.portalsdk.core.service.DataAccessService;
10 import org.onap.portalsdk.core.service.DataAccessServiceImpl;
11 import org.onap.vid.changeManagement.ChangeManagementRequest;
12 import org.onap.vid.changeManagement.GetVnfWorkflowRelationRequest;
13 import org.onap.vid.changeManagement.RequestDetails;
14 import org.onap.vid.changeManagement.VnfWorkflowRelationAllResponse;
15 import org.onap.vid.changeManagement.VnfWorkflowRelationRequest;
16 import org.onap.vid.changeManagement.VnfWorkflowRelationResponse;
17 import org.onap.vid.mso.MsoBusinessLogic;
18 import org.onap.vid.mso.MsoBusinessLogicImpl;
19 import org.onap.vid.mso.rest.MsoRestClientNew;
20 import org.onap.vid.mso.rest.Request;
21 import org.springframework.http.ResponseEntity;
22 import org.springframework.web.multipart.MultipartFile;
23
24 public class ChangeManagementServiceImplTest {
25
26     private ChangeManagementServiceImpl createTestSubject() {
27         return new ChangeManagementServiceImpl(new DataAccessServiceImpl(),
28                 new MsoBusinessLogicImpl(new MsoRestClientNew()));
29     }
30
31     @Test
32     public void testGetMSOChangeManagements() throws Exception {
33         ChangeManagementServiceImpl testSubject;
34         Collection<Request> result;
35
36         // default test
37         testSubject = createTestSubject();
38         result = testSubject.getMSOChangeManagements();
39     }
40
41     @Test
42     public void testDoChangeManagement() throws Exception {
43         ChangeManagementServiceImpl testSubject;
44         ChangeManagementRequest request = null;
45         String vnfName = "";
46         ResponseEntity<String> result;
47
48         // test 1
49         testSubject = createTestSubject();
50         request = null;
51         result = testSubject.doChangeManagement(request, vnfName);
52         Assert.assertEquals(null, result);
53     }
54
55     @Test
56     public void testGetSchedulerChangeManagements() throws Exception {
57         ChangeManagementServiceImpl testSubject;
58         JSONArray result;
59
60         // default test
61         testSubject = createTestSubject();
62         result = testSubject.getSchedulerChangeManagements();
63     }
64
65     @Test
66     public void testDeleteSchedule() throws Exception {
67         ChangeManagementServiceImpl testSubject;
68         String scheduleId = "";
69
70         // default test
71         testSubject = createTestSubject();
72         testSubject.deleteSchedule(scheduleId);
73     }
74
75     @Test
76     public void testAddVnfWorkflowRelation() throws Exception {
77         ChangeManagementServiceImpl testSubject;
78         VnfWorkflowRelationRequest vnfWorkflowRelationRequest = null;
79         VnfWorkflowRelationResponse result;
80
81         // default test
82         try {
83             testSubject = createTestSubject();
84             result = testSubject.addVnfWorkflowRelation(vnfWorkflowRelationRequest);
85         } catch (
86
87         Exception e) {
88         }
89     }
90
91     @Test
92     public void testDeleteVnfWorkflowRelation() throws Exception {
93         ChangeManagementServiceImpl testSubject;
94         VnfWorkflowRelationRequest vnfWorkflowRelationRequest = null;
95         VnfWorkflowRelationResponse result;
96
97         // default test
98         try {
99             testSubject = createTestSubject();
100             result = testSubject.deleteVnfWorkflowRelation(vnfWorkflowRelationRequest);
101         } catch (
102
103         Exception e) {
104         }
105     }
106
107     @Test
108     public void testGetAllVnfWorkflowRelations() throws Exception {
109         ChangeManagementServiceImpl testSubject;
110         VnfWorkflowRelationAllResponse result;
111
112         // default test
113         try {
114             testSubject = createTestSubject();
115             result = testSubject.getAllVnfWorkflowRelations();
116         } catch (
117
118         Exception e) {
119         }
120     }
121
122     @Test
123     public void testGetWorkflowsForVnf() throws Exception {
124         ChangeManagementServiceImpl testSubject;
125         GetVnfWorkflowRelationRequest getVnfWorkflowRelationRequest = null;
126         List<String> result;
127
128         // default test
129         try {
130             testSubject = createTestSubject();
131             result = testSubject.getWorkflowsForVnf(getVnfWorkflowRelationRequest);
132         } catch (
133
134         Exception e) {
135         }
136     }
137
138     @Test
139     public void testUploadConfigUpdateFile() throws Exception {
140         ChangeManagementServiceImpl testSubject;
141         MultipartFile file = null;
142         String result;
143
144         // default test
145         try {
146             testSubject = createTestSubject();
147             result = testSubject.uploadConfigUpdateFile(file);
148         } catch (
149
150         Exception e) {
151         }
152     }
153
154     /*
155      * TODO: fix private ChangeManagementServiceImpl createTestSubject() {
156      * return new ChangeManagementServiceImpl(); }
157      */
158
159     /*
160      * @Test public void testGetMSOChangeManagements() throws Exception {
161      * ChangeManagementServiceImpl testSubject; Collection<Request> result;
162      * 
163      * // default test testSubject = createTestSubject(); result =
164      * testSubject.getMSOChangeManagements(); }
165      * 
166      * 
167      * @Test public void testFindRequestByVnfName() throws Exception {
168      * ChangeManagementServiceImpl testSubject;List<RequestDetails> requests =
169      * null; String vnfName = ""; RequestDetails result;
170      * 
171      * // test 1 testSubject=createTestSubject();requests = null;
172      * result=Deencapsulation.invoke(testSubject, "findRequestByVnfName", new
173      * Object[]{List<RequestDetails>.class, vnfName}); Assert.assertEquals(null,
174      * result); }
175      */
176     /*
177      * 
178      * @Test public void testDoChangeManagement() throws Exception {
179      * ChangeManagementServiceImpl testSubject; ChangeManagementRequest request
180      * = null; String vnfName = ""; ResponseEntity<String> result;
181      * 
182      * // test 1 testSubject = createTestSubject(); request = null; result =
183      * testSubject.doChangeManagement(request, vnfName);
184      * Assert.assertEquals(null, result); }
185      * 
186      * 
187      * @Test public void testGetSchedulerChangeManagements() throws Exception {
188      * ChangeManagementServiceImpl testSubject; JSONArray result;
189      * 
190      * // default test testSubject = createTestSubject(); result =
191      * testSubject.getSchedulerChangeManagements(); }
192      */
193 }