2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 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.openecomp.sdc.vendorsoftwareproduct.impl;
23 import org.mockito.ArgumentCaptor;
24 import org.mockito.Captor;
25 import org.mockito.InjectMocks;
26 import org.mockito.Mock;
27 import org.mockito.MockitoAnnotations;
28 import org.mockito.Spy;
29 import org.openecomp.core.enrichment.factory.EnrichmentManagerFactory;
30 import org.openecomp.core.factory.impl.AbstractFactoryBase;
31 import org.openecomp.core.model.dao.EnrichedServiceModelDao;
32 import org.openecomp.core.model.dao.ServiceModelDao;
33 import org.openecomp.core.model.types.ServiceElement;
34 import org.openecomp.core.utilities.file.FileContentHandler;
35 import org.openecomp.core.utilities.file.FileUtils;
36 import org.openecomp.sdc.activityLog.ActivityLogManager;
37 import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
38 import org.openecomp.sdc.common.errors.CoreException;
39 import org.openecomp.sdc.common.errors.ErrorCategory;
40 import org.openecomp.sdc.common.errors.ErrorCode;
41 import org.openecomp.sdc.common.errors.Messages;
42 import org.openecomp.sdc.common.errors.ValidationErrorBuilder;
43 import org.openecomp.sdc.healing.api.HealingManager;
44 import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
45 import org.openecomp.sdc.tosca.datatypes.model.CapabilityDefinition;
46 import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade;
47 import org.openecomp.sdc.vendorlicense.licenseartifacts.VendorLicenseArtifactsService;
48 import org.openecomp.sdc.vendorsoftwareproduct.ManualVspToscaManager;
49 import org.openecomp.sdc.vendorsoftwareproduct.MonitoringUploadsManager;
50 import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManager;
51 import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
52 import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao;
53 import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
54 import org.openecomp.sdc.vendorsoftwareproduct.dao.PackageInfoDao;
55 import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
56 import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
57 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
58 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity;
59 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
60 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.PackageInfo;
61 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadDataEntity;
62 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
63 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspQuestionnaireEntity;
64 import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes;
65 import org.openecomp.sdc.vendorsoftwareproduct.impl.mock.EnrichmentManagerFactoryImpl;
66 import org.openecomp.sdc.vendorsoftwareproduct.informationArtifact.InformationArtifactGenerator;
67 import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
68 import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
69 import org.openecomp.sdc.vendorsoftwareproduct.types.ValidationResponse;
70 import org.openecomp.sdc.vendorsoftwareproduct.types.VersionedVendorSoftwareProductInfo;
71 import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor;
72 import org.openecomp.sdc.versioning.VersioningManager;
73 import org.openecomp.sdc.versioning.dao.types.Version;
74 import org.openecomp.sdc.versioning.dao.types.VersionStatus;
75 import org.openecomp.sdc.versioning.errors.EditOnEntityLockedByOtherErrorBuilder;
76 import org.openecomp.sdc.versioning.errors.EntityNotExistErrorBuilder;
77 import org.openecomp.sdc.versioning.types.VersionInfo;
78 import org.openecomp.sdc.versioning.types.VersionableEntityAction;
79 import org.testng.Assert;
80 import org.testng.annotations.BeforeMethod;
81 import org.testng.annotations.Test;
84 import java.io.FileInputStream;
85 import java.io.IOException;
86 import java.io.InputStream;
88 import java.nio.ByteBuffer;
89 import java.util.ArrayList;
90 import java.util.Arrays;
91 import java.util.Collections;
92 import java.util.HashMap;
93 import java.util.List;
95 import java.util.stream.Collectors;
96 import java.util.zip.ZipEntry;
97 import java.util.zip.ZipInputStream;
99 import static org.mockito.Matchers.any;
100 import static org.mockito.Matchers.anyObject;
101 import static org.mockito.Matchers.eq;
102 import static org.mockito.Mockito.doNothing;
103 import static org.mockito.Mockito.doReturn;
104 import static org.mockito.Mockito.doThrow;
105 import static org.mockito.Mockito.never;
106 import static org.mockito.Mockito.verify;
109 public class VendorSoftwareProductManagerImplTest {
110 private static final String INVALID_VERSION_MSG = "Invalid requested version.";
112 private static String VSP_ID = "vspId";
113 private static String VERSION_ID = "versionId";
114 public static final Version VERSION01 = new Version(0, 1);
115 private static final Version VERSION10 = new Version(1, 0);
116 private static final String USER1 = "vspTestUser1";
117 private static final String USER2 = "vspTestUser2";
118 private static final String USER3 = "vspTestUser3";
119 private static String id006 = null;
120 private static String id007 = null;
123 private VersioningManager versioningManagerMock;
125 private VendorSoftwareProductDao vendorSoftwareProductDaoMock; // todo get rid of
127 private OrchestrationTemplateDao orchestrationTemplateDataDaoMock;
129 private VendorLicenseFacade vendorLicenseFacadeMock;
131 private ServiceModelDao<ToscaServiceModel, ServiceElement> serviceModelDaoMock;
133 private EnrichedServiceModelDao<ToscaServiceModel, ServiceElement> enrichedServiceModelDaoMock;
135 private HealingManager healingManagerMock;
137 private VendorLicenseArtifactsService licenseArtifactsServiceMock;
139 private CompositionEntityDataManager compositionEntityDataManagerMock;
141 private InformationArtifactGenerator informationArtifactGeneratorMock;
143 private ActivityLogManager activityLogManagerMock;
145 private PackageInfoDao packageInfoDao;
147 private VendorSoftwareProductInfoDao vspInfoDaoMock;
149 private ManualVspToscaManager manualVspToscaManager;
151 private DeploymentFlavorDao deploymentFlavorDaoMock;
156 private VendorSoftwareProductManagerImpl vendorSoftwareProductManager;
158 private OrchestrationTemplateCandidateManager candidateManager;
159 private MonitoringUploadsManager monitoringUploadsManager;
162 private ArgumentCaptor<ActivityLogEntity> activityLogEntityArg;
165 public void setUp() throws Exception {
166 MockitoAnnotations.initMocks(this);
170 public void testListWhenNone() {
171 doReturn(new HashMap<>()).when(versioningManagerMock).listEntitiesVersionInfo
172 (VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, USER1,
173 VersionableEntityAction.Read);
174 List<VersionedVendorSoftwareProductInfo> vsps =
175 vendorSoftwareProductManager.listVsps(null, USER1);
176 Assert.assertEquals(vsps.size(), 0);
180 public void testList() {
181 String vsp1id = "vsp1_id";
182 String vsp2id = "vsp2_id";
183 Map<String, VersionInfo> vspsTobeReturned = new HashMap<>();
185 VersionInfo versionInfo1 = new VersionInfo();
186 versionInfo1.setActiveVersion(VERSION01);
187 vspsTobeReturned.put(vsp1id, versionInfo1);
189 VersionInfo versionInfo2 = new VersionInfo();
190 versionInfo2.setActiveVersion(VERSION10);
191 vspsTobeReturned.put(vsp2id, versionInfo2);
193 doReturn(vspsTobeReturned).when(versioningManagerMock).listEntitiesVersionInfo
194 (VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, USER1,
195 VersionableEntityAction.Read);
197 VspDetails vsp1 = new VspDetails(vsp1id, VERSION01);
198 vsp1.setWritetimeMicroSeconds(8L);
199 doReturn(vsp1).when(vspInfoDaoMock)
200 .get(any(VspDetails.class));
202 List<VersionedVendorSoftwareProductInfo> vsps =
203 vendorSoftwareProductManager.listVsps(null, USER1);
204 Assert.assertEquals(vsps.size(), 2);
208 public void testListFinalsWhenNone() {
209 String vsp1id = "vsp1_id";
210 String vsp2id = "vsp2_id";
211 Map<String, VersionInfo> vspsTobeReturned = new HashMap<>();
213 VersionInfo versionInfo1 = new VersionInfo();
214 versionInfo1.setActiveVersion(VERSION01);
215 vspsTobeReturned.put(vsp1id, versionInfo1);
217 VersionInfo versionInfo2 = new VersionInfo();
218 versionInfo2.setActiveVersion(VERSION10);
219 vspsTobeReturned.put(vsp2id, versionInfo2);
221 doReturn(vspsTobeReturned).when(versioningManagerMock).listEntitiesVersionInfo
222 (VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, USER1,
223 VersionableEntityAction.Read);
225 List<VersionedVendorSoftwareProductInfo> vsps =
226 vendorSoftwareProductManager.listVsps(VersionStatus.Final.name(), USER1);
227 Assert.assertEquals(vsps.size(), 0);
231 public void testListFinals() {
232 String vsp1id = "vsp1_id";
233 String vsp2id = "vsp2_id";
234 Map<String, VersionInfo> vspsTobeReturned = new HashMap<>();
236 VersionInfo versionInfo1 = new VersionInfo();
237 versionInfo1.setActiveVersion(VERSION01);
238 vspsTobeReturned.put(vsp1id, versionInfo1);
240 VersionInfo versionInfo2 = new VersionInfo();
241 versionInfo2.setActiveVersion(new Version(1, 3));
242 versionInfo2.setLatestFinalVersion(VERSION10);
243 vspsTobeReturned.put(vsp2id, versionInfo2);
245 doReturn(vspsTobeReturned).when(versioningManagerMock).listEntitiesVersionInfo
246 (VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, USER1,
247 VersionableEntityAction.Read);
249 VspDetails vsp2 = new VspDetails(vsp2id, VERSION10);
250 vsp2.setWritetimeMicroSeconds(8L);
251 doReturn(vsp2).when(vspInfoDaoMock)
252 .get(any(VspDetails.class));
254 List<VersionedVendorSoftwareProductInfo> vsps =
255 vendorSoftwareProductManager.listVsps(VersionStatus.Final.name(), USER1);
256 Assert.assertEquals(vsps.size(), 1);
259 @Test(expectedExceptions = CoreException.class)
260 public void testCreateWithExistingName_negative() {
261 doThrow(new CoreException(
262 new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION).build()))
263 .when(vendorSoftwareProductManager).validateUniqueName("Vsp1");
264 VspDetails expectedVsp =
265 createVspDetails(null, null, "Vsp1", "Test-vsp", "vendorName", "vlm1Id", "icon",
266 "category", "subCategory", "123", null);
268 vendorSoftwareProductManager.createVsp(expectedVsp, USER1);
272 public void testCreate() {
273 doNothing().when(vendorSoftwareProductManager).validateUniqueName("Vsp1");
274 doNothing().when(vendorSoftwareProductManager).createUniqueName("Vsp1");
275 doReturn(VERSION01).when(versioningManagerMock).create(anyObject(), anyObject(), anyObject());
277 .when(vendorSoftwareProductManager).getVspQuestionnaireSchema(anyObject());
279 VspDetails vspToCreate =
280 createVspDetails(null, null, "Vsp1", "Test-vsp", "vendorName", "vlm1Id", "icon",
281 "category", "subCategory", "123", null);
283 VspDetails vsp = vendorSoftwareProductManager.createVsp(vspToCreate, USER1);
285 Assert.assertNotNull(vsp);
286 vspToCreate.setId(vsp.getId());
287 vspToCreate.setVersion(VERSION01);
288 assertVspsEquals(vsp, vspToCreate);
289 verify(activityLogManagerMock).addActionLog(activityLogEntityArg.capture(), eq(USER1));
290 ActivityLogEntity activityLogEntity = activityLogEntityArg.getValue();
291 Assert.assertEquals(activityLogEntity.getVersionId(), String.valueOf(VERSION01.getMajor() + 1));
292 Assert.assertTrue(activityLogEntity.isSuccess());
295 @Test(expectedExceptions = CoreException.class)
296 public void testUpdateWithExistingName_negative() {
297 VersionInfo versionInfo = new VersionInfo();
298 versionInfo.setActiveVersion(VERSION01);
299 doReturn(versionInfo).when(versioningManagerMock).getEntityVersionInfo(
300 VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, VSP_ID, USER1,
301 VersionableEntityAction.Write);
303 VspDetails existingVsp =
304 createVspDetails(VSP_ID, VERSION01, "Vsp1", "Test-existingVsp", "vendorName", "vlm1Id",
305 "icon", "category", "subCategory", "123", null);
306 VspDetails updatedVsp =
307 createVspDetails(VSP_ID, VERSION01, "Vsp1_updated", "Test-existingVsp", "vendorName",
308 "vlm1Id", "icon", "category", "subCategory", "123", null);
309 doReturn(existingVsp).when(vspInfoDaoMock)
310 .get(any(VspDetails.class));
311 doThrow(new CoreException(
312 new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION).build()))
313 .when(vendorSoftwareProductManager)
314 .updateUniqueName(existingVsp.getName(), updatedVsp.getName());
316 vendorSoftwareProductManager.updateVsp(updatedVsp, USER1);
320 public void testUpdate() {
321 VersionInfo versionInfo = new VersionInfo();
322 versionInfo.setActiveVersion(VERSION01);
323 doReturn(versionInfo).when(versioningManagerMock).getEntityVersionInfo(
324 VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, VSP_ID, USER1,
325 VersionableEntityAction.Write);
326 VspDetails existingVsp =
327 createVspDetails(VSP_ID, VERSION01, "VSP1", null, "vendorName", "vlm1Id", "icon",
329 "subCategory", "456", null);
330 VspDetails updatedVsp =
331 createVspDetails(VSP_ID, VERSION01, "VSP1_updated", null, "vendorName", "vlm1Id", "icon",
333 "subCategory", "456", null);
334 existingVsp.setWritetimeMicroSeconds(8L);
335 doReturn(existingVsp).when(vspInfoDaoMock)
336 .get(any(VspDetails.class));
337 doNothing().when(vendorSoftwareProductManager)
338 .updateUniqueName(existingVsp.getName(), updatedVsp.getName());
340 vendorSoftwareProductManager.updateVsp(updatedVsp, USER1);
342 verify(vspInfoDaoMock).update(updatedVsp);
346 public void testUpdateRemoveFG() {
347 VersionInfo versionInfo = new VersionInfo();
348 versionInfo.setActiveVersion(VERSION01);
349 doReturn(versionInfo).when(versioningManagerMock).getEntityVersionInfo(
350 VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, VSP_ID, USER1,
351 VersionableEntityAction.Write);
352 List<String> fgs = new ArrayList<String>();
353 fgs.add("fg1"); fgs.add("fg2");
354 VspDetails existingVsp =
355 createVspDetails(VSP_ID, VERSION01, "VSP1", null, "vendorName", "vlm1Id", "icon",
357 "subCategory", "456", fgs);
359 List<String> updFgs = new ArrayList<String>();
361 VspDetails updatedVsp =
362 createVspDetails(VSP_ID, VERSION01, "VSP1_updated", null, "vendorName", "vlm1Id", "icon",
364 "subCategory", "456", updFgs);
365 existingVsp.setWritetimeMicroSeconds(8L);
366 doReturn(existingVsp).when(vspInfoDaoMock)
367 .get(any(VspDetails.class));
368 doNothing().when(vendorSoftwareProductManager)
369 .updateUniqueName(existingVsp.getName(), updatedVsp.getName());
371 DeploymentFlavorEntity dfEntity = new DeploymentFlavorEntity(VSP_ID,VERSION01,"DF_ID");
372 DeploymentFlavor flavor = new DeploymentFlavor();
373 flavor.setFeatureGroupId("fg1");
374 dfEntity.setDeploymentFlavorCompositionData(flavor);
376 List<DeploymentFlavorEntity> dfList = new ArrayList<DeploymentFlavorEntity>();
377 dfList.add(dfEntity);
379 doReturn(dfList).when(deploymentFlavorDaoMock).list(anyObject());
381 vendorSoftwareProductManager.updateVsp(updatedVsp, USER1);
383 verify(vendorSoftwareProductDaoMock).updateDeploymentFlavor(dfEntity);
385 Assert.assertNull(dfEntity.getDeploymentFlavorCompositionData().getFeatureGroupId());
389 @Test(expectedExceptions = CoreException.class)
390 public void testGetNonExistingVersion_negative() {
391 Version notExistversion = new Version(43, 8);
392 doReturn(null).when(vspInfoDaoMock).get(any(VspDetails.class));
393 vendorSoftwareProductManager.getVsp(VSP_ID, notExistversion, USER1);
397 public void testGetCheckedOutVersion() {
398 VersionInfo versionInfo = new VersionInfo();
399 versionInfo.setActiveVersion(VERSION01);
400 versionInfo.setStatus(VersionStatus.Locked);
401 versionInfo.setLockingUser(USER1);
402 doReturn(versionInfo).when(versioningManagerMock).getEntityVersionInfo(
403 VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, VSP_ID, USER1,
404 VersionableEntityAction.Read);
406 VspDetails existingVsp =
407 createVspDetails(VSP_ID, VERSION01, "VSP1", null, "vendorName", "vlm1Id", "icon",
409 "subCategory", "456", null);
410 existingVsp.setWritetimeMicroSeconds(8L);
411 doReturn(existingVsp).when(vspInfoDaoMock).get(any(VspDetails.class));
413 VspDetails actualVsp =
414 vendorSoftwareProductManager.getVsp(VSP_ID, VERSION01, USER1);
416 assertVspsEquals(actualVsp, existingVsp);
420 public void testGetOldVersion() {
421 VersionInfo versionInfo = new VersionInfo();
422 versionInfo.setActiveVersion(new Version(0, 2));
423 versionInfo.setViewableVersions(Arrays.asList(VERSION01, new Version(0, 2)));
424 versionInfo.setStatus(VersionStatus.Locked);
425 versionInfo.setLockingUser(USER2);
426 doReturn(versionInfo).when(versioningManagerMock).getEntityVersionInfo(
427 VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, VSP_ID, USER1,
428 VersionableEntityAction.Read);
430 VspDetails existingVsp =
431 createVspDetails(VSP_ID, VERSION01, "VSP1", null, "vendorName", "vlm1Id", "icon",
433 "subCategory", "456", null);
434 existingVsp.setWritetimeMicroSeconds(8L);
435 doReturn(existingVsp)
436 .when(vspInfoDaoMock).get(any(VspDetails.class));
438 VspDetails actualVsp =
439 vendorSoftwareProductManager.getVsp(VSP_ID, VERSION01, USER1);
441 VspDetails expectedVsp =
443 .get(new VspDetails(VSP_ID, VERSION01));
444 assertVspsEquals(actualVsp, expectedVsp);
448 public void testCheckin() {
449 doReturn(VERSION01).when(versioningManagerMock)
450 .checkin(VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, VSP_ID,
452 Version version = vendorSoftwareProductManager.checkin(VSP_ID, USER1);
454 Assert.assertEquals(version, VERSION01);
455 verify(versioningManagerMock)
456 .checkin(VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, VSP_ID,
458 verify(activityLogManagerMock).addActionLog(activityLogEntityArg.capture(), eq(USER1));
459 ActivityLogEntity activityLogEntity = activityLogEntityArg.getValue();
460 Assert.assertEquals(activityLogEntity.getVersionId(), String.valueOf(VERSION01.getMajor() + 1));
461 Assert.assertTrue(activityLogEntity.isSuccess());
465 public void testCheckout() {
466 doReturn(VERSION01).when(versioningManagerMock)
467 .checkout(VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, VSP_ID,
469 Version version = vendorSoftwareProductManager.checkout(VSP_ID, USER1);
471 Assert.assertEquals(version, VERSION01);
472 verify(versioningManagerMock)
473 .checkout(VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, VSP_ID,
476 verify(activityLogManagerMock).addActionLog(activityLogEntityArg.capture(), eq(USER1));
477 ActivityLogEntity activityLogEntity = activityLogEntityArg.getValue();
478 Assert.assertEquals(activityLogEntity.getVersionId(), String.valueOf(VERSION01.getMajor() + 1));
479 Assert.assertTrue(activityLogEntity.isSuccess());
484 public void testUndoCheckout() {
485 Version existingVersion = new Version(0, 2);
486 VersionInfo versionInfo = new VersionInfo();
487 versionInfo.setActiveVersion(existingVersion);
488 doReturn(versionInfo).when(versioningManagerMock).getEntityVersionInfo(
489 VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE,
490 VSP_ID, USER1, VersionableEntityAction.Read);
492 doReturn(VERSION01).when(versioningManagerMock).undoCheckout(VendorSoftwareProductConstants
493 .VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, VSP_ID, USER1);
495 VspDetails vsp = new VspDetails(VSP_ID, existingVersion);
496 vsp.setName("ExistingName");
497 doReturn(vsp).when(vspInfoDaoMock).get(anyObject());
498 doNothing().when(vendorSoftwareProductManager).updateUniqueName(vsp.getName(), vsp.getName());
500 Version undoCheckoutVersion = vendorSoftwareProductManager.undoCheckout(VSP_ID, USER1);
502 Assert.assertEquals(undoCheckoutVersion, VERSION01);
507 public void testSubmitWithMissingData() throws IOException {
508 VersionInfo versionInfo = new VersionInfo();
509 versionInfo.setActiveVersion(VERSION01);
511 doReturn(versionInfo).when(versioningManagerMock).getEntityVersionInfo(
512 VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE,
513 VSP_ID, USER1, VersionableEntityAction.Read);
515 VspDetails vsp = new VspDetails(VSP_ID, VERSION01);
516 vsp.setOnboardingMethod("Manual");
517 doReturn(vsp).when(vspInfoDaoMock).get(anyObject());
519 VspQuestionnaireEntity vspQuestionnaire = new VspQuestionnaireEntity(VSP_ID, VERSION01);
520 vspQuestionnaire.setQuestionnaireData("{}");
521 doReturn(vspQuestionnaire).when(vspInfoDaoMock).getQuestionnaire(VSP_ID, VERSION01);
523 ComponentEntity comp1 = new ComponentEntity(VSP_ID, VERSION01, "comp1");
524 comp1.setQuestionnaireData("{}");
525 doReturn(Collections.singleton(comp1)).when(vendorSoftwareProductDaoMock)
526 .listComponentsCompositionAndQuestionnaire(VSP_ID, VERSION01);
528 NicEntity nic1 = new NicEntity(VSP_ID, VERSION01, "comp1", "nic1");
529 nic1.setQuestionnaireData("{}");
530 doReturn(Collections.singleton(nic1))
531 .when(vendorSoftwareProductDaoMock).listNicsByVsp(VSP_ID, VERSION01);
533 ValidationResponse validationResponse = vendorSoftwareProductManager.submit(VSP_ID, USER1);
534 Assert.assertNotNull(validationResponse);
535 Assert.assertFalse(validationResponse.isValid());
536 List<String> errorIds = validationResponse.getVspErrors().stream().map(ErrorCode::id).distinct()
537 .collect(Collectors.toList());
538 Assert.assertTrue(errorIds.contains(ValidationErrorBuilder.FIELD_VALIDATION_ERROR_ERR_ID));
539 Assert.assertTrue(errorIds.contains(VendorSoftwareProductErrorCodes.VSP_INVALID));
541 verify(versioningManagerMock, never())
542 .submit(VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, VSP_ID,
544 verify(activityLogManagerMock, never()).addActionLog(any(ActivityLogEntity.class), eq(USER1));
549 // TODO: 3/15/2017 fix and enable
551 public void testSubmitWithInvalidLicensingData() throws IOException {
552 VersionInfo versionInfo = new VersionInfo();
553 versionInfo.setActiveVersion(VERSION01);
554 doReturn(versionInfo).when(versioningManagerMock).getEntityVersionInfo(
555 VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE,
556 VSP_ID, USER1, VersionableEntityAction.Read);
559 createVspDetails(VSP_ID, VERSION01, "Vsp1", "Test-vsp", "vendorName", "vlm1Id", "icon",
560 "category", "subCategory", "licenseAgreementId",
561 Collections.singletonList("featureGroupId"));
562 doReturn(vsp).when(vspInfoDaoMock).get(anyObject());
563 UploadDataEntity uploadData = new UploadDataEntity(VSP_ID, VERSION01);
564 uploadData.setContentData(
565 ByteBuffer.wrap(FileUtils.toByteArray(getFileInputStream("/emptyComposition"))));
566 doReturn(uploadData).when(orchestrationTemplateDataDaoMock)
567 .getOrchestrationTemplate(anyObject(), anyObject());
568 doReturn(new ToscaServiceModel(new FileContentHandler(), new HashMap<>(),
569 "MainServiceTemplate.yaml"))
570 .when(serviceModelDaoMock).getServiceModel(VSP_ID, VERSION01);
572 ValidationResponse validationResponse = vendorSoftwareProductManager.submit(VSP_ID, USER1);
573 Assert.assertNotNull(validationResponse);
574 Assert.assertFalse(validationResponse.isValid());
575 Assert.assertNull(validationResponse.getVspErrors());
576 Assert.assertEquals(validationResponse.getLicensingDataErrors(), 1);
578 verify(versioningManagerMock, never())
579 .submit(VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, VSP_ID,
583 verify(activityLogManagerMock, never()).addActionLog(any(ActivityLogEntity.class), eq(USER1));
586 // TODO: 3/15/2017 fix and enable
588 public void testSubmit() throws IOException {
589 mockVersioning(VersionableEntityAction.Read);
591 EnrichmentManagerFactory.getInstance();
593 .registerFactory(EnrichmentManagerFactory.class, EnrichmentManagerFactoryImpl.class);
596 createVspDetails(VSP_ID, VERSION01, "Vsp1", "Test-vsp", "vendorName", "vlm1Id", "icon",
597 "category", "subCategory", "123", Collections.singletonList("fg1"));
598 doReturn(vsp).when(vspInfoDaoMock).get(anyObject());
599 UploadDataEntity uploadData = new UploadDataEntity(VSP_ID, VERSION01);
600 uploadData.setContentData(
601 ByteBuffer.wrap(FileUtils.toByteArray(getFileInputStream("/emptyComposition"))));
602 doReturn(uploadData).when(orchestrationTemplateDataDaoMock)
603 .getOrchestrationTemplate(anyObject(), anyObject());
604 doReturn(new ToscaServiceModel(new FileContentHandler(), new HashMap<>(),
605 "MainServiceTemplate.yaml"))
606 .when(serviceModelDaoMock).getServiceModel(VSP_ID, VERSION01);
608 ValidationResponse validationResponse = vendorSoftwareProductManager.submit(VSP_ID, USER1);
609 Assert.assertTrue(validationResponse.isValid());
611 /* Assert.assertEquals(vsp2.getVersionInfo().getActiveVersion(), VERSION10);
612 Assert.assertEquals(vsp2.getVersionInfo().getStatus(), VersionStatus.Final);
613 Assert.assertNull(vsp2.getVersionInfo().getLockingUser());*/
615 verify(versioningManagerMock)
616 .submit(VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, VSP_ID,
618 verify(activityLogManagerMock).addActionLog(activityLogEntityArg.capture(), eq(USER1));
619 ActivityLogEntity activityLogEntity = activityLogEntityArg.getValue();
620 Assert.assertEquals(activityLogEntity.getVersionId(), String.valueOf(VERSION10.getMajor()));
621 Assert.assertTrue(activityLogEntity.isSuccess());
624 @Test(expectedExceptions = CoreException.class)
625 public void testCreatePackageOnNonFinalVersion_negative() throws IOException {
626 vendorSoftwareProductManager.createPackage(VSP_ID, VERSION01, USER1);
630 public void testCreatePackage() throws IOException {
631 /*VspDetails vspDetailsMock = new VspDetails("vspId", new Version(1, 0));
632 doReturn(vspDetailsMock).when(vspInfoDaoMock).get(anyObject());*/
633 VersionInfo versionInfo = new VersionInfo();
634 versionInfo.setActiveVersion(VERSION10);
635 doReturn(versionInfo).when(versioningManagerMock).getEntityVersionInfo(
636 VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, VSP_ID, USER1,
637 VersionableEntityAction.Read);
639 doReturn(new ToscaServiceModel(new FileContentHandler(), new HashMap<>(), "")).when
640 (enrichedServiceModelDaoMock).getServiceModel(VSP_ID, VERSION10);
642 VspDetails vsp = new VspDetails(VSP_ID, VERSION10);
643 vsp.setVendorId("vendorId");
644 vsp.setVlmVersion(VERSION10);
645 vsp.setFeatureGroups(Arrays.asList("fg1", "fg2"));
646 doReturn(vsp).when(vspInfoDaoMock).get(any(VspDetails.class));
648 doReturn(new FileContentHandler()).when(licenseArtifactsServiceMock)
649 .createLicenseArtifacts(VSP_ID, vsp.getVendorId(), VERSION10, vsp.getFeatureGroups(),
652 PackageInfo packageInfo = vendorSoftwareProductManager.createPackage(VSP_ID, VERSION10, USER1);
653 Assert.assertNotNull(packageInfo.getVspId());
656 // TODO: 3/15/2017 fix and enable
657 //@Test(dependsOnMethods = {"testListFinals"})
658 public void testUploadFileMissingFile() {
659 InputStream zis = getFileInputStream("/vspmanager/zips/missingYml.zip");
661 UploadFileResponse uploadFileResponse =
662 candidateManager.upload(VSP_ID, VERSION01, zis, USER1);
664 Assert.assertEquals(uploadFileResponse.getErrors().size(), 0);
667 // TODO: 3/15/2017 fix and enable
668 //@Test(dependsOnMethods = {"testUploadFileMissingFile"})
669 public void testUploadNotZipFile() throws IOException {
670 URL url = this.getClass().getResource("/notZipFile");
674 .upload(VSP_ID, VERSION01,
675 url.openStream(), USER1);
676 candidateManager.process(VSP_ID, VERSION01, USER1);
677 } catch (Exception ce) {
678 Assert.assertEquals(ce.getMessage(), Messages.CREATE_MANIFEST_FROM_ZIP.getErrorMessage());
681 verify(activityLogManagerMock, never()).addActionLog(any(ActivityLogEntity.class), eq(USER1));
685 public void testEnrichModelInSubmit() {
687 .deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME,
689 VspDetails vspDetails = vendorSoftwareProductManager.createVsp(
690 createVspDetails(null, null, "VSP_syb", "Test-vsp_syb", "vendorName", "vlm1Id", "icon",
691 "category", "subCategory", "456", null), USER1);
692 String id = vspDetails.getId();
695 InputStream zis = getFileInputStream("/vspmanager/zips/fullComposition.zip");
696 candidateManager.upload(id, VERSION01, zis, USER1);
697 OrchestrationTemplateActionResponse uploadFileResponse =
698 candidateManager.process(id, VERSION01, USER1);
701 vendorSoftwareProductManager.checkin(id, USER1);
704 ValidationResponse result = vendorSoftwareProductManager.submit(id, USER1);
705 } catch (IOException exception) {
708 VersionedVendorSoftwareProductInfo details =
709 vendorSoftwareProductManager.getVsp(id, null, USER1);
710 Collection<ComponentEntity> components =vendorSoftwareProductManager
711 .listComponents(id, details.getVersionInfo().getActiveVersion(), USER1);
713 ToscaServiceModel model =
714 (ToscaServiceModel) EnrichedServiceModelDaoFactory.getInstance().createInterface()
715 .getServiceModel(id, details.getVersionInfo().getActiveVersion());
717 Map<String, CapabilityDefinition> capabilities = new HashMap<>();
718 for (ComponentEntity component : components) {
719 model.getServiceTemplates().
722 filter(entryValue -> entryValue.getValue() != null &&
723 entryValue.getValue().getNode_types() != null &&
724 entryValue.getValue().
726 containsKey(component.getComponentCompositionData().getName())).
727 forEach(entryValue -> entryValue.getValue().getNode_types().
730 filter(type -> MapUtils.isNotEmpty(type.getCapabilities())).
731 forEach(type -> type.getCapabilities().
733 forEach(entry -> addCapability(entryValue.getKey(), capabilities, entry.getKey(),
734 entry.getValue()))));
738 Assert.assertNotNull(capabilities);
741 @Test(dependsOnMethods = {"testCreatePackage"})
742 public void testEnrichedFilesDeletedOnNewUpload() throws IOException {
743 Version activeVersion;
745 createPackageFromUpload(VSP_ID, USER1, "/fullComposition");
746 activeVersion = vendorSoftwareProductManager.getVsp(VSP_ID, null, USER1).getVersionInfo()
749 List<ServiceArtifact> firstExternalArtifacts = enrichedServiceModelDaoMock
750 .getExternalArtifacts(VSP_ID, activeVersion);
751 ToscaServiceModel firstServiceModel = enrichedServiceModelDaoMock.getServiceModel(VSP_ID,
754 createPackageFromUpload(VSP_ID, USER1, "/emptyComposition");
755 activeVersion = vendorSoftwareProductManager.getVsp(VSP_ID, null, USER1).getVersionInfo()
758 List<ServiceArtifact> secondExternalArtifacts = enrichedServiceModelDaoMock
759 .getExternalArtifacts(VSP_ID, activeVersion);
760 ToscaServiceModel secondServiceModel = enrichedServiceModelDaoMock.getServiceModel(VSP_ID,
763 Assert.assertNotEquals(firstExternalArtifacts, secondExternalArtifacts);
764 Assert.assertNotEquals(firstServiceModel, secondServiceModel);
768 @Test(dependsOnMethods = {"testMibsDeletedInCsar"})
769 public void testServiceTemplatesAreDeletedInCsarOnNewUpload() throws IOException {
770 String nestedPath = "Definitions" + File.separator + "nested";
772 uploadFileAndProcess(VSP_ID, USER1, "/vspmanager/zips/fullCompositionNested.zip");
773 checkinSubmitCreatePackage(VSP_ID, USER1);
774 List<String> nestedFileNamesServiceTemplates =
775 getWantedFileNamesFromCsar(nestedPath);
777 uploadFileAndProcess(VSP_ID, USER1, "/vspmanager/zips/fullComposition.zip");
778 checkinSubmitCreatePackage(VSP_ID, USER1);
779 List<String> emptyNestedNamesList = getWantedFileNamesFromCsar(nestedPath);
781 Assert.assertEquals(emptyNestedNamesList.size(), 0);
782 Assert.assertNotEquals(emptyNestedNamesList.size(), nestedFileNamesServiceTemplates.size());
785 private List<String> getWantedFileNamesFromCsar(String pathInCsar)
787 File translatedFile = vendorSoftwareProductManager.getTranslatedFile(VSP_ID, VERSION10, USER1);
789 return getFileNamesFromFolderInCsar(translatedFile,
793 private List<String> getFileNamesFromFolderInCsar(File csar, String folderName)
795 List<String> fileNames = new ArrayList<>();
797 ZipInputStream zip = new ZipInputStream(new FileInputStream(csar));
800 while ((ze = zip.getNextEntry()) != null) {
801 String name = ze.getName();
802 if (name.contains(folderName)) {
810 //Disabled for sonar null pointer issue for componentEntities
811 private Pair<String, String> uploadMib(String vspId, String user, String filePath,
813 List<ComponentEntity> componentEntities = null;
814 //(List<ComponentEntity>) vendorSoftwareProductManager.listComponents(vspId, null, user);
815 monitoringUploadsManager.upload(getFileInputStream(filePath),
817 VERSION01, componentEntities.get(0).getId(), MonitoringUploadType.SNMP_POLL, user);
818 //TODO: add validate of addActionLog() func call
820 return new ImmutablePair<>(componentEntities.get(0).getId(),
821 componentEntities.get(0).getComponentCompositionData()
825 private void createPackageFromUpload(String vspId, String user, String filePath)
827 uploadFileAndProcess(vspId, user, filePath);
828 checkinSubmitCreatePackage(vspId, user);
831 private void uploadFileAndProcess(String vspId, String user, String filePath) {
832 vendorSoftwareProductManager.checkout(vspId, user);
833 candidateManager.upload(vspId, VERSION01, getFileInputStream(filePath), user);
834 candidateManager.process(vspId, VERSION01, user);
837 private void checkinSubmitCreatePackage(String vspId, String user) throws IOException {
838 vendorSoftwareProductManager.checkin(vspId, user);
839 ValidationResponse submitResponse = vendorSoftwareProductManager.submit(vspId, user);
840 Assert.assertTrue(submitResponse.isValid());
841 vendorSoftwareProductManager.createPackage(vspId, VERSION10, user);
844 // TODO: 3/15/2017 fix and enable
847 public void testUpdatedVSPShouldBeInBeginningOfList() {
848 vendorSoftwareProductManager.updateVsp(new VspDetails(), USER3);
849 assertVSPInWantedLocationInVSPList(id006, 0, USER3);
851 InputStream zis = getFileInputStream("/vspmanager/zips/fullComposition.zip");
852 candidateManager.upload(id007, VERSION01, zis, USER3);
853 candidateManager.process(id007, VERSION01, USER3);
854 assertVSPInWantedLocationInVSPList(id007, 0, USER3);
857 @Test(dependsOnMethods = {"testUpdatedVSPShouldBeInBeginningOfList"})
858 public void testVSPInBeginningOfListAfterCheckin() {
859 vendorSoftwareProductManager.checkin(id006, USER3);
860 assertVSPInWantedLocationInVSPList(id006, 0, USER3);
862 vendorSoftwareProductManager.checkin(id007, USER3);
863 assertVSPInWantedLocationInVSPList(id007, 0, USER3);
866 @Test(dependsOnMethods = {"testVSPInBeginningOfListAfterCheckin"})
867 public void testVSPInBeginningOfListAfterCheckout() {
868 vendorSoftwareProductManager.checkout(id006, USER3);
869 assertVSPInWantedLocationInVSPList(id006, 0, USER3);
872 @Test(dependsOnMethods = {"testVSPInBeginningOfListAfterCheckout"})
873 public void testVSPInBeginningOfListAfterUndoCheckout() {
874 vendorSoftwareProductManager.checkout(id007, USER3);
875 assertVSPInWantedLocationInVSPList(id007, 0, USER3);
877 vendorSoftwareProductManager.undoCheckout(id006, USER3);
878 assertVSPInWantedLocationInVSPList(id006, 0, USER3);
881 @Test(dependsOnMethods = {"testVSPInBeginningOfListAfterUndoCheckout"})
882 public void testVSPInBeginningOfListAfterSubmit() throws IOException {
883 vendorSoftwareProductManager.checkin(id007, USER3);
884 vendorSoftwareProductManager.submit(id007, USER3);
886 assertVSPInWantedLocationInVSPList(id007, 0, USER3);
890 private void testLegalUpload(String vspId, Version version, InputStream upload, String user) {
891 candidateManager.upload(vspId, VERSION01, upload, USER1);
892 candidateManager.process(vspId, VERSION01, user);
894 UploadDataEntity uploadData =
895 orchestrationTemplateDataDaoMock.getOrchestrationTemplate(vspId, version);
896 Assert.assertNotNull(uploadData);
899 private void addCapability(String entryValueKey, Map<String, CapabilityDefinition> capabilities,
900 String key, CapabilityDefinition value) {
902 capabilities.put(entryValueKey + "_" + key, value);
905 public InputStream getFileInputStream(String fileName) {
906 URL url = this.getClass().getResource(fileName);
908 return url.openStream();
909 } catch (IOException exception) {
910 exception.printStackTrace();
915 private void assertVSPInWantedLocationInVSPList(String vspId, int location, String user) {
916 List<VersionedVendorSoftwareProductInfo> vspList =
917 vendorSoftwareProductManager.listVsps(null, user);
918 Assert.assertEquals(vspList.get(location).getVspDetails().getId(), vspId);
922 // private void assertInfoArtifactIsInRightPathInCsar(String vspId, String zipFileName)
923 // throws IOException {
924 // ZipInputStream inputZipStream = new ZipInputStream(new FileInputStream(new File(zipFileName)));
925 // boolean isInfoArtifactInZip = false;
927 // ZipEntry zipEntry;
928 // while ((zipEntry = inputZipStream.getNextEntry()) != null) {
929 // String currentEntryName = zipEntry.getName();
930 // if(currentEntryName.equals("Artifacts\\Informative\\Guide\\VSP_" +
931 // vspId + "_Information.txt")){
932 // isInfoArtifactInZip = true;
937 // Assert.assertTrue(isInfoArtifactInZip);
939 static VspDetails createVspDetails(String id, Version version, String name, String desc,
940 String vendorName, String vlm, String icon,
941 String category, String subCategory,
942 String licenseAgreement, List<String> featureGroups) {
943 VspDetails vspDetails = new VspDetails(id, version);
944 vspDetails.setName(name);
945 vspDetails.setDescription(desc);
946 vspDetails.setIcon(icon);
947 vspDetails.setCategory(category);
948 vspDetails.setSubCategory(subCategory);
949 vspDetails.setVendorName(vendorName);
950 vspDetails.setVendorId(vlm);
951 vspDetails.setVlmVersion(new Version(1, 0));
952 vspDetails.setLicenseAgreement(licenseAgreement);
953 vspDetails.setFeatureGroups(featureGroups);
954 vspDetails.setOnboardingMethod("HEAT");
958 static void assertVspsEquals(VspDetails actual, VspDetails expected) {
959 Assert.assertEquals(actual.getId(), expected.getId());
960 Assert.assertEquals(actual.getVersion(), expected.getVersion());
961 Assert.assertEquals(actual.getName(), expected.getName());
962 Assert.assertEquals(actual.getDescription(), expected.getDescription());
963 Assert.assertEquals(actual.getIcon(), expected.getIcon());
964 Assert.assertEquals(actual.getCategory(), expected.getCategory());
965 Assert.assertEquals(actual.getSubCategory(), expected.getSubCategory());
966 Assert.assertEquals(actual.getVendorName(), expected.getVendorName());
967 Assert.assertEquals(actual.getVendorId(), expected.getVendorId());
968 Assert.assertEquals(actual.getLicenseAgreement(), expected.getLicenseAgreement());
969 Assert.assertEquals(actual.getFeatureGroups(), expected.getFeatureGroups());
974 // public void testDownloadFile() throws IOException {
975 // VspDetails expectedVsp = VSPCommon.createVspDetails(null, null, String.format("VSP-test-%s", vlm1Id), "Test-vsp", "vendorName", "vlm1Id", "icon", "category", "subCategory", "123", null);
976 // VspDetails createdVsp = vendorSoftwareProductManager.createVsp(expectedVsp, USER1);
978 // id005 = createdVsp.getId();
979 // Assert.assertNotNull(id005);
980 // Assert.assertNotNull(createdVsp.getVersion());
982 // try (InputStream zipInputStream = new ZipFileUtils().getZipInputStream("/legalUploadWithWarning")) {
984 // UploadFileResponse uploadFileResponse = vendorSoftwareProductManager.upload(id005, zipInputStream, USER1);
985 // vendorSoftwareProductManager.process(id005, USER1);
986 // Optional<File> fileCandidate = vendorSoftwareProductManager.get(id005, USER1);
988 // File latestHeatPackage = fileCandidate.get();
990 // zipInputStream.reset();
991 // byte[] uploaded = IOUtils.toByteArray(zipInputStream);
993 // Optional<FileContentHandler> zipContentMap = vendorSoftwareProductManager.getZipContentMap(uploadFileResponse, uploaded);
994 // FileContentHandler fileContentHandler = new FileContentHandler();
995 // if(zipContentMap.isPresent()){
996 // fileContentHandler = zipContentMap.get();
999 // uploaded = IOUtils.toByteArray(fileContentHandler.getFiles().values());
1001 // byte[] downloaded;
1002 // try (BufferedInputStream fileStream = new BufferedInputStream(new FileInputStream(latestHeatPackage))) {
1003 // downloaded = IOUtils.toByteArray(fileStream);
1006 // Assert.assertTrue(Arrays.equals(uploaded, downloaded));
1010 // todo ********************** move to common **************************************
1012 private void mockVersioning(VersionableEntityAction action) {
1013 VersionInfo versionInfo = new VersionInfo();
1014 versionInfo.setActiveVersion(VERSION01);
1015 doReturn(versionInfo).when(versioningManagerMock).getEntityVersionInfo(
1016 VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, VSP_ID, USER1,
1020 private void mockVersioningEntityNotExist(VersionableEntityAction action, String vspId) {
1021 doThrow(new CoreException(new EntityNotExistErrorBuilder(
1022 VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, vspId).build()))
1023 .when(versioningManagerMock).getEntityVersionInfo(
1024 VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, vspId, USER1,
1028 private void MockVersioningEntityLocked(VersionableEntityAction action) {
1029 doThrow(new CoreException(new EditOnEntityLockedByOtherErrorBuilder(
1030 VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, VSP_ID, USER1)
1032 .when(versioningManagerMock).getEntityVersionInfo(
1033 VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, VSP_ID, USER2,