diff options
author | Sindhuri.A <arcot.sindhuri@huawei.com> | 2018-11-14 18:57:34 +0530 |
---|---|---|
committer | Tal Gitelman <tal.gitelman@att.com> | 2018-11-19 16:01:24 +0000 |
commit | 18ffcc13dd5e63490a0aca0b4b228ca641e2b4c4 (patch) | |
tree | 8410934bad9cb05958fcf3aa04cec7ed63b34fd9 /catalog-model/src/test/java | |
parent | 25ac344c6e58182a9273ffe32c8b6ab03fe9bb92 (diff) |
UT-ToscaOperationFacade 5
UT for catalog be ToscaOperationFacade class
Issue-ID: SDC-1775
Change-Id: Ie47efa5e9146070f3ef7ec69683db3cbbca1650e
Signed-off-by: Sindhuri.A <arcot.sindhuri@huawei.com>
Diffstat (limited to 'catalog-model/src/test/java')
-rw-r--r-- | catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacadeTest.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacadeTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacadeTest.java index b40f5d1cb8..9bcd9ff239 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacadeTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacadeTest.java @@ -340,6 +340,32 @@ public class ToscaOperationFacadeTest { assertTrue(result.isLeft()); } + @Test + public void testGetToscaElement() { + Either<Component, StorageOperationStatus> result; + String id = "id"; + GraphVertex graphVertex = getTopologyTemplateVertex(); + ToscaElement toscaElement = new TopologyTemplate(); + toscaElement.setComponentType(ComponentTypeEnum.RESOURCE); + when(titanDaoMock.getVertexById(id, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(graphVertex)); + when(topologyTemplateOperationMock.getToscaElement(any(GraphVertex.class), any(ComponentParametersView.class))).thenReturn(Either.left(toscaElement)); + result = testInstance.getToscaElement(id, JsonParseFlagEnum.ParseAll); + assertTrue(result.isLeft()); + } + + @Test + public void testMarkComponentToDelete() { + StorageOperationStatus result; + Component component = new Resource(); + String id = "id"; + component.setUniqueId(id); + GraphVertex graphVertex = getTopologyTemplateVertex(); + when(titanDaoMock.getVertexById(id, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(graphVertex)); + when(nodeTypeOperation.markComponentToDelete(graphVertex)).thenReturn(Either.left(graphVertex)); + result = testInstance.markComponentToDelete(component); + assertEquals(result, StorageOperationStatus.OK); + } + private Either<PolicyDefinition, StorageOperationStatus> associatePolicyToComponentWithStatus(StorageOperationStatus status) { PolicyDefinition policy = new PolicyDefinition(); String componentId = "componentId"; |