Get subscribers rewritten to new rest client
[vid.git] / vid-app-common / src / test / java / org / onap / vid / services / AaiServiceImplTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * VID
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * Modifications Copyright (C) 2018 Nokia. All rights reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.vid.services;
23
24 import io.joshworks.restclient.http.HttpResponse;
25 import java.util.Collection;
26 import java.util.List;
27
28 import org.junit.Assert;
29 import org.junit.Test;
30 import org.onap.vid.aai.AaiResponse;
31 import org.onap.vid.aai.SubscriberFilteredResults;
32 import org.onap.vid.aai.model.AaiGetOperationalEnvironments.OperationalEnvironmentList;
33 import org.onap.vid.aai.model.AaiGetPnfs.Pnf;
34 import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse;
35 import org.onap.vid.model.SubscriberList;
36 import org.onap.vid.roles.RoleValidator;
37
38 public class AaiServiceImplTest {
39
40     private AaiServiceImpl createTestSubject() {
41         return new AaiServiceImpl();
42     }
43
44     @Test
45     public void testGetFullSubscriberList() throws Exception {
46         AaiServiceImpl testSubject;
47         RoleValidator roleValidator = null;
48         SubscriberFilteredResults result;
49
50         // default test
51         try {
52             testSubject = createTestSubject();
53             result = testSubject.getFullSubscriberList(roleValidator);
54         } catch (
55
56         Exception e) {
57         }
58     }
59
60     @Test
61     public void testGetOperationalEnvironments() throws Exception {
62         AaiServiceImpl testSubject;
63         String operationalEnvironmentType = "";
64         String operationalEnvironmentStatus = "";
65         AaiResponse<OperationalEnvironmentList> result;
66
67         // default test
68         try {
69             testSubject = createTestSubject();
70             result = testSubject.getOperationalEnvironments(operationalEnvironmentType, operationalEnvironmentStatus);
71         } catch (
72
73         Exception e) {
74         }
75     }
76
77     @Test
78     public void testGetFullSubscriberList_1() throws Exception {
79         AaiServiceImpl testSubject;
80         HttpResponse<SubscriberList> result;
81
82         // default test
83         try {
84             testSubject = createTestSubject();
85             result = testSubject.getFullSubscriberList();
86         } catch (
87
88         Exception e) {
89         }
90     }
91
92     @Test
93     public void testGetSubscriberData() throws Exception {
94         AaiServiceImpl testSubject;
95         String subscriberId = "";
96         RoleValidator roleValidator = null;
97         AaiResponse result;
98
99         // default test
100         try {
101             testSubject = createTestSubject();
102             result = testSubject.getSubscriberData(subscriberId, roleValidator);
103         } catch (
104
105         Exception e) {
106         }
107     }
108
109     @Test
110     public void testGetServiceInstanceSearchResults() throws Exception {
111         AaiServiceImpl testSubject;
112         String subscriberId = "";
113         String instanceIdentifier = "";
114         RoleValidator roleValidator = null;
115         List<String> owningEntities = null;
116         List<String> projects = null;
117         AaiResponse result;
118
119         // test 1
120         testSubject = createTestSubject();
121         subscriberId = null;
122         instanceIdentifier = null;
123         result = testSubject.getServiceInstanceSearchResults(subscriberId, instanceIdentifier, roleValidator,
124                 owningEntities, projects);
125         Assert.assertNotEquals(null, result);
126
127         /*/ test 2
128         testSubject = createTestSubject();
129         subscriberId = "";
130         instanceIdentifier = null;
131         result = testSubject.getServiceInstanceSearchResults(subscriberId, instanceIdentifier, roleValidator,
132                 owningEntities, projects);
133         Assert.assertNotEquals(null, result);
134
135         // test 3
136         testSubject = createTestSubject();
137         instanceIdentifier = null;
138         subscriberId = null;
139         result = testSubject.getServiceInstanceSearchResults(subscriberId, instanceIdentifier, roleValidator,
140                 owningEntities, projects);
141         Assert.assertEquals(null, result);
142
143         // test 4
144         testSubject = createTestSubject();
145         instanceIdentifier = "";
146         subscriberId = null;
147         result = testSubject.getServiceInstanceSearchResults(subscriberId, instanceIdentifier, roleValidator,
148                 owningEntities, projects);
149         Assert.assertEquals(null, result);
150
151         // test 5
152         testSubject = createTestSubject();
153         owningEntities = null;
154         result = testSubject.getServiceInstanceSearchResults(subscriberId, instanceIdentifier, roleValidator,
155                 owningEntities, projects);
156         Assert.assertEquals(null, result);
157
158         // test 6
159         testSubject = createTestSubject();
160         projects = null;
161         result = testSubject.getServiceInstanceSearchResults(subscriberId, instanceIdentifier, roleValidator,
162                 owningEntities, projects);
163         Assert.assertEquals(null, result);*/
164     }
165
166     @Test
167     public void testGetVersionByInvariantId() throws Exception {
168         AaiServiceImpl testSubject;
169         List<String> modelInvariantId = null;
170
171         // default test
172         try {
173             testSubject = createTestSubject();
174             testSubject.getVersionByInvariantId(modelInvariantId);
175         } catch (
176
177         Exception e) {
178         }
179     }
180
181     @Test
182     public void testGetSpecificPnf() throws Exception {
183         AaiServiceImpl testSubject;
184         String pnfId = "";
185         AaiResponse<Pnf> result;
186
187         // default test
188         try {
189             testSubject = createTestSubject();
190             result = testSubject.getSpecificPnf(pnfId);
191         } catch (
192
193         Exception e) {
194         }
195     }
196
197     @Test
198     public void testGetPNFData() throws Exception {
199         AaiServiceImpl testSubject;
200         String globalCustomerId = "";
201         String serviceType = "";
202         String modelVersionId = "";
203         String modelInvariantId = "";
204         String cloudRegion = "";
205         String equipVendor = "";
206         String equipModel = "";
207         AaiResponse result;
208
209         // default test
210         try {
211             testSubject = createTestSubject();
212             result = testSubject.getPNFData(globalCustomerId, serviceType, modelVersionId, modelInvariantId,
213                     cloudRegion, equipVendor, equipModel);
214         } catch (
215
216         Exception e) {
217         }
218     }
219
220     @Test
221     public void testGetServices() throws Exception {
222         AaiServiceImpl testSubject;
223         RoleValidator roleValidator = null;
224         AaiResponse result;
225
226         // default test
227         try {
228             testSubject = createTestSubject();
229             result = testSubject.getServices(roleValidator);
230         } catch (
231
232         Exception e) {
233         }
234     }
235
236     @Test
237     public void testGetTenants() throws Exception {
238         AaiServiceImpl testSubject;
239         String globalCustomerId = "";
240         String serviceType = "";
241         RoleValidator roleValidator = null;
242         AaiResponse<GetTenantsResponse[]> result;
243
244         // default test
245         try {
246             testSubject = createTestSubject();
247             result = testSubject.getTenants(globalCustomerId, serviceType, roleValidator);
248         } catch (
249
250         Exception e) {
251         }
252     }
253
254     @Test
255     public void testGetVNFData() throws Exception {
256         AaiServiceImpl testSubject;
257         String globalSubscriberId = "";
258         String serviceType = "";
259         String serviceInstanceId = "";
260         AaiResponse result;
261
262         // default test
263         try {
264             testSubject = createTestSubject();
265             result = testSubject.getVNFData(globalSubscriberId, serviceType, serviceInstanceId);
266         } catch (
267
268         Exception e) {
269         }
270     }
271
272     @Test
273     public void testGetVNFData_1() throws Exception {
274         AaiServiceImpl testSubject;
275         String globalSubscriberId = "";
276         String serviceType = "";
277
278         // default test
279         try {
280             testSubject = createTestSubject();
281             testSubject.getVNFData(globalSubscriberId, serviceType);
282         } catch (
283
284         Exception e) {
285         }
286     }
287
288     @Test
289     public void testGetAaiZones() throws Exception {
290         AaiServiceImpl testSubject;
291         AaiResponse result;
292
293         // default test
294         try {
295             testSubject = createTestSubject();
296             result = testSubject.getAaiZones();
297         } catch (
298
299         Exception e) {
300         }
301     }
302
303     @Test
304     public void testGetAicZoneForPnf() throws Exception {
305         AaiServiceImpl testSubject;
306         String globalCustomerId = "";
307         String serviceType = "";
308         String serviceId = "";
309         AaiResponse result;
310
311         // default test
312         try {
313             testSubject = createTestSubject();
314             result = testSubject.getAicZoneForPnf(globalCustomerId, serviceType, serviceId);
315         } catch (
316
317         Exception e) {
318         }
319     }
320
321     @Test
322     public void testGetNodeTemplateInstances() throws Exception {
323         AaiServiceImpl testSubject;
324         String globalCustomerId = "";
325         String serviceType = "";
326         String modelVersionId = "";
327         String modelInvariantId = "";
328         String cloudRegion = "";
329         AaiResponse result;
330
331         // default test
332         try {
333             testSubject = createTestSubject();
334             result = testSubject.getNodeTemplateInstances(globalCustomerId, serviceType, modelVersionId,
335                     modelInvariantId, cloudRegion);
336         } catch (
337
338         Exception e) {
339         }
340     }
341
342     @Test
343     public void testGetServicesByDistributionStatus() throws Exception {
344         AaiServiceImpl testSubject;
345
346         // default test
347         try {
348             testSubject = createTestSubject();
349             testSubject.getServicesByDistributionStatus();
350         } catch (
351
352         Exception e) {
353         }
354     }
355
356     @Test
357     public void testGetServiceInstanceAssociatedPnfs() throws Exception {
358         AaiServiceImpl testSubject;
359         String globalCustomerId = "";
360         String serviceType = "";
361         String serviceInstanceId = "";
362         List<String> result;
363
364         // default test
365         try {
366             testSubject = createTestSubject();
367             result = testSubject.getServiceInstanceAssociatedPnfs(globalCustomerId, serviceType, serviceInstanceId);
368         } catch (
369
370         Exception e) {
371         }
372     }
373 }