summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test/java
diff options
context:
space:
mode:
authorJvD_Ericsson <jeff.van.dam@est.tech>2023-03-23 11:52:27 +0000
committerJEFF VAN DAM <jeff.van.dam@est.tech>2023-03-31 10:28:19 +0000
commit3dff1c221e58de6a81cf6bbdfb84fdf97665e484 (patch)
treed670bd19a3721a59547f057e19109aa424191b88 /catalog-be/src/test/java
parent94176d70ee48b1703981cd8786c306f7c055e15d (diff)
Support to change substitution mapping node or version after service creation
Before changing check for service property usage in sub mapping node change Issue-ID: SDC-4439 Issue-ID: SDC-4430 Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech> Change-Id: Ia0f24c626ac836f0b4e7ffbe0004e7ab30089b25
Diffstat (limited to 'catalog-be/src/test/java')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java2
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java2
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogicBaseTestSetup.java2
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogicTest.java322
4 files changed, 228 insertions, 100 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java
index 638eef6898..c3fc69895b 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java
@@ -187,7 +187,7 @@ public abstract class BaseServiceBusinessLogicTest extends ComponentBusinessLogi
serviceDistributionValidation, forwardingPathValidator, uiComponentDataConverter,
artifactToscaOperation, componentContactIdValidator, componentNameValidator,
componentTagsValidator, componentValidator, componentIconValidator, componentProjectCodeValidator, componentDescriptionValidator,
- modelOperation, null, null, null, null, null);
+ modelOperation, null, null, null, null);
bl.setUserAdmin(mockUserAdmin);
bl.setGraphLockOperation(graphLockOperation);
bl.setJanusGraphDao(mockJanusGraphDao);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java
index 602a3bb4ce..e2d4e0ee78 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java
@@ -77,7 +77,7 @@ class ServiceDistributionBLTest extends ComponentBusinessLogicMock {
artifactToscaOperation, componentContactIdValidator,
componentNameValidator, componentTagsValidator, componentValidator, componentIconValidator,
componentProjectCodeValidator, componentDescriptionValidator, modelOperation, null, null,
- null, null, null);
+ null, null);
private Service serviceToActivate;
private ActivationRequestInformation activationRequestInformation;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogicBaseTestSetup.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogicBaseTestSetup.java
index 049f8a5541..cc6f676618 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogicBaseTestSetup.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogicBaseTestSetup.java
@@ -204,7 +204,7 @@ class ServiceBusinessLogicBaseTestSetup extends BaseBusinessLogicMock {
interfaceLifecycleTypeOperation, artifactBl, distributionEngine, componentInstanceBusinessLogic, serviceDistributionValidation,
forwardingPathValidator, uiComponentDataConverter, artifactToscaOperation, componentContactIdValidator, componentNameValidator,
componentTagsValidator, componentValidator, componentIconValidator, componentProjectCodeValidator, componentDescriptionValidator,
- modelOperation, serviceRoleValidator, serviceInstantiationTypeValidator, serviceCategoryValidator, serviceValidator, null);
+ modelOperation, serviceRoleValidator, serviceInstantiationTypeValidator, serviceCategoryValidator, serviceValidator);
bl.setComponentContactIdValidator(componentContactIdValidator);
bl.setComponentIconValidator(componentIconValidator);
bl.setComponentTagsValidator(componentTagsValidator);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogicTest.java
index a5f823b12f..416703637f 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogicTest.java
@@ -26,12 +26,11 @@ import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.assertSame;
-import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.fail;
import static org.mockito.Mockito.when;
@@ -42,13 +41,12 @@ import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-import java.util.UUID;
import java.util.Set;
-import java.util.HashSet;
-
+import java.util.UUID;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.hamcrest.MatcherAssert;
import org.junit.Assert;
@@ -59,13 +57,17 @@ import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.InterfaceInstanceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.ToscaGetFunctionDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ModelTypeEnum;
+import org.openecomp.sdc.be.datatypes.tosca.ToscaGetFunctionType;
import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.ComponentInstanceInterface;
+import org.openecomp.sdc.be.model.ComponentInstanceProperty;
import org.openecomp.sdc.be.model.GroupInstance;
+import org.openecomp.sdc.be.model.InputDefinition;
import org.openecomp.sdc.be.model.Model;
import org.openecomp.sdc.be.model.Operation;
import org.openecomp.sdc.be.model.PropertyDefinition;
@@ -94,14 +96,16 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
@Test
void testGetComponentAuditRecordsCertifiedVersion() {
- Either<List<Map<String, Object>>, ResponseFormat> componentAuditRecords = bl.getComponentAuditRecords(CERTIFIED_VERSION, COMPONNET_ID, user.getUserId());
+ Either<List<Map<String, Object>>, ResponseFormat> componentAuditRecords =
+ bl.getComponentAuditRecords(CERTIFIED_VERSION, COMPONNET_ID, user.getUserId());
assertTrue(componentAuditRecords.isLeft());
assertEquals(3, componentAuditRecords.left().value().size());
}
@Test
void testGetComponentAuditRecordsUnCertifiedVersion() {
- Either<List<Map<String, Object>>, ResponseFormat> componentAuditRecords = bl.getComponentAuditRecords(UNCERTIFIED_VERSION, COMPONNET_ID, user.getUserId());
+ Either<List<Map<String, Object>>, ResponseFormat> componentAuditRecords =
+ bl.getComponentAuditRecords(UNCERTIFIED_VERSION, COMPONNET_ID, user.getUserId());
assertTrue(componentAuditRecords.isLeft());
assertEquals(4, componentAuditRecords.left().value().size());
}
@@ -224,6 +228,7 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
}
assertEqualsServiceObject(createServiceObject(true), createResponse.left().value());
}
+
private void assertEqualsServiceObject(final Service expectedService, final Service actualService) {
assertEquals(expectedService.getContactId(), actualService.getContactId());
assertEquals(expectedService.getCategories(), actualService.getCategories());
@@ -304,9 +309,9 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
private void testServiceNameEmpty() {
Service serviceExccedsNameLimit = createServiceObject(false);
serviceExccedsNameLimit.setName(null);
- try{
+ try {
bl.createService(serviceExccedsNameLimit, user);
- } catch(ComponentException e){
+ } catch (ComponentException e) {
assertComponentException(e, ActionStatus.MISSING_COMPONENT_NAME, ComponentTypeEnum.SERVICE.getValue());
return;
}
@@ -318,9 +323,9 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
// contains :
String nameWrongFormat = "ljg\\fd";
service.setName(nameWrongFormat);
- try{
+ try {
bl.createService(service, user);
- } catch(ComponentException e){
+ } catch (ComponentException e) {
assertComponentException(e, ActionStatus.INVALID_COMPONENT_NAME, ComponentTypeEnum.SERVICE.getValue());
return;
}
@@ -333,20 +338,21 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
private void testServiceDescriptionEmpty() {
Service serviceExist = createServiceObject(false);
serviceExist.setDescription("");
- try{
+ try {
bl.createService(serviceExist, user);
- } catch(ComponentException e){
+ } catch (ComponentException e) {
assertComponentException(e, ActionStatus.COMPONENT_MISSING_DESCRIPTION, ComponentTypeEnum.SERVICE.getValue());
return;
}
fail();
}
+
private void testServiceDescriptionMissing() {
Service serviceExist = createServiceObject(false);
serviceExist.setDescription(null);
- try{
+ try {
bl.createService(serviceExist, user);
- } catch(ComponentException e){
+ } catch (ComponentException e) {
assertComponentException(e, ActionStatus.COMPONENT_MISSING_DESCRIPTION, ComponentTypeEnum.SERVICE.getValue());
return;
}
@@ -357,19 +363,23 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
Service serviceExccedsDescLimit = createServiceObject(false);
// 1025 chars, the limit is 1024
String tooLongServiceDesc = "1GUODojQ0sGzKR4NP7e5j82ADQ3KHTVOaezL95qcbuaqDtjZhAQGQ3iFwKAy580K4WiiXs3u3zq7RzXcSASl5fm0RsWtCMOIDP"
- + "AOf9Tf2xtXxPCuCIMCR5wOGnNTaFxgnJEHAGxilBhZDgeMNHmCN1rMK5B5IRJOnZxcpcL1NeG3APTCIMP1lNAxngYulDm9heFSBc8TfXAADq7703AvkJT0QPpGq2z2P"
- + "tlikcAnIjmWgfC5Tm7UH462BAlTyHg4ExnPPL4AO8c92VrD7kZSgSqiy73cN3gLT8uigkKrUgXQFGVUFrXVyyQXYtVM6bLBeuCGQf4C2j8lkNg6M0J3PC0PzMRoinOxk"
- + "Ae2teeCtVcIj4A1KQo3210j8q2v7qQU69Mabsa6DT9FgE4rcrbiFWrg0Zto4SXWD3o1eJA9o29lTg6kxtklH3TuZTmpi5KVp1NFhS1RpnqF83tzv4mZLKsx7Zh1fEgYvRFwx1"
- + "ar3RolyDfNoZiGBGTMsZzz7RPFBf2hTnLmNqVGQnHKhhGj0Y5s8t2cbqbO2nmHiJb9uaUVrCGypgbAcJL3KPOBfAVW8PcpmNj4yVjI3L4x5zHjmGZbp9vKshEQODcrmcgsYAoKqe"
- + "uu5u7jk8XVxEfQ0m5qL8UOErXPlJovSmKUmP5B5T0w299zIWDYCzSoNasHpHjOMDLAiDDeHbozUOn9t3Qou00e9POq4RMM0VnIx1H38nJoJZz2XH8CI5YMQe7oTagaxgQTF2aa0qaq2"
- + "V6nJsfRGRklGjNhFFYP2cS4Xv2IJO9DSX6LTXOmENrGVJJvMOZcvnBaZPfoAHN0LU4i1SoepLzulIxnZBfkUWFJgZ5wQ0Bco2GC1HMqzW21rwy4XHRxXpXbmW8LVyoA1KbnmVmROycU4"
- + "scTZ62IxIcIWCVeMjBIcTviXULbPUyqlfEPXWr8IMJtpAaELWgyquPClAREMDs2b9ztKmUeXlMccFES1XWbFTrhBHhmmDyVReEgCwfokrUFR13LTUK1k8I6OEHOs";
+ + "AOf9Tf2xtXxPCuCIMCR5wOGnNTaFxgnJEHAGxilBhZDgeMNHmCN1rMK5B5IRJOnZxcpcL1NeG3APTCIMP1lNAxngYulDm9heFSBc8TfXAADq7703AvkJT0QPpGq2z2P"
+ + "tlikcAnIjmWgfC5Tm7UH462BAlTyHg4ExnPPL4AO8c92VrD7kZSgSqiy73cN3gLT8uigkKrUgXQFGVUFrXVyyQXYtVM6bLBeuCGQf4C2j8lkNg6M0J3PC0PzMRoinOxk"
+ + "Ae2teeCtVcIj4A1KQo3210j8q2v7qQU69Mabsa6DT9FgE4rcrbiFWrg0Zto4SXWD3o1eJA9o29lTg6kxtklH3TuZTmpi5KVp1NFhS1RpnqF83tzv4mZLKsx7Zh1fEgYvRFwx1"
+ +
+ "ar3RolyDfNoZiGBGTMsZzz7RPFBf2hTnLmNqVGQnHKhhGj0Y5s8t2cbqbO2nmHiJb9uaUVrCGypgbAcJL3KPOBfAVW8PcpmNj4yVjI3L4x5zHjmGZbp9vKshEQODcrmcgsYAoKqe"
+ +
+ "uu5u7jk8XVxEfQ0m5qL8UOErXPlJovSmKUmP5B5T0w299zIWDYCzSoNasHpHjOMDLAiDDeHbozUOn9t3Qou00e9POq4RMM0VnIx1H38nJoJZz2XH8CI5YMQe7oTagaxgQTF2aa0qaq2"
+ +
+ "V6nJsfRGRklGjNhFFYP2cS4Xv2IJO9DSX6LTXOmENrGVJJvMOZcvnBaZPfoAHN0LU4i1SoepLzulIxnZBfkUWFJgZ5wQ0Bco2GC1HMqzW21rwy4XHRxXpXbmW8LVyoA1KbnmVmROycU4"
+ + "scTZ62IxIcIWCVeMjBIcTviXULbPUyqlfEPXWr8IMJtpAaELWgyquPClAREMDs2b9ztKmUeXlMccFES1XWbFTrhBHhmmDyVReEgCwfokrUFR13LTUK1k8I6OEHOs";
serviceExccedsDescLimit.setDescription(tooLongServiceDesc);
- try{
+ try {
bl.createService(serviceExccedsDescLimit, user);
- } catch(ComponentException e){
- assertComponentException(e, ActionStatus.COMPONENT_DESCRIPTION_EXCEEDS_LIMIT, ComponentTypeEnum.SERVICE.getValue(), "" + ValidationUtils.COMPONENT_DESCRIPTION_MAX_LENGTH);
+ } catch (ComponentException e) {
+ assertComponentException(e, ActionStatus.COMPONENT_DESCRIPTION_EXCEEDS_LIMIT, ComponentTypeEnum.SERVICE.getValue(),
+ "" + ValidationUtils.COMPONENT_DESCRIPTION_MAX_LENGTH);
return;
}
fail();
@@ -380,9 +390,9 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
// Not english
String tooLongServiceDesc = "\uC2B5";
notEnglish.setDescription(tooLongServiceDesc);
- try{
+ try {
bl.createService(notEnglish, user);
- } catch(ComponentException e){
+ } catch (ComponentException e) {
assertComponentException(e, ActionStatus.COMPONENT_INVALID_DESCRIPTION, ComponentTypeEnum.SERVICE.getValue());
return;
}
@@ -395,14 +405,15 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
private void testServiceIconEmpty() {
Service serviceExist = createServiceObject(false);
serviceExist.setIcon("");
- Either<Service, ResponseFormat> service = bl.validateServiceBeforeCreate(serviceExist,user,AuditingActionEnum.CREATE_SERVICE);
+ Either<Service, ResponseFormat> service = bl.validateServiceBeforeCreate(serviceExist, user, AuditingActionEnum.CREATE_SERVICE);
assertThat(service.left().value().getIcon()).isEqualTo(DEFAULT_ICON);
}
+
private void testServiceIconMissing() {
Service serviceExist = createServiceObject(false);
serviceExist.setIcon(null);
- Either<Service, ResponseFormat> service = bl.validateServiceBeforeCreate(serviceExist,user,AuditingActionEnum.CREATE_SERVICE);
+ Either<Service, ResponseFormat> service = bl.validateServiceBeforeCreate(serviceExist, user, AuditingActionEnum.CREATE_SERVICE);
assertThat(service.left().value().getIcon()).isEqualTo(DEFAULT_ICON);
}
@@ -421,9 +432,9 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
List<String> tagsList = new ArrayList<>();
tagsList.add(tag1);
serviceExccedsNameLimit.setTags(tagsList);
- try{
+ try {
bl.createService(serviceExccedsNameLimit, user);
- } catch(ComponentException e) {
+ } catch (ComponentException e) {
assertComponentException(e, ActionStatus.COMPONENT_INVALID_TAGS_NO_COMP_NAME);
return;
}
@@ -436,9 +447,9 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
List<String> tagsList = new ArrayList<>();
tagsList.add(tag1);
serviceExccedsNameLimit.setTags(tagsList);
- try{
+ try {
bl.createService(serviceExccedsNameLimit, user);
- } catch(ComponentException e) {
+ } catch (ComponentException e) {
assertComponentException(e, ActionStatus.INVALID_FIELD_FORMAT, "Service", "tag");
return;
}
@@ -469,22 +480,23 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
// 59 chars instead of 50
String contactIdTooLong = "thisNameIsVeryLongAndExeccedsTheNormalLengthForContactId";
serviceContactId.setContactId(contactIdTooLong);
- try{
+ try {
bl.createService(serviceContactId, user);
- } catch(ComponentException e) {
+ } catch (ComponentException e) {
assertComponentException(e, ActionStatus.COMPONENT_INVALID_CONTACT, ComponentTypeEnum.SERVICE.getValue());
return;
}
fail();
}
+
private void testContactIdWrongFormatCreate() {
Service serviceContactId = createServiceObject(false);
// 3 letters and 3 digits and special characters
String contactIdTooLong = "yrt134!!!";
serviceContactId.setContactId(contactIdTooLong);
- try{
+ try {
bl.createService(serviceContactId, user);
- } catch(ComponentException e) {
+ } catch (ComponentException e) {
assertComponentException(e, ActionStatus.COMPONENT_INVALID_CONTACT, ComponentTypeEnum.SERVICE.getValue());
return;
}
@@ -494,9 +506,9 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
private void testResourceContactIdMissing() {
Service resourceExist = createServiceObject(false);
resourceExist.setContactId(null);
- try{
+ try {
bl.createService(resourceExist, user);
- } catch(ComponentException e) {
+ } catch (ComponentException e) {
assertComponentException(e, ActionStatus.COMPONENT_MISSING_CONTACT, ComponentTypeEnum.SERVICE.getValue());
return;
}
@@ -509,14 +521,15 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
private void testServiceCategoryExist() {
Service serviceExist = createServiceObject(false);
serviceExist.setCategories(null);
- try{
+ try {
bl.createService(serviceExist, user);
- } catch(ComponentException e) {
+ } catch (ComponentException e) {
assertComponentException(e, ActionStatus.COMPONENT_MISSING_CATEGORY, ComponentTypeEnum.SERVICE.getValue());
return;
}
fail();
}
+
@Test
void markDistributionAsDeployedTestAlreadyDeployed() {
String notifyAction = "DNotify";
@@ -537,7 +550,8 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
resultList.add(event);
Either<List<DistributionDeployEvent>, ActionStatus> eventList = Either.left(resultList);
- Mockito.when(auditingDao.getDistributionDeployByStatus(Mockito.anyString(), Mockito.eq(resultAction), Mockito.anyString())).thenReturn(eventList);
+ Mockito.when(auditingDao.getDistributionDeployByStatus(Mockito.anyString(), Mockito.eq(resultAction), Mockito.anyString()))
+ .thenReturn(eventList);
Either<Service, ResponseFormat> markDeployed = bl.markDistributionAsDeployed(did, did, user);
assertTrue(markDeployed.isLeft());
@@ -589,9 +603,9 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
List<CategoryDefinition> categories = new ArrayList<>();
categories.add(category);
serviceExist.setCategories(categories);
- try{
+ try {
bl.createService(serviceExist, user);
- } catch(ComponentException e) {
+ } catch (ComponentException e) {
assertComponentException(e, ActionStatus.COMPONENT_INVALID_CATEGORY, ComponentTypeEnum.SERVICE.getValue());
return;
}
@@ -608,8 +622,8 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
try {
bl.createService(serviceExist, user);
- } catch(ComponentException exp) {
- assertComponentException(exp, ActionStatus.INVALID_PROJECT_CODE);
+ } catch (ComponentException exp) {
+ assertComponentException(exp, ActionStatus.INVALID_PROJECT_CODE);
return;
}
fail();
@@ -623,7 +637,7 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
try {
bl.createService(serviceExist, user);
- } catch(ComponentException exp) {
+ } catch (ComponentException exp) {
assertComponentException(exp, ActionStatus.INVALID_PROJECT_CODE);
return;
}
@@ -638,7 +652,7 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
try {
bl.createService(serviceExist, user);
- } catch(ComponentException exp) {
+ } catch (ComponentException exp) {
assertComponentException(exp, ActionStatus.INVALID_PROJECT_CODE);
return;
}
@@ -695,7 +709,7 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
void testDeleteArchivedService_DeleteServiceSpecificModel() throws ToscaOperationException {
String serviceId = "12345";
String model = "serviceSpecificModel";
- List<String> deletedServcies= new ArrayList<>();
+ List<String> deletedServcies = new ArrayList<>();
deletedServcies.add("54321");
Model normativeExtensionModel = new Model("normativeExtensionModel", ModelTypeEnum.NORMATIVE_EXTENSION);
Either<Component, StorageOperationStatus> eitherService = Either.left(createNewService());
@@ -708,7 +722,7 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
Mockito.verify(modelOperation, Mockito.times(1)).deleteModel(normativeExtensionModel, false);
}
- @SuppressWarnings({ "unchecked", "rawtypes" })
+ @SuppressWarnings({"unchecked", "rawtypes"})
@Test
void testFindGroupInstanceOnRelatedComponentInstance() {
@@ -721,7 +735,7 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
Either<ImmutablePair<ComponentInstance, GroupInstance>, ResponseFormat> findGroupInstanceRes;
Object[] argObjects = {service, componentInstances.get(1).getUniqueId(), componentInstances.get(1).getGroupInstances().get(1).getUniqueId()};
- Class[] argClasses = {Component.class, String.class,String.class};
+ Class[] argClasses = {Component.class, String.class, String.class};
try {
Method method = targetClass.getDeclaredMethod(methodName, argClasses);
method.setAccessible(true);
@@ -729,27 +743,26 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
findGroupInstanceRes = (Either<ImmutablePair<ComponentInstance, GroupInstance>, ResponseFormat>) method.invoke(bl, argObjects);
assertNotNull(findGroupInstanceRes);
assertEquals(findGroupInstanceRes.left().value().getKey().getUniqueId(), componentInstances.get(1)
- .getUniqueId());
+ .getUniqueId());
assertEquals(findGroupInstanceRes.left().value().getValue().getUniqueId(), componentInstances.get(1)
- .getGroupInstances()
- .get(1)
- .getUniqueId());
+ .getGroupInstances()
+ .get(1)
+ .getUniqueId());
- Object[] argObjectsInvalidCiId = {service, invalidId , componentInstances.get(1).getGroupInstances().get(1).getUniqueId()};
+ Object[] argObjectsInvalidCiId = {service, invalidId, componentInstances.get(1).getGroupInstances().get(1).getUniqueId()};
- findGroupInstanceRes = (Either<ImmutablePair<ComponentInstance, GroupInstance>, ResponseFormat>) method.invoke(bl, argObjectsInvalidCiId);
+ findGroupInstanceRes = (Either<ImmutablePair<ComponentInstance, GroupInstance>, ResponseFormat>) method.invoke(bl, argObjectsInvalidCiId);
assertNotNull(findGroupInstanceRes);
assertTrue(findGroupInstanceRes.isRight());
assertEquals("SVC4593", findGroupInstanceRes.right().value().getMessageId());
- Object[] argObjectsInvalidGiId = {service, componentInstances.get(1).getUniqueId() , invalidId};
+ Object[] argObjectsInvalidGiId = {service, componentInstances.get(1).getUniqueId(), invalidId};
- findGroupInstanceRes = (Either<ImmutablePair<ComponentInstance, GroupInstance>, ResponseFormat>) method.invoke(bl, argObjectsInvalidGiId);
+ findGroupInstanceRes = (Either<ImmutablePair<ComponentInstance, GroupInstance>, ResponseFormat>) method.invoke(bl, argObjectsInvalidGiId);
assertNotNull(findGroupInstanceRes);
assertTrue(findGroupInstanceRes.isRight());
assertEquals("SVC4653", findGroupInstanceRes.right().value().getMessageId());
- }
- catch (Exception e) {
+ } catch (Exception e) {
e.printStackTrace();
}
}
@@ -762,15 +775,15 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
service.setUniqueId("serviceUniqueId");
List<ComponentInstance> componentInstances = new ArrayList<>();
ComponentInstance ci;
- for(int i= 0; i<listSize; ++i){
+ for (int i = 0; i < listSize; ++i) {
ci = new ComponentInstance();
ci.setName("ciName" + i);
ci.setUniqueId("ciId" + i);
- List<GroupInstance> groupInstances= new ArrayList<>();
+ List<GroupInstance> groupInstances = new ArrayList<>();
GroupInstance gi;
- for(int j = 0; j<listSize; ++j){
+ for (int j = 0; j < listSize; ++j) {
gi = new GroupInstance();
- gi.setName(ci.getName( )+ "giName" + j);
+ gi.setName(ci.getName() + "giName" + j);
gi.setUniqueId(ci.getName() + "giId" + j);
groupInstances.add(gi);
}
@@ -782,7 +795,7 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
}
protected Service createNewService() {
- return (Service)createNewComponent();
+ return (Service) createNewComponent();
}
@Test
@@ -817,7 +830,8 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
currentService.setEcompGeneratedNaming(false);
newService.setEcompGeneratedNaming(true);
newService.setNamingPolicy("policy");
- Either<Service, ResponseFormat> resultOfUpdate = bl.validateAndUpdateServiceMetadata(user, currentService, newService);
+ Either<Service, ResponseFormat> resultOfUpdate =
+ bl.validateAndUpdateServiceMetadata(user, currentService, newService, false, new ArrayList<>());
assertThat(resultOfUpdate.isLeft()).isTrue();
Service updatedService = resultOfUpdate.left().value();
assertThat(updatedService.isEcompGeneratedNaming()).isTrue();
@@ -830,7 +844,8 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
Service newService = createServiceObject(false);
currentService.setProjectCode("12345");
newService.setProjectCode("");
- Either<Service, ResponseFormat> resultOfUpdate = bl.validateAndUpdateServiceMetadata(user, currentService, newService);
+ Either<Service, ResponseFormat> resultOfUpdate =
+ bl.validateAndUpdateServiceMetadata(user, currentService, newService, false, new ArrayList<>());
assertThat(resultOfUpdate.isLeft()).isTrue();
Service updatedService = resultOfUpdate.left().value();
assertThat(updatedService.getProjectCode()).isEmpty();
@@ -842,7 +857,8 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
Service newService = createServiceObject(false);
currentService.setProjectCode("");
newService.setProjectCode("12345");
- Either<Service, ResponseFormat> resultOfUpdate = bl.validateAndUpdateServiceMetadata(user, currentService, newService);
+ Either<Service, ResponseFormat> resultOfUpdate =
+ bl.validateAndUpdateServiceMetadata(user, currentService, newService, false, new ArrayList<>());
assertThat(resultOfUpdate.isLeft()).isTrue();
Service updatedService = resultOfUpdate.left().value();
assertThat(updatedService.getProjectCode()).isEqualTo("12345");
@@ -854,7 +870,8 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
Service newService = createServiceObject(false);
currentService.setProjectCode("33333");
newService.setProjectCode("12345");
- Either<Service, ResponseFormat> resultOfUpdate = bl.validateAndUpdateServiceMetadata(user, currentService, newService);
+ Either<Service, ResponseFormat> resultOfUpdate =
+ bl.validateAndUpdateServiceMetadata(user, currentService, newService, false, new ArrayList<>());
assertThat(resultOfUpdate.isLeft()).isTrue();
Service updatedService = resultOfUpdate.left().value();
assertThat(updatedService.getProjectCode()).isEqualTo("12345");
@@ -867,17 +884,18 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
currentService.setServiceType("alice");
//valid English word
newService.setServiceType("bob");
- Either<Service, ResponseFormat> resultOfUpdate = bl.validateAndUpdateServiceMetadata(user, currentService, newService);
+ Either<Service, ResponseFormat> resultOfUpdate =
+ bl.validateAndUpdateServiceMetadata(user, currentService, newService, false, new ArrayList<>());
assertThat(resultOfUpdate.isLeft()).isTrue();
Service updatedService = resultOfUpdate.left().value();
assertThat(updatedService.getServiceType()).isEqualToIgnoringCase("bob");
//empty string is invalid
newService.setServiceType("");
- resultOfUpdate = bl.validateAndUpdateServiceMetadata(user, currentService, newService);
+ resultOfUpdate = bl.validateAndUpdateServiceMetadata(user, currentService, newService, false, new ArrayList<>());
assertThat(resultOfUpdate.isLeft()).isTrue();
//null is invalid
newService.setServiceType(null);
- resultOfUpdate = bl.validateAndUpdateServiceMetadata(user, currentService, newService);
+ resultOfUpdate = bl.validateAndUpdateServiceMetadata(user, currentService, newService, false, new ArrayList<>());
assertThat(resultOfUpdate.isRight()).isTrue();
}
@@ -902,27 +920,28 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
currentService.setServiceFunction("alice");
//valid English word
newService.setServiceFunction("bob");
- Either<Service, ResponseFormat> resultOfUpdate = bl.validateAndUpdateServiceMetadata(user, currentService, newService);
+ Either<Service, ResponseFormat> resultOfUpdate =
+ bl.validateAndUpdateServiceMetadata(user, currentService, newService, false, new ArrayList<>());
assertThat(resultOfUpdate.isLeft()).isTrue();
Service updatedService = resultOfUpdate.left().value();
assertThat(updatedService.getServiceFunction()).isEqualToIgnoringCase("bob");
//empty string is valid
newService.setServiceFunction("");
- resultOfUpdate = bl.validateAndUpdateServiceMetadata(user, currentService, newService);
+ resultOfUpdate = bl.validateAndUpdateServiceMetadata(user, currentService, newService, false, new ArrayList<>());
assertThat(resultOfUpdate.isLeft()).isTrue();
//null is valid and assigner to ""
newService.setServiceFunction(null);
- resultOfUpdate = bl.validateAndUpdateServiceMetadata(user, currentService, newService);
+ resultOfUpdate = bl.validateAndUpdateServiceMetadata(user, currentService, newService, false, new ArrayList<>());
assertThat(resultOfUpdate.isLeft()).isTrue();
assertThat(updatedService.getServiceFunction()).isEqualTo("");
}
-
@Test
void testServiceFunctionExceedLength() {
String serviceName = "Service";
- String serviceFunction = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
+ String serviceFunction =
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
Service serviceFunctionExceedLength = createServiceObject(false);
serviceFunctionExceedLength.setName(serviceName);
serviceFunctionExceedLength.setServiceFunction(serviceFunction);
@@ -937,7 +956,7 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
}
@Test
- void testServiceFunctionInvalidCharacter(){
+ void testServiceFunctionInvalidCharacter() {
String serviceName = "Service";
String serviceFunction = "a?";
Service serviceFunctionExceedLength = createServiceObject(false);
@@ -958,8 +977,8 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
Mockito.when(toscaOperationFacade.getToscaElement(Mockito.anyString())).thenReturn(Either.right(StorageOperationStatus.NOT_FOUND));
Either<Operation, ResponseFormat> operationEither =
- bl.addPropertyServiceConsumption("1", "2", "3",
- user.getUserId(), new ServiceConsumptionData());
+ bl.addPropertyServiceConsumption("1", "2", "3",
+ user.getUserId(), new ServiceConsumptionData());
assertTrue(operationEither.isRight());
assertEquals(HttpStatus.NOT_FOUND.value(), operationEither.right().value().getStatus().intValue());
}
@@ -970,8 +989,8 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
Mockito.when(toscaOperationFacade.getToscaElement(Mockito.anyString())).thenReturn(eitherService);
Either<Operation, ResponseFormat> operationEither =
- bl.addPropertyServiceConsumption("1", "2", "3",
- user.getUserId(), new ServiceConsumptionData());
+ bl.addPropertyServiceConsumption("1", "2", "3",
+ user.getUserId(), new ServiceConsumptionData());
assertTrue(operationEither.isRight());
assertEquals(HttpStatus.NOT_FOUND.value(), operationEither.right().value().getStatus().intValue());
}
@@ -985,8 +1004,8 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
String weirdUniqueServiceInstanceId = UUID.randomUUID().toString();
Either<Operation, ResponseFormat> operationEither =
- bl.addPropertyServiceConsumption("1", weirdUniqueServiceInstanceId, "3",
- user.getUserId(), new ServiceConsumptionData());
+ bl.addPropertyServiceConsumption("1", weirdUniqueServiceInstanceId, "3",
+ user.getUserId(), new ServiceConsumptionData());
assertTrue(operationEither.isRight());
assertEquals(HttpStatus.NOT_FOUND.value(), operationEither.right().value().getStatus().intValue());
}
@@ -999,8 +1018,8 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
Mockito.when(toscaOperationFacade.getToscaElement(Mockito.anyString())).thenReturn(eitherService);
Either<Operation, ResponseFormat> operationEither =
- bl.addPropertyServiceConsumption("1", aService.getUniqueId(), "3",
- user.getUserId(), new ServiceConsumptionData());
+ bl.addPropertyServiceConsumption("1", aService.getUniqueId(), "3",
+ user.getUserId(), new ServiceConsumptionData());
assertTrue(operationEither.isRight());
assertEquals(HttpStatus.NOT_FOUND.value(), operationEither.right().value().getStatus().intValue());
}
@@ -1013,15 +1032,15 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
Mockito.when(toscaOperationFacade.getToscaElement(Mockito.anyString())).thenReturn(eitherService);
Map<String, List<ComponentInstanceInterface>> componentInstancesInterfacesMap =
- Maps.newHashMap();
+ Maps.newHashMap();
componentInstancesInterfacesMap.put(aService.getUniqueId(),
- Lists.newArrayList(new ComponentInstanceInterface("1", new InterfaceInstanceDataDefinition())));
+ Lists.newArrayList(new ComponentInstanceInterface("1", new InterfaceInstanceDataDefinition())));
aService.setComponentInstancesInterfaces(componentInstancesInterfacesMap);
Either<Operation, ResponseFormat> operationEither =
- bl.addPropertyServiceConsumption("1", aService.getUniqueId(), "3",
- user.getUserId(), new ServiceConsumptionData());
+ bl.addPropertyServiceConsumption("1", aService.getUniqueId(), "3",
+ user.getUserId(), new ServiceConsumptionData());
assertTrue(operationEither.isRight());
assertEquals(HttpStatus.NOT_FOUND.value(), operationEither.right().value().getStatus().intValue());
}
@@ -1035,10 +1054,10 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
String operationId = "operationId";
ComponentInstanceInterface componentInstanceInterface =
- new ComponentInstanceInterface("interfaceId", new InterfaceInstanceDataDefinition());
+ new ComponentInstanceInterface("interfaceId", new InterfaceInstanceDataDefinition());
Map<String, Operation> operationsMap = Maps.newHashMap();
operationsMap.put(operationId, new Operation(new ArtifactDataDefinition(), "1",
- new ListDataDefinition<>(), new ListDataDefinition<>()));
+ new ListDataDefinition<>(), new ListDataDefinition<>()));
componentInstanceInterface.setOperationsMap(operationsMap);
Map<String, List<ComponentInstanceInterface>> componentInstancesInterfacesMap = Maps.newHashMap();
@@ -1046,8 +1065,8 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
aService.setComponentInstancesInterfaces(componentInstancesInterfacesMap);
Either<Operation, ResponseFormat> operationEither =
- bl.addPropertyServiceConsumption("1", aService.getUniqueId(), operationId,
- user.getUserId(), new ServiceConsumptionData());
+ bl.addPropertyServiceConsumption("1", aService.getUniqueId(), operationId,
+ user.getUserId(), new ServiceConsumptionData());
assertTrue(operationEither.isRight());
assertEquals(HttpStatus.NOT_FOUND.value(), operationEither.right().value().getStatus().intValue());
}
@@ -1096,7 +1115,7 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
@Test
- void testCreateService_withMultitenancyInvalidTenant_Failure() {
+ void testCreateService_withMultitenancyInvalidTenant_Failure() {
Service service = createServiceObject(false);
service.setTenant("invalid_tenant");
when(genericTypeBusinessLogic.fetchDerivedFromGenericType(service, null)).thenReturn(Either.left(genericService));
@@ -1106,7 +1125,116 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
assertEqualsServiceObject(createServiceObject(true), createResponse.left().value());
}
- private Set<String> getTestRoles(){
+ @Test
+ void testUpdateSubstitutionNodeTypeAndVersion() {
+ Service currentService = createServiceObject(true);
+ currentService.setDerivedFromGenericType("genericTypeOne");
+ currentService.setDerivedFromGenericVersion("1.0");
+ Service newService = createServiceObject(false);
+ newService.setDerivedFromGenericType("genericTypeTwo");
+ newService.setDerivedFromGenericVersion("2.0");
+ List<String> subNodePropsToBeRemoved = new ArrayList<>();
+ subNodePropsToBeRemoved.add("testProp");
+ Either<Service, ResponseFormat> resultOfUpdate =
+ bl.validateAndUpdateServiceMetadata(user, currentService, newService, true, subNodePropsToBeRemoved);
+ assertThat(resultOfUpdate.isLeft()).isTrue();
+ Service updatedService = resultOfUpdate.left().value();
+ assertEquals("genericTypeTwo", updatedService.getDerivedFromGenericType());
+ assertEquals("2.0", updatedService.getDerivedFromGenericVersion());
+ }
+
+ @Test
+ void testUpdateSubstitutionNodeTypePropsToRemoveThrowInUseGetProperty() {
+ Service currentService = createServiceObject(true);
+ setComponentInstanceOnServiceWithPropWithToscaFunction(currentService, ToscaGetFunctionType.GET_PROPERTY, "testProp");
+ Service newService = createServiceObject(false);
+ List<String> subNodePropsToBeRemoved = new ArrayList<>();
+ subNodePropsToBeRemoved.add("testProp");
+ Either<Service, ResponseFormat> resultOfUpdate =
+ bl.validateAndUpdateServiceMetadata(user, currentService, newService, true, subNodePropsToBeRemoved);
+ assertThat(resultOfUpdate.isRight()).isTrue();
+ ResponseFormat response = resultOfUpdate.right().value();
+ assertEquals(409, response.getStatus());
+ assertEquals("Cannot change substitution node type as properties of the existing type are referenced by properties %1.", response.getText());
+ }
+
+ @Test
+ void testUpdateSubstitutionNodeTypePropsToRemoveThrowInUseGetAttribute() {
+ Service currentService = createServiceObject(true);
+ setComponentInstanceOnServiceWithPropWithToscaFunction(currentService, ToscaGetFunctionType.GET_ATTRIBUTE, "testProp");
+ Service newService = createServiceObject(false);
+ List<String> subNodePropsToBeRemoved = new ArrayList<>();
+ subNodePropsToBeRemoved.add("testProp");
+ Either<Service, ResponseFormat> resultOfUpdate =
+ bl.validateAndUpdateServiceMetadata(user, currentService, newService, true, subNodePropsToBeRemoved);
+ assertThat(resultOfUpdate.isRight()).isTrue();
+ ResponseFormat response = resultOfUpdate.right().value();
+ assertEquals(409, response.getStatus());
+ assertEquals("Cannot change substitution node type as properties of the existing type are referenced by properties %1.", response.getText());
+ }
+
+ @Test
+ void testUpdateSubstitutionNodeTypePropsToRemoveThrowInUseGetInput() {
+ Service currentService = createServiceObject(true);
+ setComponentInstanceOnServiceWithPropWithToscaFunction(currentService, ToscaGetFunctionType.GET_INPUT, "testProp");
+ Service newService = createServiceObject(false);
+ List<String> subNodePropsToBeRemoved = new ArrayList<>();
+ subNodePropsToBeRemoved.add("testProp");
+ Either<Service, ResponseFormat> resultOfUpdate =
+ bl.validateAndUpdateServiceMetadata(user, currentService, newService, true, subNodePropsToBeRemoved);
+ assertThat(resultOfUpdate.isRight()).isTrue();
+ ResponseFormat response = resultOfUpdate.right().value();
+ assertEquals(409, response.getStatus());
+ assertEquals("Cannot change substitution node type as properties of the existing type are referenced by properties %1.", response.getText());
+ }
+
+ private void setComponentInstanceOnServiceWithPropWithToscaFunction(Service currentService, ToscaGetFunctionType toscaGetFunctionType,
+ String testPropName) {
+ ComponentInstance compInstance = new ComponentInstance();
+ compInstance.setUniqueId("resourceUid");
+
+ List<ComponentInstance> compInstances = new ArrayList<>();
+ compInstances.add(compInstance);
+ currentService.setComponentInstances(compInstances);
+
+ ToscaGetFunctionDataDefinition toscaFunc = new ToscaGetFunctionDataDefinition();
+ toscaFunc.setPropertyName(testPropName);
+ toscaFunc.setPropertyUniqueId(testPropName + "Uid");
+ toscaFunc.setFunctionType(toscaGetFunctionType);
+
+ if (ToscaGetFunctionType.GET_INPUT.equals(toscaGetFunctionType)) {
+ toscaFunc.setPropertyName(testPropName + "Input");
+ toscaFunc.setPropertyUniqueId(testPropName + "InputUid");
+ InputDefinition compInput = new InputDefinition();
+ compInput.setName(testPropName + "Input");
+ compInput.setUniqueId(testPropName + "InputUid");
+ compInput.setPropertyId(testPropName + "Uid");
+ List<InputDefinition> compInputs = new ArrayList<>();
+ compInputs.add(compInput);
+ currentService.setInputs(compInputs);
+ }
+
+ ComponentInstanceProperty compInstProp = new ComponentInstanceProperty();
+ compInstProp.setName("compInstProp");
+ compInstProp.setToscaFunction(toscaFunc);
+
+ List<ComponentInstanceProperty> compInstProps = new ArrayList<>();
+ compInstProps.add(compInstProp);
+
+ Map<String, List<ComponentInstanceProperty>> mapCompInstProps = new HashMap<>();
+ mapCompInstProps.put("resourceUid", compInstProps);
+
+ PropertyDefinition compProp = new PropertyDefinition();
+ compProp.setName(testPropName);
+ compProp.setUniqueId(testPropName + "Uid");
+ List<PropertyDefinition> compProps = new ArrayList<>();
+ compProps.add(compProp);
+ currentService.setProperties(compProps);
+
+ currentService.setComponentInstancesProperties(mapCompInstProps);
+ }
+
+ private Set<String> getTestRoles() {
Set<String> roles = new HashSet<>();
roles.add("test_admin");
roles.add("test_tenant");