1 package org.onap.vid.services;
3 import static org.junit.Assert.*;
6 import org.json.simple.JSONArray;
7 import org.junit.Assert;
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;
24 public class ChangeManagementServiceImplTest {
26 private ChangeManagementServiceImpl createTestSubject() {
27 return new ChangeManagementServiceImpl(new DataAccessServiceImpl(),
28 new MsoBusinessLogicImpl(new MsoRestClientNew()));
32 public void testGetMSOChangeManagements() throws Exception {
33 ChangeManagementServiceImpl testSubject;
34 Collection<Request> result;
37 testSubject = createTestSubject();
38 result = testSubject.getMSOChangeManagements();
42 public void testDoChangeManagement() throws Exception {
43 ChangeManagementServiceImpl testSubject;
44 ChangeManagementRequest request = null;
46 ResponseEntity<String> result;
49 testSubject = createTestSubject();
51 result = testSubject.doChangeManagement(request, vnfName);
52 Assert.assertEquals(null, result);
56 public void testGetSchedulerChangeManagements() throws Exception {
57 ChangeManagementServiceImpl testSubject;
61 testSubject = createTestSubject();
62 result = testSubject.getSchedulerChangeManagements();
66 public void testDeleteSchedule() throws Exception {
67 ChangeManagementServiceImpl testSubject;
68 String scheduleId = "";
71 testSubject = createTestSubject();
72 testSubject.deleteSchedule(scheduleId);
76 public void testAddVnfWorkflowRelation() throws Exception {
77 ChangeManagementServiceImpl testSubject;
78 VnfWorkflowRelationRequest vnfWorkflowRelationRequest = null;
79 VnfWorkflowRelationResponse result;
83 testSubject = createTestSubject();
84 result = testSubject.addVnfWorkflowRelation(vnfWorkflowRelationRequest);
92 public void testDeleteVnfWorkflowRelation() throws Exception {
93 ChangeManagementServiceImpl testSubject;
94 VnfWorkflowRelationRequest vnfWorkflowRelationRequest = null;
95 VnfWorkflowRelationResponse result;
99 testSubject = createTestSubject();
100 result = testSubject.deleteVnfWorkflowRelation(vnfWorkflowRelationRequest);
108 public void testGetAllVnfWorkflowRelations() throws Exception {
109 ChangeManagementServiceImpl testSubject;
110 VnfWorkflowRelationAllResponse result;
114 testSubject = createTestSubject();
115 result = testSubject.getAllVnfWorkflowRelations();
123 public void testGetWorkflowsForVnf() throws Exception {
124 ChangeManagementServiceImpl testSubject;
125 GetVnfWorkflowRelationRequest getVnfWorkflowRelationRequest = null;
130 testSubject = createTestSubject();
131 result = testSubject.getWorkflowsForVnf(getVnfWorkflowRelationRequest);
139 public void testUploadConfigUpdateFile() throws Exception {
140 ChangeManagementServiceImpl testSubject;
141 MultipartFile file = null;
146 testSubject = createTestSubject();
147 result = testSubject.uploadConfigUpdateFile(file);
155 * TODO: fix private ChangeManagementServiceImpl createTestSubject() {
156 * return new ChangeManagementServiceImpl(); }
160 * @Test public void testGetMSOChangeManagements() throws Exception {
161 * ChangeManagementServiceImpl testSubject; Collection<Request> result;
163 * // default test testSubject = createTestSubject(); result =
164 * testSubject.getMSOChangeManagements(); }
167 * @Test public void testFindRequestByVnfName() throws Exception {
168 * ChangeManagementServiceImpl testSubject;List<RequestDetails> requests =
169 * null; String vnfName = ""; RequestDetails result;
171 * // test 1 testSubject=createTestSubject();requests = null;
172 * result=Deencapsulation.invoke(testSubject, "findRequestByVnfName", new
173 * Object[]{List<RequestDetails>.class, vnfName}); Assert.assertEquals(null,
178 * @Test public void testDoChangeManagement() throws Exception {
179 * ChangeManagementServiceImpl testSubject; ChangeManagementRequest request
180 * = null; String vnfName = ""; ResponseEntity<String> result;
182 * // test 1 testSubject = createTestSubject(); request = null; result =
183 * testSubject.doChangeManagement(request, vnfName);
184 * Assert.assertEquals(null, result); }
187 * @Test public void testGetSchedulerChangeManagements() throws Exception {
188 * ChangeManagementServiceImpl testSubject; JSONArray result;
190 * // default test testSubject = createTestSubject(); result =
191 * testSubject.getSchedulerChangeManagements(); }