diff options
Diffstat (limited to 'catalog-be/src/test')
2 files changed, 28 insertions, 28 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogicTest.java index d75a731b04..c4a4acecbc 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogicTest.java @@ -251,7 +251,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(resource)); when(nodeFilterValidator - .validateNodeFilter(resource, componentInstanceId, + .validateFilter(resource, componentInstanceId, requirementNodeFilterPropertyDataDefinition.getConstraints(), NodeFilterConstraintAction.ADD)).thenReturn(Either.left(true)); when(nodeFilterValidator.validateComponentInstanceExist(resource, componentInstanceId)) @@ -268,7 +268,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock verify(toscaOperationFacade, times(1)).getToscaElement(componentId); verify(graphLockOperation, times(1)).lockComponent(componentId, NodeTypeEnum.Resource); - verify(nodeFilterValidator, times(1)).validateNodeFilter(resource, componentInstanceId, + verify(nodeFilterValidator, times(1)).validateFilter(resource, componentInstanceId, constraints, NodeFilterConstraintAction.ADD); verify(nodeFilterOperation, times(0)) .addNewProperty(componentId, componentInstanceId, ciNodeFilterDataDefinition, @@ -295,7 +295,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(resource)); when(nodeFilterValidator.validateComponentInstanceExist(resource, componentInstanceId)) .thenReturn(Either.left(true)); - when(nodeFilterValidator.validateNodeFilter(resource, componentInstanceId, singletonList(constraint), + when(nodeFilterValidator.validateFilter(resource, componentInstanceId, singletonList(constraint), NodeFilterConstraintAction.DELETE)).thenReturn(Either.left(true)); when(graphLockOperation.lockComponent(componentId, NodeTypeEnum.Resource)) .thenReturn(StorageOperationStatus.OK); @@ -318,7 +318,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock verify(nodeFilterValidator, times(1)) .validateComponentInstanceExist(resource, componentInstanceId); verify(nodeFilterValidator, times(1)) - .validateNodeFilter(resource, componentInstanceId, singletonList(constraint), + .validateFilter(resource, componentInstanceId, singletonList(constraint), NodeFilterConstraintAction.DELETE); verify(nodeFilterOperation, times(1)) .deleteConstraint(componentId, componentInstanceId, ciNodeFilterDataDefinition, 0); @@ -332,7 +332,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(resource)); when(nodeFilterValidator.validateComponentInstanceExist(resource, componentInstanceId)) .thenReturn(Either.left(true)); - when(nodeFilterValidator.validateNodeFilter(resource, componentInstanceId, singletonList(constraint), + when(nodeFilterValidator.validateFilter(resource, componentInstanceId, singletonList(constraint), NodeFilterConstraintAction.DELETE)).thenReturn(Either.left(true)); when(graphLockOperation.lockComponent(componentId, NodeTypeEnum.Resource)) .thenReturn(StorageOperationStatus.OK); @@ -351,7 +351,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock verify(toscaOperationFacade, times(1)).getToscaElement(componentId); verify(graphLockOperation, times(1)).lockComponent(componentId, NodeTypeEnum.Resource); verify(nodeFilterValidator, times(1)) - .validateNodeFilter(resource, componentInstanceId, singletonList(constraint), + .validateFilter(resource, componentInstanceId, singletonList(constraint), NodeFilterConstraintAction.DELETE); verify(nodeFilterValidator, times(1)) .validateComponentInstanceExist(resource, componentInstanceId); @@ -363,7 +363,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(resource)); when(nodeFilterValidator.validateComponentInstanceExist(resource, componentInstanceId)) .thenReturn(Either.left(true)); - when(nodeFilterValidator.validateNodeFilter(resource, componentInstanceId, singletonList(constraint), + when(nodeFilterValidator.validateFilter(resource, componentInstanceId, singletonList(constraint), NodeFilterConstraintAction.DELETE)).thenReturn(Either.left(true)); assertThrows(BusinessLogicException.class, () -> componentNodeFilterBusinessLogic @@ -372,7 +372,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock verify(toscaOperationFacade, times(1)).getToscaElement(componentId); verify(nodeFilterValidator, times(1)) - .validateNodeFilter(resource, componentInstanceId, singletonList(constraint), + .validateFilter(resource, componentInstanceId, singletonList(constraint), NodeFilterConstraintAction.DELETE); verify(nodeFilterValidator, times(1)) .validateComponentInstanceExist(resource, componentInstanceId); @@ -383,7 +383,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock componentInstance.setNodeFilter(ciNodeFilterDataDefinition); when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(resource)); - when(nodeFilterValidator.validateNodeFilter(resource, componentInstanceId, + when(nodeFilterValidator.validateFilter(resource, componentInstanceId, Collections.singletonList(constraint), NodeFilterConstraintAction.UPDATE)).thenReturn(Either.left(true)); when(graphLockOperation.lockComponent(componentId, NodeTypeEnum.Resource)) .thenReturn(StorageOperationStatus.OK); @@ -395,7 +395,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock .updateNodeFilter(componentId, componentInstanceId, constraints, true, ComponentTypeEnum.RESOURCE)); verify(toscaOperationFacade, times(1)).getToscaElement(componentId); - verify(nodeFilterValidator, times(1)).validateNodeFilter(resource, componentInstanceId, + verify(nodeFilterValidator, times(1)).validateFilter(resource, componentInstanceId, constraints, NodeFilterConstraintAction.UPDATE); } @@ -403,14 +403,14 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock public void updateNodeFilterFailValidationTest() { final List<String> constraints = requirementNodeFilterPropertyDataDefinition.getConstraints(); when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(resource)); - when(nodeFilterValidator.validateNodeFilter(resource, componentInstanceId, + when(nodeFilterValidator.validateFilter(resource, componentInstanceId, constraints, NodeFilterConstraintAction.UPDATE)).thenReturn(Either.left(true)); assertThrows(BusinessLogicException.class, () -> componentNodeFilterBusinessLogic .updateNodeFilter(componentId, componentInstanceId, constraints, true, ComponentTypeEnum.RESOURCE)); verify(toscaOperationFacade, times(1)).getToscaElement(componentId); - verify(nodeFilterValidator, times(1)).validateNodeFilter(resource, componentInstanceId, + verify(nodeFilterValidator, times(1)).validateFilter(resource, componentInstanceId, constraints, NodeFilterConstraintAction.UPDATE); } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/NodeFilterValidationTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/NodeFilterValidationTest.java index 4b254701a7..83a968c756 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/NodeFilterValidationTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/NodeFilterValidationTest.java @@ -72,7 +72,7 @@ public class NodeFilterValidationTest { public void testValidateNodeFilterStaticIncorrectPropertyTypeProvided() { Service service = createService("booleanIncorrect"); Either<Boolean, ResponseFormat> either = - nodeFilterValidator.validateNodeFilter(service, INNER_SERVICE, + nodeFilterValidator.validateFilter(service, INNER_SERVICE, Collections.singletonList(UI_CONSTRAINT_STATIC.replace(VALUE, "true")), NodeFilterConstraintAction.ADD); @@ -83,7 +83,7 @@ public class NodeFilterValidationTest { public void testValidateNodeFilterStaticIncorrectOperatorProvidedBoolean() { Service service = createService("boolean"); Either<Boolean, ResponseFormat> either = - nodeFilterValidator.validateNodeFilter(service, INNER_SERVICE, + nodeFilterValidator.validateFilter(service, INNER_SERVICE, Collections.singletonList(UI_CONSTRAINT_STATIC.replace(VALUE, "true") .replace("equal", "greater_than")), NodeFilterConstraintAction.ADD); @@ -95,7 +95,7 @@ public class NodeFilterValidationTest { public void testValidateNodeFilterStaticIncorrectValueProvidedBoolean() { Service service = createService("boolean"); Either<Boolean, ResponseFormat> either = - nodeFilterValidator.validateNodeFilter(service, INNER_SERVICE, + nodeFilterValidator.validateFilter(service, INNER_SERVICE, Collections.singletonList(UI_CONSTRAINT_STATIC.replace(VALUE, "trues")), NodeFilterConstraintAction.ADD); @@ -106,7 +106,7 @@ public class NodeFilterValidationTest { public void testValidateNodeFilterStaticIncorrectOperatorProvidedString() { Service service = createService(STRING_TYPE); Either<Boolean, ResponseFormat> either = - nodeFilterValidator.validateNodeFilter(service, INNER_SERVICE, + nodeFilterValidator.validateFilter(service, INNER_SERVICE, Collections.singletonList(UI_CONSTRAINT_STATIC.replace(VALUE, "true") .replace("equal", "greater_than")), NodeFilterConstraintAction.ADD); @@ -118,7 +118,7 @@ public class NodeFilterValidationTest { public void testValidateNodeFilterIntegerValueSuccess() { Service service = createService(INTEGER_TYPE); Either<Boolean, ResponseFormat> either = - nodeFilterValidator.validateNodeFilter(service, INNER_SERVICE, + nodeFilterValidator.validateFilter(service, INNER_SERVICE, Collections.singletonList(UI_CONSTRAINT_STATIC.replace(VALUE, "1")), NodeFilterConstraintAction.ADD); @@ -133,7 +133,7 @@ public class NodeFilterValidationTest { .thenReturn(new ResponseFormat()); Either<Boolean, ResponseFormat> either = - nodeFilterValidator.validateNodeFilter(service, INNER_SERVICE, + nodeFilterValidator.validateFilter(service, INNER_SERVICE, Collections.singletonList(UI_CONSTRAINT_STATIC.replace(VALUE, "1.0")), NodeFilterConstraintAction.ADD); @@ -144,7 +144,7 @@ public class NodeFilterValidationTest { public void testValidateNodeFilterFloatValueSuccess() { Service service = createService(FLOAT_TYPE); Either<Boolean, ResponseFormat> either = - nodeFilterValidator.validateNodeFilter(service, INNER_SERVICE, + nodeFilterValidator.validateFilter(service, INNER_SERVICE, Collections.singletonList(UI_CONSTRAINT_STATIC.replace(VALUE, "1.0")), NodeFilterConstraintAction.ADD); @@ -159,7 +159,7 @@ public class NodeFilterValidationTest { .thenReturn(new ResponseFormat()); Either<Boolean, ResponseFormat> either = - nodeFilterValidator.validateNodeFilter(service, INNER_SERVICE, + nodeFilterValidator.validateFilter(service, INNER_SERVICE, Collections.singletonList(UI_CONSTRAINT_STATIC), NodeFilterConstraintAction.ADD); Assert.assertTrue(either.isRight()); @@ -169,7 +169,7 @@ public class NodeFilterValidationTest { public void testValidateNodeFilterStringValueSuccess() { Service service = createService(STRING_TYPE); Either<Boolean, ResponseFormat> either = - nodeFilterValidator.validateNodeFilter(service, INNER_SERVICE, + nodeFilterValidator.validateFilter(service, INNER_SERVICE, Collections.singletonList(UI_CONSTRAINT_STATIC), NodeFilterConstraintAction.ADD); Assert.assertTrue(either.isLeft()); @@ -179,7 +179,7 @@ public class NodeFilterValidationTest { public void testValidatePropertyConstraintBrotherSuccess() { Service service = createService(STRING_TYPE); Either<Boolean, ResponseFormat> either = - nodeFilterValidator.validateNodeFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n" + nodeFilterValidator.validateFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n" + " equal: { get_property :[component2, Prop1]}\n"), NodeFilterConstraintAction.ADD); Assert.assertTrue(either.isLeft()); @@ -189,7 +189,7 @@ public class NodeFilterValidationTest { public void testValidatePropertyConstraintParentSuccess() { Service service = createService(STRING_TYPE); Either<Boolean, ResponseFormat> either = - nodeFilterValidator.validateNodeFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n" + nodeFilterValidator.validateFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n" + " equal: { get_property : [parentservice, Prop1]}\n"), NodeFilterConstraintAction.ADD); Assert.assertTrue(either.isLeft()); @@ -201,7 +201,7 @@ public class NodeFilterValidationTest { service.getComponentInstancesProperties().get(COMPONENT2_ID).get(0).setType(INTEGER_TYPE); Either<Boolean, ResponseFormat> either = - nodeFilterValidator.validateNodeFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n" + nodeFilterValidator.validateFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n" + " equal: { get_property : [component2, Prop1]}\n"), NodeFilterConstraintAction.ADD); Assert.assertFalse(either.isLeft()); @@ -213,7 +213,7 @@ public class NodeFilterValidationTest { service.getComponentInstancesProperties().get(COMPONENT1_ID).get(0).setType(INTEGER_TYPE); Either<Boolean, ResponseFormat> either = - nodeFilterValidator.validateNodeFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n" + nodeFilterValidator.validateFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n" + " equal: { get_property : [parentservice, Prop1]}\n"), NodeFilterConstraintAction.ADD); Assert.assertFalse(either.isLeft()); @@ -225,7 +225,7 @@ public class NodeFilterValidationTest { service.getComponentInstancesProperties().get(COMPONENT1_ID).get(0).setName("Prop2"); Either<Boolean, ResponseFormat> either = - nodeFilterValidator.validateNodeFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n" + nodeFilterValidator.validateFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n" + " equal: { get_property : [parentservice, Prop1]}\n"), NodeFilterConstraintAction.ADD); Assert.assertFalse(either.isLeft()); @@ -237,7 +237,7 @@ public class NodeFilterValidationTest { service.getComponentInstancesProperties().get(COMPONENT1_ID).get(0).setName("Prop2"); Either<Boolean, ResponseFormat> either = - nodeFilterValidator.validateNodeFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n" + nodeFilterValidator.validateFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n" + " equal: { get_property : [parentservice, Prop1]}\n"), NodeFilterConstraintAction.ADD); Assert.assertFalse(either.isLeft()); @@ -249,7 +249,7 @@ public class NodeFilterValidationTest { service.getComponentInstancesProperties().get(COMPONENT1_ID).get(0).setType(LIST_TYPE); Either<Boolean, ResponseFormat> either = - nodeFilterValidator.validateNodeFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n" + nodeFilterValidator.validateFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n" + " equal: { get_property : [parentservice, Prop1]}\n"), NodeFilterConstraintAction.ADD); Assert.assertFalse(either.isLeft()); |