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