2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2020 Telecom Italia
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.bpmn.infrastructure.scripts
23 import com.fasterxml.jackson.databind.ObjectMapper
24 import org.junit.Before
26 import org.mockito.Mockito
27 import org.onap.aai.domain.yang.*
28 import org.onap.aaiclient.client.aai.AAIObjectType
29 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
30 import org.onap.aaiclient.client.aai.entities.Relationships
31 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
32 import org.onap.aaiclient.client.aai.entities.uri.AAISimpleUri
33 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
34 import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
35 import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
36 import org.onap.aaiclient.client.aai.entities.uri.ServiceInstanceUri
37 import org.onap.so.bpmn.common.scripts.MsoGroovyTest
38 import org.onap.so.serviceinstancebeans.RequestDetails
40 import static org.junit.Assert.assertNotNull
41 import static org.junit.Assert.assertTrue
42 import static org.mockito.Mockito.*
44 class DoCommonCoreNSSITest extends MsoGroovyTest {
46 void init() throws IOException {
47 super.init("DoCommonCoreNSSITest")
52 void testPreProcessRequest() {
54 currentNSSI.put("nssiId","5G-999")
55 when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
57 DoCommonCoreNSSI dcnssi = new DoCommonCoreNSSI()
58 dcnssi.preProcessRequest(mockExecution)
59 Mockito.verify(mockExecution,times(1)).getVariable("currentNSSI")
64 void testGetNetworkServiceInstance() {
66 currentNSSI.put("nssiId","5G-999")
68 when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
70 AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment("5G-999"))
71 AAIResourceUri networkServiceInstanceUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment("NS-777"))
73 ServiceInstance nssi = new ServiceInstance()
74 nssi.setServiceInstanceId("5G-999")
76 ServiceInstance networkServiceInstance = new ServiceInstance()
77 networkServiceInstance.setServiceInstanceId("NS-777")
78 networkServiceInstance.setServiceRole("Network Service")
80 Optional<ServiceInstance> nssiOpt = Optional.of(nssi)
81 Optional<ServiceInstance> networkServiceInstaneOpt = Optional.of(networkServiceInstance)
83 DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class)
84 when(spy.getAAIClient()).thenReturn(client)
86 when(client.get(ServiceInstance.class, nssiUri)).thenReturn(nssiOpt)
88 //String json = FileUtil.readResourceFile("__files/AAI/ServiceInstanceWithAR.json")
89 AAIResultWrapper wrapperMock = mock(AAIResultWrapper.class) //new AAIResultWrapper(json)
90 Relationships rsMock = mock(Relationships.class)
91 Optional<Relationships> orsMock = Optional.of(rsMock)
92 List<AAIResourceUri> arus = new ArrayList<>()
93 AAIResourceUri aru = new ServiceInstanceUri(networkServiceInstanceUri)
96 when(client.get(nssiUri)).thenReturn(wrapperMock)
97 when(wrapperMock.getRelationships()).thenReturn(orsMock)
99 when(rsMockgetRelatedUris(Types.SERVICE_INSTANCE)).thenReturn(arus)
100 when(client.get(ServiceInstance.class, aru)).thenReturn(networkServiceInstaneOpt)
102 spy.getNetworkServiceInstance(mockExecution)
104 assertTrue("Either NSSI doesn't exist or unexpected NSSI Service Instance ID",
105 currentNSSI.get("nssi") != null && ((ServiceInstance)currentNSSI.get("nssi")).getServiceInstanceId().equals(nssi.getServiceInstanceId()))
107 assertTrue("Either Network Service Instance doesn't exist or unexpected Network Service Instance ID",
108 currentNSSI.get("networkServiceInstance") != null && ((ServiceInstance)currentNSSI.get("networkServiceInstance")).getServiceInstanceId().equals(networkServiceInstance.getServiceInstanceId()))
110 assertNotNull("networkServiceInstanceUri doesn't exist", currentNSSI.get("networkServiceInstanceUri"))
115 void getConstituteVNFFromNetworkServiceInst() {
116 def currentNSSI = [:]
118 when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
120 DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class)
121 when(spy.getAAIClient()).thenReturn(client)
123 ServiceInstance networkServiceInstance = new ServiceInstance()
124 networkServiceInstance.setServiceInstanceId("NS-777")
125 networkServiceInstance.setServiceRole("Network Service")
127 GenericVnf genericVNF = new GenericVnf()
128 genericVNF.setVnfId("VNF-1")
130 AAIResourceUri networkServiceInstanceUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(networkServiceInstance.getServiceInstanceId()))
132 Optional<GenericVnf> genericVnfOpt = Optional.of(genericVNF)
133 AAIResourceUri genericVNFUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVNF.getVnfId()))
135 currentNSSI.put("networkServiceInstanceUri", networkServiceInstanceUri)
136 currentNSSI.put("networkServiceInstance", networkServiceInstance)
138 AAIResultWrapper wrapperMock = mock(AAIResultWrapper.class) //new AAIResultWrapper(json)
139 Relationships rsMock = mock(Relationships.class)
140 Optional<Relationships> orsMock = Optional.of(rsMock)
141 List<AAIResourceUri> arus = new ArrayList<>()
142 AAIResourceUri aru = new AAISimpleUri(genericVNFUri)
145 when(client.get(networkServiceInstanceUri)).thenReturn(wrapperMock)
146 when(wrapperMock.getRelationships()).thenReturn(orsMock)
148 when(rsMockgetRelatedUris(Types.GENERIC_VNF)).thenReturn(arus)
149 when(client.get(GenericVnf.class, genericVNFUri)).thenReturn(genericVnfOpt)
151 spy.getConstituteVNFFromNetworkServiceInst(mockExecution)
153 assertNotNull("constituteVnfUri doesn't exist", currentNSSI.get("constituteVnfUri"))
155 assertTrue("Either Constitute VNF doesn't exist or unexpected VNF ID",
156 currentNSSI.get("constituteVnf") != null && ((GenericVnf)currentNSSI.get("constituteVnf")).getVnfId().equals(genericVNF.getVnfId()))
161 void testGetNSSIAssociatedProfiles() {
162 def currentNSSI = [:]
163 when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
165 ServiceInstance nssi = new ServiceInstance()
166 nssi.setServiceInstanceId("5G-999")
168 SliceProfiles sliceProfiles = new SliceProfiles()
170 List<SliceProfile> slProfiles = sliceProfiles.getSliceProfile()
171 slProfiles.add(new SliceProfile())
172 slProfiles.add(new SliceProfile())
174 nssi.setSliceProfiles(sliceProfiles)
175 currentNSSI.put("nssi", nssi)
177 DoCommonCoreNSSI obj = new DoCommonCoreNSSI()
178 obj.getNSSIAssociatedProfiles(mockExecution)
180 List<SliceProfile> associatedProfiles = (List<SliceProfile>)currentNSSI.get("associatedProfiles")
181 assertTrue("Either associatedProfiles doesn't exist or size is incorrect", (associatedProfiles != null && associatedProfiles.size() == 2))
186 void testInvokePUTServiceInstance() {
187 def currentNSSI = [:]
189 ServiceInstance networkServiceInstance = new ServiceInstance()
190 networkServiceInstance.setServiceInstanceId("NS-777")
191 networkServiceInstance.setServiceRole("Network Service")
193 GenericVnf constituteVnf = new GenericVnf()
194 constituteVnf.setVnfId("VNF-1")
196 when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
198 currentNSSI.put("networkServiceInstance", networkServiceInstance)
199 currentNSSI.put("constituteVnf", constituteVnf)
201 when(mockExecution.getVariable("mso.infra.endpoint.url")).thenReturn("http://mso.onap:8088")
202 when(mockExecution.getVariable("mso.msoKey")).thenReturn("mso.msoKey")
203 when(mockExecution.getVariable("mso.infra.endpoint.auth")).thenReturn("mso.infra.endpoint.auth")
205 DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class)
206 when(spy.getAAIClient()).thenReturn(client)
208 when(spy.encryptBasicAuth("mso.infra.endpoint.auth", "mso.msoKey")).thenReturn("auth-value")
210 String authHeaderResponse = "auth-header"
212 when(spy.getAuthHeader(mockExecution, "auth-value", "mso.msoKey")).thenReturn(authHeaderResponse)
214 String urlString = String.format("http://mso.onap:8088/serviceInstantiation/v7/serviceInstances/%s/vnfs/%s", networkServiceInstance.getServiceInstanceId(), constituteVnf.getVnfId())
216 String callPUTServiceInstanceResponse = "put"
218 RequestDetails requestDetails = new RequestDetails()
219 ObjectMapper mapper = new ObjectMapper()
220 String requestDetailsStr = mapper.writeValueAsString(requestDetails)
222 when(spy.prepareRequestDetails(mockExecution)).thenReturn(requestDetailsStr)
224 when(spy.callPUTServiceInstance(urlString, "auth-header", requestDetailsStr)).thenReturn(callPUTServiceInstanceResponse)
226 spy.invokePUTServiceInstance(mockExecution)
231 void testRemoveSPAssociationWithNSSI() {
232 def currentNSSI = [:]
234 when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
236 String nssiId = "5G-999"
237 currentNSSI.put("nssiId", nssiId)
238 ServiceInstance nssi = new ServiceInstance()
239 nssi.setServiceInstanceId(nssiId)
240 nssi.setSliceProfiles(new SliceProfiles())
242 currentNSSI.put("nssi", nssi)
244 AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId))
246 DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class)
248 when(spy.getAAIClient()).thenReturn(client)
250 String theSNSSAI = "theS-NSSAI"
251 currentNSSI.put("S-NSSAI", theSNSSAI)
253 List<SliceProfile> associatedProfiles = nssi.getSliceProfiles().getSliceProfile()
255 SliceProfile sliceProfile1 = new SliceProfile()
256 sliceProfile1.setSNssai("snssai1")
258 SliceProfile sliceProfile2 = new SliceProfile()
259 sliceProfile2.setSNssai(theSNSSAI)
261 SliceProfile sliceProfile3 = new SliceProfile()
262 sliceProfile3.setSNssai("snssai3")
264 associatedProfiles.add(sliceProfile1)
265 associatedProfiles.add(sliceProfile2)
266 associatedProfiles.add(sliceProfile3)
268 int sizeBefore = associatedProfiles.size()
270 doNothing().when(client).update(nssiUri, nssi)
272 spy.removeSPAssociationWithNSSI(mockExecution)
274 assertTrue("Association between slice profile and NSSI wasn't removed", ((ServiceInstance)currentNSSI.get("nssi")).getSliceProfiles().getSliceProfile().size() == (sizeBefore - 1))
279 void testDeleteSliceProfileInstance() {
280 def currentNSSI = [:]
282 when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
284 String globalSubscriberId = "global-id"
285 String serviceType = "service"
286 String nssiId = "5G-999"
288 currentNSSI.put("globalSubscriberId", globalSubscriberId)
289 currentNSSI.put("serviceType", serviceType)
290 currentNSSI.put("nssiId", nssiId)
292 String theSNSSAI = "theS-NSSAI"
294 SliceProfile sliceProfile = new SliceProfile()
295 sliceProfile.setSNssai(theSNSSAI)
296 sliceProfile.setProfileId("prof-id")
298 AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId))
300 currentNSSI.put("sliceProfileS-NSSAI", sliceProfile)
302 DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class)
304 when(spy.getAAIClient()).thenReturn(client)
306 doNothing().when(client).delete(nssiUri)
308 spy.deleteSliceProfileInstance(mockExecution)
314 void testUpdateServiceOperationStatus() {
315 def currentNSSI = [:]
317 when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
319 String nssiId = "5G-999"
321 currentNSSI.put("nssiId", nssiId)
322 currentNSSI.put("e2eServiceInstanceId", "e2eServiceInstanceId")
323 currentNSSI.put("operationId", "operationId")
324 currentNSSI.put("operationType", "operationType")
326 DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class)
328 spy.updateServiceOperationStatus(mockExecution)
334 void testPrepareRequestDetails() {
335 def currentNSSI = [:]
337 when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
339 ServiceInstance networkServiceInstance = new ServiceInstance()
340 networkServiceInstance.setServiceInstanceId("NS-777")
341 networkServiceInstance.setServiceRole("Network Service")
342 networkServiceInstance.setModelInvariantId("model-invariant-id")
343 networkServiceInstance.setServiceInstanceName("service-instance-name")
345 ServiceInstance nssi = new ServiceInstance()
346 nssi.setServiceInstanceId("5G-999")
347 nssi.setOrchestrationStatus("orchestration-status")
349 AAIResourceUri networkServiceInstanceUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(networkServiceInstance.getServiceInstanceId()))
351 AAIResourceUri cloudRegionAAIUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion("cloud-owner", "cloud-region-id"))
353 currentNSSI.put("networkServiceInstanceUri", networkServiceInstanceUri)
355 currentNSSI.put("networkServiceInstance", networkServiceInstance)
357 currentNSSI.put("globalSubscriberId", "globalSubscriberId")
359 currentNSSI.put("subscriberName", "subscriber-name")
361 currentNSSI.put("serviceId", "service-id")
363 currentNSSI.put("nssi", nssi)
365 List<SliceProfile> associatedProfiles = new ArrayList<>()
366 SliceProfile sliceProfile1 = new SliceProfile()
367 sliceProfile1.setSNssai("snssai1")
369 SliceProfile sliceProfile2 = new SliceProfile()
370 sliceProfile2.setSNssai("snssai2")
372 associatedProfiles.add(sliceProfile1)
373 associatedProfiles.add(sliceProfile2)
375 List<String> snssais = new ArrayList<>()
376 snssais.add(sliceProfile1.getSNssai())
377 snssais.add(sliceProfile2.getSNssai())
379 currentNSSI.put("S-NSSAIs", snssais)
382 ServiceSubscription serviceSubscription = new ServiceSubscription()
383 serviceSubscription.setServiceType("service-type")
385 currentNSSI.put("serviceSubscription", serviceSubscription)
387 GenericVnf genericVnf = new GenericVnf()
388 genericVnf.setServiceId("service-id")
389 genericVnf.setVnfName("vnf-name")
390 genericVnf.setModelInvariantId("model-invariant-id")
391 genericVnf.setModelCustomizationId("model-customization-id")
392 genericVnf.setVnfName("vnf-name")
393 genericVnf.setVnfId("vnf-id")
395 VfModule vfModule = new VfModule()
396 vfModule.setModelInvariantId("model-invariant-id")
397 vfModule.setModelCustomizationId("model-customization-id")
398 vfModule.setModelVersionId("model-version-id")
399 vfModule.setVfModuleName("vf-module-name")
401 VfModules vfModules = new VfModules()
402 vfModules.getVfModule().add(vfModule)
403 genericVnf.setVfModules(vfModules)
405 currentNSSI.put("constituteVnf", genericVnf)
407 AAIResourceUri constituteVNFURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnf.getVnfId()))
409 currentNSSI.put("constituteVnfUri", constituteVNFURI)
411 DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class)
413 when(spy.getAAIClient()).thenReturn(client)
415 prepareModelVer(networkServiceInstance)
417 //prepareSubscriberInfo(networkServiceInstanceUri)
419 prepareCloudConfiguration(constituteVNFURI, cloudRegionAAIUri)
421 prepareModelVer(genericVnf)
423 prepareModelVer(vfModule)
425 prepareOwningEntity(networkServiceInstanceUri)
427 prepareProject(cloudRegionAAIUri)
429 String requestDetails = spy.prepareRequestDetails(mockExecution)
434 void prepareProject(AAIResourceUri cloudRegionAAIUri) {
435 Project project = new Project()
436 project.setProjectName("project-name")
438 AAIResultWrapper wrapperMock = mock(AAIResultWrapper.class)
439 Relationships rsMock = mock(Relationships.class)
440 Optional<Relationships> orsMock = Optional.of(rsMock)
442 when(client.get(cloudRegionAAIUri)).thenReturn(wrapperMock)
443 when(wrapperMock.getRelationships()).thenReturn(orsMock)
445 List<AAIResourceUri> arus = new ArrayList<>()
446 AAIResourceUri aru = new AAISimpleUri(cloudRegionAAIUri)
449 when(rsMockgetRelatedUris(Types.PROJECT)).thenReturn(arus)
451 Optional<Project> projectOpt = Optional.of(project)
453 when(client.get(Project.class, aru)).thenReturn(projectOpt)
457 void prepareOwningEntity(AAIResourceUri networkServiceInstanceUri) {
458 OwningEntity owningEntity = new OwningEntity()
460 owningEntity.setOwningEntityId("owning-entity-id")
461 owningEntity.setOwningEntityName("owning-entity-name")
463 AAIResultWrapper wrapperMock = mock(AAIResultWrapper.class)
465 Relationships rsMock = mock(Relationships.class)
466 Optional<Relationships> orsMock = Optional.of(rsMock)
468 when(client.get(networkServiceInstanceUri)).thenReturn(wrapperMock)
469 when(wrapperMock.getRelationships()).thenReturn(orsMock)
471 List<AAIResourceUri> arus = new ArrayList<>()
472 AAIResourceUri aru = new AAISimpleUri(networkServiceInstanceUri)
475 when(rsMockgetRelatedUris(Types.OWNING_ENTITY)).thenReturn(arus)
477 Optional<OwningEntity> owningEntityOpt = Optional.of(owningEntity)
479 when(client.get(OwningEntity.class, aru)).thenReturn(owningEntityOpt)
484 void prepareCloudConfiguration(AAIResourceUri constituteVNFURI, cloudRegionAAIUri) {
485 AAIResultWrapper wrapperMock = mock(AAIResultWrapper.class)
487 Relationships rsMock = mock(Relationships.class)
488 Optional<Relationships> orsMock = Optional.of(rsMock)
490 when(client.get(constituteVNFURI)).thenReturn(wrapperMock)
491 when(wrapperMock.getRelationships()).thenReturn(orsMock)
493 List<AAIResourceUri> arus = new ArrayList<>()
494 AAIResourceUri aru = new AAISimpleUri(cloudRegionAAIUri)
497 when(rsMockgetRelatedUris(Types.CLOUD_REGION)).thenReturn(arus)
499 CloudRegion cloudRegion = new CloudRegion()
500 cloudRegion.setCloudRegionId("cloud-region-id")
501 cloudRegion.setCloudOwner("cloud-owner")
502 Tenant tenant = new Tenant()
503 tenant.setTenantId("tenant-id")
505 Tenants tenants = new Tenants()
506 tenants.getTenant().add(tenant)
507 cloudRegion.setTenants(tenants)
508 Optional<CloudRegion> cloudRegionOpt = Optional.of(cloudRegion)
510 when(client.get(CloudRegion.class, aru)).thenReturn(cloudRegionOpt)
514 void prepareSubscriberInfo( AAIResourceUri networkServiceInstanceUri) {
515 AAIResultWrapper wrapperMock = mock(AAIResultWrapper.class)
517 Relationships rsMock = mock(Relationships.class)
518 Optional<Relationships> orsMock = Optional.of(rsMock)
520 when(client.get(networkServiceInstanceUri)).thenReturn(wrapperMock)
521 when(wrapperMock.getRelationships()).thenReturn(orsMock)
523 AAIResourceUri serviceSubscriptionUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("global-customer-id").serviceSubscription("service-type"))
525 AAIResourceUri customerUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("global-customer-id"))
526 List<AAIResourceUri> arus = new ArrayList<>()
528 arus.add(serviceSubscriptionUri)
530 when(rsMockgetRelatedUris(Types.SERVICE_SUBSCRIPTION)).thenReturn(arus)
532 ServiceSubscription serviceSubscription = new ServiceSubscription()
533 serviceSubscription.setServiceType("service-type")
534 Optional<ServiceSubscription> serviceSubscriptionOpt = Optional.of(serviceSubscription)
536 when(client.get(ServiceSubscription.class, serviceSubscriptionUri)).thenReturn(serviceSubscriptionOpt)
538 when(client.get(networkServiceInstanceUri)).thenReturn(wrapperMock)
540 when(rsMockgetRelatedUris(Types.CUSTOMER)).thenReturn(arus)
542 Customer customer = new Customer()
543 customer.setSubscriberName("subscriber-name")
544 Optional<Customer> customerOpt = Optional.of(customer)
546 when(client.get(Customer.class, customerUri)).thenReturn(customerOpt)
550 void prepareModelVer(ServiceInstance networkServiceInstance) {
551 ModelVer modelVer = new ModelVer()
552 modelVer.setModelVersionId("model-version-id")
553 modelVer.setModelName("model-name")
554 modelVer.setModelVersion("model-version")
556 Optional<ModelVer> modelVerOpt = Optional.of(modelVer)
558 AAIResourceUri modelVerUrl = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.serviceDesignAndCreation().model(networkServiceInstance.getModelInvariantId()).modelVer(networkServiceInstance.getModelVersionId()))
559 when(client.get(ModelVer.class, modelVerUrl)).thenReturn(modelVerOpt)
562 void prepareModelVer(GenericVnf genericVnf) {
563 ModelVer modelVer = new ModelVer()
564 modelVer.setModelVersionId("model-version-id")
565 modelVer.setModelName("model-name")
566 modelVer.setModelVersion("model-version")
568 Optional<ModelVer> modelVerOpt = Optional.of(modelVer)
570 AAIResourceUri modelVerUrl = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.serviceDesignAndCreation().model(genericVnf.getModelInvariantId()).modelVer(genericVnf.getModelVersionId()))
571 when(client.get(ModelVer.class, modelVerUrl)).thenReturn(modelVerOpt)
574 void prepareModelVer(VfModule vfModule) {
575 ModelVer modelVer = new ModelVer()
576 modelVer.setModelVersionId("model-version-id")
577 modelVer.setModelName("model-name")
578 modelVer.setModelVersion("model-version")
580 Optional<ModelVer> modelVerOpt = Optional.of(modelVer)
582 AAIResourceUri modelVerUrl = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.serviceDesignAndCreation().model(vfModule.getModelInvariantId()).modelVer(vfModule.getModelVersionId()))
583 when(client.get(ModelVer.class, modelVerUrl)).thenReturn(modelVerOpt)