aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-model/src/test/java/org
diff options
context:
space:
mode:
authorisaac.manuelraj <isaac.manuelraj@huawei.com>2018-11-28 17:47:11 +0530
committerTal Gitelman <tal.gitelman@att.com>2019-01-10 15:11:17 +0000
commitc8e1fa30e88ff067e1beeb61e4bee062f5f68b83 (patch)
treee4d0b39c1984264f7cc79863779ba7ddec1002c0 /catalog-model/src/test/java/org
parenta4eeb110b076672b3bb88f5e2f3420ae70c78f38 (diff)
Add new test cases on existing class.
Added new test cases on top of existing test classes. Issue-ID: SDC-1774 Change-Id: I2025ea57ab61df6955eed7b409e720583a8bdcff Signed-off-by: isaac.manuelraj <isaac.manuelraj@huawei.com>
Diffstat (limited to 'catalog-model/src/test/java/org')
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java68
1 files changed, 68 insertions, 0 deletions
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java
index 70e866b5cd..a19f188ce1 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java
@@ -39,11 +39,21 @@ import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
+import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
+import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.ComponentInstanceInput;
+import org.openecomp.sdc.be.model.GroupInstance;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
+import org.openecomp.sdc.be.resources.data.ComponentInstanceData;
+
+import java.util.ArrayList;
+import java.util.List;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.anyObject;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
@@ -81,4 +91,62 @@ public class ComponentInstanceOperationTest {
result = componentInstanceOperation.updateCustomizationUUID(componentInstanceId);
assertEquals(StorageOperationStatus.OK, result);
}
+
+ @Test
+ public void testupdateComponentInstanceModificationTimeAndCustomizationUuidOnGraph_CatchException() throws Exception {
+ ComponentInstance componentInstance = new ComponentInstance();
+ GroupInstance groupInstance=new GroupInstance();
+ groupInstance.setCreationTime(23234234234L);
+ groupInstance.setCustomizationUUID("CUSTUUID0.1");
+ groupInstance.setGroupUid("GRP0.1");
+ groupInstance.setGroupUUID("GRPU0.1");
+ groupInstance.setGroupName("GRP1");
+ List gilist = new ArrayList<GroupInstance>();
+ gilist.add(groupInstance);
+ componentInstance.setUniqueId("INST0.1");
+ componentInstance.setComponentUid("RES0.1");
+ componentInstance.setGroupInstances(gilist);
+ Either<ComponentInstanceData, StorageOperationStatus> result = componentInstanceOperation.updateComponentInstanceModificationTimeAndCustomizationUuidOnGraph(componentInstance, NodeTypeEnum.Component,234234545L,false);
+ assertEquals(StorageOperationStatus.GENERAL_ERROR, result.right().value());
+ }
+
+ @Test
+ public void testupdateComponentInstanceModificationTimeAndCustomizationUuidOnGraph_GENERAL_ERROR() throws Exception {
+ ComponentInstance componentInstance = new ComponentInstance();
+ GroupInstance groupInstance=new GroupInstance();
+ groupInstance.setCreationTime(23234234234L);
+ groupInstance.setCustomizationUUID("CUSTUUID0.1");
+ groupInstance.setGroupUid("GRP0.1");
+ groupInstance.setGroupUUID("GRPU0.1");
+ groupInstance.setGroupName("GRP1");
+ List gilist = new ArrayList<GroupInstance>();
+ gilist.add(groupInstance);
+ componentInstance.setUniqueId("INST0.1");
+ componentInstance.setComponentUid("RES0.1");
+ componentInstance.setGroupInstances(gilist);
+ when(titanGenericDao.updateNode(anyObject(),eq(ComponentInstanceData.class))).thenReturn(Either.right(TitanOperationStatus.GENERAL_ERROR));
+ Either<ComponentInstanceData, StorageOperationStatus> result = componentInstanceOperation.updateComponentInstanceModificationTimeAndCustomizationUuidOnGraph(componentInstance, NodeTypeEnum.Component,234234545L,false);
+ assertEquals(StorageOperationStatus.GENERAL_ERROR, result.right().value());
+ }
+
+ @Test
+ public void testupdateComponentInstanceModificationTimeAndCustomizationUuidOnGraph() throws Exception {
+ ComponentInstance componentInstance = new ComponentInstance();
+ GroupInstance groupInstance=new GroupInstance();
+ groupInstance.setCreationTime(23234234234L);
+ groupInstance.setCustomizationUUID("CUSTUUID0.1");
+ groupInstance.setGroupUid("GRP0.1");
+ groupInstance.setGroupUUID("GRPU0.1");
+ groupInstance.setGroupName("GRP1");
+ List gilist = new ArrayList<GroupInstance>();
+ gilist.add(groupInstance);
+ componentInstance.setUniqueId("INST0.1");
+ componentInstance.setComponentUid("RES0.1");
+ componentInstance.setGroupInstances(gilist);
+ ComponentInstanceData componentInstanceData = new ComponentInstanceData();
+ when(titanGenericDao.updateNode(anyObject(),eq(ComponentInstanceData.class))).thenReturn(Either.left(componentInstanceData));
+ Either<ComponentInstanceData, StorageOperationStatus> result = componentInstanceOperation.updateComponentInstanceModificationTimeAndCustomizationUuidOnGraph(componentInstance, NodeTypeEnum.Component,234234545L,false);
+ assertEquals(componentInstanceData, result.left().value());
+ }
+
}