2 * ============LICENSE_START=======================================================
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
22 package org.onap.vid.services;
24 import com.google.common.collect.ImmutableList;
25 import io.joshworks.restclient.http.HttpResponse;
26 import org.junit.Assert;
27 import org.junit.Test;
28 import org.onap.vid.aai.AaiResponse;
29 import org.onap.vid.aai.SubscriberFilteredResults;
30 import org.onap.vid.aai.model.AaiGetOperationalEnvironments.OperationalEnvironmentList;
31 import org.onap.vid.aai.model.AaiGetPnfs.Pnf;
32 import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse;
33 import org.onap.vid.model.SubscriberList;
34 import org.onap.vid.roles.RoleValidator;
36 import java.util.List;
38 public class AaiServiceImplTest {
40 private AaiServiceImpl createTestSubject() {
41 return new AaiServiceImpl();
45 public void testGetFullSubscriberList() throws Exception {
46 AaiServiceImpl testSubject;
47 RoleValidator roleValidator = null;
48 SubscriberFilteredResults result;
52 testSubject = createTestSubject();
53 result = testSubject.getFullSubscriberList(roleValidator);
61 public void testGetOperationalEnvironments() throws Exception {
62 AaiServiceImpl testSubject;
63 String operationalEnvironmentType = "";
64 String operationalEnvironmentStatus = "";
65 AaiResponse<OperationalEnvironmentList> result;
69 testSubject = createTestSubject();
70 result = testSubject.getOperationalEnvironments(operationalEnvironmentType, operationalEnvironmentStatus);
78 public void testGetFullSubscriberList_1() throws Exception {
79 AaiServiceImpl testSubject;
80 HttpResponse<SubscriberList> result;
84 testSubject = createTestSubject();
85 result = testSubject.getFullSubscriberList();
93 public void testGetSubscriberData() throws Exception {
94 AaiServiceImpl testSubject;
95 String subscriberId = "";
96 RoleValidator roleValidator = null;
101 testSubject = createTestSubject();
102 result = testSubject.getSubscriberData(subscriberId, roleValidator);
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;
120 testSubject = createTestSubject();
122 instanceIdentifier = null;
123 result = testSubject.getServiceInstanceSearchResults(subscriberId, instanceIdentifier, roleValidator,
124 owningEntities, projects);
125 Assert.assertNotEquals(null, result);
128 testSubject = createTestSubject();
130 instanceIdentifier = null;
131 result = testSubject.getServiceInstanceSearchResults(subscriberId, instanceIdentifier, roleValidator,
132 owningEntities, projects);
133 Assert.assertNotEquals(null, result);
136 testSubject = createTestSubject();
137 instanceIdentifier = null;
139 result = testSubject.getServiceInstanceSearchResults(subscriberId, instanceIdentifier, roleValidator,
140 owningEntities, projects);
141 Assert.assertEquals(null, result);
144 testSubject = createTestSubject();
145 instanceIdentifier = "";
147 result = testSubject.getServiceInstanceSearchResults(subscriberId, instanceIdentifier, roleValidator,
148 owningEntities, projects);
149 Assert.assertEquals(null, result);
152 testSubject = createTestSubject();
153 owningEntities = null;
154 result = testSubject.getServiceInstanceSearchResults(subscriberId, instanceIdentifier, roleValidator,
155 owningEntities, projects);
156 Assert.assertEquals(null, result);
159 testSubject = createTestSubject();
161 result = testSubject.getServiceInstanceSearchResults(subscriberId, instanceIdentifier, roleValidator,
162 owningEntities, projects);
163 Assert.assertEquals(null, result);*/
167 public void testGetVersionByInvariantId() throws Exception {
168 AaiServiceImpl testSubject;
169 List<String> modelInvariantId = ImmutableList.of("some invariant id");
173 testSubject = createTestSubject();
174 testSubject.getVersionByInvariantId(modelInvariantId);
182 public void testGetSpecificPnf() throws Exception {
183 AaiServiceImpl testSubject;
185 AaiResponse<Pnf> result;
189 testSubject = createTestSubject();
190 result = testSubject.getSpecificPnf(pnfId);
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 = "";
211 testSubject = createTestSubject();
212 result = testSubject.getPNFData(globalCustomerId, serviceType, modelVersionId, modelInvariantId,
213 cloudRegion, equipVendor, equipModel);
221 public void testGetServices() throws Exception {
222 AaiServiceImpl testSubject;
223 RoleValidator roleValidator = null;
228 testSubject = createTestSubject();
229 result = testSubject.getServices(roleValidator);
237 public void testGetTenants() throws Exception {
238 AaiServiceImpl testSubject;
239 String globalCustomerId = "";
240 String serviceType = "";
241 RoleValidator roleValidator = null;
242 AaiResponse<GetTenantsResponse[]> result;
246 testSubject = createTestSubject();
247 result = testSubject.getTenants(globalCustomerId, serviceType, roleValidator);
255 public void testGetVNFData() throws Exception {
256 AaiServiceImpl testSubject;
257 String globalSubscriberId = "";
258 String serviceType = "";
259 String serviceInstanceId = "";
264 testSubject = createTestSubject();
265 result = testSubject.getVNFData(globalSubscriberId, serviceType, serviceInstanceId);
273 public void testGetVNFData_1() throws Exception {
274 AaiServiceImpl testSubject;
275 String globalSubscriberId = "";
276 String serviceType = "";
280 testSubject = createTestSubject();
281 testSubject.getVNFData(globalSubscriberId, serviceType);
289 public void testGetAaiZones() throws Exception {
290 AaiServiceImpl testSubject;
295 testSubject = createTestSubject();
296 result = testSubject.getAaiZones();
304 public void testGetAicZoneForPnf() throws Exception {
305 AaiServiceImpl testSubject;
306 String globalCustomerId = "";
307 String serviceType = "";
308 String serviceId = "";
313 testSubject = createTestSubject();
314 result = testSubject.getAicZoneForPnf(globalCustomerId, serviceType, serviceId);
322 public void testGetNodeTemplateInstances() throws Exception {
323 AaiServiceImpl testSubject;
324 String globalCustomerId = "";
325 String serviceType = "";
326 String modelVersionId = "";
327 String modelInvariantId = "";
328 String cloudRegion = "";
333 testSubject = createTestSubject();
334 result = testSubject.getNodeTemplateInstances(globalCustomerId, serviceType, modelVersionId,
335 modelInvariantId, cloudRegion);
343 public void testGetServicesByDistributionStatus() throws Exception {
344 AaiServiceImpl testSubject;
348 testSubject = createTestSubject();
349 testSubject.getServicesByDistributionStatus();
357 public void testGetServiceInstanceAssociatedPnfs() throws Exception {
358 AaiServiceImpl testSubject;
359 String globalCustomerId = "";
360 String serviceType = "";
361 String serviceInstanceId = "";
366 testSubject = createTestSubject();
367 result = testSubject.getServiceInstanceAssociatedPnfs(globalCustomerId, serviceType, serviceInstanceId);