From 2048043bb4c66efa28063fc1e591c0297850a6e6 Mon Sep 17 00:00:00 2001 From: Francis Toth Date: Fri, 8 May 2020 08:17:33 -0400 Subject: Refactor ArtifactsBusinessLogic::handleDelete and ArtifactsBusinessLogic::deleteArtifactByInterface Signed-off-by: Francis Toth Change-Id: I89f12c70f388375ed13554edf62bf6a442c9036a Issue-ID: SDC-2812 --- .../sdc/be/components/impl/ArtifactBusinessLogicTest.java | 10 +++------- .../sdc/be/components/impl/ArtifactsBusinessLogicTest.java | 10 +++------- 2 files changed, 6 insertions(+), 14 deletions(-) (limited to 'catalog-be/src/test/java/org') diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactBusinessLogicTest.java index e3e6924b7e..fddb76efe6 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactBusinessLogicTest.java @@ -65,10 +65,7 @@ import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation; import org.openecomp.sdc.be.model.operations.api.IInterfaceLifecycleOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import org.openecomp.sdc.be.model.operations.impl.ArtifactOperation; -import org.openecomp.sdc.be.model.operations.impl.UserAdminOperation; import org.openecomp.sdc.be.resources.data.DAOArtifactData; -import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.servlets.RepresentationUtils; import org.openecomp.sdc.be.tosca.CsarUtils; import org.openecomp.sdc.be.tosca.ToscaExportHandler; @@ -573,7 +570,6 @@ public class ArtifactBusinessLogicTest extends BaseBusinessLogicMock{ @Test public void testDeleteComponent_ArtifactNotFound(){ - Either, ResponseFormat> result; Resource resource = new Resource(); String uniqueId = "uniqueId"; resource.setUniqueId(uniqueId); @@ -593,9 +589,9 @@ public class ArtifactBusinessLogicTest extends BaseBusinessLogicMock{ .thenReturn(StorageOperationStatus.OK); when(graphLockOperation.unlockComponent(uniqueId, NodeTypeEnum.Resource)) .thenReturn(StorageOperationStatus.OK); - result = artifactBL.handleDelete("parentId", "artifactId", USER, AuditingActionEnum.ARTIFACT_DELETE, - ComponentTypeEnum.RESOURCE, resource, - true, false); + Either result = artifactBL.handleDelete( + "parentId", "artifactId", USER, + resource, true, false); assertThat(result.isRight()).isTrue(); } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java index cd171d9b65..6f0b83b0d5 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java @@ -2373,12 +2373,8 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock { String parentId = "parentId"; String artifactId = "artifactId"; - AuditingActionEnum auditingAction = AuditingActionEnum.ARTIFACT_DELETE; ArtifactDefinition artifactDefinition = new ArtifactDefinition(); Resource resource = new Resource(); - ComponentTypeEnum componentType = ComponentTypeEnum.RESOURCE; - boolean shouldUnlock = true; - boolean inTransaction = false; User user = new User(); artifactDefinition.setArtifactName("test.csar"); @@ -2405,9 +2401,9 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock { when(artifactCassandraDao.deleteArtifact(any())) .thenReturn(CassandraOperationStatus.OK); - Either, ResponseFormat> result = artifactBL.handleDelete(parentId, artifactId, user, auditingAction, componentType, resource, shouldUnlock, inTransaction); - Either leftValue = result.left().value(); - Assert.assertEquals(artifactDefinition.getArtifactName(), leftValue.left().value().getArtifactName()); + Either result = artifactBL.handleDelete( + parentId, artifactId, user, resource, true, false); + Assert.assertEquals(artifactDefinition.getArtifactName(), result.left().value().getArtifactName()); } @Test -- cgit 1.2.3-korg