aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src/test/java')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java2
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AttributeBusinessLogicTest.java4
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java6
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/DataTypesServiceTest.java13
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicTest.java10
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java55
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogicTest.java37
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java46
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogicTest.java97
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogicTest.java16
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/AnnotationValidatorTest.java24
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/PropertyValueConstraintValidationUtilTest.java124
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/GroupExportParserImplTest.java45
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/PolicyExportParserImplTest.java34
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java38
15 files changed, 281 insertions, 270 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java
index 834964b5a2..341dce9f49 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java
@@ -246,7 +246,7 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock {
when(toscaOperationFacade.createToscaComponent(any(Resource.class))).thenReturn(eitherCreate);
when(toscaOperationFacade.validateCsarUuidUniqueness(Mockito.anyString())).thenReturn(StorageOperationStatus.OK);
Map<String, DataTypeDefinition> emptyDataTypes = new HashMap<String, DataTypeDefinition>();
- when(applicationDataTypeCache.getAll()).thenReturn(Either.left(emptyDataTypes));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(emptyDataTypes));
when(mockJanusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK);
Either<Component, StorageOperationStatus> resourceStorageOperationStatusEither = Either
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AttributeBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AttributeBusinessLogicTest.java
index 7b0b40cc8b..7db449df6a 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AttributeBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AttributeBusinessLogicTest.java
@@ -135,7 +135,7 @@ public class AttributeBusinessLogicTest extends BaseBusinessLogicMock {
Map<String, DataTypeDefinition> data = new HashMap<>();
data.put("ONE", new DataTypeDefinition());
Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> allDataTypes = Either.left(data);
- when(applicationDataTypeCache.getAll()).thenReturn(allDataTypes);
+ when(applicationDataTypeCache.getAll(null)).thenReturn(allDataTypes);
when(attributeOperation.isAttributeDefaultValueValid(any(), any())).thenReturn(true);
Either<AttributeDefinition, ResponseFormat> response;
@@ -237,7 +237,7 @@ public class AttributeBusinessLogicTest extends BaseBusinessLogicMock {
Map<String, DataTypeDefinition> data = new HashMap<>();
data.put("ONE", new DataTypeDefinition());
Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> allDataTypes = Either.left(data);
- when(applicationDataTypeCache.getAll()).thenReturn(allDataTypes);
+ when(applicationDataTypeCache.getAll(null)).thenReturn(allDataTypes);
when(attributeOperation.isAttributeDefaultValueValid(any(), any())).thenReturn(true);
Either<AttributeDefinition, ResponseFormat> response;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java
index 5c8b6ce6d2..a2996c531d 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java
@@ -186,7 +186,7 @@ class ComponentInstanceBusinessLogicTest {
@Mock
private JanusGraphDao janusGraphDao;
@Mock
- private ApplicationDataTypeCache dataTypeCache;
+ private ApplicationDataTypeCache applicationDataTypeCache;
@Mock
private PropertyOperation propertyOperation;
@Mock
@@ -321,7 +321,7 @@ class ComponentInstanceBusinessLogicTest {
.thenReturn(Either.left(component));
when(graphLockOperation.lockComponent(containerComponentID, NodeTypeEnum.ResourceInstance))
.thenReturn(StorageOperationStatus.OK);
- when(dataTypeCache.getAll()).thenReturn(Either.left(types));
+ when(componentsUtils.getAllDataTypes(applicationDataTypeCache, component.getModel())).thenReturn(types);
when(propertyOperation.validateAndUpdatePropertyValue(property.getType(), "newVal", true, null, types))
.thenReturn(Either.left("newVal"));
when(propertyOperation.validateAndUpdateRules("string", property.getRules(),
@@ -420,7 +420,7 @@ class ComponentInstanceBusinessLogicTest {
.thenReturn(Either.left(component));
when(graphLockOperation.lockComponent(containerComponentID, NodeTypeEnum.ResourceInstance))
.thenReturn(StorageOperationStatus.OK);
- when(dataTypeCache.getAll()).thenReturn(Either.left(types));
+ when(componentsUtils.getAllDataTypes(applicationDataTypeCache, component.getModel())).thenReturn(types);
when(propertyOperation.validateAndUpdatePropertyValue(property.getType(), "newVal", true, null, types))
.thenReturn(Either.right(false));
when(componentsUtils.convertFromStorageResponse(StorageOperationStatus.BAD_REQUEST))
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/DataTypesServiceTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/DataTypesServiceTest.java
index 0349985608..46326c350c 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/DataTypesServiceTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/DataTypesServiceTest.java
@@ -20,7 +20,11 @@
package org.openecomp.sdc.be.components.impl;
+import static org.mockito.Mockito.when;
+
import fj.data.Either;
+import java.util.HashMap;
+import java.util.Map;
import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -30,11 +34,6 @@ import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.DataTypeDefinition;
import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.mockito.Mockito.when;
-
public class DataTypesServiceTest {
ApplicationDataTypeCache applicationDataTypeCache = Mockito.mock(ApplicationDataTypeCache.class);
ComponentsUtils componentsUtils = Mockito.mock(ComponentsUtils.class);
@@ -48,7 +47,7 @@ public class DataTypesServiceTest {
public void setup() {
mapreturn.put("Demo",new DataTypeDefinition());
allDataTypes = Either.left(mapreturn);
- when(applicationDataTypeCache.getAll()).thenReturn(allDataTypes);
+ when(applicationDataTypeCache.getAll(null)).thenReturn(allDataTypes);
}
@@ -60,7 +59,7 @@ public class DataTypesServiceTest {
@Test
public void getAllDataTypes_failure() {
allDataTypes = Either.right(janusGraphOperationStatus);
- when(applicationDataTypeCache.getAll()).thenReturn(allDataTypes);
+ when(applicationDataTypeCache.getAll(null)).thenReturn(allDataTypes);
Assert.assertEquals(true,dataTypesService.getAllDataTypes(applicationDataTypeCache).isRight());
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicTest.java
index 2520e44aca..e7cadc4b98 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicTest.java
@@ -95,7 +95,7 @@ class GroupBusinessLogicTest {
@InjectMocks
private GroupBusinessLogic test;
@Mock
- private ApplicationDataTypeCache dataTypeCache;
+ private ApplicationDataTypeCache applicationDataTypeCache;
@Mock
private ComponentsUtils componentsUtils;
@Mock
@@ -115,7 +115,7 @@ class GroupBusinessLogicTest {
@BeforeEach
public void setUp() throws Exception {
- test.setDataTypeCache(dataTypeCache);
+ test.setApplicationDataTypeCache(applicationDataTypeCache);
test.setToscaOperationFacade(toscaOperationFacade);
test.setPropertyOperation(propertyOperation);
test.setComponentsUtils(componentsUtils);
@@ -129,7 +129,6 @@ class GroupBusinessLogicTest {
List<GroupDefinition> groupDefinitions = new ArrayList<>();
GroupDefinition groupDefinition = new GroupDefinition();
groupDefinitions.add(groupDefinition);
- when(dataTypeCache.getAll()).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
result = test.createGroups(component, groupDefinitions, true);
assertThat(result.isRight()).isTrue();
}
@@ -146,8 +145,8 @@ class GroupBusinessLogicTest {
groupDefinition.setType(Constants.DEFAULT_GROUP_VF_MODULE);
GroupTypeDefinition groupTypeDefinition = new GroupTypeDefinition();
Map<String, DataTypeDefinition> map = new HashMap<>();
- when(dataTypeCache.getAll()).thenReturn(Either.left(map));
- when(groupTypeOperation.getLatestGroupTypeByType(Constants.DEFAULT_GROUP_VF_MODULE, null, true)).thenReturn(Either.left(groupTypeDefinition));
+ when(groupTypeOperation.getLatestGroupTypeByType(Constants.DEFAULT_GROUP_VF_MODULE, component.getModel(), true))
+ .thenReturn(Either.left(groupTypeDefinition));
when(groupsOperation.createGroups(any(Component.class), anyMap())).thenReturn(Either.left(groupDefinitions));
when(groupsOperation.addCalculatedCapabilitiesWithProperties(anyString(), anyMap(), anyMap())).thenReturn(StorageOperationStatus.OK);
result = test.createGroups(component, groupDefinitions, true);
@@ -203,7 +202,6 @@ class GroupBusinessLogicTest {
Map<String, Set<String>> excludedGroupTypesMap = new HashMap<>();
GroupTypeDefinition groupTypeDefinition = new GroupTypeDefinition();
Map<String, DataTypeDefinition> map = new HashMap<>();
- when(dataTypeCache.getAll()).thenReturn(Either.left(map));
when(accessValidations.validateUserCanWorkOnComponent(componentId, compTypeEnum, userId, "CreateGroup")).thenReturn(component);
ConfigurationManager configurationManager = new ConfigurationManager(configurationSource);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java
index 308d272a79..b9f6bf004c 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java
@@ -17,7 +17,26 @@
package org.openecomp.sdc.be.components.impl;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyMap;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
import fj.data.Either;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.junit.Before;
@@ -65,26 +84,6 @@ import org.openecomp.sdc.common.impl.ExternalConfiguration;
import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.openecomp.sdc.exception.ResponseFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyMap;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
public class InputsBusinessLogicTest {
@@ -467,7 +466,7 @@ public class InputsBusinessLogicTest {
when(propertyDeclarationOrchestrator.getPropOwnerId(componentInstInputsMap)).thenReturn(COMPONENT_INSTANCE_ID);
when(propertyDeclarationOrchestrator.declarePropertiesToListInput(service, componentInstInputsMap, listInput)).thenReturn(Either.left(listInput));
// for BaseOperation.getAllDataTypes:
- when(applicationDataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>())); // don't use Collections.emptyMap
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>())); // don't use Collections.emptyMap
// for BaseOperation.validatePropertyDefaultValue:
when(propertyOperation.isPropertyTypeValid(any(), any())).thenReturn(true);
when(propertyOperation.isPropertyInnerTypeValid(any(),any())).thenReturn(new ImmutablePair<>(listInput.getSchemaType(), true));
@@ -540,14 +539,16 @@ public class InputsBusinessLogicTest {
when(graphLockOperation.lockComponent(COMPONENT_ID, NodeTypeEnum.Service)).thenReturn(StorageOperationStatus.OK);
when(toscaOperationFacadeMock.addDataTypesToComponent(dataTypesMapCaptor.capture(), eq(COMPONENT_ID))).thenReturn(Either.left(new ArrayList<>()));
when(propertyDeclarationOrchestrator.getPropOwnerId(componentInstInputsMap)).thenReturn(COMPONENT_INSTANCE_ID);
- when(applicationDataTypeCache.getAll()).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
+ when(applicationDataTypeCache.getAll(service.getModel())).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
+ when(componentsUtilsMock.getAllDataTypes(applicationDataTypeCache, service.getModel()))
+ .thenThrow(new ByActionStatusComponentException(ActionStatus.DATA_TYPES_NOT_LOADED));
try {
Either<List<InputDefinition>, ResponseFormat> result =
testInstance.createListInput(USER_ID, COMPONENT_ID, ComponentTypeEnum.SERVICE, createListInputParams, true, false);
} catch (ByActionStatusComponentException e) {
- assertEquals(ActionStatus.DATA_TYPE_CANNOT_BE_EMPTY, e.getActionStatus());
- verify(applicationDataTypeCache, times(1)).getAll();
+ assertEquals(ActionStatus.DATA_TYPES_NOT_LOADED, e.getActionStatus());
+ verify(componentsUtilsMock, times(1)).getAllDataTypes(applicationDataTypeCache, service.getModel());
return;
}
fail();
@@ -563,7 +564,7 @@ public class InputsBusinessLogicTest {
when(graphLockOperation.lockComponent(COMPONENT_ID, NodeTypeEnum.Service)).thenReturn(StorageOperationStatus.OK);
when(toscaOperationFacadeMock.addDataTypesToComponent(dataTypesMapCaptor.capture(), eq(COMPONENT_ID))).thenReturn(Either.left(new ArrayList<>()));
when(propertyDeclarationOrchestrator.getPropOwnerId(componentInstInputsMap)).thenReturn(COMPONENT_INSTANCE_ID);
- when(applicationDataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>())); // don't use Collections.emptyMap
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>())); // don't use Collections.emptyMap
// for BaseOperation.validatePropertyDefaultValue:
when(propertyOperation.isPropertyTypeValid(any(), any())).thenReturn(false);
@@ -583,7 +584,7 @@ public class InputsBusinessLogicTest {
when(graphLockOperation.lockComponent(COMPONENT_ID, NodeTypeEnum.Service)).thenReturn(StorageOperationStatus.OK);
when(toscaOperationFacadeMock.addDataTypesToComponent(dataTypesMapCaptor.capture(), eq(COMPONENT_ID))).thenReturn(Either.left(new ArrayList<>()));
when(propertyDeclarationOrchestrator.getPropOwnerId(componentInstInputsMap)).thenReturn(COMPONENT_INSTANCE_ID);
- when(applicationDataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>())); // don't use Collections.emptyMap
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>())); // don't use Collections.emptyMap
// for BaseOperation.validatePropertyDefaultValue:
when(propertyOperation.isPropertyTypeValid(any(), any())).thenReturn(true);
when(propertyOperation.isPropertyInnerTypeValid(any(),any())).thenReturn(new ImmutablePair<>(listInput.getSchemaType(), true));
@@ -788,7 +789,7 @@ public class InputsBusinessLogicTest {
when(graphLockOperation.lockComponent(COMPONENT_ID, NodeTypeEnum.Service)).thenReturn(StorageOperationStatus.OK);
// used in validateInputValueConstraint
Map<String, DataTypeDefinition> dataTypeMap = new HashMap<>();
- when(applicationDataTypeCache.getAll()).thenReturn(Either.left(dataTypeMap)); // don't use Collections.emptyMap
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(dataTypeMap)); // don't use Collections.emptyMap
// used in updateInputObjectValue
when(propertyOperation.validateAndUpdatePropertyValue(INPUT_TYPE, NEW_VALUE, true, null, dataTypeMap))
.thenReturn(Either.left(NEW_VALUE));
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogicTest.java
index 627c536720..a183d52913 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogicTest.java
@@ -17,8 +17,23 @@
package org.openecomp.sdc.be.components.impl;
+import static org.assertj.core.api.Java6Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.anyMap;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.when;
+
import fj.data.Either;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import org.apache.commons.collections.CollectionUtils;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -70,22 +85,6 @@ import org.openecomp.sdc.common.impl.ExternalConfiguration;
import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.openecomp.sdc.exception.ResponseFormat;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.assertj.core.api.Java6Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyBoolean;
-import static org.mockito.ArgumentMatchers.anyMap;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.when;
-
@RunWith(MockitoJUnitRunner.class)
public class PolicyBusinessLogicTest {
@@ -104,7 +103,7 @@ public class PolicyBusinessLogicTest {
@Mock
private JanusGraphDao janusGraphDao;
@Mock
- private ApplicationDataTypeCache dataTypeCache;
+ private ApplicationDataTypeCache applicationDataTypeCache;
@Mock
private PropertyOperation propertyOperation;
@Mock
@@ -151,7 +150,7 @@ public class PolicyBusinessLogicTest {
businessLogic.setUserValidations(userValidations);
businessLogic.setGraphLockOperation(graphLockOperation);
businessLogic.setPolicyTypeOperation(policyTypeOperation);
- businessLogic.setDataTypeCache(dataTypeCache);
+ businessLogic.setApplicationDataTypeCache(applicationDataTypeCache);
businessLogic.setPropertyOperation(propertyOperation);
businessLogic.setPropertyDeclarationOrchestrator(propertyDeclarationOrchestrator);
}
@@ -205,7 +204,6 @@ public class PolicyBusinessLogicTest {
when(toscaOperationFacade.associatePolicyToComponent(eq(COMPONENT_ID), any(PolicyDefinition.class), eq(0))).thenReturn(Either.left(policy));
when(toscaOperationFacade.getToscaFullElement(eq(COMPONENT_ID))).thenReturn(Either.left(newResource));
when(toscaOperationFacade.updatePolicyOfComponent(eq(COMPONENT_ID), any(PolicyDefinition.class), any(PromoteVersionEnum.class))).thenReturn(Either.left(policy));
- when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
when(propertyOperation.validateAndUpdatePropertyValue(eq(null), eq(prop1), anyBoolean(), eq(null), anyMap())).thenReturn(Either.left(prop1));
when(propertyOperation.validateAndUpdatePropertyValue(eq(null), eq(prop2), anyBoolean(), eq(null), anyMap())).thenReturn(Either.left(prop2));
@@ -318,7 +316,6 @@ public class PolicyBusinessLogicTest {
@Test
public void updatePolicyPropertiesSuccessTest(){
stubValidateAndLockSuccess(CREATE_POLICY);
- when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
String prop1 = "Name";
String prop2 = "Type";
when(propertyOperation.validateAndUpdatePropertyValue(eq(null), eq(prop1), anyBoolean(), eq(null), anyMap())).thenReturn(Either.left(prop1));
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java
index f0900f7589..a2893af2ba 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java
@@ -30,11 +30,9 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyList;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.when;
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
import fj.data.Either;
import java.io.File;
@@ -71,7 +69,6 @@ import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOpera
import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException;
import org.openecomp.sdc.be.components.impl.exceptions.ComponentException;
import org.openecomp.sdc.be.components.impl.generic.GenericTypeBusinessLogic;
-import org.openecomp.sdc.be.components.impl.utils.YamlTemplateParsingHandlerTest;
import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic;
import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction;
import org.openecomp.sdc.be.components.merge.resource.ResourceDataMergeBusinessLogic;
@@ -114,7 +111,6 @@ import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.RequirementDefinition;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.UploadComponentInstanceInfo;
-import org.openecomp.sdc.be.model.UploadReqInfo;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations;
@@ -181,8 +177,7 @@ public class ResourceBusinessLogicTest {
private final CatalogOperation catalogOperation = Mockito.mock(CatalogOperation.class);
private final ICapabilityTypeOperation capabilityTypeOperation = Mockito.mock(ICapabilityTypeOperation.class);
private final PropertyOperation propertyOperation = Mockito.mock(PropertyOperation.class);
- private final ApplicationDataTypeCache applicationDataTypeCache = Mockito.mock(ApplicationDataTypeCache.class);
- private final ApplicationDataTypeCache dataTypeCache = Mockito.mock(ApplicationDataTypeCache.class);
+ private final ApplicationDataTypeCache applicationDataTypeCache = Mockito.mock(ApplicationDataTypeCache.class);
private final WebAppContextWrapper webAppContextWrapper = Mockito.mock(WebAppContextWrapper.class);
private final UserValidations userValidations = Mockito.mock(UserValidations.class);
private final WebApplicationContext webAppContext = Mockito.mock(WebApplicationContext.class);
@@ -307,8 +302,7 @@ public class ResourceBusinessLogicTest {
when(toscaOperationFacade.createToscaComponent(any(Resource.class))).thenReturn(eitherCreate);
when(catalogOperation.updateCatalog(Mockito.any(), Mockito.any())).thenReturn(ActionStatus.OK);
Map<String, DataTypeDefinition> emptyDataTypes = new HashMap<>();
- when(applicationDataTypeCache.getAll()).thenReturn(Either.left(emptyDataTypes));
- when(dataTypeCache.getAll()).thenReturn(Either.left(emptyDataTypes));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(emptyDataTypes));
when(mockJanusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK);
// BL object
@@ -329,8 +323,7 @@ public class ResourceBusinessLogicTest {
bl.setGraphLockOperation(graphLockOperation);
bl.setPropertyOperation(propertyOperation);
bl.setJanusGraphDao(mockJanusGraphDao);
- bl.setApplicationDataTypeCache(applicationDataTypeCache);
- bl.setDataTypeCache(dataTypeCache);
+ bl.setApplicationDataTypeCache(applicationDataTypeCache);
bl.setGenericTypeBusinessLogic(genericTypeBusinessLogic);
bl.setCatalogOperations(catalogOperation);
toscaOperationFacade.setNodeTypeOperation(nodeTypeOperation);
@@ -440,7 +433,7 @@ public class ResourceBusinessLogicTest {
}
return resource;
}
-
+
private Resource createResourceObjectWithModel(boolean afterCreate) {
Resource resource = new Resource();
resource.setName(RESOURCE_NAME);
@@ -1454,19 +1447,19 @@ public class ResourceBusinessLogicTest {
public void createResourceFromCsarTest() {
bl.createResourceFromCsar(resourceResponse, user, new HashMap<>(), "");
}
-
+
@Test()
public void testCreateResourceFromCsarWithModel() throws URISyntaxException, ZipException {
-
+
final File csarFile = new File(
ResourceBusinessLogicTest.class.getClassLoader().getResource("csars/nonOnapCsar.csar").toURI());
final Map<String, byte[]> csar = ZipUtils.readZip(csarFile, false);
-
+
String resourceYml = new String(csar.get("Definitions/my_vnf.yaml"));
-
+
YamlTemplateParsingHandler yamlTemplateParser = new YamlTemplateParsingHandler(mockJanusGraphDao, null, Mockito.mock(AnnotationBusinessLogic.class), null);
final ParsedToscaYamlInfo parsedToscaYamlInfo = yamlTemplateParser.parseResourceInfoFromYAML("Definitions/my_vnf.yml", resourceYml, Collections.EMPTY_MAP, Collections.EMPTY_MAP, "myVnf", resourceResponse);
-
+
when(toscaOperationFacade.getLatestByToscaResourceName(anyString())).thenReturn(Either.right(StorageOperationStatus.NOT_FOUND));
Resource vduCp = new Resource();
vduCp.setToscaResourceName("tosca.nodes.nfv.VduCp");
@@ -1498,7 +1491,7 @@ public class ResourceBusinessLogicTest {
vduCp.getProperties().add(roleProp);
when(toscaOperationFacade.getByToscaResourceNameMatchingVendorRelease("tosca.nodes.nfv.VduCp", "1.0.0")).thenReturn(Either.left(vduCp));
-
+
when(yamlTemplateParsingHandler.parseResourceInfoFromYAML(any(), any(), any(), any(), any(), any())).thenReturn(parsedToscaYamlInfo);
UploadComponentInstanceInfo uploadComponentInstanceInfo = new UploadComponentInstanceInfo();
@@ -1509,7 +1502,7 @@ public class ResourceBusinessLogicTest {
resourceResponse.setModel("testModel");
resourceResponse.setResourceType(ResourceTypeEnum.VF);
resourceResponse.setProperties(new ArrayList<>());
-
+
Resource derivedFrom = new Resource();
List<PropertyDefinition> properties = new ArrayList<>();
PropertyDefinition baseTypeProp = new PropertyDefinition();
@@ -1518,7 +1511,7 @@ public class ResourceBusinessLogicTest {
properties.add(baseTypeProp);
derivedFrom.setProperties(properties );
when(genericTypeBusinessLogic.fetchDerivedFromGenericType(any(), eq("tosca.nodes.nfv.VNF"))).thenReturn(Either.left(derivedFrom));
-
+
when(toscaOperationFacade
.validateComponentNameAndModelExists("myVnf", "testModel", ResourceTypeEnum.VF, ComponentTypeEnum.RESOURCE)).thenReturn(Either.left(false));
@@ -1528,6 +1521,7 @@ public class ResourceBusinessLogicTest {
when(toscaOperationFacade.associateDeploymentArtifactsToInstances(any(), any(), any())).thenReturn(StorageOperationStatus.OK);
when(toscaOperationFacade.associateInstAttributeToComponentToInstances(any(), any())).thenReturn(StorageOperationStatus.OK);
when(toscaOperationFacade.associateResourceInstances(any(Component.class), anyString(), anyList())).thenReturn(Either.left(Collections.EMPTY_LIST));
+ when(applicationDataTypeCache.getAll(resourceResponse.getModel())).thenReturn(Either.left(emptyDataTypes));
doAnswer(invocation -> {
Map<ComponentInstance, Map<String, List<RequirementDefinition>>> instReqs = invocation.getArgument(1);
@@ -1538,10 +1532,10 @@ public class ResourceBusinessLogicTest {
}).
when(toscaOperationFacade).associateOrAddCalculatedCapReq(any(), any(), any());
-
+
when(toscaOperationFacade.updateCalculatedCapabilitiesRequirements(any(), any(), any())).thenReturn(StorageOperationStatus.OK);
when(groupBusinessLogic.validateUpdateVfGroupNames(any(), any())).thenReturn(Either.left(Collections.EMPTY_MAP));
-
+
ComponentInstance ci = new ComponentInstance();
List<ComponentInstance> cis = new ArrayList<>();
cis.add(ci);
@@ -1558,10 +1552,10 @@ public class ResourceBusinessLogicTest {
doAnswer(invocation -> {
return Either.left(resourceResponse);
}).when(toscaOperationFacade).getToscaFullElement("myVnf");
-
-
+
+
Resource result = bl.createResourceFromCsar(resourceResponse, user, csar, "1234");
-
+
assertEquals("myDomain.myVnf", result.getToscaResourceName());
List<String> propIds = result.getProperties().stream().map(prop -> prop.getUniqueId()).collect(Collectors.toList());
assertTrue(propIds.contains("myVnf.propInBase"));
@@ -1573,7 +1567,7 @@ public class ResourceBusinessLogicTest {
assertTrue(propIds.contains("myVnf.provider"));
assertTrue(propIds.contains("myVnf.software_version"));
assertTrue(propIds.contains("myVnf.vnfm_info"));
-
+
final List<String> reqsName = new ArrayList<>();
final List<ComponentInstance> cisWithExtReq = result.getComponentInstances().stream().filter(instance -> instance.getRequirements().get("tosca.nodes.nfv.VduCp").get(0).isExternal()).collect(Collectors.toList());
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogicTest.java
index 6655ee2b1f..adfd5de888 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogicTest.java
@@ -17,7 +17,33 @@
package org.openecomp.sdc.be.components.impl;
+import static org.assertj.core.api.Java6Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyBoolean;
+import static org.mockito.Mockito.anyList;
+import static org.mockito.Mockito.anyMap;
+import static org.mockito.Mockito.anyString;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
import fj.data.Either;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.EnumMap;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.tuple.ImmutablePair;
@@ -42,7 +68,35 @@ import org.openecomp.sdc.be.externalapi.servlet.ArtifactExternalServlet;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.impl.ServletUtils;
import org.openecomp.sdc.be.info.NodeTypeInfoToUpdateArtifacts;
-import org.openecomp.sdc.be.model.*;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.AttributeDefinition;
+import org.openecomp.sdc.be.model.CapabilityDefinition;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.ComponentInstanceInput;
+import org.openecomp.sdc.be.model.ComponentInstanceProperty;
+import org.openecomp.sdc.be.model.ComponentMetadataDefinition;
+import org.openecomp.sdc.be.model.ComponentParametersView;
+import org.openecomp.sdc.be.model.DataTypeDefinition;
+import org.openecomp.sdc.be.model.GroupDefinition;
+import org.openecomp.sdc.be.model.IPropertyInputCommon;
+import org.openecomp.sdc.be.model.InputDefinition;
+import org.openecomp.sdc.be.model.InterfaceDefinition;
+import org.openecomp.sdc.be.model.LifecycleStateEnum;
+import org.openecomp.sdc.be.model.NodeTypeInfo;
+import org.openecomp.sdc.be.model.Operation;
+import org.openecomp.sdc.be.model.ParsedToscaYamlInfo;
+import org.openecomp.sdc.be.model.PolicyDefinition;
+import org.openecomp.sdc.be.model.PropertyDefinition;
+import org.openecomp.sdc.be.model.RequirementCapabilityRelDef;
+import org.openecomp.sdc.be.model.RequirementDefinition;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.be.model.UploadComponentInstanceInfo;
+import org.openecomp.sdc.be.model.UploadPropInfo;
+import org.openecomp.sdc.be.model.UploadReqInfo;
+import org.openecomp.sdc.be.model.UploadResourceInfo;
+import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.ICapabilityTypeOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
@@ -55,33 +109,6 @@ import org.openecomp.sdc.common.api.ArtifactTypeEnum;
import org.openecomp.sdc.common.api.Constants;
import org.openecomp.sdc.exception.ResponseFormat;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.nio.file.FileSystems;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.EnumMap;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import static org.assertj.core.api.Java6Assertions.assertThat;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.anyBoolean;
-import static org.mockito.Mockito.anyList;
-import static org.mockito.Mockito.anyMap;
-import static org.mockito.Mockito.anyString;
-import static org.mockito.Mockito.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
class ServiceImportBusinessLogicTest extends ServiceImportBussinessLogicBaseTestSetup {
private final static String DEFAULT_ICON = "defaulticon";
@@ -829,7 +856,7 @@ class ServiceImportBusinessLogicTest extends ServiceImportBussinessLogicBaseTest
uploadComponentInstanceInfo.setName("zxjTestImportServiceAb");
Assertions.assertNotNull(resource);
Assertions.assertNotNull(yamlName);
- sIB1.processComponentInstance(yamlName, resource, componentInstancesList, allDataTypes, instProperties,
+ sIB1.processComponentInstance(yamlName, resource, componentInstancesList, allDataTypes.left().value(), instProperties,
instCapabilties, instRequirements, instDeploymentArtifacts, instArtifacts, instAttributes,
originCompMap, instInputs, uploadComponentInstanceInfo);
}
@@ -854,7 +881,7 @@ class ServiceImportBusinessLogicTest extends ServiceImportBussinessLogicBaseTest
uploadComponentInstanceInfo.setName("zxjTestImportServiceAb0");
Assertions.assertThrows(ComponentException.class, () -> sIB1.processComponentInstance(yamlName,
- resource, componentInstancesList, allDataTypes, instProperties, instCapabilties,
+ resource, componentInstancesList, null, instProperties, instCapabilties,
instRequirements, instDeploymentArtifacts, instArtifacts, instAttributes, originCompMap,
instInputs, uploadComponentInstanceInfo));
}
@@ -1175,7 +1202,7 @@ class ServiceImportBusinessLogicTest extends ServiceImportBussinessLogicBaseTest
uploadComponentInstanceInfo.setName("zxjTestImportServiceAb");
Assertions.assertNotNull(service);
- sIB1.processComponentInstance(yamlName, service, componentInstancesList, allDataTypes,
+ sIB1.processComponentInstance(yamlName, service, componentInstancesList, allDataTypes.left().value(),
instProperties, instCapabilties, instRequirements, instDeploymentArtifacts,
instArtifacts, instAttributes, originCompMap, instInputs,
uploadComponentInstanceInfo);
@@ -1201,7 +1228,7 @@ class ServiceImportBusinessLogicTest extends ServiceImportBussinessLogicBaseTest
uploadComponentInstanceInfo.setName("zxjTestImportServiceAb0");
Assertions.assertThrows(ComponentException.class, () -> sIB1.processComponentInstance(yamlName,
- service, componentInstancesList, allDataTypes, instProperties, instCapabilties,
+ service, componentInstancesList, null, instProperties, instCapabilties,
instRequirements, instDeploymentArtifacts, instArtifacts, instAttributes, originCompMap,
instInputs, uploadComponentInstanceInfo));
}
@@ -1382,7 +1409,7 @@ class ServiceImportBusinessLogicTest extends ServiceImportBussinessLogicBaseTest
ComponentInstance currentCompInstance = new ComponentInstance();
Resource originResource = createParseResourceObject(false);
Assertions.assertNotNull(originResource);
- sIB1.processComponentInstanceCapabilities(allDataTypes, instCapabilties,
+ sIB1.processComponentInstanceCapabilities(null, instCapabilties,
uploadComponentInstanceInfo, currentCompInstance, originResource);
}
@@ -1395,7 +1422,7 @@ class ServiceImportBusinessLogicTest extends ServiceImportBussinessLogicBaseTest
Resource originResource = createParseResourceObject(false);
Assertions.assertNotNull(originResource);
- sIB1.processComponentInstanceCapabilities(allDataTypes, instCapabilties, uploadComponentInstanceInfo,
+ sIB1.processComponentInstanceCapabilities(null, instCapabilties, uploadComponentInstanceInfo,
currentCompInstance, originResource);
}
@@ -1405,7 +1432,7 @@ class ServiceImportBusinessLogicTest extends ServiceImportBussinessLogicBaseTest
Map<String, List<CapabilityDefinition>> originCapabilities = new HashMap<>();
Map<String, Map<String, UploadPropInfo>> newPropertiesMap = new HashMap<>();
Assertions.assertNull(allDataTypes);
- sIB1.updateCapabilityPropertiesValues(allDataTypes, originCapabilities, newPropertiesMap);
+ sIB1.updateCapabilityPropertiesValues(null, originCapabilities, newPropertiesMap, null);
}
@Test
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogicTest.java
index bded51db11..400b20cdc0 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogicTest.java
@@ -178,7 +178,7 @@ public class PropertyDataValueMergeBusinessLogicTest {
myType.setProperties(Arrays.asList(mac_range_plan, mac_count_required));
Map<String, DataTypeDefinition> dataTypes = Collections.singletonMap(myType.getName(), myType);
- when(applicationDataTypeCache.getAll()).thenReturn(Either.left(dataTypes));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(dataTypes));
testInstance.mergePropertyValue(oldProp, newProp, Collections.emptyList());
@@ -230,7 +230,7 @@ public class PropertyDataValueMergeBusinessLogicTest {
myType.setProperties(Arrays.asList(mac_range_plan, mymap, mac_count_required));
Map<String, DataTypeDefinition> dataTypes = Collections.singletonMap(myType.getName(), myType);
- when(applicationDataTypeCache.getAll()).thenReturn(Either.left(dataTypes));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(dataTypes));
testInstance.mergePropertyValue(oldProp, newProp, Collections.emptyList());
@@ -264,7 +264,7 @@ public class PropertyDataValueMergeBusinessLogicTest {
PropertyDataDefinition newProp = createProp("prop1", "list", "myType", "[{\"prop2\":{\"prop3\":false}}]");
Map<String, DataTypeDefinition> dataTypes = buildDataTypes();
- when(applicationDataTypeCache.getAll()).thenReturn(Either.left(dataTypes));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(dataTypes));
testInstance.mergePropertyValue(oldProp, newProp, Collections.emptyList());
assertEquals("myType", "[{\"prop2\":{\"prop3\":false}}]", newProp.getValue());
}
@@ -300,7 +300,7 @@ public class PropertyDataValueMergeBusinessLogicTest {
myType.setName("myType");
Map<String, DataTypeDefinition> dataTypes = buildDataTypes();
- when(applicationDataTypeCache.getAll()).thenReturn(Either.left(dataTypes));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(dataTypes));
testInstance.mergePropertyValue(oldProp, newProp, Collections.emptyList());
assertEquals("lprop", "[{\"prop2\":{\"prop4\":45,\"prop3\":true},\"prop1\":\"val1\"},{\"prop2\":{\"prop3\":false},\"prop1\":\"val2\"}]", newProp.getValue());
}
@@ -311,7 +311,7 @@ public class PropertyDataValueMergeBusinessLogicTest {
PropertyDataDefinition newProp = createProp("value_spec", "list", "json", "[{\"prop22\":{\"prop221\":45,\"prop222\":\"val222\",\"prop223\":\"false\"}}]");
Map<String, DataTypeDefinition> dataTypes = buildDataTypes();
- when(applicationDataTypeCache.getAll()).thenReturn(Either.left(dataTypes));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(dataTypes));
testInstance.mergePropertyValue(oldProp, newProp, Collections.emptyList());
assertEquals("value_spec", "[{\"prop22\":{\"prop223\":\"false\",\"prop221\":45,\"prop222\":\"val222\"}}]", newProp.getValue());
}
@@ -397,7 +397,7 @@ public class PropertyDataValueMergeBusinessLogicTest {
Map<String, DataTypeDefinition> dataTypes = Stream.of(complexType, myType, myInnerType)
.collect(Collectors.toMap(DataTypeDefinition::getName, Function.identity()));
- when(applicationDataTypeCache.getAll()).thenReturn(Either.left(dataTypes));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(dataTypes));
testInstance.mergePropertyValue(oldProp, newProp, Collections.emptyList());
@@ -525,14 +525,14 @@ public class PropertyDataValueMergeBusinessLogicTest {
}
private void testMergeProps(PropertyDataDefinition oldProp, PropertyDataDefinition newProp, String expectedValue, List<String> getInputsToMerge) {
- when(applicationDataTypeCache.getAll()).thenReturn(Either.left(Collections.emptyMap()));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(Collections.emptyMap()));
testInstance.mergePropertyValue(oldProp, newProp, getInputsToMerge);
assertEquals(expectedValue, newProp.getValue());
}
private String getMergedMapProp(PropertyDataDefinition oldProp, PropertyDataDefinition newProp, List<String> getInputsToMerge) {
- when(applicationDataTypeCache.getAll()).thenReturn(Either.left(Collections.emptyMap()));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(Collections.emptyMap()));
testInstance.mergePropertyValue(oldProp, newProp, getInputsToMerge);
return newProp.getValue();
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/AnnotationValidatorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/AnnotationValidatorTest.java
index 4b33e2d2be..9577bc6a11 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/AnnotationValidatorTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/AnnotationValidatorTest.java
@@ -19,7 +19,14 @@
*/
package org.openecomp.sdc.be.components.validation;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
import fj.data.Either;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -36,14 +43,6 @@ import org.openecomp.sdc.be.model.DataTypeDefinition;
import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
@RunWith(MockitoJUnitRunner.class)
public class AnnotationValidatorTest {
@@ -62,7 +61,7 @@ public class AnnotationValidatorTest {
@Mock
private ComponentsUtils componentsUtils;
@Mock
- private ApplicationDataTypeCache dataTypeCache;
+ private ApplicationDataTypeCache applicationDataTypeCache;
@Mock
private PropertyValidator propertyValidator;
@Mock
@@ -70,10 +69,10 @@ public class AnnotationValidatorTest {
@Before
public void setUp() throws Exception {
- annotationValidator = new AnnotationValidator(propertyValidator, exceptionUtils, dataTypeCache, componentsUtils);
+ annotationValidator = new AnnotationValidator(propertyValidator, exceptionUtils, applicationDataTypeCache, componentsUtils);
allData = Collections.emptyMap();
Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> cacheResponse = Either.left(allData);
- Mockito.when(dataTypeCache.getAll()).thenReturn(cacheResponse);
+ Mockito.when(applicationDataTypeCache.getAll(null)).thenReturn(cacheResponse);
annotationTypeProperties = Collections.emptyList();
propertyDataDefinitions = new ArrayList<>();
}
@@ -85,8 +84,7 @@ public class AnnotationValidatorTest {
List<PropertyDefinition> properties = new ArrayList<>();
properties.add(new PropertyDefinition(propertyDataDefinition));
- List<Annotation> annotations = annotationValidator
- .validateAnnotationsProperties(annotation, annotationTypeDefinition);
+ List<Annotation> annotations = annotationValidator.validateAnnotationsProperties(annotation, annotationTypeDefinition, null);
Mockito.verify(propertyValidator).thinPropertiesValidator(properties, annotationTypeProperties, allData);
assertThat(annotations.get(0), is(annotation));
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/PropertyValueConstraintValidationUtilTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/PropertyValueConstraintValidationUtilTest.java
index acb3d39b79..a8dcf8acce 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/PropertyValueConstraintValidationUtilTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/PropertyValueConstraintValidationUtilTest.java
@@ -20,10 +20,24 @@
package org.openecomp.sdc.be.datamodel.utils;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.when;
+
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import fj.data.Either;
+import java.io.BufferedReader;
+import java.io.File;
+import java.lang.reflect.Type;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -44,21 +58,6 @@ import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade
import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
import org.openecomp.sdc.exception.ResponseFormat;
-import java.io.BufferedReader;
-import java.io.File;
-import java.lang.reflect.Type;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.when;
-
public class PropertyValueConstraintValidationUtilTest {
@Mock
@@ -75,7 +74,7 @@ public class PropertyValueConstraintValidationUtilTest {
@Before
public void init() {
- MockitoAnnotations.initMocks(this);
+ MockitoAnnotations.openMocks(this);
ResponseFormatManager responseFormatManagerMock = Mockito.mock(ResponseFormatManager.class);
when(responseFormatManagerMock.getResponseFormat(any())).thenReturn(new ResponseFormat());
when(responseFormatManagerMock.getResponseFormat(any(), any())).thenReturn(new ResponseFormat());
@@ -88,7 +87,7 @@ public class PropertyValueConstraintValidationUtilTest {
@Test
public void primitiveValueSuccessTest() {
Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
- Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+ Mockito.when(applicationDataTypeCache.getAll(null)).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
propertyDefinition.setType("integer");
@@ -96,7 +95,7 @@ public class PropertyValueConstraintValidationUtilTest {
Either<Boolean, ResponseFormat> responseEither =
propertyValueConstraintValidationUtil.validatePropertyConstraints(
- Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+ Collections.singletonList(propertyDefinition), applicationDataTypeCache, null);
Assert.assertTrue(responseEither.isLeft());
}
@@ -104,15 +103,14 @@ public class PropertyValueConstraintValidationUtilTest {
@Test
public void primitiveValueFailTest() {
Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
- Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+ Mockito.when(applicationDataTypeCache.getAll(null)).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
propertyDefinition.setType("integer");
propertyDefinition.setValue("abcd");
- Either<Boolean, ResponseFormat> responseEither =
- propertyValueConstraintValidationUtil.validatePropertyConstraints(
- Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+ Either<Boolean, ResponseFormat> responseEither = propertyValueConstraintValidationUtil.validatePropertyConstraints(
+ Collections.singletonList(propertyDefinition), applicationDataTypeCache, null);
Assert.assertTrue(responseEither.isRight());
}
@@ -120,7 +118,7 @@ public class PropertyValueConstraintValidationUtilTest {
@Test
public void complexWithValidValueSuccessTest() {
Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
- Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+ Mockito.when(applicationDataTypeCache.getAll(null)).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
propertyDefinition.setType("org.openecomp.datatypes.heat.network.neutron.Subnet");
@@ -128,7 +126,7 @@ public class PropertyValueConstraintValidationUtilTest {
Either<Boolean, ResponseFormat> responseEither =
propertyValueConstraintValidationUtil.validatePropertyConstraints(
- Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+ Collections.singletonList(propertyDefinition), applicationDataTypeCache, null);
Assert.assertTrue(responseEither.isLeft());
}
@@ -136,15 +134,14 @@ public class PropertyValueConstraintValidationUtilTest {
@Test
public void complexWithValidValueFailTest() {
Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
- Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+ Mockito.when(applicationDataTypeCache.getAll(null)).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
propertyDefinition.setType("org.openecomp.datatypes.heat.network.neutron.Subnet");
propertyDefinition.setValue("{\"prefixlen\":\"5\"}");
- Either<Boolean, ResponseFormat> responseEither =
- propertyValueConstraintValidationUtil.validatePropertyConstraints(
- Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+ Either<Boolean, ResponseFormat> responseEither = propertyValueConstraintValidationUtil
+ .validatePropertyConstraints(Collections.singletonList(propertyDefinition), applicationDataTypeCache, null);
Assert.assertTrue(responseEither.isRight());
}
@@ -152,7 +149,7 @@ public class PropertyValueConstraintValidationUtilTest {
@Test
public void complexWithListWithPrimitiveValueSuccessTest() {
Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
- Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+ Mockito.when(applicationDataTypeCache.getAll(null)).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
propertyDefinition.setType("org.openecomp.datatypes.heat.network.neutron.Subnet");
@@ -160,7 +157,7 @@ public class PropertyValueConstraintValidationUtilTest {
Either<Boolean, ResponseFormat> responseEither =
propertyValueConstraintValidationUtil.validatePropertyConstraints(
- Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+ Collections.singletonList(propertyDefinition), applicationDataTypeCache, null);
Assert.assertTrue(responseEither.isLeft());
}
@@ -168,7 +165,7 @@ public class PropertyValueConstraintValidationUtilTest {
@Test
public void complexWithListWithPrimitiveValueFailTest() {
Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
- Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+ Mockito.when(applicationDataTypeCache.getAll(null)).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
propertyDefinition.setType("org.openecomp.datatypes.heat.network.neutron.Subnet");
@@ -176,7 +173,7 @@ public class PropertyValueConstraintValidationUtilTest {
Either<Boolean, ResponseFormat> responseEither =
propertyValueConstraintValidationUtil.validatePropertyConstraints(
- Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+ Collections.singletonList(propertyDefinition), applicationDataTypeCache, null);
Assert.assertTrue(responseEither.isRight());
}
@@ -184,7 +181,7 @@ public class PropertyValueConstraintValidationUtilTest {
@Test
public void complexWithMapWithPrimitiveValueSuccessTest() {
Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
- Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+ Mockito.when(applicationDataTypeCache.getAll(null)).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
propertyDefinition.setType("org.openecomp.datatypes.heat.network.neutron.Subnet");
@@ -192,7 +189,7 @@ public class PropertyValueConstraintValidationUtilTest {
Either<Boolean, ResponseFormat> responseEither =
propertyValueConstraintValidationUtil.validatePropertyConstraints(
- Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+ Collections.singletonList(propertyDefinition), applicationDataTypeCache, null);
Assert.assertTrue(responseEither.isLeft());
}
@@ -200,7 +197,7 @@ public class PropertyValueConstraintValidationUtilTest {
@Test
public void complexWithMapWithPrimitiveValueFailTest() {
Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
- Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+ Mockito.when(applicationDataTypeCache.getAll(null)).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
propertyDefinition.setType("org.openecomp.datatypes.heat.network.neutron.Subnet");
@@ -208,7 +205,7 @@ public class PropertyValueConstraintValidationUtilTest {
Either<Boolean, ResponseFormat> responseEither =
propertyValueConstraintValidationUtil.validatePropertyConstraints(
- Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+ Collections.singletonList(propertyDefinition), applicationDataTypeCache, null);
Assert.assertTrue(responseEither.isRight());
}
@@ -216,7 +213,7 @@ public class PropertyValueConstraintValidationUtilTest {
@Test
public void inputValidValueSuccessTest() {
Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
- Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+ Mockito.when(applicationDataTypeCache.getAll(null)).thenReturn(either);
InputDefinition inputDefinition = new InputDefinition();
inputDefinition.setInputPath("propetyName#ipv6_ra_mode");
@@ -228,7 +225,7 @@ public class PropertyValueConstraintValidationUtilTest {
Either<Boolean, ResponseFormat> responseEither =
propertyValueConstraintValidationUtil.validatePropertyConstraints(
- Collections.singletonList(inputDefinition), applicationDataTypeCache);
+ Collections.singletonList(inputDefinition), applicationDataTypeCache, null);
Assert.assertTrue(responseEither.isLeft());
}
@@ -236,7 +233,7 @@ public class PropertyValueConstraintValidationUtilTest {
@Test
public void inputValidValueFailTest() {
Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
- Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+ Mockito.when(applicationDataTypeCache.getAll(null)).thenReturn(either);
InputDefinition inputDefinition = new InputDefinition();
inputDefinition.setInputPath("propetyName#ipv6_ra_mode");
@@ -247,7 +244,7 @@ public class PropertyValueConstraintValidationUtilTest {
Either<Boolean, ResponseFormat> responseEither =
propertyValueConstraintValidationUtil.validatePropertyConstraints(
- Collections.singletonList(inputDefinition), applicationDataTypeCache);
+ Collections.singletonList(inputDefinition), applicationDataTypeCache, null);
Assert.assertTrue(responseEither.isRight());
}
@@ -255,7 +252,7 @@ public class PropertyValueConstraintValidationUtilTest {
@Test
public void serviceConsumptionValidValueSuccessTest() {
Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
- Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+ Mockito.when(applicationDataTypeCache.getAll(null)).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
propertyDefinition.setType("org.openecomp.datatypes.heat.network.neutron.Subnet");
@@ -264,14 +261,14 @@ public class PropertyValueConstraintValidationUtilTest {
Either<Boolean, ResponseFormat> responseEither =
propertyValueConstraintValidationUtil.validatePropertyConstraints(
- Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+ Collections.singletonList(propertyDefinition), applicationDataTypeCache, null);
Assert.assertTrue(responseEither.isLeft());
}
@Test
public void serviceConsumptionValidValueFailTest() {
Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
- Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+ Mockito.when(applicationDataTypeCache.getAll(null)).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
propertyDefinition.setType("org.openecomp.datatypes.heat.network.neutron.Subnet");
@@ -280,7 +277,7 @@ public class PropertyValueConstraintValidationUtilTest {
Either<Boolean, ResponseFormat> responseEither =
propertyValueConstraintValidationUtil.validatePropertyConstraints(
- Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+ Collections.singletonList(propertyDefinition), applicationDataTypeCache, null);
Assert.assertTrue(responseEither.isRight());
}
@@ -288,33 +285,30 @@ public class PropertyValueConstraintValidationUtilTest {
@Test
public void bandwidthTypeValueSuccessTest(){
Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
- Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+ Mockito.when(applicationDataTypeCache.getAll(null)).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
propertyDefinition.setType("onap.datatypes.partner.bandwidth");
propertyDefinition.setValue("{\"bandwidth_type\":\"guaranteed\"}");
propertyDefinition.setName("bandwidth_type");
- Either<Boolean, ResponseFormat> responseEither =
- propertyValueConstraintValidationUtil.validatePropertyConstraints(
- Collections.singletonList(propertyDefinition), applicationDataTypeCache);
-
+ Either<Boolean, ResponseFormat> responseEither = propertyValueConstraintValidationUtil.validatePropertyConstraints(
+ Collections.singletonList(propertyDefinition), applicationDataTypeCache, null);
Assert.assertTrue(responseEither.isLeft());
}
@Test
public void bandwidthTypeValueFailTest(){
Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
- Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+ Mockito.when(applicationDataTypeCache.getAll(null)).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
propertyDefinition.setType("onap.datatypes.partner.bandwidth");
propertyDefinition.setValue("{\"bandwidth_type\":\"incorrectValue\"}");
propertyDefinition.setName("bandwidth_type");
- Either<Boolean, ResponseFormat> responseEither =
- propertyValueConstraintValidationUtil.validatePropertyConstraints(
- Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+ Either<Boolean, ResponseFormat> responseEither = propertyValueConstraintValidationUtil.validatePropertyConstraints(
+ Collections.singletonList(propertyDefinition), applicationDataTypeCache, null);
Assert.assertTrue(responseEither.isRight());
}
@@ -322,7 +316,7 @@ public class PropertyValueConstraintValidationUtilTest {
@Test
public void bandwidthDownstreamValueSuccessTest(){
Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
- Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+ Mockito.when(applicationDataTypeCache.getAll(null)).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
propertyDefinition.setType("onap.datatypes.partner.bandwidth");
@@ -331,7 +325,7 @@ public class PropertyValueConstraintValidationUtilTest {
Either<Boolean, ResponseFormat> responseEither =
propertyValueConstraintValidationUtil.validatePropertyConstraints(
- Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+ Collections.singletonList(propertyDefinition), applicationDataTypeCache, null);
Assert.assertTrue(responseEither.isLeft());
}
@@ -339,7 +333,7 @@ public class PropertyValueConstraintValidationUtilTest {
@Test
public void bandwidthDownstreamValueFailTest(){
Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
- Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+ Mockito.when(applicationDataTypeCache.getAll(null)).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
propertyDefinition.setType("onap.datatypes.partner.bandwidth");
@@ -348,7 +342,7 @@ public class PropertyValueConstraintValidationUtilTest {
Either<Boolean, ResponseFormat> responseEither =
propertyValueConstraintValidationUtil.validatePropertyConstraints(
- Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+ Collections.singletonList(propertyDefinition), applicationDataTypeCache, null);
Assert.assertTrue(responseEither.isRight());
}
@@ -356,7 +350,7 @@ public class PropertyValueConstraintValidationUtilTest {
@Test
public void bandwidthUpstreamValueSuccessTest(){
Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
- Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+ Mockito.when(applicationDataTypeCache.getAll(null)).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
propertyDefinition.setType("onap.datatypes.partner.bandwidth");
@@ -365,7 +359,7 @@ public class PropertyValueConstraintValidationUtilTest {
Either<Boolean, ResponseFormat> responseEither =
propertyValueConstraintValidationUtil.validatePropertyConstraints(
- Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+ Collections.singletonList(propertyDefinition), applicationDataTypeCache, null);
Assert.assertTrue(responseEither.isLeft());
}
@@ -373,7 +367,7 @@ public class PropertyValueConstraintValidationUtilTest {
@Test
public void bandwidthUpstreamValueFailTest(){
Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
- Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+ Mockito.when(applicationDataTypeCache.getAll(null)).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
propertyDefinition.setType("onap.datatypes.partner.bandwidth");
@@ -382,7 +376,7 @@ public class PropertyValueConstraintValidationUtilTest {
Either<Boolean, ResponseFormat> responseEither =
propertyValueConstraintValidationUtil.validatePropertyConstraints(
- Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+ Collections.singletonList(propertyDefinition), applicationDataTypeCache, null);
Assert.assertTrue(responseEither.isRight());
}
@@ -390,7 +384,7 @@ public class PropertyValueConstraintValidationUtilTest {
@Test
public void bandwidthUnitsValueSuccessTest(){
Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
- Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+ Mockito.when(applicationDataTypeCache.getAll(null)).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
propertyDefinition.setType("onap.datatypes.partner.bandwidth");
@@ -399,7 +393,7 @@ public class PropertyValueConstraintValidationUtilTest {
Either<Boolean, ResponseFormat> responseEither =
propertyValueConstraintValidationUtil.validatePropertyConstraints(
- Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+ Collections.singletonList(propertyDefinition), applicationDataTypeCache, null);
Assert.assertTrue(responseEither.isLeft());
}
@@ -407,7 +401,7 @@ public class PropertyValueConstraintValidationUtilTest {
@Test
public void bandwidthUnitsValueFailTest(){
Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap);
- Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either);
+ Mockito.when(applicationDataTypeCache.getAll(null)).thenReturn(either);
PropertyDefinition propertyDefinition = new PropertyDefinition();
propertyDefinition.setType("onap.datatypes.partner.bandwidth");
@@ -416,7 +410,7 @@ public class PropertyValueConstraintValidationUtilTest {
Either<Boolean, ResponseFormat> responseEither =
propertyValueConstraintValidationUtil.validatePropertyConstraints(
- Collections.singletonList(propertyDefinition), applicationDataTypeCache);
+ Collections.singletonList(propertyDefinition), applicationDataTypeCache, null);
Assert.assertTrue(responseEither.isRight());
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/GroupExportParserImplTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/GroupExportParserImplTest.java
index b8f60fe5b7..dcc5f6a29b 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/GroupExportParserImplTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/GroupExportParserImplTest.java
@@ -20,36 +20,38 @@
package org.openecomp.sdc.be.tosca;
+import static java.util.Collections.singletonList;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.mockito.Mockito.when;
+
import fj.data.Either;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Stream;
import org.apache.commons.lang3.tuple.Pair;
-
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.openecomp.sdc.be.components.impl.exceptions.SdcResourceNotFoundException;
import org.openecomp.sdc.be.components.utils.GroupDefinitionBuilder;
import org.openecomp.sdc.be.components.utils.ResourceBuilder;
-import org.openecomp.sdc.be.model.*;
+import org.openecomp.sdc.be.model.CapabilityDefinition;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.ComponentInstanceProperty;
+import org.openecomp.sdc.be.model.GroupDefinition;
+import org.openecomp.sdc.be.model.GroupInstance;
+import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
import org.openecomp.sdc.be.tosca.model.ToscaGroupTemplate;
import org.openecomp.sdc.be.tosca.model.ToscaTemplateCapability;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Stream;
-
-import static java.util.Collections.singletonList;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.mockito.Mockito.when;
-
@ExtendWith(MockitoExtension.class)
public class GroupExportParserImplTest {
@@ -67,7 +69,7 @@ public class GroupExportParserImplTest {
private GroupExportParser groupExportParser;
@Mock
- private ApplicationDataTypeCache dataTypeCache;
+ private ApplicationDataTypeCache applicationDataTypeCache;
@Mock
private Component component;
@Mock
@@ -79,14 +81,15 @@ public class GroupExportParserImplTest {
}
private void initGroupExportParser() {
- when(dataTypeCache.getAll()).thenReturn(Either.left(null));
- groupExportParser = new GroupExportParserImpl(dataTypeCache, propertyConvertor);
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(null));
+ groupExportParser = new GroupExportParserImpl(applicationDataTypeCache, propertyConvertor);
}
@Test
public void failToGetAllDataTypes() {
- when(dataTypeCache.getAll()).thenReturn(Either.right(null));
- assertThatExceptionOfType(SdcResourceNotFoundException.class).isThrownBy(() -> groupExportParser = new GroupExportParserImpl(dataTypeCache,
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.right(null));
+ assertThatExceptionOfType(SdcResourceNotFoundException.class).isThrownBy(() -> groupExportParser = new GroupExportParserImpl(
+ applicationDataTypeCache,
propertyConvertor));
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/PolicyExportParserImplTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/PolicyExportParserImplTest.java
index b499830138..d7f70ae8a7 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/PolicyExportParserImplTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/PolicyExportParserImplTest.java
@@ -20,7 +20,16 @@
package org.openecomp.sdc.be.tosca;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
+import static org.mockito.Mockito.when;
+
import fj.data.Either;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -35,16 +44,6 @@ import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
import org.openecomp.sdc.be.tosca.model.ToscaMetadata;
import org.openecomp.sdc.be.tosca.model.ToscaPolicyTemplate;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
-import static org.mockito.Mockito.when;
-
@RunWith(MockitoJUnitRunner.class)
public class PolicyExportParserImplTest {
@@ -62,7 +61,7 @@ public class PolicyExportParserImplTest {
private PolicyExportParser policiyExportParser;
@Mock
- private ApplicationDataTypeCache dataTypeCache;
+ private ApplicationDataTypeCache applicationDataTypeCache;
@Mock
private PropertyConvertor propertyConvertor;
@@ -72,17 +71,18 @@ public class PolicyExportParserImplTest {
@Test
public void failToGetAllDataTypes() {
- when(dataTypeCache.getAll()).thenReturn(Either.right(null));
- assertThatExceptionOfType(SdcResourceNotFoundException.class).isThrownBy(() -> policiyExportParser = new PolicyExportParserImpl(dataTypeCache,
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.right(null));
+ assertThatExceptionOfType(SdcResourceNotFoundException.class).isThrownBy(() -> policiyExportParser = new PolicyExportParserImpl(
+ applicationDataTypeCache,
propertyConvertor));
}
@Test
public void noPoliciesInComponent() {
- when(dataTypeCache.getAll()).thenReturn(Either.left(null));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(null));
when(component.getPolicies()).thenReturn(null);
- policiyExportParser = new PolicyExportParserImpl(dataTypeCache, propertyConvertor);
+ policiyExportParser = new PolicyExportParserImpl(applicationDataTypeCache, propertyConvertor);
Map<String, ToscaPolicyTemplate> policies = policiyExportParser.getPolicies(component);
assertThat(policies).isEqualTo(null);
}
@@ -102,13 +102,13 @@ public class PolicyExportParserImplTest {
}
private void testPoliciesInComponent(List<Integer> constIndexes) {
- when(dataTypeCache.getAll()).thenReturn(Either.left(null));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(null));
Map<String, PolicyDefinition> policiesToAdd = getPolicies(constIndexes);
when(component.getPolicies()).thenReturn(policiesToAdd);
when(component.getComponentInstances()).thenReturn(getComponentInstances());
when(component.getGroups()).thenReturn(getGroups());
- policiyExportParser = new PolicyExportParserImpl(dataTypeCache, propertyConvertor);
+ policiyExportParser = new PolicyExportParserImpl(applicationDataTypeCache, propertyConvertor);
Map<String, ToscaPolicyTemplate> policies = policiyExportParser.getPolicies(component);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java
index 5c8d522482..38c72922fd 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java
@@ -129,7 +129,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
private ToscaExportHandler testSubject;
@Mock
- private ApplicationDataTypeCache dataTypeCache;
+ private ApplicationDataTypeCache applicationDataTypeCache;
@Mock
private ToscaOperationFacade toscaOperationFacade;
@@ -236,7 +236,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
Component component = getNewResource();
Either<ToscaRepresentation, ToscaError> result;
- when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
when(capabilityRequirementConverter.convertRequirements(any(Map.class), any(Resource.class),
any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
@@ -249,7 +249,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
component = getNewService();
when(capabilityRequirementConverter.convertRequirements(any(Map.class), any(Service.class),
any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
- when(dataTypeCache.getAll()).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
// default test when component is Service
result = testSubject.exportComponent(component);
@@ -263,14 +263,14 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
((Resource) component).setInterfaces(new HashMap<>());
- when(dataTypeCache.getAll()).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
.thenReturn(Either.left(Collections.emptyMap()));
// default test when convertInterfaceNodeType is right
result = testSubject.exportComponentInterface(component, false);
Assert.assertNotNull(result);
- when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
when(capabilityRequirementConverter.convertRequirements(any(Map.class), any(Resource.class),
any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
@@ -298,7 +298,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
.thenReturn(Either.left(Collections.emptyMap()));
- when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
// when convertRequirements is called, make it return the same value as 3rd (index=2) argument.
when(capabilityRequirementConverter.convertRequirements(any(Map.class), any(Resource.class),
any(ToscaNodeType.class))).thenAnswer(i -> Either.left(i.getArgument(2)));
@@ -392,7 +392,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
component.setComponentInstances(resourceInstances);
- when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
when(capabilityRequirementConverter.getOriginComponent(any(Map.class), any(ComponentInstance.class))).thenReturn(Either.right(false));
final Map<String, ToscaProperty> map = new HashMap<>();
@@ -431,7 +431,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
any(Component.class), any(SubstitutionMapping.class)))
.thenReturn(Either.left(new SubstitutionMapping()));
- when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
when(inputConverter.convertInputs(any(List.class), any(Map.class))).thenReturn(new HashMap<>());
@@ -473,7 +473,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
.convertSubstitutionMappingRequirements(anyMap(), any(Component.class), any(SubstitutionMapping.class)))
.thenReturn(Either.left(new SubstitutionMapping()));
- when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
when(inputConverter.convertInputs(anyList(), anyMap())).thenReturn(new HashMap<>());
final Map<String, ToscaProperty> map = new HashMap<>();
@@ -580,7 +580,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
Map<String, ToscaNodeType> nodeTypes = new HashMap<>();
Either<ToscaTemplate, ToscaError> result;
- when(dataTypeCache.getAll()).thenReturn(Either.right(JanusGraphOperationStatus.ALREADY_EXIST));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.right(JanusGraphOperationStatus.ALREADY_EXIST));
when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
.thenReturn(Either.left(Collections.emptyMap()));
// default test
@@ -599,7 +599,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
inputs.add(new InputDefinition());
component.setInputs(inputs);
- when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
.thenReturn(Either.left(Collections.emptyMap()));
@@ -730,7 +730,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
.convertComponentInstanceCapabilities(any(ComponentInstance.class), any(Map.class), any(ToscaNodeTemplate.class)))
.thenReturn(Either.left(new ToscaNodeTemplate()));
when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any())).thenReturn(Either.left(Collections.emptyMap()));
- when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
when(capabilityRequirementConverter.convertRequirements(any(Map.class), any(Resource.class), any(ToscaNodeType.class)))
.thenReturn(Either.left(new ToscaNodeType()));
when(toscaOperationFacade.getToscaFullElement("uid")).thenReturn(Either.left(component));
@@ -854,7 +854,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
.convertComponentInstanceCapabilities(any(ComponentInstance.class), any(Map.class), any(ToscaNodeTemplate.class)))
.thenReturn(Either.left(new ToscaNodeTemplate()));
when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any())).thenReturn(Either.left(Collections.emptyMap()));
- when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
when(capabilityRequirementConverter.convertRequirements(any(Map.class), any(Resource.class), any(ToscaNodeType.class)))
.thenReturn(Either.left(new ToscaNodeType()));
when(toscaOperationFacade.getToscaFullElement("uid")).thenReturn(Either.left(component));
@@ -917,7 +917,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
.convertComponentInstanceCapabilities(any(ComponentInstance.class), any(Map.class), any(ToscaNodeTemplate.class)))
.thenReturn(Either.right(ToscaError.GENERAL_ERROR));
when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any())).thenReturn(Either.left(Collections.emptyMap()));
- when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
when(capabilityRequirementConverter.convertRequirements(any(Map.class), any(Resource.class),
any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
@@ -968,7 +968,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
when(capabilityRequirementConverter.getOriginComponent(any(Map.class), any(ComponentInstance.class))).thenReturn(Either.right(false));
when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any())).thenReturn(Either.left(Collections.emptyMap()));
- when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
when(capabilityRequirementConverter.convertRequirements(any(Map.class), any(Resource.class),
any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
@@ -1023,7 +1023,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
doReturn(Either.left(component)).when(toscaOperationFacade).getToscaFullElement("id");
when(capabilityRequirementConverter.getOriginComponent(any(Map.class), any(ComponentInstance.class))).thenReturn(Either.left(component));
when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any())).thenReturn(Either.left(Collections.emptyMap()));
- when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
when(capabilityRequirementConverter.convertRequirements(any(Map.class), any(Resource.class),
any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
when(toscaOperationFacade.getToscaElement(any(String.class), any(ComponentParametersView.class)))
@@ -1165,7 +1165,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
.thenReturn(Either.left(Collections.emptyMap()));
- when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
when(capabilityRequirementConverter.convertRequirements(any(Map.class), any(Service.class),
any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
@@ -1198,7 +1198,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
any(ComponentParametersView.class)))
.thenReturn(Either.right(StorageOperationStatus.BAD_REQUEST));
- when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
// test when getLatestByName is left
result = Deencapsulation.invoke(testSubject, "createProxyNodeTypes", componentCache, container);
@@ -1213,7 +1213,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
ComponentInstance instance = new ComponentInstance();
ToscaNodeType result;
- when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
+ when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
// default test
result = Deencapsulation.invoke(testSubject, "createProxyNodeType", componentCache, origComponent,