2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.so.db.catalog.client;
24 import static org.junit.Assert.assertEquals;
25 import static org.mockito.Mockito.when;
27 import java.util.List;
28 import java.util.UUID;
30 import javax.ws.rs.core.UriBuilder;
32 import org.junit.Assert;
33 import org.junit.Before;
34 import org.junit.Test;
35 import org.junit.runner.RunWith;
36 import org.onap.so.adapters.catalogdb.CatalogDBApplication;
37 import org.onap.so.db.catalog.beans.AuthenticationType;
38 import org.onap.so.db.catalog.beans.CloudIdentity;
39 import org.onap.so.db.catalog.beans.CloudSite;
40 import org.onap.so.db.catalog.beans.CloudifyManager;
41 import org.onap.so.db.catalog.beans.ExternalServiceToInternalService;
42 import org.onap.so.db.catalog.beans.InstanceGroup;
43 import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
44 import org.onap.so.db.catalog.beans.ServerType;
45 import org.onap.so.db.catalog.beans.Service;
46 import org.onap.so.db.catalog.beans.ServiceRecipe;
47 import org.onap.so.db.catalog.beans.VfModule;
48 import org.onap.so.db.catalog.beans.VfModuleCustomization;
49 import org.onap.so.db.catalog.beans.VnfComponentsRecipe;
50 import org.onap.so.db.catalog.beans.VnfRecipe;
51 import org.onap.so.db.catalog.beans.VnfResource;
52 import org.onap.so.db.catalog.beans.VnfResourceCustomization;
53 import org.onap.so.db.catalog.beans.ExternalServiceToInternalService;
54 import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
55 import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
56 import org.springframework.beans.factory.annotation.Autowired;
57 import org.springframework.beans.factory.annotation.Value;
58 import org.springframework.boot.web.server.LocalServerPort;
59 import org.springframework.boot.test.context.SpringBootTest;
60 import org.springframework.boot.test.mock.mockito.MockBean;
61 import org.springframework.test.context.ActiveProfiles;
62 import org.springframework.test.context.junit4.SpringRunner;
64 import com.fasterxml.jackson.databind.ObjectMapper;
66 @RunWith(SpringRunner.class)
67 @SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
68 @ActiveProfiles("test")
69 public class CatalogDbClientTest {
70 public static final String MTN13 = "mtn13";
75 @Value("${mso.db.auth}")
76 private String msoAdaptersAuth;
79 CatalogDbClientPortChanger client;
82 public void initialize(){
83 client.wiremockPort= String.valueOf(port);
87 public void testGetRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(){
88 RainyDayHandlerStatus rainyDayHandlerStatus = client.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep("AssignServiceInstanceBB", "*", "*", "*", "*");
89 Assert.assertEquals("Rollback", rainyDayHandlerStatus.getPolicy());
93 public void testGetRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStepRecordNotFound(){
94 RainyDayHandlerStatus rainyDayHandlerStatus = client.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(UUID.randomUUID().toString(), "*", "*", "*", "*");
95 Assert.assertNull(rainyDayHandlerStatus);
99 public void testGetCloudSiteHappyPath() throws Exception {
100 CloudSite cloudSite = client.getCloudSite(MTN13);
101 Assert.assertNotNull(cloudSite);
102 Assert.assertNotNull(cloudSite.getIdentityService());
103 Assert.assertEquals("MDT13", cloudSite.getClli());
104 Assert.assertEquals("mtn13", cloudSite.getRegionId());
105 Assert.assertEquals("MTN13", cloudSite.getIdentityServiceId());
109 public void testGetCloudSiteNotFound() throws Exception {
110 CloudSite cloudSite = client.getCloudSite(UUID.randomUUID().toString());
111 Assert.assertNull(cloudSite);
115 public void testGetCloudifyManagerHappyPath() throws Exception {
116 CloudifyManager cloudifyManager = client.getCloudifyManager("mtn13");
117 Assert.assertNotNull(cloudifyManager);
118 Assert.assertEquals("http://localhost:28090/v2.0", cloudifyManager.getCloudifyUrl());
123 public void testGetCloudifyManagerNotFound() throws Exception {
124 CloudifyManager cloudifyManager = client.getCloudifyManager(UUID.randomUUID().toString());
125 Assert.assertNull(cloudifyManager);
130 public void testGetCloudSiteByClliAndAicVersionHappyPath() throws Exception {
131 CloudSite cloudSite = client.getCloudSiteByClliAndAicVersion("MDT13", "2.5");
132 Assert.assertNotNull(cloudSite);
136 public void testGetCloudSiteByClliAndAicVersionNotFound() throws Exception {
137 CloudSite cloudSite = client.getCloudSiteByClliAndAicVersion("MDT13", "232496239746328");
138 Assert.assertNull(cloudSite);
142 public void testGetServiceByID() throws Exception {
143 Service serviceByID = client.getServiceByID("5df8b6de-2083-11e7-93ae-92361f002671");
144 Assert.assertNotNull(serviceByID);
145 Assert.assertEquals("MSOTADevInfra_vSAMP10a_Service", serviceByID.getModelName());
146 Assert.assertEquals("NA", serviceByID.getServiceType());
147 Assert.assertEquals("NA", serviceByID.getServiceRole());
151 public void testGetServiceByIDNotFound() throws Exception {
152 Service serviceByID = client.getServiceByID(UUID.randomUUID().toString());
153 Assert.assertNull(serviceByID);
157 public void testGetVfModuleByModelUUID() throws Exception {
158 VfModule vfModule = client.getVfModuleByModelUUID("20c4431c-246d-11e7-93ae-92361f002671");
159 Assert.assertNotNull(vfModule);
160 Assert.assertNotNull(vfModule.getVfModuleCustomization());
161 Assert.assertEquals("78ca26d0-246d-11e7-93ae-92361f002671", vfModule.getModelInvariantUUID());
162 Assert.assertEquals("vSAMP10aDEV::base::module-0", vfModule.getModelName());
166 public void testGetVfModuleByModelUUIDNotFound() throws Exception {
167 VfModule vfModule = client.getVfModuleByModelUUID(UUID.randomUUID().toString());
168 Assert.assertNull(vfModule);
172 public void testGetVnfResourceByModelUUID() throws Exception {
173 VnfResource vnfResource = client.getVnfResourceByModelUUID("ff2ae348-214a-11e7-93ae-92361f002671");
174 Assert.assertNotNull(vnfResource);
175 Assert.assertEquals("vSAMP10a", vnfResource.getModelName());
179 public void testGetVnfResourceByModelUUIDNotFound() throws Exception {
180 VnfResource vnfResource = client.getVnfResourceByModelUUID(UUID.randomUUID().toString());
181 Assert.assertNull(vnfResource);
185 public void testGetVnfResourceCustomizationByModelCustomizationUUID() {
186 VnfResourceCustomization vnfResourceCustomization = client.getVnfResourceCustomizationByModelCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002671");
187 Assert.assertNotNull(vnfResourceCustomization);
188 Assert.assertEquals("vSAMP", vnfResourceCustomization.getNfRole());
189 Assert.assertNotNull(vnfResourceCustomization.getModelCustomizationUUID());
190 Assert.assertNotNull(vnfResourceCustomization.getVnfResources());
191 Assert.assertNotNull(vnfResourceCustomization.getVfModuleCustomizations());
192 Assert.assertEquals("vSAMP10a", vnfResourceCustomization.getVnfResources().getModelName());
197 public void testGetVnfResourceCustomizationByModelCustomizationUUINotFound() {
198 VnfResourceCustomization vnfResourceCustomization = client.getVnfResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString());
199 Assert.assertNull(vnfResourceCustomization);
203 public void testGetInstanceGroupByModelUUID() {
204 InstanceGroup instanceGroup = client.getInstanceGroupByModelUUID("0c8692ef-b9c0-435d-a738-edf31e71f38b");
205 Assert.assertNotNull(instanceGroup);
206 Assert.assertEquals("network_collection_resource_1806..NetworkCollection..0", instanceGroup.getModelName());
207 Assert.assertEquals("org.openecomp.resource.cr.NetworkCollectionResource1806", instanceGroup.getToscaNodeType().toString());
211 public void testGetVfModuleCustomizationByModelCuztomizationUUID() {
212 VfModuleCustomization vfModuleCustomization = client.getVfModuleCustomizationByModelCuztomizationUUID("cb82ffd8-252a-11e7-93ae-92361f002671");
213 Assert.assertNotNull(vfModuleCustomization);
214 Assert.assertNotNull(vfModuleCustomization.getModelCustomizationUUID());
215 Assert.assertEquals("base", vfModuleCustomization.getLabel());
219 public void testGetVfModuleCustomizationByModelCuztomizationUUIDNotFound() {
220 VfModuleCustomization vfModuleCustomization = client.getVfModuleCustomizationByModelCuztomizationUUID(UUID.randomUUID().toString());
221 Assert.assertNull(vfModuleCustomization);
225 public void testGetNetworkResourceCustomizationByModelCustomizationUUID() {
226 NetworkResourceCustomization networkResourceCustomization = client.getNetworkResourceCustomizationByModelCustomizationUUID("3bdbb104-476c-483e-9f8b-c095b3d308ac");
227 Assert.assertNotNull(networkResourceCustomization);
228 Assert.assertNotNull(networkResourceCustomization.getModelCustomizationUUID());
229 Assert.assertEquals("CONTRAIL30_GNDIRECT 9", networkResourceCustomization.getModelInstanceName());
230 Assert.assertNotNull(networkResourceCustomization.getNetworkResource());
234 public void testGetNetworkResourceCustomizationByModelCustomizationUUIDNotFound() {
235 NetworkResourceCustomization networkResourceCustomization = client.getNetworkResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString());
236 Assert.assertNull(networkResourceCustomization);
240 public void testGgetVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID() {
241 VfModuleCustomization vfModuleCustomization = client.getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID("cb82ffd8-252a-11e7-93ae-92361f002672", "20c4431c-246d-11e7-93ae-92361f002672");
242 Assert.assertNotNull(vfModuleCustomization);
243 Assert.assertNotNull(vfModuleCustomization.getModelCustomizationUUID());
244 Assert.assertNotNull(vfModuleCustomization.getVfModule());
245 Assert.assertEquals("base", vfModuleCustomization.getLabel());
249 public void testGgetVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUIDNotFound() {
250 VfModuleCustomization vfModuleCustomization = client.getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID("cb82ffd8-252a-11e7-93ae-92361f002672", UUID.randomUUID().toString());
251 Assert.assertNull(vfModuleCustomization);
255 public void testGetFirstByServiceModelUUIDAndAction() {
256 ServiceRecipe serviceRecipe = client.getFirstByServiceModelUUIDAndAction("4694a55f-58b3-4f17-92a5-796d6f5ffd0d", "createInstance");
257 Assert.assertNotNull(serviceRecipe);
258 Assert.assertNotNull(serviceRecipe.getServiceModelUUID());
259 Assert.assertNotNull(serviceRecipe.getAction());
260 Assert.assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance", serviceRecipe.getOrchestrationUri());
261 Assert.assertEquals("MSOTADevInfra aLaCarte", serviceRecipe.getDescription());
265 public void testGetFirstByServiceModelUUIDAndActionNotFound() {
266 ServiceRecipe serviceRecipe = client.getFirstByServiceModelUUIDAndAction("5df8b6de-2083-11e7-93ae-92361f002671", UUID.randomUUID().toString());
267 Assert.assertNull(serviceRecipe);
271 public void testGetFirstVnfResourceByModelInvariantUUIDAndModelVersion() {
272 VnfResource vnfResource = client.getFirstVnfResourceByModelInvariantUUIDAndModelVersion("2fff5b20-214b-11e7-93ae-92361f002671", "2.0");
273 Assert.assertNotNull(vnfResource);
274 Assert.assertNotNull(vnfResource.getModelInvariantId());
275 Assert.assertNotNull(vnfResource.getModelVersion());
276 Assert.assertNotNull(vnfResource.getHeatTemplates());
277 Assert.assertNotNull(vnfResource.getVnfResourceCustomizations());
278 Assert.assertEquals("vSAMP10a", vnfResource.getModelName());
282 public void testGetFirstVnfResourceByModelInvariantUUIDAndModelVersionNotFound() {
283 VnfResource vnfResource = client.getFirstVnfResourceByModelInvariantUUIDAndModelVersion("2fff5b20-214b-11e7-93ae-92361f002671", UUID.randomUUID().toString());
284 Assert.assertNull(vnfResource);
288 public void testGetFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources() {
289 VnfResource vnfr = new VnfResource();
290 vnfr.setModelUUID("ff2ae348-214a-11e7-93ae-92361f002671");
291 VnfResourceCustomization firstVnfResourceCustomizationByModelInstanceNameAndVnfResources = client.getFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources("vSAMP10a 1", vnfr);
292 Assert.assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources);
293 Assert.assertEquals("vSAMP", firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getNfRole());
294 Assert.assertEquals("vSAMP10a 1", firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getModelInstanceName());
295 Assert.assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVnfResources());
296 Assert.assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVfModuleCustomizations());
300 public void testGetFirstVnfRecipeByNfRoleAndAction() {
301 VnfRecipe vnfRecipe = client.getFirstVnfRecipeByNfRoleAndAction("GR-API-DEFAULT", "createInstance");
302 Assert.assertNotNull(vnfRecipe);
303 Assert.assertNotNull(vnfRecipe.getNfRole());
304 Assert.assertNotNull(vnfRecipe.getAction());
305 Assert.assertEquals("Gr api recipe to create vnf", vnfRecipe.getDescription());
306 Assert.assertEquals("/mso/async/services/WorkflowActionBB", vnfRecipe.getOrchestrationUri());
310 public void testGetFirstVnfRecipeByNfRoleAndActionNotFound() {
311 VnfRecipe vnfRecipe = client.getFirstVnfRecipeByNfRoleAndAction(UUID.randomUUID().toString(), "createInstance");
312 Assert.assertNull(vnfRecipe);
316 public void testGetFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction() {
317 VnfComponentsRecipe vnfComponentsRecipe = client.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction("20c4431c-246d-11e7-93ae-92361f002671", "volumeGroup", "createInstance");
318 Assert.assertNotNull(vnfComponentsRecipe);
319 Assert.assertNotNull(vnfComponentsRecipe.getAction());
320 Assert.assertNotNull(vnfComponentsRecipe.getVfModuleModelUUID());
321 Assert.assertNotNull(vnfComponentsRecipe.getVnfComponentType());
322 Assert.assertEquals("Gr api recipe to create volume-group", vnfComponentsRecipe.getDescription());
323 Assert.assertEquals("/mso/async/services/WorkflowActionBB", vnfComponentsRecipe.getOrchestrationUri());
329 public void testGetFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndActionNotFound() {
330 VnfComponentsRecipe vnfComponentsRecipe = client.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(UUID.randomUUID().toString(), "volumeGroup", "createInstance");
331 Assert.assertNull(vnfComponentsRecipe);
335 public void testGetFirstVnfComponentsRecipeByVnfComponentTypeAndAction() {
336 VnfComponentsRecipe vnfComponentsRecipe = client.getFirstVnfComponentsRecipeByVnfComponentTypeAndAction("volumeGroup", "createInstance");
337 Assert.assertNotNull(vnfComponentsRecipe);
338 Assert.assertNotNull(vnfComponentsRecipe.getAction());
339 Assert.assertNotNull(vnfComponentsRecipe.getVnfComponentType());
340 Assert.assertEquals("VID_DEFAULT recipe t", vnfComponentsRecipe.getDescription());
341 Assert.assertEquals("/mso/async/services/CreateVfModuleVolumeInfraV1", vnfComponentsRecipe.getOrchestrationUri());
345 public void testGetServiceByModelVersionAndModelInvariantUUID() {
346 Service service = client.getServiceByModelVersionAndModelInvariantUUID("2.0", "9647dfc4-2083-11e7-93ae-92361f002671");
347 Assert.assertNotNull(service);
348 Assert.assertNotNull(service.getModelVersion());
349 Assert.assertNotNull(service.getModelInvariantUUID());
350 Assert.assertEquals("MSOTADevInfra_vSAMP10a_Service", service.getModelName());
351 Assert.assertEquals("NA", service.getServiceRole());
355 public void testGetServiceByModelVersionAndModelInvariantUUIDNotFound() {
356 Service service = client.getServiceByModelVersionAndModelInvariantUUID("2.0", UUID.randomUUID().toString());
357 Assert.assertNull(service);
361 public void testGetVfModuleByModelInvariantUUIDAndModelVersion() {
362 VfModule vfModule = client.getVfModuleByModelInvariantUUIDAndModelVersion("78ca26d0-246d-11e7-93ae-92361f002671", "2");
363 Assert.assertNotNull(vfModule);
364 Assert.assertNotNull(vfModule.getModelVersion());
365 Assert.assertNotNull(vfModule.getModelInvariantUUID());
366 Assert.assertEquals("vSAMP10aDEV::base::module-0", vfModule.getModelName());
367 Assert.assertEquals("vSAMP10a DEV Base", vfModule.getDescription());
371 public void testGetVfModuleByModelInvariantUUIDAndModelVersionNotFound() {
372 VfModule vfModule = client.getVfModuleByModelInvariantUUIDAndModelVersion(UUID.randomUUID().toString(), "2");
373 Assert.assertNull(vfModule);
377 public void testGetServiceByModelInvariantUUIDOrderByModelVersionDesc() {
378 List<Service> serviceList = client.getServiceByModelInvariantUUIDOrderByModelVersionDesc("9647dfc4-2083-11e7-93ae-92361f002671");
379 Assert.assertFalse(serviceList.isEmpty());
380 Assert.assertEquals(2, serviceList.size());
381 Service service = serviceList.get(0);
382 Assert.assertEquals("2.0", service.getModelVersion());
386 public void testGetServiceByModelInvariantUUIDOrderByModelVersionDescNotFound() {
387 List<Service> serviceList = client.getServiceByModelInvariantUUIDOrderByModelVersionDesc(UUID.randomUUID().toString());
388 Assert.assertTrue(serviceList.isEmpty());
392 public void testGetVfModuleByModelInvariantUUIDOrderByModelVersionDesc() {
393 List<VfModule> moduleList = client.getVfModuleByModelInvariantUUIDOrderByModelVersionDesc("78ca26d0-246d-11e7-93ae-92361f002671");
394 Assert.assertFalse(moduleList.isEmpty());
395 Assert.assertEquals(2, moduleList.size());
396 VfModule module = moduleList.get(0);
397 Assert.assertEquals("vSAMP10a DEV Base",module.getDescription());
401 public void testPostCloudSite() {
402 CatalogDbClientPortChanger localClient = new CatalogDbClientPortChanger("http://localhost:" + client.wiremockPort, msoAdaptersAuth, client.wiremockPort);
403 CloudSite cloudSite = new CloudSite();
404 cloudSite.setId("MTN6");
405 cloudSite.setClli("TESTCLLI");
406 cloudSite.setRegionId("regionId");
407 cloudSite.setCloudVersion("VERSION");
408 cloudSite.setPlatform("PLATFORM");
410 CloudIdentity cloudIdentity = new CloudIdentity();
411 cloudIdentity.setId("RANDOMID");
412 cloudIdentity.setIdentityUrl("URL");
413 cloudIdentity.setMsoId("MSO_ID");
414 cloudIdentity.setMsoPass("MSO_PASS");
415 cloudIdentity.setAdminTenant("ADMIN_TENANT");
416 cloudIdentity.setMemberRole("ROLE");
417 cloudIdentity.setIdentityServerType(ServerType.KEYSTONE);
418 cloudIdentity.setIdentityAuthenticationType(AuthenticationType.RACKSPACE_APIKEY);
419 cloudSite.setIdentityService(cloudIdentity);
420 localClient.postCloudSite(cloudSite);
421 CloudSite getCloudSite = this.client.getCloudSite("MTN6");
422 Assert.assertNotNull(getCloudSite);
423 Assert.assertNotNull(getCloudSite.getIdentityService());
424 Assert.assertEquals("TESTCLLI", getCloudSite.getClli());
425 Assert.assertEquals("regionId", getCloudSite.getRegionId());
426 Assert.assertEquals("RANDOMID", getCloudSite.getIdentityServiceId());
429 public void testGetServiceByModelName() {
430 Service service = client.getServiceByModelName("MSOTADevInfra_Test_Service");
431 Assert.assertNotNull(service);
432 Assert.assertNotNull(service.getModelVersion());
433 Assert.assertNotNull(service.getModelInvariantUUID());
434 Assert.assertEquals("MSOTADevInfra_Test_Service", service.getModelName());
435 Assert.assertEquals("NA", service.getServiceRole());
439 public void testGetServiceByModelNameNotFound() {
440 Service service = client.getServiceByModelName("Not_Found");
441 Assert.assertNull(service);
445 public void testGetServiceByModelUUID() {
446 Service service = client.getServiceByModelUUID("5df8b6de-2083-11e7-93ae-92361f002679");
447 Assert.assertNotNull(service);
448 Assert.assertNotNull(service.getModelVersion());
449 Assert.assertNotNull(service.getModelInvariantUUID());
450 Assert.assertEquals("5df8b6de-2083-11e7-93ae-92361f002679", service.getModelUUID());
451 Assert.assertEquals("NA", service.getServiceRole());
455 public void testGetServiceByModelUUIDNotFound() {
456 Service service = client.getServiceByModelUUID("Not_Found");
457 Assert.assertNull(service);
461 public void testGetNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(){
462 NorthBoundRequest northBoundRequest = new NorthBoundRequest();
463 northBoundRequest.setAction("createService");
464 northBoundRequest.setRequestScope("service");
465 northBoundRequest.setIsAlacarte(true);
466 northBoundRequest.setCloudOwner("my-custom-cloud-owner");
467 client.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner("createService", "service", true, "my-custom-cloud-owner");
468 Assert.assertNotNull(northBoundRequest);
469 Assert.assertEquals("createService",northBoundRequest.getAction());
470 Assert.assertEquals("service",northBoundRequest.getRequestScope());
471 Assert.assertEquals(true,northBoundRequest.getIsAlacarte() );
472 Assert.assertEquals("my-custom-cloud-owner", northBoundRequest.getCloudOwner());
476 public void testFindServiceRecipeByActionAndServiceModelUUID() {
477 ServiceRecipe serviceRecipe = client.findServiceRecipeByActionAndServiceModelUUID("createInstance","4694a55f-58b3-4f17-92a5-796d6f5ffd0d" );
478 Assert.assertNotNull(serviceRecipe);
479 Assert.assertNotNull(serviceRecipe.getServiceModelUUID());
480 Assert.assertNotNull(serviceRecipe.getAction());
481 Assert.assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance", serviceRecipe.getOrchestrationUri());
482 Assert.assertEquals("MSOTADevInfra aLaCarte", serviceRecipe.getDescription());
486 public void testFindServiceRecipeByActionAndServiceModelUUIDNotFound() {
487 ServiceRecipe serviceRecipe = client.findServiceRecipeByActionAndServiceModelUUID("not_found","5df8b6de-2083-11e7-93ae-test" );
488 Assert.assertNull(serviceRecipe);
492 public void testFindExternalToInternalServiceByServiceName() {
493 ExternalServiceToInternalService externalServiceToInternalService = client.findExternalToInternalServiceByServiceName("MySpecialServiceName");
494 Assert.assertNotNull(externalServiceToInternalService);
495 Assert.assertNotNull(externalServiceToInternalService.getServiceName());
496 Assert.assertNotNull(externalServiceToInternalService.getServiceModelUUID());
497 Assert.assertEquals("MySpecialServiceName", externalServiceToInternalService.getServiceName());
501 public void testFindExternalToInternalServiceByServiceNameNotFound() {
502 ExternalServiceToInternalService externalServiceToInternalService = client.findExternalToInternalServiceByServiceName("Not_Found");
503 Assert.assertNull(externalServiceToInternalService);