summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test
diff options
context:
space:
mode:
authorFrancis Toth <francis.toth@yoppworks.com>2020-05-08 08:17:33 -0400
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-05-10 06:52:51 +0000
commit2048043bb4c66efa28063fc1e591c0297850a6e6 (patch)
tree1db1459650319f4f9f2b3e03844beaa54d64ec62 /catalog-be/src/test
parent8e27d0fcbdf46eb2b15e0b3856a8e485a83079d4 (diff)
Refactor ArtifactsBusinessLogic::handleDelete and ArtifactsBusinessLogic::deleteArtifactByInterface
Signed-off-by: Francis Toth <francis.toth@yoppworks.com> Change-Id: I89f12c70f388375ed13554edf62bf6a442c9036a Issue-ID: SDC-2812
Diffstat (limited to 'catalog-be/src/test')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactBusinessLogicTest.java10
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java10
2 files changed, 6 insertions, 14 deletions
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<Either<ArtifactDefinition, Operation>, 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<ArtifactDefinition, ResponseFormat> 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<Either<ArtifactDefinition, Operation>, ResponseFormat> result = artifactBL.handleDelete(parentId, artifactId, user, auditingAction, componentType, resource, shouldUnlock, inTransaction);
- Either<ArtifactDefinition, Operation> leftValue = result.left().value();
- Assert.assertEquals(artifactDefinition.getArtifactName(), leftValue.left().value().getArtifactName());
+ Either<ArtifactDefinition, ResponseFormat> result = artifactBL.handleDelete(
+ parentId, artifactId, user, resource, true, false);
+ Assert.assertEquals(artifactDefinition.getArtifactName(), result.left().value().getArtifactName());
}
@Test