diff options
author | MichaelMorris <michael.morris@est.tech> | 2022-03-10 12:19:18 +0000 |
---|---|---|
committer | Andr� Schmid <andre.schmid@est.tech> | 2022-03-14 15:23:07 +0000 |
commit | 302c525546650b71ad699903d98090f8cb23f068 (patch) | |
tree | 0284bef058f201425d98cdd8987e38a9269f5ce9 /catalog-be/src | |
parent | 5816f717507a2edc5fdc17cfee579358f2949961 (diff) |
Fix cannot set node filter cap using get_property
Change-Id: I92fd4016b19e03e22622cf6e476f17b49e3d6a47
Issue-ID: SDC-3904
Signed-off-by: MichaelMorris <michael.morris@est.tech>
Diffstat (limited to 'catalog-be/src')
4 files changed, 82 insertions, 48 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogic.java index 729538c640..c1669d18f6 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogic.java @@ -164,7 +164,7 @@ public class ComponentNodeFilterBusinessLogic extends BaseBusinessLogic { throws BusinessLogicException { final Component component = getComponent(componentId); CINodeFilterDataDefinition nodeFilterDataDefinition = validateAndReturnNodeFilterDefinition(componentInstanceId, action, constraint, - component, nodeFilterConstraintType); + component, nodeFilterConstraintType, capabilityName); boolean wasLocked = false; try { if (shouldLock) { @@ -204,7 +204,7 @@ public class ComponentNodeFilterBusinessLogic extends BaseBusinessLogic { throws BusinessLogicException { final Component component = getComponent(componentId); CINodeFilterDataDefinition nodeFilterDataDefinition = validateAndReturnNodeFilterDefinition(componentInstanceId, action, constraint, - component, nodeFilterConstraintType); + component, nodeFilterConstraintType, ""); boolean wasLocked = false; try { if (shouldLock) { @@ -291,9 +291,10 @@ public class ComponentNodeFilterBusinessLogic extends BaseBusinessLogic { private CINodeFilterDataDefinition validateAndReturnNodeFilterDefinition(final String componentInstanceId, final NodeFilterConstraintAction action, final String constraint, final Component component, - final NodeFilterConstraintType nodeFilterConstraintType) + final NodeFilterConstraintType nodeFilterConstraintType, + final String capabilityName) throws BusinessLogicException { - validateNodeFilter(component, componentInstanceId, action, constraint, nodeFilterConstraintType); + validateNodeFilter(component, componentInstanceId, action, constraint, nodeFilterConstraintType, capabilityName); final Optional<CINodeFilterDataDefinition> cINodeFilterDataDefinition = getCiNodeFilterDataDefinition(componentInstanceId, component); if (!cINodeFilterDataDefinition.isPresent()) { throw new BusinessLogicException(componentsUtils.getResponseFormat(ActionStatus.NODE_FILTER_NOT_FOUND)); @@ -302,9 +303,9 @@ public class ComponentNodeFilterBusinessLogic extends BaseBusinessLogic { } private void validateNodeFilter(final Component component, final String componentInstanceId, final NodeFilterConstraintAction action, - final String constraint, final NodeFilterConstraintType nodeFilterConstraintType) throws BusinessLogicException { + final String constraint, final NodeFilterConstraintType nodeFilterConstraintType, final String capabilityName) throws BusinessLogicException { final Either<Boolean, ResponseFormat> response = nodeFilterValidator - .validateFilter(component, componentInstanceId, Collections.singletonList(constraint), action, nodeFilterConstraintType); + .validateFilter(component, componentInstanceId, Collections.singletonList(constraint), action, nodeFilterConstraintType, capabilityName); if (response.isRight()) { throw new BusinessLogicException( componentsUtils.getResponseFormat(ActionStatus.NODE_FILTER_NOT_FOUND, response.right().value().getFormattedMessage())); @@ -323,7 +324,7 @@ public class ComponentNodeFilterBusinessLogic extends BaseBusinessLogic { } return addNodeFilter(componentId.toLowerCase(), componentInstanceId, NodeFilterConstraintAction.ADD, uiConstraint.getServicePropertyName(), new ConstraintConvertor().convert(uiConstraint), true, componentTypeEnum, nodeFilterConstraintType, - StringUtils.isEmpty(uiConstraint.getCapabilityName()) ? "" : uiConstraint.getCapabilityName()); + uiConstraint.getCapabilityName()); } public StorageOperationStatus associateNodeFilterToComponentInstance(final String componentId, diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java index db5de58129..c1eaf60ad0 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java @@ -90,14 +90,15 @@ public class NodeFilterValidator { public Either<Boolean, ResponseFormat> validateFilter(final Component parentComponent, final String componentInstanceId, final List<String> uiConstraints, final NodeFilterConstraintAction action, - final NodeFilterConstraintType nodeFilterConstraintType) { + final NodeFilterConstraintType nodeFilterConstraintType, + final String capabilityName) { try { if (NodeFilterConstraintAction.ADD == action || NodeFilterConstraintAction.UPDATE == action) { for (final String uiConstraint : uiConstraints) { final UIConstraint constraint = new ConstraintConvertor().convert(uiConstraint); if (ConstraintConvertor.PROPERTY_CONSTRAINT.equals(constraint.getSourceType())) { final Either<Boolean, ResponseFormat> booleanResponseFormatEither = validatePropertyConstraint(parentComponent, - componentInstanceId, constraint); + componentInstanceId, constraint, capabilityName); if (booleanResponseFormatEither.isRight()) { return booleanResponseFormatEither; } @@ -141,7 +142,7 @@ public class NodeFilterValidator { } private Either<Boolean, ResponseFormat> validatePropertyConstraint(final Component parentComponent, final String componentInstanceId, - final UIConstraint uiConstraint) { + final UIConstraint uiConstraint, final String capabilityName) { String source = SOURCE; final Optional<ComponentInstance> optionalComponentInstance; final List<PropertyDefinition> propertyDefinitions = parentComponent.getProperties(); @@ -161,8 +162,8 @@ public class NodeFilterValidator { if (CollectionUtils.isNotEmpty(sourcePropertyDefinition)) { final Optional<? extends PropertyDefinition> sourceSelectedProperty = sourcePropertyDefinition.stream() .filter(property -> uiConstraint.getValue().equals(property.getName())).findFirst(); - final Optional<? extends PropertyDefinition> targetComponentInstanceProperty = parentComponent.getComponentInstancesProperties() - .get(componentInstanceId).stream().filter(property -> uiConstraint.getServicePropertyName().equals(property.getName())).findFirst(); + Optional<? extends PropertyDefinition> targetComponentInstanceProperty = getProperty(parentComponent, componentInstanceId, capabilityName, uiConstraint.getServicePropertyName()); + source = !targetComponentInstanceProperty.isPresent() ? "Target" : SOURCE; if (sourceSelectedProperty.isPresent() && targetComponentInstanceProperty.isPresent()) { return validatePropertyData(uiConstraint, sourceSelectedProperty, targetComponentInstanceProperty); @@ -171,6 +172,27 @@ public class NodeFilterValidator { final String missingProperty = source.equals(SOURCE) ? uiConstraint.getValue().toString() : uiConstraint.getServicePropertyName(); return Either.right(componentsUtils.getResponseFormat(ActionStatus.MAPPED_PROPERTY_NOT_FOUND, source, missingProperty)); } + + private Optional<ComponentInstanceProperty> getProperty(final Component parentComponent, final String componentInstanceId, + final String capabilityName, final String propertyName) { + + if (StringUtils.isEmpty(capabilityName)) { + return parentComponent.getComponentInstancesProperties().get(componentInstanceId).stream() + .filter(property -> propertyName.equals(property.getName())).findFirst(); + } else { + final Optional<ComponentInstance> componentInstanceOptional = parentComponent.getComponentInstances().stream() + .filter(componentInstance -> componentInstance.getUniqueId().equals(componentInstanceId)).findAny(); + if (componentInstanceOptional.isPresent()) { + for (final List<CapabilityDefinition> listOfCaps : componentInstanceOptional.get().getCapabilities().values()) { + final Optional<CapabilityDefinition> capDef = listOfCaps.stream().filter(cap -> cap.getName().equals(capabilityName)).findAny(); + if (capDef.isPresent()) { + return capDef.get().getProperties().stream().filter(property -> propertyName.equals(property.getName())).findFirst(); + } + } + } + } + return Optional.empty(); + } private Either<Boolean, ResponseFormat> validateInputConstraint(final Component parentComponent, final String componentInstanceId, final UIConstraint uiConstraint) { 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 ed5c5b9a2d..3b717fb51d 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 @@ -29,6 +29,7 @@ import static org.junit.jupiter.api.Assertions.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyList; import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -266,7 +267,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock when(nodeFilterValidator .validateFilter(resource, componentInstanceId, requirementNodeFilterPropertyDataDefinition.getConstraints(), - NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES)).thenReturn(Either.left(true)); + NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES, "")).thenReturn(Either.left(true)); when(nodeFilterValidator.validateComponentInstanceExist(resource, componentInstanceId)) .thenReturn(Either.left(true)); when(graphLockOperation.lockComponent(componentId, NodeTypeEnum.Resource)) @@ -279,13 +280,13 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock final Optional<CINodeFilterDataDefinition> result = componentNodeFilterBusinessLogic .addNodeFilter(componentId, componentInstanceId, NodeFilterConstraintAction.ADD, "MyPropertyName", constraint, true, ComponentTypeEnum.RESOURCE, - NodeFilterConstraintType.PROPERTIES, capabilityName); + NodeFilterConstraintType.PROPERTIES, ""); assertThat(result).isPresent(); assertThat(result.get().getProperties().getListToscaDataDefinition()).hasSize(1); verify(toscaOperationFacade, times(1)).getToscaElement(componentId); verify(nodeFilterValidator, times(1)).validateFilter(resource, componentInstanceId, - Collections.singletonList(constraint), NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES); + Collections.singletonList(constraint), NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES, ""); verify(graphLockOperation, times(1)).lockComponent(componentId, NodeTypeEnum.Resource); verify(nodeFilterOperation, times(1)) .addNewProperty(anyString(), anyString(), any(CINodeFilterDataDefinition.class), @@ -301,7 +302,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock when(nodeFilterValidator .validateFilter(resource, componentInstanceId, requirementNodeFilterPropertyDataDefinition.getConstraints(), - NodeFilterConstraintAction.ADD, NodeFilterConstraintType.CAPABILITIES)).thenReturn(Either.left(true)); + NodeFilterConstraintAction.ADD, NodeFilterConstraintType.CAPABILITIES, capabilityName)).thenReturn(Either.left(true)); when(nodeFilterValidator.validateComponentInstanceExist(resource, componentInstanceId)) .thenReturn(Either.left(true)); when(graphLockOperation.lockComponent(componentId, NodeTypeEnum.Resource)) @@ -320,7 +321,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock assertThat(result.get().getProperties().getListToscaDataDefinition()).hasSize(1); verify(toscaOperationFacade, times(1)).getToscaElement(componentId); verify(nodeFilterValidator, times(1)).validateFilter(resource, componentInstanceId, - Collections.singletonList(constraint), NodeFilterConstraintAction.ADD, NodeFilterConstraintType.CAPABILITIES); + Collections.singletonList(constraint), NodeFilterConstraintAction.ADD, NodeFilterConstraintType.CAPABILITIES, capabilityName); verify(graphLockOperation, times(1)).lockComponent(componentId, NodeTypeEnum.Resource); verify(nodeFilterOperation, times(1)) .addNewCapabilities(anyString(), anyString(), any(CINodeFilterDataDefinition.class), @@ -336,7 +337,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock when(nodeFilterValidator .validateFilter(resource, componentInstanceId, requirementNodeFilterPropertyDataDefinition.getConstraints(), - NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES)).thenReturn(Either.left(true)); + NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES, capabilityName)).thenReturn(Either.left(true)); when(nodeFilterValidator.validateComponentInstanceExist(resource, componentInstanceId)) .thenReturn(Either.left(true)); when(graphLockOperation.lockComponent(componentId, NodeTypeEnum.Resource)) @@ -353,7 +354,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock verify(toscaOperationFacade, times(1)).getToscaElement(componentId); verify(graphLockOperation, times(1)).lockComponent(componentId, NodeTypeEnum.Resource); verify(nodeFilterValidator, times(1)).validateFilter(resource, componentInstanceId, - constraints, NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES); + constraints, NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES, capabilityName); verify(nodeFilterOperation, times(0)) .addNewProperty(componentId, componentInstanceId, ciNodeFilterDataDefinition, requirementNodeFilterPropertyDataDefinition); @@ -381,7 +382,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock when(nodeFilterValidator.validateComponentInstanceExist(resource, componentInstanceId)) .thenReturn(Either.left(true)); when(nodeFilterValidator.validateFilter(resource, componentInstanceId, singletonList(constraint), - NodeFilterConstraintAction.DELETE, NodeFilterConstraintType.PROPERTIES)).thenReturn(Either.left(true)); + NodeFilterConstraintAction.DELETE, NodeFilterConstraintType.PROPERTIES, "")).thenReturn(Either.left(true)); when(graphLockOperation.lockComponent(componentId, NodeTypeEnum.Resource)) .thenReturn(StorageOperationStatus.OK); @@ -405,7 +406,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock .validateComponentInstanceExist(resource, componentInstanceId); verify(nodeFilterValidator, times(1)) .validateFilter(resource, componentInstanceId, singletonList(constraint), - NodeFilterConstraintAction.DELETE, NodeFilterConstraintType.PROPERTIES); + NodeFilterConstraintAction.DELETE, NodeFilterConstraintType.PROPERTIES, ""); verify(nodeFilterOperation, times(1)) .deleteConstraint(componentId, componentInstanceId, ciNodeFilterDataDefinition, 0, NodeFilterConstraintType.PROPERTIES); @@ -420,7 +421,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock when(nodeFilterValidator.validateComponentInstanceExist(resource, componentInstanceId)) .thenReturn(Either.left(true)); when(nodeFilterValidator.validateFilter(resource, componentInstanceId, singletonList(constraint), - NodeFilterConstraintAction.DELETE, NodeFilterConstraintType.PROPERTIES)).thenReturn(Either.left(true)); + NodeFilterConstraintAction.DELETE, NodeFilterConstraintType.PROPERTIES, "")).thenReturn(Either.left(true)); when(graphLockOperation.lockComponent(componentId, NodeTypeEnum.Resource)) .thenReturn(StorageOperationStatus.OK); @@ -440,7 +441,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock verify(graphLockOperation, times(1)).lockComponent(componentId, NodeTypeEnum.Resource); verify(nodeFilterValidator, times(1)) .validateFilter(resource, componentInstanceId, singletonList(constraint), - NodeFilterConstraintAction.DELETE, NodeFilterConstraintType.PROPERTIES); + NodeFilterConstraintAction.DELETE, NodeFilterConstraintType.PROPERTIES, ""); verify(nodeFilterValidator, times(1)) .validateComponentInstanceExist(resource, componentInstanceId); verify(graphLockOperation, times(1)).unlockComponent(componentId, NodeTypeEnum.Resource); @@ -452,7 +453,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock when(nodeFilterValidator.validateComponentInstanceExist(resource, componentInstanceId)) .thenReturn(Either.left(true)); when(nodeFilterValidator.validateFilter(resource, componentInstanceId, singletonList(constraint), - NodeFilterConstraintAction.DELETE, NodeFilterConstraintType.PROPERTIES)).thenReturn(Either.left(true)); + NodeFilterConstraintAction.DELETE, NodeFilterConstraintType.PROPERTIES, "")).thenReturn(Either.left(true)); assertThrows(BusinessLogicException.class, () -> componentNodeFilterBusinessLogic .deleteNodeFilter(componentId, componentInstanceId, NodeFilterConstraintAction.DELETE, constraint, @@ -461,7 +462,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock verify(toscaOperationFacade, times(1)).getToscaElement(componentId); verify(nodeFilterValidator, times(1)) .validateFilter(resource, componentInstanceId, singletonList(constraint), - NodeFilterConstraintAction.DELETE, NodeFilterConstraintType.PROPERTIES); + NodeFilterConstraintAction.DELETE, NodeFilterConstraintType.PROPERTIES, ""); verify(nodeFilterValidator, times(1)) .validateComponentInstanceExist(resource, componentInstanceId); } @@ -476,7 +477,12 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock when(nodeFilterValidator .validateFilter(ArgumentMatchers.any(Component.class), anyString(), anyList(), ArgumentMatchers.any(NodeFilterConstraintAction.class), - ArgumentMatchers.any(NodeFilterConstraintType.class))).thenReturn(Either.left(true)); + ArgumentMatchers.any(NodeFilterConstraintType.class), anyString())).thenReturn(Either.left(true)); + + when(nodeFilterValidator + .validateFilter(ArgumentMatchers.any(Component.class), anyString(), anyList(), + ArgumentMatchers.any(NodeFilterConstraintAction.class), + ArgumentMatchers.any(NodeFilterConstraintType.class), isNull())).thenReturn(Either.left(true)); when(graphLockOperation.lockComponent(componentId, NodeTypeEnum.Resource)) .thenReturn(StorageOperationStatus.OK); @@ -499,16 +505,20 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock } @Test - public void updateNodeFilterFailTest() { + public void updateNodeFilterFailTest() throws BusinessLogicException { componentInstance.setNodeFilter(ciNodeFilterDataDefinition); when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(resource)); when(nodeFilterValidator.validateComponentInstanceExist(resource, componentInstanceId)) .thenReturn(Either.left(true)); when(nodeFilterValidator + .validateFilter(ArgumentMatchers.any(Component.class), anyString(), anyList(), + ArgumentMatchers.any(NodeFilterConstraintAction.class), + ArgumentMatchers.any(NodeFilterConstraintType.class), anyString())).thenReturn(Either.left(true)); + when(nodeFilterValidator .validateFilter(ArgumentMatchers.any(Component.class), anyString(), anyList(), ArgumentMatchers.any(NodeFilterConstraintAction.class), - ArgumentMatchers.any(NodeFilterConstraintType.class))).thenReturn(Either.left(true)); + ArgumentMatchers.any(NodeFilterConstraintType.class), isNull())).thenReturn(Either.left(true)); when(graphLockOperation.lockComponent(componentId, NodeTypeEnum.Resource)) .thenReturn(StorageOperationStatus.OK); @@ -523,7 +533,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock .thenReturn(StorageOperationStatus.OK); assertThrows(BusinessLogicException.class, () -> componentNodeFilterBusinessLogic - .updateNodeFilter(componentId, componentInstanceId, uiConstraint, ComponentTypeEnum.RESOURCE, + .updateNodeFilter(componentId, componentInstanceId, uiConstraint, ComponentTypeEnum.RESOURCE, NodeFilterConstraintType.PROPERTIES, 0)); } @@ -535,7 +545,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock when(nodeFilterValidator .validateFilter(ArgumentMatchers.any(Component.class), anyString(), anyList(), ArgumentMatchers.any(NodeFilterConstraintAction.class), - ArgumentMatchers.any(NodeFilterConstraintType.class))).thenReturn(Either.left(true)); + ArgumentMatchers.any(NodeFilterConstraintType.class), anyString())).thenReturn(Either.left(true)); assertThrows(BusinessLogicException.class, () -> componentNodeFilterBusinessLogic .updateNodeFilter(componentId, componentInstanceId, uiConstraint, ComponentTypeEnum.RESOURCE, 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 3bdd22c6fc..621b14102f 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 @@ -53,7 +53,8 @@ import org.openecomp.sdc.exception.ResponseFormat; public class NodeFilterValidationTest { - private static final String UI_CONSTRAINT_STATIC = "Prop1: {equal: 'value'}"; + private static final String EMPTY_STR = ""; + private static final String UI_CONSTRAINT_STATIC = "Prop1: {equal: 'value'}"; private static final String INNER_SERVICE = "innerService"; private static final String PROPERTY_NAME = "Prop1"; private static final String VALUE = "value"; @@ -105,13 +106,13 @@ public class NodeFilterValidationTest { Either<Boolean, ResponseFormat> either = nodeFilterValidator.validateFilter(service, INNER_SERVICE, Collections.singletonList(UI_CONSTRAINT_STATIC.replace(VALUE, "true")), - NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES); + NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES, EMPTY_STR); assertTrue(either.isRight()); either = nodeFilterValidator.validateFilter(service, INNER_SERVICE, Collections.singletonList(UI_CONSTRAINT_STATIC.replace(VALUE, "true")), - NodeFilterConstraintAction.ADD, NodeFilterConstraintType.CAPABILITIES); + NodeFilterConstraintAction.ADD, NodeFilterConstraintType.CAPABILITIES, EMPTY_STR); assertTrue(either.isRight()); } @@ -159,7 +160,7 @@ public class NodeFilterValidationTest { nodeFilterValidator.validateFilter(service, INNER_SERVICE, Collections.singletonList(UI_CONSTRAINT_STATIC.replace(VALUE, "true") .replace("equal", "greater_than")), - NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES); + NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES, EMPTY_STR); Assert.assertFalse(either.isLeft()); } @@ -170,7 +171,7 @@ public class NodeFilterValidationTest { Either<Boolean, ResponseFormat> either = nodeFilterValidator.validateFilter(service, INNER_SERVICE, Collections.singletonList(UI_CONSTRAINT_STATIC.replace(VALUE, "trues")), - NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES); + NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES, EMPTY_STR); Assert.assertFalse(either.isLeft()); } @@ -182,7 +183,7 @@ public class NodeFilterValidationTest { nodeFilterValidator.validateFilter(service, INNER_SERVICE, Collections.singletonList(UI_CONSTRAINT_STATIC.replace(VALUE, "true") .replace("equal", "greater_than")), - NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES); + NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES, EMPTY_STR); Assert.assertTrue(either.isLeft()); } @@ -193,7 +194,7 @@ public class NodeFilterValidationTest { Either<Boolean, ResponseFormat> either = nodeFilterValidator.validateFilter(service, INNER_SERVICE, Collections.singletonList(UI_CONSTRAINT_STATIC.replace(VALUE, "1")), - NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES); + NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES, EMPTY_STR); Assert.assertTrue(either.isLeft()); } @@ -208,7 +209,7 @@ public class NodeFilterValidationTest { Either<Boolean, ResponseFormat> either = nodeFilterValidator.validateFilter(service, INNER_SERVICE, Collections.singletonList(UI_CONSTRAINT_STATIC.replace(VALUE, "1.0")), - NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES); + NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES, EMPTY_STR); Assert.assertTrue(either.isRight()); } @@ -219,7 +220,7 @@ public class NodeFilterValidationTest { Either<Boolean, ResponseFormat> either = nodeFilterValidator.validateFilter(service, INNER_SERVICE, Collections.singletonList(UI_CONSTRAINT_STATIC.replace(VALUE, "1.0")), - NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES); + NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES, EMPTY_STR); Assert.assertTrue(either.isLeft()); } @@ -234,7 +235,7 @@ public class NodeFilterValidationTest { Either<Boolean, ResponseFormat> either = nodeFilterValidator.validateFilter(service, INNER_SERVICE, Collections.singletonList(UI_CONSTRAINT_STATIC), NodeFilterConstraintAction.ADD, - NodeFilterConstraintType.PROPERTIES); + NodeFilterConstraintType.PROPERTIES, EMPTY_STR); Assert.assertTrue(either.isRight()); } @@ -245,7 +246,7 @@ public class NodeFilterValidationTest { Either<Boolean, ResponseFormat> either = nodeFilterValidator.validateFilter(service, INNER_SERVICE, Collections.singletonList(UI_CONSTRAINT_STATIC), NodeFilterConstraintAction.ADD, - NodeFilterConstraintType.PROPERTIES); + NodeFilterConstraintType.PROPERTIES, EMPTY_STR); Assert.assertTrue(either.isLeft()); } @@ -256,7 +257,7 @@ public class NodeFilterValidationTest { Either<Boolean, ResponseFormat> either = nodeFilterValidator.validateFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n" + " equal: { get_property :[component2, Prop1]}\n"), NodeFilterConstraintAction.ADD, - NodeFilterConstraintType.PROPERTIES); + NodeFilterConstraintType.PROPERTIES, EMPTY_STR); Assert.assertTrue(either.isLeft()); } @@ -267,7 +268,7 @@ public class NodeFilterValidationTest { Either<Boolean, ResponseFormat> either = nodeFilterValidator.validateFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n" + " equal: { get_property : [SELF, Prop1]}\n"), NodeFilterConstraintAction.ADD, - NodeFilterConstraintType.PROPERTIES); + NodeFilterConstraintType.PROPERTIES, EMPTY_STR); Assert.assertTrue(either.isLeft()); } @@ -280,7 +281,7 @@ public class NodeFilterValidationTest { Either<Boolean, ResponseFormat> either = nodeFilterValidator.validateFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n" + " equal: { get_property : [component2, Prop1]}\n"), NodeFilterConstraintAction.ADD, - NodeFilterConstraintType.PROPERTIES); + NodeFilterConstraintType.PROPERTIES, EMPTY_STR); Assert.assertFalse(either.isLeft()); } @@ -293,7 +294,7 @@ public class NodeFilterValidationTest { Either<Boolean, ResponseFormat> either = nodeFilterValidator.validateFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n" + " equal: { get_property : [parentservice, Prop1]}\n"), NodeFilterConstraintAction.ADD, - NodeFilterConstraintType.PROPERTIES); + NodeFilterConstraintType.PROPERTIES, EMPTY_STR); Assert.assertFalse(either.isLeft()); } @@ -306,7 +307,7 @@ public class NodeFilterValidationTest { Either<Boolean, ResponseFormat> either = nodeFilterValidator.validateFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n" + " equal: { get_property : [parentservice, Prop1]}\n"), NodeFilterConstraintAction.ADD, - NodeFilterConstraintType.PROPERTIES); + NodeFilterConstraintType.PROPERTIES, EMPTY_STR); Assert.assertFalse(either.isLeft()); } @@ -319,7 +320,7 @@ public class NodeFilterValidationTest { Either<Boolean, ResponseFormat> either = nodeFilterValidator.validateFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n" + " equal: { get_property : [parentservice, Prop1]}\n"), NodeFilterConstraintAction.ADD, - NodeFilterConstraintType.PROPERTIES); + NodeFilterConstraintType.PROPERTIES, EMPTY_STR); Assert.assertFalse(either.isLeft()); } @@ -332,7 +333,7 @@ public class NodeFilterValidationTest { Either<Boolean, ResponseFormat> either = nodeFilterValidator.validateFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n" + " equal: { get_property : [parentservice, Prop1]}\n"), NodeFilterConstraintAction.ADD, - NodeFilterConstraintType.PROPERTIES); + NodeFilterConstraintType.PROPERTIES, EMPTY_STR); Assert.assertFalse(either.isLeft()); } |