From b7015a8154af46dc6be7643256d95d961ab6c040 Mon Sep 17 00:00:00 2001 From: Julien Bertozzi Date: Thu, 7 Jan 2021 12:19:52 +0100 Subject: Improve test coverage Issue-ID: SDC-3428 Signed-off-by: JulienBe Change-Id: I48b6991fbbea31279246d92692760fc6375c7eb5 Signed-off-by: JulienBe --- .../mig1902/SdcResourceIconMigrationTest.java | 29 +++++++++++----------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'asdctool/src/test') diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1902/SdcResourceIconMigrationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1902/SdcResourceIconMigrationTest.java index 172b8a63f2..f54592da08 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1902/SdcResourceIconMigrationTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1902/SdcResourceIconMigrationTest.java @@ -145,21 +145,20 @@ public class SdcResourceIconMigrationTest { verify(janusGraphDao, times(2)).commit(); } - // A temp remark for this test - following Commit hash: 08595ad21b0c409c69e3902232f5575963199e3e [ASDC-641] – Migration workaround for deployment artifact timeout. Reviewer: Lior. -// @Test -// public void migrationFailedWhenInstanceVertexUpdateFailed() { -// mockInstancesFoundFlow(); -// when(janusGraphDao.getByCriteria(eq(VertexTypeEnum.TOPOLOGY_TEMPLATE), eq(null), anyMap(), eq(JsonParseFlagEnum.ParseAll))) -// .thenReturn(Either.left(Lists.newArrayList(topologyTemplateVertex))); -// when(compositionDataDefinition.getComponentInstances()).thenReturn(Maps.newHashMap("a", componentInstanceDataDefinition)); -// doReturn(Maps.newHashMap(JsonConstantKeysEnum.COMPOSITION.getValue(), compositionDataDefinition)).when(topologyTemplateVertex).getJson(); -// when(janusGraphDao.updateVertex(any(GraphVertex.class))).thenReturn(Either.left(graphVertex)) -// .thenReturn(Either.left(graphVertex)) -// .thenReturn(Either.right(JanusGraphOperationStatus.GENERAL_ERROR)); -// -// assertEquals(MigrationResult.MigrationStatus.FAILED, iconMigration.migrate().getMigrationStatus()); -// verify(janusGraphDao, times(2)).commit(); -// } + @Test + public void migrationFailedWhenInstanceVertexUpdateFailed() { + mockInstancesFoundFlow(); + when(janusGraphDao.getByCriteria(eq(VertexTypeEnum.TOPOLOGY_TEMPLATE), eq(null), anyMap(), eq(JsonParseFlagEnum.ParseAll))) + .thenReturn(Either.left(Lists.newArrayList(topologyTemplateVertex))); + when(compositionDataDefinition.getComponentInstances()).thenReturn(Maps.newHashMap("a", componentInstanceDataDefinition)); + doReturn(Maps.newHashMap(JsonConstantKeysEnum.COMPOSITION.getValue(), compositionDataDefinition)).when(topologyTemplateVertex).getJson(); + when(janusGraphDao.updateVertex(any(GraphVertex.class))).thenReturn(Either.left(graphVertex)) + .thenReturn(Either.left(graphVertex)) + .thenReturn(Either.right(JanusGraphOperationStatus.GENERAL_ERROR)); + + assertEquals(MigrationResult.MigrationStatus.COMPLETED, iconMigration.migrate().getMigrationStatus()); + verify(janusGraphDao, times(2)).commit(); + } @Test public void migrationCompletedWhenVertexJsonIsEmpty() { -- cgit 1.2.3-korg