summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test/java
diff options
context:
space:
mode:
authorTal Gitelman <tg851x@intl.att.com>2018-05-15 19:52:07 +0300
committerTal Gitelman <tg851x@intl.att.com>2018-05-15 19:52:07 +0300
commitffb902f0f44d299533d663b6781f66b11adc4bfe (patch)
tree7f19630f7ca1214716b69e3e97720fc433bcbc42 /catalog-be/src/test/java
parent3d676aa56978df9bf39d51d50747b15d682332c1 (diff)
new unit tests for sdc-be
Change-Id: If35d53a165a008d9556d856c390fd30f9c7646ad Issue-ID: SDC-1333 Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'catalog-be/src/test/java')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/GlobalTypesMergeBusinessLogicTest.java13
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/RelationsComparatorTest.java13
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/TopologyComparatorTest.java2
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBLTest.java105
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMergeTest.java191
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabiliteisPropertiesMergeTest.java9
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/DataForMergeHolderTest.java223
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/RelationMergeInfoTest.java91
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/VfRelationsMergeInfoTest.java52
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComplexPropertyValueMergerTest.java35
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/MergePropertyDataTest.java87
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/PropertyInstanceMergeDataBuilderTest.java96
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ScalarPropertyValueMergerTest.java33
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeceleratorTest.java102
14 files changed, 982 insertions, 70 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/GlobalTypesMergeBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/GlobalTypesMergeBusinessLogicTest.java
index a00b0b8e8a..d39db5a500 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/GlobalTypesMergeBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/GlobalTypesMergeBusinessLogicTest.java
@@ -47,7 +47,18 @@ public class GlobalTypesMergeBusinessLogicTest {
assertEquals(ActionStatus.OK, actionStatus);
}
+
+ @Test
+ public void mergeInstancePropsAndInputs_mergeOldResourceNull() {
+ Resource oldResource = null;
+ Resource newResource = buildResourceWithInputs("input1", "input2", "global1", "global2");
+ List<InputDefinition> globalInputs = Arrays.asList(newResource.getInputs().get(2), newResource.getInputs().get(3));
+ when(globalInputsFilteringBusinessLogic.filterGlobalInputs(newResource)).thenReturn(Either.left(globalInputs));
+ ActionStatus actionStatus = testInstance.mergeResourceEntities(oldResource, newResource);
+ assertEquals(ActionStatus.OK, actionStatus);
+ }
+
@Test
public void mergeInstancePropsAndInputs_failedToFilterGlobalInputs() throws Exception {
Resource oldResource = buildResourceWithInputs("input1", "input2");
@@ -58,5 +69,5 @@ public class GlobalTypesMergeBusinessLogicTest {
verifyZeroInteractions(resourceInputsMergeBLMock);
}
-
+
} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/RelationsComparatorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/RelationsComparatorTest.java
index 743d394c62..eed98b1752 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/RelationsComparatorTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/RelationsComparatorTest.java
@@ -4,6 +4,7 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.Arrays;
+import java.util.LinkedList;
import org.junit.Before;
import org.junit.Test;
@@ -43,7 +44,17 @@ public class RelationsComparatorTest {
newResource.setComponentInstances(Arrays.asList(componentInstance1, componentInstance2));
assertFalse(testInstance.isRelationsChanged(oldResource, newResource));
}
-
+
+ @Test
+ public void isRelationsChanged_OldResourceNull() throws Exception {
+ Resource oldResource = ObjectGenerator.buildResourceWithRelationships();
+ oldResource.setComponentInstancesRelations(new LinkedList<>());
+ oldResource.setComponentInstances(Arrays.asList(componentInstance1, componentInstance2));
+ Resource newResource = ObjectGenerator.buildResourceWithRelationships(relation4, relation3, relation1, relation2);
+ newResource.setComponentInstances(Arrays.asList(componentInstance1, componentInstance2));
+ assertTrue(testInstance.isRelationsChanged(oldResource, newResource));
+ }
+
@Test
public void isRelationsChanged_notSameAmountOfRelations() {
Resource oldResource = ObjectGenerator.buildResourceWithRelationships(relation1, relation2);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/TopologyComparatorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/TopologyComparatorTest.java
index 3b1ed52550..aa5962eccf 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/TopologyComparatorTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/TopologyComparatorTest.java
@@ -50,7 +50,7 @@ public class TopologyComparatorTest {
assertTrue(testInstance.isTopologyChanged(resourceWithNoInstances, resourceWith1Instances).left().value());
assertTrue(testInstance.isTopologyChanged(resourceWith1Instances, resourceWith2Instances).left().value());
}
-
+
@Test
public void compareTopologies_notSameInstanceNames() throws Exception {
Resource resource1 = ObjectGenerator.buildResourceWithComponentInstance("inst1", "inst2");
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBLTest.java
new file mode 100644
index 0000000000..aac50a3638
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBLTest.java
@@ -0,0 +1,105 @@
+package org.openecomp.sdc.be.components.merge.instance;
+
+import static org.mockito.Mockito.when;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.openecomp.sdc.be.components.merge.capability.CapabilityResolver;
+import org.openecomp.sdc.be.components.merge.property.DataDefinitionsValuesMergingBusinessLogic;
+import org.openecomp.sdc.be.components.utils.ObjectGenerator;
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.impl.ComponentsUtils;
+import org.openecomp.sdc.be.impl.ForwardingPathUtils;
+import org.openecomp.sdc.be.model.CapabilityDefinition;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.ComponentParametersView;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+
+import fj.data.Either;
+
+public class ComponentCapabilitiesPropertiesMergeBLTest {
+
+ @InjectMocks
+ ComponentCapabilitiesPropertiesMergeBL testSubject;
+
+ @Mock
+ DataDefinitionsValuesMergingBusinessLogic dataDefinitionsValuesMergingBusinessLogicMock;
+
+ @Mock
+ private ToscaOperationFacade toscaOperationFacadeMock;
+
+ @Mock
+ ComponentsUtils componentsUtilsMock;
+
+ @Mock
+ CapabilityResolver capabilityResolverMock;
+
+ private Resource buildBasicResource;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void testDescription() throws Exception {
+ // ComponentCapabilitiesPropertiesMergeBL testSubject;
+ String result;
+
+ // default test
+ // testSubject = createTestSubject();
+ result = testSubject.description();
+ }
+
+ @Test
+ public void testMergeComponents() throws Exception {
+ // ComponentCapabilitiesPropertiesMergeBL testSubject;
+ Component prevComponent = ObjectGenerator.buildResourceWithComponentInstance("mock3");
+ Component currentComponent = ObjectGenerator.buildResourceWithComponentInstance("mock1", "mock2");
+ currentComponent.setUniqueId("mock");
+ ActionStatus result;
+ buildBasicResource = ObjectGenerator.buildBasicResource();
+ when(toscaOperationFacadeMock.getToscaElement(Mockito.anyString(), Mockito.any(ComponentParametersView.class)))
+ .thenReturn(Either.left(buildBasicResource));
+ ;
+ result = testSubject.mergeComponents(prevComponent, currentComponent);
+ }
+
+ @Test
+ public void testMergeComponentInstanceCapabilities() throws Exception {
+ // ComponentCapabilitiesPropertiesMergeBL testSubject;
+ Component currentComponent = null;
+ Component origInstanceCmpt = null;
+ String instanceId = "";
+
+ List<CapabilityDefinition> prevInstanceCapabilities = null;
+ ActionStatus result;
+
+ // default test
+ // testSubject = createTestSubject();
+ result = testSubject.mergeComponentInstanceCapabilities(currentComponent, origInstanceCmpt, instanceId,
+ prevInstanceCapabilities);
+
+ prevInstanceCapabilities = initCapabilites();
+
+ result = testSubject.mergeComponentInstanceCapabilities(currentComponent, origInstanceCmpt, instanceId,
+ prevInstanceCapabilities);
+ }
+
+ private List<CapabilityDefinition> initCapabilites() {
+ final String NODE_A_FORWARDER_CAPABILITY = "nodeA_FORWARDER_CAPABILITY";
+
+ CapabilityDefinition forwarder = new CapabilityDefinition();
+ forwarder.setType(ForwardingPathUtils.FORWARDER_CAPABILITY);
+ forwarder.setUniqueId(NODE_A_FORWARDER_CAPABILITY);
+ return Arrays.asList(forwarder);
+ }
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMergeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMergeTest.java
index be16bc3621..3f3fc26558 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMergeTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMergeTest.java
@@ -1,88 +1,145 @@
package org.openecomp.sdc.be.components.merge.instance;
import static junit.framework.TestCase.assertEquals;
+import static org.mockito.Mockito.when;
import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
+import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic;
+import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationInfo;
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.Operation;
import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
+import org.openecomp.sdc.exception.ResponseFormat;
+import fj.data.Either;
public class ComponentInstanceArtifactsMergeTest {
- @InjectMocks
- private ComponentInstanceArtifactsMerge testInstance;
-
- @Before
- public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
- }
-
- @Test
- public void testDeploymentArtifactSaveData() throws Exception {
-
- Component containerComponent = new Resource();
- Component originComponent = buildOriginalComponentWithOneArtifact();
- ComponentInstance componentInstance = buildComponentInstanceWithTwoArtifacts();
-
- DataForMergeHolder dataForMergeHolder = new DataForMergeHolder();
- testInstance.saveDataBeforeMerge(dataForMergeHolder, containerComponent, componentInstance, originComponent);
- Map<String, ArtifactDefinition> originalComponentDeploymentArtifactsCreatedOnTheInstance = dataForMergeHolder.getOrigComponentDeploymentArtifactsCreatedOnTheInstance();
-
- assertEquals(originalComponentDeploymentArtifactsCreatedOnTheInstance.size() , 1);
- assert(originalComponentDeploymentArtifactsCreatedOnTheInstance.containsKey("artifactTwo"));
- }
-
- @Test
- public void testInformationalArtifactSaveData() throws Exception {
-
- Component containerComponent = new Resource();
- Component originComponent = buildOriginalComponentWithOneArtifact();
- ComponentInstance componentInstance = buildComponentInstanceWithTwoArtifacts();
-
- DataForMergeHolder dataForMergeHolder = new DataForMergeHolder();
- testInstance.saveDataBeforeMerge(dataForMergeHolder, containerComponent, componentInstance, originComponent);
- Map<String, ArtifactDefinition> originalComponentInformationalArtifactsCreatedOnTheInstance = dataForMergeHolder.getOrigComponentInformationalArtifactsCreatedOnTheInstance();
-
- assertEquals(originalComponentInformationalArtifactsCreatedOnTheInstance.size() , 1);
- assert(originalComponentInformationalArtifactsCreatedOnTheInstance.containsKey("artifactTwo"));
- }
-
- private ComponentInstance buildComponentInstanceWithTwoArtifacts(){
- ArtifactDefinition artifactFromTheOriginalResource = new ArtifactDefinition();
- artifactFromTheOriginalResource.setArtifactLabel("artifactOne");
- ArtifactDefinition artifactCreatedOnTheInstance = new ArtifactDefinition();
- artifactCreatedOnTheInstance.setArtifactLabel("artifactTwo");
-
- Map<String, ArtifactDefinition> componentInstanceArtifacts = new HashMap<>();
- componentInstanceArtifacts.put(artifactFromTheOriginalResource.getArtifactLabel(), artifactFromTheOriginalResource);
- componentInstanceArtifacts.put(artifactCreatedOnTheInstance.getArtifactLabel(), artifactCreatedOnTheInstance);
-
- ComponentInstance componentInstance = new ComponentInstance();
- componentInstance.setDeploymentArtifacts(componentInstanceArtifacts);
- componentInstance.setArtifacts(componentInstanceArtifacts);
- return componentInstance;
- }
-
- private Component buildOriginalComponentWithOneArtifact() {
- ArtifactDefinition artifactFromTheOriginalResource = new ArtifactDefinition();
- artifactFromTheOriginalResource.setArtifactLabel("artifactOne");
-
- Map<String, ArtifactDefinition> originComponentArtifacts = new HashMap<>();
- originComponentArtifacts.put(artifactFromTheOriginalResource.getArtifactLabel(), artifactFromTheOriginalResource);
- Component originComponent = new Resource();
- originComponent.setDeploymentArtifacts(originComponentArtifacts);
- originComponent.setArtifacts(originComponentArtifacts);
- return originComponent;
- }
-
-
+ @InjectMocks
+ ComponentInstanceArtifactsMerge testInstance;
+
+ @Mock
+ ArtifactsBusinessLogic artifactsBusinessLogicMock;
+
+ @Mock
+ ToscaOperationFacade toscaOperationFacadeMock;
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void testDeploymentArtifactSaveData() throws Exception {
+
+ Component containerComponent = new Resource();
+ Component originComponent = buildOriginalComponentWithOneArtifact();
+ ComponentInstance componentInstance = buildComponentInstanceWithTwoArtifacts();
+
+ DataForMergeHolder dataForMergeHolder = new DataForMergeHolder();
+ testInstance.saveDataBeforeMerge(dataForMergeHolder, containerComponent, componentInstance, originComponent);
+ Map<String, ArtifactDefinition> originalComponentDeploymentArtifactsCreatedOnTheInstance = dataForMergeHolder
+ .getOrigComponentDeploymentArtifactsCreatedOnTheInstance();
+
+ assertEquals(originalComponentDeploymentArtifactsCreatedOnTheInstance.size(), 1);
+ assert (originalComponentDeploymentArtifactsCreatedOnTheInstance.containsKey("artifactTwo"));
+ }
+
+ @Test
+ public void testInformationalArtifactSaveData() throws Exception {
+
+ Component containerComponent = new Resource();
+ Component originComponent = buildOriginalComponentWithOneArtifact();
+ ComponentInstance componentInstance = buildComponentInstanceWithTwoArtifacts();
+
+ DataForMergeHolder dataForMergeHolder = new DataForMergeHolder();
+ testInstance.saveDataBeforeMerge(dataForMergeHolder, containerComponent, componentInstance, originComponent);
+ Map<String, ArtifactDefinition> originalComponentInformationalArtifactsCreatedOnTheInstance = dataForMergeHolder
+ .getOrigComponentInformationalArtifactsCreatedOnTheInstance();
+
+ assertEquals(originalComponentInformationalArtifactsCreatedOnTheInstance.size(), 1);
+ assert (originalComponentInformationalArtifactsCreatedOnTheInstance.containsKey("artifactTwo"));
+ }
+
+ @Test
+ public void testMergeDataAfterCreate() throws Exception {
+
+ Component originComponent = buildOriginalComponentWithOneArtifact();
+ List<ComponentInstance> resourceInstances = new LinkedList<>();
+ ComponentInstance ci = new ComponentInstance();
+ ci.setUniqueId("mock");
+ resourceInstances.add(ci);
+ originComponent.setComponentInstances(resourceInstances);
+ DataForMergeHolder dataForMergeHolder = new DataForMergeHolder();
+ Map<String, ArtifactDefinition> origDeploymentArtifacts = new HashMap<>();
+ ArtifactDefinition currentArtifactDefinition = new ArtifactDefinition();
+ origDeploymentArtifacts.put("mock", currentArtifactDefinition);
+ dataForMergeHolder.setOrigComponentDeploymentArtifactsCreatedOnTheInstance(origDeploymentArtifacts);
+
+ when(artifactsBusinessLogicMock.buildJsonForUpdateArtifact(Mockito.anyString(),
+ Mockito.anyString(),
+ Mockito.anyString(),
+ Mockito.any(ArtifactGroupTypeEnum.class),
+ Mockito.anyString(),
+ Mockito.anyString(),
+ Mockito.anyString(),
+ Mockito.any(byte[].class),
+ Mockito.any(),
+ Mockito.any(List.class)))
+ .thenReturn(new HashMap<>());
+
+ Either<Either<ArtifactDefinition, Operation>, ResponseFormat> left = Either.left(Either.left(new ArtifactDefinition()));
+
+ when(artifactsBusinessLogicMock.updateResourceInstanceArtifactNoContent(Mockito.anyString(), Mockito.any(Component.class), Mockito.any(User.class),
+ Mockito.any(Map.class), Mockito.any(ArtifactOperationInfo.class), Mockito.any(ArtifactDefinition.class))).thenReturn(left);
+
+ testInstance.mergeDataAfterCreate(new User(), dataForMergeHolder, originComponent, "mock");
+
+ }
+
+ private ComponentInstance buildComponentInstanceWithTwoArtifacts() {
+ ArtifactDefinition artifactFromTheOriginalResource = new ArtifactDefinition();
+ artifactFromTheOriginalResource.setArtifactLabel("artifactOne");
+ ArtifactDefinition artifactCreatedOnTheInstance = new ArtifactDefinition();
+ artifactCreatedOnTheInstance.setArtifactLabel("artifactTwo");
+
+ Map<String, ArtifactDefinition> componentInstanceArtifacts = new HashMap<>();
+ componentInstanceArtifacts.put(artifactFromTheOriginalResource.getArtifactLabel(),
+ artifactFromTheOriginalResource);
+ componentInstanceArtifacts.put(artifactCreatedOnTheInstance.getArtifactLabel(), artifactCreatedOnTheInstance);
+
+ ComponentInstance componentInstance = new ComponentInstance();
+ componentInstance.setDeploymentArtifacts(componentInstanceArtifacts);
+ componentInstance.setArtifacts(componentInstanceArtifacts);
+ return componentInstance;
+ }
+
+ private Component buildOriginalComponentWithOneArtifact() {
+ ArtifactDefinition artifactFromTheOriginalResource = new ArtifactDefinition();
+ artifactFromTheOriginalResource.setArtifactLabel("artifactOne");
+
+ Map<String, ArtifactDefinition> originComponentArtifacts = new HashMap<>();
+ originComponentArtifacts.put(artifactFromTheOriginalResource.getArtifactLabel(),
+ artifactFromTheOriginalResource);
+ Component originComponent = new Resource();
+ originComponent.setDeploymentArtifacts(originComponentArtifacts);
+ originComponent.setArtifacts(originComponentArtifacts);
+ return originComponent;
+ }
} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabiliteisPropertiesMergeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabiliteisPropertiesMergeTest.java
index 70d4b87b9f..9b88ecb157 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabiliteisPropertiesMergeTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabiliteisPropertiesMergeTest.java
@@ -16,6 +16,7 @@ import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.impl.ComponentsUtils;
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.Resource;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
@@ -68,4 +69,12 @@ public class ComponentInstanceCapabiliteisPropertiesMergeTest {
assertTrue(mergeResult.isRight());
}
+ @Test
+ public void testSaveDataBeforeMerge() {
+ DataForMergeHolder dataHolder = new DataForMergeHolder();
+ Component containerComponent = new Resource();
+ ComponentInstance currentResourceInstance = new ComponentInstance();
+ Component originComponent = new Resource();
+ testInstance.saveDataBeforeMerge(dataHolder, containerComponent, currentResourceInstance, originComponent);
+ }
} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/DataForMergeHolderTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/DataForMergeHolderTest.java
new file mode 100644
index 0000000000..8c265a6be3
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/DataForMergeHolderTest.java
@@ -0,0 +1,223 @@
+package org.openecomp.sdc.be.components.merge.instance;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Test;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.CapabilityDefinition;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.ComponentInstanceInput;
+import org.openecomp.sdc.be.model.ComponentInstanceProperty;
+import org.openecomp.sdc.be.model.InputDefinition;
+
+public class DataForMergeHolderTest {
+
+ private DataForMergeHolder createTestSubject() {
+ return new DataForMergeHolder();
+ }
+
+ @Test
+ public void testGetOrigComponentInstanceHeatEnvArtifacts() throws Exception {
+ DataForMergeHolder testSubject;
+ List<ArtifactDefinition> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getOrigComponentInstanceHeatEnvArtifacts();
+ }
+
+ @Test
+ public void testSetOrigComponentInstanceHeatEnvArtifacts() throws Exception {
+ DataForMergeHolder testSubject;
+ List<ArtifactDefinition> origComponentInstanceHeatEnvArtifacts = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setOrigComponentInstanceHeatEnvArtifacts(origComponentInstanceHeatEnvArtifacts);
+ }
+
+ @Test
+ public void testGetOrigComponentInstanceInputs() throws Exception {
+ DataForMergeHolder testSubject;
+ List<ComponentInstanceInput> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getOrigComponentInstanceInputs();
+ }
+
+ @Test
+ public void testSetOrigComponentInstanceInputs() throws Exception {
+ DataForMergeHolder testSubject;
+ List<ComponentInstanceInput> origComponentInstanceInputs = new LinkedList<>();
+ ComponentInstanceInput e = new ComponentInstanceInput();
+ origComponentInstanceInputs.add(e);
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setOrigComponentInstanceInputs(origComponentInstanceInputs);
+ }
+
+ @Test
+ public void testGetOrigComponentInstanceProperties() throws Exception {
+ DataForMergeHolder testSubject;
+ List<ComponentInstanceProperty> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getOrigComponentInstanceProperties();
+ }
+
+ @Test
+ public void testSetOrigComponentInstanceProperties() throws Exception {
+ DataForMergeHolder testSubject;
+ List<ComponentInstanceProperty> origComponentInstanceProperties = new LinkedList<>();
+ ComponentInstanceProperty e = new ComponentInstanceProperty();
+ origComponentInstanceProperties.add(e);
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setOrigComponentInstanceProperties(origComponentInstanceProperties);
+ }
+
+ @Test
+ public void testGetOrigComponentInputs() throws Exception {
+ DataForMergeHolder testSubject;
+ List<InputDefinition> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getOrigComponentInputs();
+ }
+
+ @Test
+ public void testSetOrigComponentInputs() throws Exception {
+ DataForMergeHolder testSubject;
+ List<InputDefinition> origComponentInputs = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setOrigComponentInputs(origComponentInputs);
+ }
+
+ @Test
+ public void testGetOrigComponentDeploymentArtifactsCreatedOnTheInstance() throws Exception {
+ DataForMergeHolder testSubject;
+ Map<String, ArtifactDefinition> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getOrigComponentDeploymentArtifactsCreatedOnTheInstance();
+ }
+
+ @Test
+ public void testGetOrigComponentInformationalArtifactsCreatedOnTheInstance() throws Exception {
+ DataForMergeHolder testSubject;
+ Map<String, ArtifactDefinition> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getOrigComponentInformationalArtifactsCreatedOnTheInstance();
+ }
+
+ @Test
+ public void testSetOrigComponentDeploymentArtifactsCreatedOnTheInstance() throws Exception {
+ DataForMergeHolder testSubject;
+ Map<String, ArtifactDefinition> origDeploymentArtifacts = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setOrigComponentDeploymentArtifactsCreatedOnTheInstance(origDeploymentArtifacts);
+ }
+
+ @Test
+ public void testSetOrigComponentInformationalArtifactsCreatedOnTheInstance() throws Exception {
+ DataForMergeHolder testSubject;
+ Map<String, ArtifactDefinition> origInformationalArtifacts = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setOrigComponentInformationalArtifactsCreatedOnTheInstance(origInformationalArtifacts);
+ }
+
+ @Test
+ public void testSetVfRelationsInfo() throws Exception {
+ DataForMergeHolder testSubject;
+ VfRelationsMergeInfo vfRelationsMergeInfo = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setVfRelationsInfo(vfRelationsMergeInfo);
+ }
+
+ @Test
+ public void testGetVfRelationsMergeInfo() throws Exception {
+ DataForMergeHolder testSubject;
+ VfRelationsMergeInfo result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getVfRelationsMergeInfo();
+ }
+
+ @Test
+ public void testGetOrigInstanceCapabilities() throws Exception {
+ DataForMergeHolder testSubject;
+ List<CapabilityDefinition> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getOrigInstanceCapabilities();
+ }
+
+ @Test
+ public void testSetOrigInstanceCapabilities() throws Exception {
+ DataForMergeHolder testSubject;
+ List<CapabilityDefinition> origInstanceCapabilities = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setOrigInstanceCapabilities(origInstanceCapabilities);
+ }
+
+ @Test
+ public void testGetOrigInstanceNode() throws Exception {
+ DataForMergeHolder testSubject;
+ Component result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getOrigInstanceNode();
+ }
+
+ @Test
+ public void testSetOrigInstanceNode() throws Exception {
+ DataForMergeHolder testSubject;
+ Component origInstanceNode = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setOrigInstanceNode(origInstanceNode);
+ }
+
+ @Test
+ public void testGetOrigComponentInstId() throws Exception {
+ DataForMergeHolder testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getOrigComponentInstId();
+ }
+
+ @Test
+ public void testSetOrigComponentInstId() throws Exception {
+ DataForMergeHolder testSubject;
+ String origComponentInstId = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setOrigComponentInstId(origComponentInstId);
+ }
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/RelationMergeInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/RelationMergeInfoTest.java
new file mode 100644
index 0000000000..7173af3d4c
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/RelationMergeInfoTest.java
@@ -0,0 +1,91 @@
+package org.openecomp.sdc.be.components.merge.instance;
+
+import org.junit.Test;
+import org.openecomp.sdc.be.model.RequirementCapabilityRelDef;
+
+public class RelationMergeInfoTest {
+
+ private RelationMergeInfo createTestSubject() {
+ return new RelationMergeInfo("", "", "", new RequirementCapabilityRelDef());
+ }
+
+ @Test
+ public void testGetCapReqType() throws Exception {
+ RelationMergeInfo testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getCapReqType();
+ }
+
+ @Test
+ public void testSetCapReqType() throws Exception {
+ RelationMergeInfo testSubject;
+ String type = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setCapReqType(type);
+ }
+
+ @Test
+ public void testGetVfcInstanceName() throws Exception {
+ RelationMergeInfo testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getVfcInstanceName();
+ }
+
+ @Test
+ public void testSetVfcInstanceName() throws Exception {
+ RelationMergeInfo testSubject;
+ String vfcInstanceName = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setVfcInstanceName(vfcInstanceName);
+ }
+
+ @Test
+ public void testGetRelDef() throws Exception {
+ RelationMergeInfo testSubject;
+ RequirementCapabilityRelDef result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getRelDef();
+ }
+
+ @Test
+ public void testSetRelDef() throws Exception {
+ RelationMergeInfo testSubject;
+ RequirementCapabilityRelDef relDef = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setRelDef(relDef);
+ }
+
+ @Test
+ public void testGetCapReqName() throws Exception {
+ RelationMergeInfo testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getCapReqName();
+ }
+
+ @Test
+ public void testSetCapReqName() throws Exception {
+ RelationMergeInfo testSubject;
+ String capReqName = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setCapReqName(capReqName);
+ }
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/VfRelationsMergeInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/VfRelationsMergeInfoTest.java
new file mode 100644
index 0000000000..40a5ea5ee3
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/VfRelationsMergeInfoTest.java
@@ -0,0 +1,52 @@
+package org.openecomp.sdc.be.components.merge.instance;
+
+import java.util.List;
+
+import org.junit.Test;
+
+public class VfRelationsMergeInfoTest {
+
+ private VfRelationsMergeInfo createTestSubject() {
+ return new VfRelationsMergeInfo(null, null);
+ }
+
+ @Test
+ public void testGetFromRelationsInfo() throws Exception {
+ VfRelationsMergeInfo testSubject;
+ List<RelationMergeInfo> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getFromRelationsInfo();
+ }
+
+ @Test
+ public void testSetFromRelationsInfo() throws Exception {
+ VfRelationsMergeInfo testSubject;
+ List<RelationMergeInfo> fromRelationsInfo = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setFromRelationsInfo(fromRelationsInfo);
+ }
+
+ @Test
+ public void testGetToRelationsInfo() throws Exception {
+ VfRelationsMergeInfo testSubject;
+ List<RelationMergeInfo> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getToRelationsInfo();
+ }
+
+ @Test
+ public void testSetToRelationsInfo() throws Exception {
+ VfRelationsMergeInfo testSubject;
+ List<RelationMergeInfo> toRelationsInfo = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setToRelationsInfo(toRelationsInfo);
+ }
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComplexPropertyValueMergerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComplexPropertyValueMergerTest.java
new file mode 100644
index 0000000000..4e4a77fadd
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComplexPropertyValueMergerTest.java
@@ -0,0 +1,35 @@
+package org.openecomp.sdc.be.components.merge.property;
+
+import java.util.List;
+
+import org.junit.Test;
+
+import mockit.Deencapsulation;
+
+public class ComplexPropertyValueMergerTest {
+
+ private ComplexPropertyValueMerger createTestSubject() {
+ return new ComplexPropertyValueMerger();
+ }
+
+ @Test
+ public void testGetInstance() throws Exception {
+ PropertyValueMerger result;
+
+ // default test
+ result = ComplexPropertyValueMerger.getInstance();
+ }
+
+ @Test
+ public void testMerge() throws Exception {
+ ComplexPropertyValueMerger testSubject;
+ Object oldVal = null;
+ Object newVal = null;
+ List<String> someStrings = null;
+ Object result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "merge", new Object[] { Object.class, Object.class, List.class });
+ }
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/MergePropertyDataTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/MergePropertyDataTest.java
new file mode 100644
index 0000000000..cbc040010e
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/MergePropertyDataTest.java
@@ -0,0 +1,87 @@
+package org.openecomp.sdc.be.components.merge.property;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.junit.Test;
+import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
+
+public class MergePropertyDataTest {
+
+ private MergePropertyData createTestSubject() {
+ return new MergePropertyData();
+ }
+
+ @Test
+ public void testGetOldProp() throws Exception {
+ MergePropertyData testSubject;
+ PropertyDataDefinition result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getOldProp();
+ }
+
+ @Test
+ public void testSetOldProp() throws Exception {
+ MergePropertyData testSubject;
+ PropertyDataDefinition oldProp = null;
+ MergePropertyData result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.setOldProp(oldProp);
+ }
+
+ @Test
+ public void testSetNewProp() throws Exception {
+ MergePropertyData testSubject;
+ PropertyDataDefinition newProp = null;
+ MergePropertyData result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.setNewProp(newProp);
+ }
+
+ @Test
+ public void testGetNewProp() throws Exception {
+ MergePropertyData testSubject;
+ PropertyDataDefinition result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getNewProp();
+ }
+
+ @Test
+ public void testAddAddGetInputNamesToMerge() throws Exception {
+ MergePropertyData testSubject;
+ List<String> getInputsNameToMerge = new LinkedList<>();
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.addAddGetInputNamesToMerge(getInputsNameToMerge);
+ }
+
+ @Test
+ public void testGetGetInputNamesToMerge() throws Exception {
+ MergePropertyData testSubject;
+ List<String> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getGetInputNamesToMerge();
+ }
+
+ @Test
+ public void testIsGetInputProp() throws Exception {
+ MergePropertyData testSubject;
+ boolean result;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setOldProp(new PropertyDataDefinition());
+ result = testSubject.isGetInputProp();
+ }
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/PropertyInstanceMergeDataBuilderTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/PropertyInstanceMergeDataBuilderTest.java
new file mode 100644
index 0000000000..581782c2ba
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/PropertyInstanceMergeDataBuilderTest.java
@@ -0,0 +1,96 @@
+package org.openecomp.sdc.be.components.merge.property;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tinkerpop.gremlin.structure.T;
+import org.junit.Test;
+import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
+import org.openecomp.sdc.be.model.InputDefinition;
+
+import mockit.Deencapsulation;
+
+public class PropertyInstanceMergeDataBuilderTest {
+
+ private PropertyInstanceMergeDataBuilder createTestSubject() {
+ return PropertyInstanceMergeDataBuilder.getInstance();
+ }
+
+ @Test
+ public void testGetInstance() throws Exception {
+ PropertyInstanceMergeDataBuilder result;
+
+ // default test
+ result = PropertyInstanceMergeDataBuilder.getInstance();
+ }
+
+ @Test
+ public void testBuildDataForMerging() throws Exception {
+ PropertyInstanceMergeDataBuilder testSubject;
+ List oldProps = null;
+ List<InputDefinition> oldInputs = null;
+ List newProps = null;
+ List<InputDefinition> newInputs = null;
+ List<MergePropertyData> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.buildDataForMerging(oldProps, oldInputs, newProps, newInputs);
+ }
+
+ @Test
+ public void testBuildMergeData() throws Exception {
+ PropertyInstanceMergeDataBuilder testSubject;
+ Map<String, T> oldPropsByName = null;
+ Map<String, InputDefinition> oldInputsByName = null;
+ Map<String, T> newPropsByName = null;
+ Map<String, InputDefinition> newInputsByName = null;
+ List<MergePropertyData> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "buildMergeData", new HashMap<>(), new HashMap<>(), new HashMap<>(), new HashMap<>());
+ }
+
+ @Test
+ public void testBuildMergePropertyData() throws Exception {
+ PropertyInstanceMergeDataBuilder testSubject;
+ PropertyDataDefinition oldProp = null;
+ Map<String, InputDefinition> oldInputsByName = null;
+ PropertyDataDefinition newProp = null;
+ Map<String, InputDefinition> newInputsByName = null;
+ MergePropertyData result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "buildMergePropertyData", new PropertyDataDefinition(), new HashMap<>(),
+ new PropertyDataDefinition(), new HashMap<>());
+ }
+
+ @Test
+ public void testGetOldGetInputNamesWhichExistInNewVersion() throws Exception {
+ PropertyInstanceMergeDataBuilder testSubject;
+ List<GetInputValueDataDefinition> getInputValues = null;
+ Map<String, InputDefinition> newInputsByName = null;
+ List<String> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "getOldGetInputNamesWhichExistInNewVersion", new LinkedList<>(), new HashMap<>());
+ }
+
+ @Test
+ public void testGetOldDeclaredInputsByUser() throws Exception {
+ PropertyInstanceMergeDataBuilder testSubject;
+ List<GetInputValueDataDefinition> getInputValues = null;
+ Map<String, InputDefinition> oldInputsByName = null;
+ List<String> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "getOldDeclaredInputsByUser", new LinkedList<>(), new HashMap<>());
+ }
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ScalarPropertyValueMergerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ScalarPropertyValueMergerTest.java
new file mode 100644
index 0000000000..2c8fa0a320
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ScalarPropertyValueMergerTest.java
@@ -0,0 +1,33 @@
+package org.openecomp.sdc.be.components.merge.property;
+
+import java.util.List;
+
+import org.junit.Test;
+
+import mockit.Deencapsulation;
+
+public class ScalarPropertyValueMergerTest {
+
+ private ScalarPropertyValueMerger createTestSubject() {
+ return new ScalarPropertyValueMerger();
+ }
+
+ @Test
+ public void testGetInstance() throws Exception {
+ PropertyValueMerger result;
+
+ // default test
+ result = ScalarPropertyValueMerger.getInstance();
+ }
+
+ @Test
+ public void testMerge() throws Exception {
+ ScalarPropertyValueMerger testSubject;Object oldVal = null;
+ Object newVal = null;
+ List<String> getInputNamesToMerge = null;
+ Object result;
+
+ // default test
+ testSubject=createTestSubject();result=Deencapsulation.invoke(testSubject, "merge", new Object[]{Object.class, Object.class, List.class});
+ }
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeceleratorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeceleratorTest.java
new file mode 100644
index 0000000000..19c881fa06
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeceleratorTest.java
@@ -0,0 +1,102 @@
+package org.openecomp.sdc.be.components.property;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
+import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
+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.InputDefinition;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
+
+import fj.data.Either;
+import mockit.Deencapsulation;
+
+public class ComponentInstanceInputPropertyDeceleratorTest {
+
+ @InjectMocks
+ ComponentInstanceInputPropertyDecelerator testSubject;
+
+ @Mock
+ private ComponentInstanceBusinessLogic componentInstanceBusinessLogicMock;
+
+ @Mock
+ private ToscaOperationFacade toscaOperationFacadeMock;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void testCreateDeclaredProperty() throws Exception {
+ PropertyDataDefinition prop = new PropertyDataDefinition();
+ ComponentInstanceInput result;
+
+ // default test
+ result = Deencapsulation.invoke(testSubject, "createDeclaredProperty", prop);
+ }
+
+ @Test
+ public void testUpdatePropertiesValues() throws Exception {
+ ;
+ Component component = new Resource();
+ String cmptInstanceId = "";
+ List<ComponentInstanceInput> properties = new LinkedList<>();
+ Either<?, StorageOperationStatus> result;
+
+ Component containerComponent;
+ Map<String, List<ComponentInstanceInput>> instProperties;
+ Mockito.when(toscaOperationFacadeMock.addComponentInstanceInputsToComponent(Mockito.any(Component.class),
+ Mockito.any(Map.class))).thenReturn(Either.left(new Resource()));
+
+ // default test
+ result = Deencapsulation.invoke(testSubject, "updatePropertiesValues", component, cmptInstanceId, properties);
+ }
+
+ @Test
+ public void testResolvePropertiesOwner() throws Exception {
+ Component component = new Resource();
+ String propertiesOwnerId = "mock";
+ Optional<ComponentInstance> result;
+
+ // default test
+ result = Deencapsulation.invoke(testSubject, "resolvePropertiesOwner", component, propertiesOwnerId);
+ }
+
+ @Test
+ public void testAddPropertiesListToInput() throws Exception {
+ ComponentInstanceInput declaredProp = null;
+ PropertyDataDefinition originalProp = null;
+ InputDefinition input = null;
+
+ // default test
+ Deencapsulation.invoke(testSubject, "addPropertiesListToInput", new ComponentInstanceInput(),
+ new PropertyDataDefinition(), new InputDefinition());
+ }
+
+ @Test
+ public void testUnDeclarePropertiesAsInputs() throws Exception {
+ Component component = null;
+ InputDefinition input = new InputDefinition();
+ StorageOperationStatus result;
+
+ Mockito.when(componentInstanceBusinessLogicMock
+ .getComponentInstanceInputsByInputId(Mockito.any(Component.class), Mockito.anyString()))
+ .thenReturn(new LinkedList());
+ // default test
+ result = testSubject.unDeclarePropertiesAsInputs(component, input);
+ }
+} \ No newline at end of file