diff options
author | Yarin Dekel <yarind@amdocs.com> | 2018-12-26 13:14:01 +0200 |
---|---|---|
committer | Yarin Dekel <yarind@amdocs.com> | 2018-12-26 13:14:05 +0200 |
commit | bd2841ad36ef57983f8669b470e661d46d309012 (patch) | |
tree | 01ef36edbdab7c80298db0382b4ca635127cfd8b /workflow-designer-be/src/test/java/org | |
parent | 11ed075eb955be52b1326692fe401dd8e743f4c2 (diff) |
WF-validation to empty artifact
Issue-ID: SDC-2023
Change-Id: Idcc690cfad19da0d29232c93b202042f6230ffaf
Signed-off-by: Yarin Dekel <yarind@amdocs.com>
Diffstat (limited to 'workflow-designer-be/src/test/java/org')
-rw-r--r-- | workflow-designer-be/src/test/java/org/onap/sdc/workflow/services/impl/WorkflowVersionManagerImplTest.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/workflow-designer-be/src/test/java/org/onap/sdc/workflow/services/impl/WorkflowVersionManagerImplTest.java b/workflow-designer-be/src/test/java/org/onap/sdc/workflow/services/impl/WorkflowVersionManagerImplTest.java index 640d3e8b..8e714f62 100644 --- a/workflow-designer-be/src/test/java/org/onap/sdc/workflow/services/impl/WorkflowVersionManagerImplTest.java +++ b/workflow-designer-be/src/test/java/org/onap/sdc/workflow/services/impl/WorkflowVersionManagerImplTest.java @@ -399,15 +399,28 @@ public class WorkflowVersionManagerImplTest { } @Test - public void shouldDeleteArtifact() { + public void shouldNotDeleteArtifactIfNotExist() { doNothing().when(workflowVersionManager).validateWorkflowStatus(ITEM1_ID); Version version = new Version(VERSION1_ID); doReturn(version).when(versioningManagerMock).get(ITEM1_ID, version); WorkflowVersion workflowVersion = new WorkflowVersion(VERSION1_ID); doReturn(workflowVersion).when(versionMapperMock).versionToWorkflowVersion(version); workflowVersionManager.deleteArtifact(ITEM1_ID, VERSION1_ID); - verify(artifactRepositoryMock).delete(ITEM1_ID, VERSION1_ID); - verify(versioningManagerMock).publish(ITEM1_ID, version, "Delete Artifact"); + verify(artifactRepositoryMock, times(0)).delete(ITEM1_ID, VERSION1_ID); + verify(versioningManagerMock, times(0)).publish(ITEM1_ID, version, "Delete Artifact"); + } + + @Test + public void shouldDeleteArtifactIfExist() { + doNothing().when(workflowVersionManager).validateWorkflowStatus(ITEM1_ID); + Version version = new Version(VERSION1_ID); + doReturn(version).when(versioningManagerMock).get(ITEM1_ID, version); + WorkflowVersion workflowVersion = new WorkflowVersion(VERSION1_ID); + doReturn(true).when(artifactRepositoryMock).isExist(ITEM1_ID, VERSION1_ID); + doReturn(workflowVersion).when(versionMapperMock).versionToWorkflowVersion(version); + workflowVersionManager.deleteArtifact(ITEM1_ID, VERSION1_ID); + verify(artifactRepositoryMock, times(1)).delete(ITEM1_ID, VERSION1_ID); + verify(versioningManagerMock, times(1)).publish(ITEM1_ID, version, "Delete Artifact"); } private static Version eqVersion(String versionId) { |