summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src/test/java')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogicTest.java111
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/NodeFilterValidationTest.java42
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentNodeFilterServletTest.java98
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentSubstitutionFilterServletTest.java3
4 files changed, 147 insertions, 107 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 be9dd1689a..91abd16259 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
@@ -44,6 +44,7 @@ import java.util.Optional;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -65,6 +66,7 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.NodeFilterConstraintType;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
+import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.ComponentInstanceProperty;
import org.openecomp.sdc.be.model.PropertyDefinition;
@@ -87,6 +89,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock
private static final String propertyValue = "resourceTypeValue";
private static final String componentId = "dac65869-dfb4-40d2-aa20-084324659ec1";
private static final String componentInstanceId = "dac65869-dfb4-40d2-aa20-084324659ec1.resource0";
+ private static final String capabilityName = "MyCapabilityName";
@InjectMocks
private ComponentNodeFilterBusinessLogic componentNodeFilterBusinessLogic;
@@ -112,6 +115,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock
private CINodeFilterDataDefinition ciNodeFilterDataDefinition;
private RequirementNodeFilterPropertyDataDefinition requirementNodeFilterPropertyDataDefinition;
private String constraint;
+ private UIConstraint uiConstraint;
@BeforeEach
public void init() {
@@ -257,7 +261,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock
when(nodeFilterValidator
.validateFilter(resource, componentInstanceId,
requirementNodeFilterPropertyDataDefinition.getConstraints(),
- NodeFilterConstraintAction.ADD)).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))
@@ -270,13 +274,13 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock
final Optional<CINodeFilterDataDefinition> result = componentNodeFilterBusinessLogic
.addNodeFilter(componentId, componentInstanceId, NodeFilterConstraintAction.ADD,
"MyPropertyName", constraint, true, ComponentTypeEnum.RESOURCE,
- NodeFilterConstraintType.PROPERTIES);
+ NodeFilterConstraintType.PROPERTIES, capabilityName);
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);
+ 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),
@@ -292,7 +296,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock
when(nodeFilterValidator
.validateFilter(resource, componentInstanceId,
requirementNodeFilterPropertyDataDefinition.getConstraints(),
- NodeFilterConstraintAction.ADD)).thenReturn(Either.left(true));
+ NodeFilterConstraintAction.ADD, NodeFilterConstraintType.CAPABILITIES)).thenReturn(Either.left(true));
when(nodeFilterValidator.validateComponentInstanceExist(resource, componentInstanceId))
.thenReturn(Either.left(true));
when(graphLockOperation.lockComponent(componentId, NodeTypeEnum.Resource))
@@ -305,13 +309,13 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock
final Optional<CINodeFilterDataDefinition> result = componentNodeFilterBusinessLogic
.addNodeFilter(componentId, componentInstanceId, NodeFilterConstraintAction.ADD,
"MyPropertyName", constraint, true, ComponentTypeEnum.RESOURCE,
- NodeFilterConstraintType.CAPABILITIES);
+ NodeFilterConstraintType.CAPABILITIES, capabilityName);
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);
+ Collections.singletonList(constraint), NodeFilterConstraintAction.ADD, NodeFilterConstraintType.CAPABILITIES);
verify(graphLockOperation, times(1)).lockComponent(componentId, NodeTypeEnum.Resource);
verify(nodeFilterOperation, times(1))
.addNewCapabilities(anyString(), anyString(), any(CINodeFilterDataDefinition.class),
@@ -327,7 +331,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock
when(nodeFilterValidator
.validateFilter(resource, componentInstanceId,
requirementNodeFilterPropertyDataDefinition.getConstraints(),
- NodeFilterConstraintAction.ADD)).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))
@@ -339,12 +343,12 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock
assertThrows(BusinessLogicException.class, () -> componentNodeFilterBusinessLogic
.addNodeFilter(componentId, componentInstanceId, NodeFilterConstraintAction.ADD,
"MyPropertyName", constraint, true, ComponentTypeEnum.RESOURCE,
- NodeFilterConstraintType.PROPERTIES));
+ NodeFilterConstraintType.PROPERTIES, capabilityName));
verify(toscaOperationFacade, times(1)).getToscaElement(componentId);
verify(graphLockOperation, times(1)).lockComponent(componentId, NodeTypeEnum.Resource);
verify(nodeFilterValidator, times(1)).validateFilter(resource, componentInstanceId,
- constraints, NodeFilterConstraintAction.ADD);
+ constraints, NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES);
verify(nodeFilterOperation, times(0))
.addNewProperty(componentId, componentInstanceId, ciNodeFilterDataDefinition,
requirementNodeFilterPropertyDataDefinition);
@@ -361,7 +365,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock
assertThrows(BusinessLogicException.class, () -> componentNodeFilterBusinessLogic
.addNodeFilter(componentId, componentInstanceId, NodeFilterConstraintAction.ADD,
"MyPropertyName", constraint, true, ComponentTypeEnum.RESOURCE,
- NodeFilterConstraintType.PROPERTIES));
+ NodeFilterConstraintType.PROPERTIES, capabilityName));
}
@Test
@@ -372,7 +376,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock
when(nodeFilterValidator.validateComponentInstanceExist(resource, componentInstanceId))
.thenReturn(Either.left(true));
when(nodeFilterValidator.validateFilter(resource, componentInstanceId, singletonList(constraint),
- NodeFilterConstraintAction.DELETE)).thenReturn(Either.left(true));
+ NodeFilterConstraintAction.DELETE, NodeFilterConstraintType.PROPERTIES)).thenReturn(Either.left(true));
when(graphLockOperation.lockComponent(componentId, NodeTypeEnum.Resource))
.thenReturn(StorageOperationStatus.OK);
@@ -396,7 +400,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock
.validateComponentInstanceExist(resource, componentInstanceId);
verify(nodeFilterValidator, times(1))
.validateFilter(resource, componentInstanceId, singletonList(constraint),
- NodeFilterConstraintAction.DELETE);
+ NodeFilterConstraintAction.DELETE, NodeFilterConstraintType.PROPERTIES);
verify(nodeFilterOperation, times(1))
.deleteConstraint(componentId, componentInstanceId, ciNodeFilterDataDefinition, 0,
NodeFilterConstraintType.PROPERTIES);
@@ -411,7 +415,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock
when(nodeFilterValidator.validateComponentInstanceExist(resource, componentInstanceId))
.thenReturn(Either.left(true));
when(nodeFilterValidator.validateFilter(resource, componentInstanceId, singletonList(constraint),
- NodeFilterConstraintAction.DELETE)).thenReturn(Either.left(true));
+ NodeFilterConstraintAction.DELETE, NodeFilterConstraintType.PROPERTIES)).thenReturn(Either.left(true));
when(graphLockOperation.lockComponent(componentId, NodeTypeEnum.Resource))
.thenReturn(StorageOperationStatus.OK);
@@ -431,7 +435,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);
+ NodeFilterConstraintAction.DELETE, NodeFilterConstraintType.PROPERTIES);
verify(nodeFilterValidator, times(1))
.validateComponentInstanceExist(resource, componentInstanceId);
verify(graphLockOperation, times(1)).unlockComponent(componentId, NodeTypeEnum.Resource);
@@ -443,7 +447,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock
when(nodeFilterValidator.validateComponentInstanceExist(resource, componentInstanceId))
.thenReturn(Either.left(true));
when(nodeFilterValidator.validateFilter(resource, componentInstanceId, singletonList(constraint),
- NodeFilterConstraintAction.DELETE)).thenReturn(Either.left(true));
+ NodeFilterConstraintAction.DELETE, NodeFilterConstraintType.PROPERTIES)).thenReturn(Either.left(true));
assertThrows(BusinessLogicException.class, () -> componentNodeFilterBusinessLogic
.deleteNodeFilter(componentId, componentInstanceId, NodeFilterConstraintAction.DELETE, constraint,
@@ -452,7 +456,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock
verify(toscaOperationFacade, times(1)).getToscaElement(componentId);
verify(nodeFilterValidator, times(1))
.validateFilter(resource, componentInstanceId, singletonList(constraint),
- NodeFilterConstraintAction.DELETE);
+ NodeFilterConstraintAction.DELETE, NodeFilterConstraintType.PROPERTIES);
verify(nodeFilterValidator, times(1))
.validateComponentInstanceExist(resource, componentInstanceId);
}
@@ -462,31 +466,31 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock
componentInstance.setNodeFilter(ciNodeFilterDataDefinition);
when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(resource));
- when(nodeFilterValidator.validateFilter(resource, componentInstanceId,
- Collections.singletonList(constraint), NodeFilterConstraintAction.UPDATE)).thenReturn(Either.left(true));
+ 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))).thenReturn(Either.left(true));
+
when(graphLockOperation.lockComponent(componentId, NodeTypeEnum.Resource))
.thenReturn(StorageOperationStatus.OK);
+
+ when(nodeFilterOperation.deleteConstraint(componentId, componentInstanceId, ciNodeFilterDataDefinition,
+ 0, NodeFilterConstraintType.PROPERTIES)).thenReturn(Either.left(ciNodeFilterDataDefinition));
+
+ when(nodeFilterOperation.addNewProperty(anyString(), anyString(), any(CINodeFilterDataDefinition.class),
+ any(RequirementNodeFilterPropertyDataDefinition.class))).thenReturn(Either.left(ciNodeFilterDataDefinition));
+
when(graphLockOperation.unlockComponent(componentId, NodeTypeEnum.Resource))
.thenReturn(StorageOperationStatus.OK);
- when(nodeFilterOperation.updateCapabilities(anyString(), anyString(),
- any(CINodeFilterDataDefinition.class), anyList())).thenReturn(Either.left(ciNodeFilterDataDefinition));
-
- final List<String> constraints = requirementNodeFilterPropertyDataDefinition.getConstraints();
final Optional<CINodeFilterDataDefinition> updateNodeFilterResult = componentNodeFilterBusinessLogic
- .updateNodeFilter(componentId, componentInstanceId, constraints, true, ComponentTypeEnum.RESOURCE,
- NodeFilterConstraintType.CAPABILITIES);
+ .updateNodeFilter(componentId, componentInstanceId, uiConstraint, ComponentTypeEnum.RESOURCE,
+ NodeFilterConstraintType.PROPERTIES, 0);
assertThat(updateNodeFilterResult).isPresent();
assertThat(updateNodeFilterResult.get().getProperties().getListToscaDataDefinition()).hasSize(1);
-
- verify(toscaOperationFacade, times(1)).getToscaElement(componentId);
- verify(graphLockOperation, times(1)).lockComponent(componentId, NodeTypeEnum.Resource);
- verify(nodeFilterValidator, times(1)).validateFilter(resource, componentInstanceId,
- constraints, NodeFilterConstraintAction.UPDATE);
- verify(graphLockOperation, times(1)).unlockComponent(componentId, NodeTypeEnum.Resource);
- verify(nodeFilterOperation, times(1))
- .updateCapabilities(anyString(), anyString(), any(CINodeFilterDataDefinition.class), anyList());
}
@Test
@@ -494,37 +498,45 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock
componentInstance.setNodeFilter(ciNodeFilterDataDefinition);
when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(resource));
- when(nodeFilterValidator.validateFilter(resource, componentInstanceId,
- Collections.singletonList(constraint), NodeFilterConstraintAction.UPDATE)).thenReturn(Either.left(true));
+ 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))).thenReturn(Either.left(true));
+
when(graphLockOperation.lockComponent(componentId, NodeTypeEnum.Resource))
.thenReturn(StorageOperationStatus.OK);
+
+ when(nodeFilterOperation.deleteConstraint(componentId, componentInstanceId, ciNodeFilterDataDefinition,
+ 0, NodeFilterConstraintType.PROPERTIES)).thenReturn(Either.left(ciNodeFilterDataDefinition));
+
+ when(nodeFilterOperation.addNewProperty(anyString(), anyString(), any(CINodeFilterDataDefinition.class),
+ any(RequirementNodeFilterPropertyDataDefinition.class))).thenReturn(Either.right(StorageOperationStatus.GENERAL_ERROR));
+
when(graphLockOperation.unlockComponent(componentId, NodeTypeEnum.Resource))
.thenReturn(StorageOperationStatus.OK);
- final List<String> constraints = requirementNodeFilterPropertyDataDefinition.getConstraints();
assertThrows(BusinessLogicException.class, () -> componentNodeFilterBusinessLogic
- .updateNodeFilter(componentId, componentInstanceId, constraints, true, ComponentTypeEnum.RESOURCE,
- NodeFilterConstraintType.PROPERTIES));
-
- verify(toscaOperationFacade, times(1)).getToscaElement(componentId);
- verify(nodeFilterValidator, times(1)).validateFilter(resource, componentInstanceId,
- constraints, NodeFilterConstraintAction.UPDATE);
+ .updateNodeFilter(componentId, componentInstanceId, uiConstraint, ComponentTypeEnum.RESOURCE,
+ NodeFilterConstraintType.PROPERTIES, 0));
}
@Test
public void updateNodeFilterFailValidationTest() {
- final List<String> constraints = requirementNodeFilterPropertyDataDefinition.getConstraints();
when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(resource));
- when(nodeFilterValidator.validateFilter(resource, componentInstanceId,
- constraints, NodeFilterConstraintAction.UPDATE)).thenReturn(Either.left(true));
+ 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))).thenReturn(Either.left(true));
assertThrows(BusinessLogicException.class, () -> componentNodeFilterBusinessLogic
- .updateNodeFilter(componentId, componentInstanceId, constraints, true, ComponentTypeEnum.RESOURCE,
- NodeFilterConstraintType.PROPERTIES));
+ .updateNodeFilter(componentId, componentInstanceId, uiConstraint, ComponentTypeEnum.RESOURCE,
+ NodeFilterConstraintType.PROPERTIES, 0));
verify(toscaOperationFacade, times(1)).getToscaElement(componentId);
- verify(nodeFilterValidator, times(1)).validateFilter(resource, componentInstanceId,
- constraints, NodeFilterConstraintAction.UPDATE);
}
@Test
@@ -555,8 +567,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock
componentInstance.setDirectives(ConfigurationManager.getConfigurationManager().getConfiguration()
.getDirectives());
- final UIConstraint uiConstraint =
- new UIConstraint(servicePropertyName, constraintOperator, sourceType, sourceName, propertyValue);
+ uiConstraint = new UIConstraint(servicePropertyName, constraintOperator, sourceType, sourceName, propertyValue);
constraint = new ConstraintConvertor().convert(uiConstraint);
requirementNodeFilterPropertyDataDefinition = new RequirementNodeFilterPropertyDataDefinition();
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 83a968c756..82dde5e396 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
@@ -31,6 +31,7 @@ import org.openecomp.sdc.be.components.impl.utils.NodeFilterConstraintAction;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
+import org.openecomp.sdc.be.datatypes.enums.NodeFilterConstraintType;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.ComponentInstanceProperty;
@@ -74,7 +75,7 @@ public class NodeFilterValidationTest {
Either<Boolean, ResponseFormat> either =
nodeFilterValidator.validateFilter(service, INNER_SERVICE,
Collections.singletonList(UI_CONSTRAINT_STATIC.replace(VALUE, "true")),
- NodeFilterConstraintAction.ADD);
+ NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES);
Assert.assertFalse(either.isLeft());
}
@@ -86,7 +87,7 @@ public class NodeFilterValidationTest {
nodeFilterValidator.validateFilter(service, INNER_SERVICE,
Collections.singletonList(UI_CONSTRAINT_STATIC.replace(VALUE, "true")
.replace("equal", "greater_than")),
- NodeFilterConstraintAction.ADD);
+ NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES);
Assert.assertFalse(either.isLeft());
}
@@ -97,7 +98,7 @@ public class NodeFilterValidationTest {
Either<Boolean, ResponseFormat> either =
nodeFilterValidator.validateFilter(service, INNER_SERVICE,
Collections.singletonList(UI_CONSTRAINT_STATIC.replace(VALUE, "trues")),
- NodeFilterConstraintAction.ADD);
+ NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES);
Assert.assertFalse(either.isLeft());
}
@@ -109,7 +110,7 @@ public class NodeFilterValidationTest {
nodeFilterValidator.validateFilter(service, INNER_SERVICE,
Collections.singletonList(UI_CONSTRAINT_STATIC.replace(VALUE, "true")
.replace("equal", "greater_than")),
- NodeFilterConstraintAction.ADD);
+ NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES);
Assert.assertTrue(either.isLeft());
}
@@ -120,7 +121,7 @@ public class NodeFilterValidationTest {
Either<Boolean, ResponseFormat> either =
nodeFilterValidator.validateFilter(service, INNER_SERVICE,
Collections.singletonList(UI_CONSTRAINT_STATIC.replace(VALUE, "1")),
- NodeFilterConstraintAction.ADD);
+ NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES);
Assert.assertTrue(either.isLeft());
}
@@ -135,7 +136,7 @@ public class NodeFilterValidationTest {
Either<Boolean, ResponseFormat> either =
nodeFilterValidator.validateFilter(service, INNER_SERVICE,
Collections.singletonList(UI_CONSTRAINT_STATIC.replace(VALUE, "1.0")),
- NodeFilterConstraintAction.ADD);
+ NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES);
Assert.assertTrue(either.isRight());
}
@@ -146,7 +147,7 @@ public class NodeFilterValidationTest {
Either<Boolean, ResponseFormat> either =
nodeFilterValidator.validateFilter(service, INNER_SERVICE,
Collections.singletonList(UI_CONSTRAINT_STATIC.replace(VALUE, "1.0")),
- NodeFilterConstraintAction.ADD);
+ NodeFilterConstraintAction.ADD, NodeFilterConstraintType.PROPERTIES);
Assert.assertTrue(either.isLeft());
}
@@ -160,7 +161,8 @@ public class NodeFilterValidationTest {
Either<Boolean, ResponseFormat> either =
nodeFilterValidator.validateFilter(service, INNER_SERVICE,
- Collections.singletonList(UI_CONSTRAINT_STATIC), NodeFilterConstraintAction.ADD);
+ Collections.singletonList(UI_CONSTRAINT_STATIC), NodeFilterConstraintAction.ADD,
+ NodeFilterConstraintType.PROPERTIES);
Assert.assertTrue(either.isRight());
}
@@ -170,7 +172,8 @@ public class NodeFilterValidationTest {
Service service = createService(STRING_TYPE);
Either<Boolean, ResponseFormat> either =
nodeFilterValidator.validateFilter(service, INNER_SERVICE,
- Collections.singletonList(UI_CONSTRAINT_STATIC), NodeFilterConstraintAction.ADD);
+ Collections.singletonList(UI_CONSTRAINT_STATIC), NodeFilterConstraintAction.ADD,
+ NodeFilterConstraintType.PROPERTIES);
Assert.assertTrue(either.isLeft());
}
@@ -180,7 +183,8 @@ public class NodeFilterValidationTest {
Service service = createService(STRING_TYPE);
Either<Boolean, ResponseFormat> either =
nodeFilterValidator.validateFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n"
- + " equal: { get_property :[component2, Prop1]}\n"), NodeFilterConstraintAction.ADD);
+ + " equal: { get_property :[component2, Prop1]}\n"), NodeFilterConstraintAction.ADD,
+ NodeFilterConstraintType.PROPERTIES);
Assert.assertTrue(either.isLeft());
}
@@ -190,7 +194,8 @@ public class NodeFilterValidationTest {
Service service = createService(STRING_TYPE);
Either<Boolean, ResponseFormat> either =
nodeFilterValidator.validateFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n"
- + " equal: { get_property : [parentservice, Prop1]}\n"), NodeFilterConstraintAction.ADD);
+ + " equal: { get_property : [parentservice, Prop1]}\n"), NodeFilterConstraintAction.ADD,
+ NodeFilterConstraintType.PROPERTIES);
Assert.assertTrue(either.isLeft());
}
@@ -202,7 +207,8 @@ public class NodeFilterValidationTest {
Either<Boolean, ResponseFormat> either =
nodeFilterValidator.validateFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n"
- + " equal: { get_property : [component2, Prop1]}\n"), NodeFilterConstraintAction.ADD);
+ + " equal: { get_property : [component2, Prop1]}\n"), NodeFilterConstraintAction.ADD,
+ NodeFilterConstraintType.PROPERTIES);
Assert.assertFalse(either.isLeft());
}
@@ -214,7 +220,8 @@ public class NodeFilterValidationTest {
Either<Boolean, ResponseFormat> either =
nodeFilterValidator.validateFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n"
- + " equal: { get_property : [parentservice, Prop1]}\n"), NodeFilterConstraintAction.ADD);
+ + " equal: { get_property : [parentservice, Prop1]}\n"), NodeFilterConstraintAction.ADD,
+ NodeFilterConstraintType.PROPERTIES);
Assert.assertFalse(either.isLeft());
}
@@ -226,7 +233,8 @@ public class NodeFilterValidationTest {
Either<Boolean, ResponseFormat> either =
nodeFilterValidator.validateFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n"
- + " equal: { get_property : [parentservice, Prop1]}\n"), NodeFilterConstraintAction.ADD);
+ + " equal: { get_property : [parentservice, Prop1]}\n"), NodeFilterConstraintAction.ADD,
+ NodeFilterConstraintType.PROPERTIES);
Assert.assertFalse(either.isLeft());
}
@@ -238,7 +246,8 @@ public class NodeFilterValidationTest {
Either<Boolean, ResponseFormat> either =
nodeFilterValidator.validateFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n"
- + " equal: { get_property : [parentservice, Prop1]}\n"), NodeFilterConstraintAction.ADD);
+ + " equal: { get_property : [parentservice, Prop1]}\n"), NodeFilterConstraintAction.ADD,
+ NodeFilterConstraintType.PROPERTIES);
Assert.assertFalse(either.isLeft());
}
@@ -250,7 +259,8 @@ public class NodeFilterValidationTest {
Either<Boolean, ResponseFormat> either =
nodeFilterValidator.validateFilter(service, COMPONENT1_ID, Collections.singletonList("Prop1:\n"
- + " equal: { get_property : [parentservice, Prop1]}\n"), NodeFilterConstraintAction.ADD);
+ + " equal: { get_property : [parentservice, Prop1]}\n"), NodeFilterConstraintAction.ADD,
+ NodeFilterConstraintType.PROPERTIES);
Assert.assertFalse(either.isLeft());
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentNodeFilterServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentNodeFilterServletTest.java
index a745f41ec0..4109f6222c 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentNodeFilterServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentNodeFilterServletTest.java
@@ -24,7 +24,6 @@ import static org.junit.Assert.assertNotNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.ArgumentMatchers.anyList;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Mockito.mock;
@@ -98,6 +97,7 @@ public class ComponentNodeFilterServletTest extends JerseyTest {
private static final String componentId = "dac65869-dfb4-40d2-aa20-084324659ec1";
private static final String componentInstance = "dac65869-dfb4-40d2-aa20-084324659ec1.resource0";
private static final String componentType = "resources";
+ private static final String capabilityName = "MyCapabilityName";
private static HttpServletRequest request;
private static HttpSession session;
@@ -146,7 +146,7 @@ public class ComponentNodeFilterServletTest extends JerseyTest {
@Test
public void addNodeFilterPropertiesSuccessTest() throws BusinessLogicException, JsonProcessingException {
initComponentData();
- final String pathFormat = "/v1/catalog/%s/%s/resourceInstances/%s/nodeFilter/%s";
+ final String pathFormat = "/v1/catalog/%s/%s/componentInstance/%s/%s/nodeFilter";
final String path = String.format(pathFormat, componentType, componentId, componentInstance,
NodeFilterConstraintType.PROPERTIES_PARAM_NAME);
@@ -172,7 +172,7 @@ public class ComponentNodeFilterServletTest extends JerseyTest {
when(componentNodeFilterBusinessLogic
.addNodeFilter(componentId, componentInstance, NodeFilterConstraintAction.ADD,
uiConstraint.getServicePropertyName(), constraint, true, ComponentTypeEnum.RESOURCE,
- NodeFilterConstraintType.PROPERTIES))
+ NodeFilterConstraintType.PROPERTIES, ""))
.thenReturn(Optional.of(ciNodeFilterDataDefinition));
final Response response = target()
@@ -184,7 +184,7 @@ public class ComponentNodeFilterServletTest extends JerseyTest {
verify(componentNodeFilterBusinessLogic, times(1))
.addNodeFilter(anyString(), anyString(), ArgumentMatchers.any(NodeFilterConstraintAction.class), anyString(),
anyString(), anyBoolean(), ArgumentMatchers.any(ComponentTypeEnum.class),
- ArgumentMatchers.any(NodeFilterConstraintType.class));
+ ArgumentMatchers.any(NodeFilterConstraintType.class), anyString());
assertThat(response.getStatus()).isEqualTo(HttpStatus.OK_200);
}
@@ -192,10 +192,11 @@ public class ComponentNodeFilterServletTest extends JerseyTest {
@Test
public void addNodeFilterCapabilitiesSuccessTest() throws BusinessLogicException, JsonProcessingException {
initComponentData();
- final String pathFormat = "/v1/catalog/%s/%s/resourceInstances/%s/nodeFilter/%s";
+ final String pathFormat = "/v1/catalog/%s/%s/componentInstance/%s/%s/nodeFilter";
final String path = String.format(pathFormat, componentType, componentId, componentInstance,
NodeFilterConstraintType.CAPABILITIES_PARAM_NAME);
+ final UIConstraint uiConstraint1 = uiConstraint;
when(userValidations.validateUserExists(user)).thenReturn(user);
when(componentNodeFilterBusinessLogic.validateUser(USER_ID)).thenReturn(user);
when(responseFormat.getStatus()).thenReturn(HttpStatus.OK_200);
@@ -203,11 +204,12 @@ public class ComponentNodeFilterServletTest extends JerseyTest {
when(componentsUtils.parseToConstraint(anyString(), any(User.class),ArgumentMatchers.any(ComponentTypeEnum.class)))
.thenReturn(Optional.of(uiConstraint));
+ uiConstraint1.setCapabilityName(capabilityName);
assertThat(ciNodeFilterDataDefinition.getProperties().getListToscaDataDefinition()).hasSize(1);
when(componentNodeFilterBusinessLogic
.addNodeFilter(componentId, componentInstance, NodeFilterConstraintAction.ADD,
- uiConstraint.getServicePropertyName(), constraint, true, ComponentTypeEnum.RESOURCE,
- NodeFilterConstraintType.CAPABILITIES))
+ uiConstraint1.getServicePropertyName(), constraint, true, ComponentTypeEnum.RESOURCE,
+ NodeFilterConstraintType.CAPABILITIES, capabilityName))
.thenReturn(Optional.of(ciNodeFilterDataDefinition));
final Response response = target()
@@ -219,7 +221,7 @@ public class ComponentNodeFilterServletTest extends JerseyTest {
verify(componentNodeFilterBusinessLogic, times(1))
.addNodeFilter(anyString(), anyString(), ArgumentMatchers.any(NodeFilterConstraintAction.class), anyString(),
anyString(), anyBoolean(), ArgumentMatchers.any(ComponentTypeEnum.class),
- ArgumentMatchers.any(NodeFilterConstraintType.class));
+ ArgumentMatchers.any(NodeFilterConstraintType.class), anyString());
assertThat(response.getStatus()).isEqualTo(HttpStatus.OK_200);
}
@@ -227,7 +229,7 @@ public class ComponentNodeFilterServletTest extends JerseyTest {
@Test
public void addNodeFilterFailTest() throws BusinessLogicException, JsonProcessingException {
initComponentData();
- final String pathFormat = "/v1/catalog/%s/%s/resourceInstances/%s/nodeFilter/%s";
+ final String pathFormat = "/v1/catalog/%s/%s/componentInstance/%s/%s/nodeFilter";
final String path = String.format(pathFormat, componentType, componentId, componentInstance,
NodeFilterConstraintType.PROPERTIES_PARAM_NAME);
@@ -243,7 +245,7 @@ public class ComponentNodeFilterServletTest extends JerseyTest {
when(componentNodeFilterBusinessLogic
.addNodeFilter(componentId, componentInstance, NodeFilterConstraintAction.ADD,
uiConstraint.getServicePropertyName(), constraint, true, ComponentTypeEnum.RESOURCE,
- NodeFilterConstraintType.PROPERTIES))
+ NodeFilterConstraintType.PROPERTIES, ""))
.thenReturn(Optional.empty());
final Response response = target()
@@ -258,7 +260,7 @@ public class ComponentNodeFilterServletTest extends JerseyTest {
@Test
public void addNodeFilterFailConstraintParseTest() throws JsonProcessingException {
initComponentData();
- final String pathFormat = "/v1/catalog/%s/%s/resourceInstances/%s/nodeFilter/%s";
+ final String pathFormat = "/v1/catalog/%s/%s/componentInstance/%s/%s/nodeFilter";
final String path = String.format(pathFormat, componentType, componentId, componentInstance, NodeFilterConstraintType.PROPERTIES_PARAM_NAME);
when(userValidations.validateUserExists(user)).thenReturn(user);
@@ -282,9 +284,9 @@ public class ComponentNodeFilterServletTest extends JerseyTest {
}
@Test
- public void addNodeFilterFailConvertTest() throws JsonProcessingException, BusinessLogicException {
+ public void addNodeFilterFailConvertTest() throws JsonProcessingException {
initComponentData();
- final String pathFormat = "/v1/catalog/%s/%s/resourceInstances/%s/nodeFilter/%s";
+ final String pathFormat = "/v1/catalog/%s/%s/componentInstance/%s/%s/nodeFilter";
final String path = String.format(pathFormat, componentType, componentId, componentInstance,
NodeFilterConstraintType.PROPERTIES.getType());
@@ -311,9 +313,9 @@ public class ComponentNodeFilterServletTest extends JerseyTest {
@Test
public void updateNodeFilterPropertiesSuccessTest() throws BusinessLogicException, JsonProcessingException {
initComponentData();
- final String pathFormat = "/v1/catalog/%s/%s/resourceInstances/%s/nodeFilter/%s";
+ final String pathFormat = "/v1/catalog/%s/%s/componentInstance/%s/%s/%s/nodeFilter";
final String path = String.format(pathFormat, componentType, componentId, componentInstance,
- NodeFilterConstraintType.PROPERTIES_PARAM_NAME);
+ NodeFilterConstraintType.PROPERTIES_PARAM_NAME, 0);
when(userValidations.validateUserExists(user)).thenReturn(user);
when(componentNodeFilterBusinessLogic.validateUser(USER_ID)).thenReturn(user);
@@ -327,9 +329,8 @@ public class ComponentNodeFilterServletTest extends JerseyTest {
.thenReturn(Either.left(Arrays.asList(new ObjectMapper().convertValue(uiConstraint, Map.class))));
when(componentNodeFilterBusinessLogic
- .updateNodeFilter(componentId, componentInstance, Collections.singletonList(constraint),
- true, ComponentTypeEnum.RESOURCE, NodeFilterConstraintType.PROPERTIES))
- .thenReturn(Optional.of(ciNodeFilterDataDefinition));
+ .updateNodeFilter(componentId, componentInstance, uiConstraint, ComponentTypeEnum.RESOURCE,
+ NodeFilterConstraintType.PROPERTIES, 0)).thenReturn(Optional.of(ciNodeFilterDataDefinition));
final Response response = target()
.path(path)
.request(MediaType.APPLICATION_JSON)
@@ -337,8 +338,9 @@ public class ComponentNodeFilterServletTest extends JerseyTest {
.put(Entity.entity(inputJson, MediaType.APPLICATION_JSON));
verify(componentNodeFilterBusinessLogic, times(1))
- .updateNodeFilter(anyString(), anyString(), anyList(), anyBoolean(),
- ArgumentMatchers.any(ComponentTypeEnum.class), ArgumentMatchers.any(NodeFilterConstraintType.class));
+ .updateNodeFilter(anyString(), anyString(), ArgumentMatchers.any(UIConstraint.class),
+ ArgumentMatchers.any(ComponentTypeEnum.class), ArgumentMatchers.any(NodeFilterConstraintType.class),
+ anyInt());
assertThat(response.getStatus()).isEqualTo(HttpStatus.OK_200);
}
@@ -346,13 +348,16 @@ public class ComponentNodeFilterServletTest extends JerseyTest {
@Test
public void updateNodeFilterCapabilitiesSuccessTest() throws BusinessLogicException, JsonProcessingException {
initComponentData();
- final String pathFormat = "/v1/catalog/%s/%s/resourceInstances/%s/nodeFilter/%s";
+ final String pathFormat = "/v1/catalog/%s/%s/componentInstance/%s/%s/%s/nodeFilter";
final String path = String.format(pathFormat, componentType, componentId, componentInstance,
- NodeFilterConstraintType.CAPABILITIES_PARAM_NAME);
+ NodeFilterConstraintType.CAPABILITIES_PARAM_NAME, 0);
when(userValidations.validateUserExists(user)).thenReturn(user);
when(componentNodeFilterBusinessLogic.validateUser(USER_ID)).thenReturn(user);
+ when(componentsUtils.parseToConstraint(anyString(), any(User.class), ArgumentMatchers.any(ComponentTypeEnum.class)))
+ .thenReturn(Optional.of(uiConstraint));
+
when(responseFormat.getStatus()).thenReturn(HttpStatus.OK_200);
when(componentsUtils.getResponseFormat(ActionStatus.OK)).thenReturn(responseFormat);
@@ -364,10 +369,22 @@ public class ComponentNodeFilterServletTest extends JerseyTest {
nullable(AuditingActionEnum.class), nullable(ComponentTypeEnum.class)))
.thenReturn(Either.left(Arrays.asList(new ObjectMapper().convertValue(uiConstraint, Map.class))));
+ when(componentNodeFilterBusinessLogic.deleteNodeFilter(componentId, componentInstance,
+ NodeFilterConstraintAction.DELETE, null, 0, true, ComponentTypeEnum.RESOURCE,
+ NodeFilterConstraintType.PROPERTIES))
+ .thenReturn(Optional.of(ciNodeFilterDataDefinition));
+
when(componentNodeFilterBusinessLogic
- .updateNodeFilter(componentId, componentInstance, Collections.singletonList(constraint),
- true, ComponentTypeEnum.RESOURCE, NodeFilterConstraintType.CAPABILITIES))
+ .addNodeFilter(componentId, componentInstance, NodeFilterConstraintAction.ADD,
+ uiConstraint.getServicePropertyName(), constraint, true, ComponentTypeEnum.RESOURCE,
+ NodeFilterConstraintType.PROPERTIES, ""))
.thenReturn(Optional.of(ciNodeFilterDataDefinition));
+
+ when(componentNodeFilterBusinessLogic
+ .updateNodeFilter(componentId, componentInstance, uiConstraint,
+ ComponentTypeEnum.RESOURCE, NodeFilterConstraintType.CAPABILITIES, 0))
+ .thenReturn(Optional.of(ciNodeFilterDataDefinition));
+
final Response response = target()
.path(path)
.request(MediaType.APPLICATION_JSON)
@@ -375,8 +392,9 @@ public class ComponentNodeFilterServletTest extends JerseyTest {
.put(Entity.entity(inputJson, MediaType.APPLICATION_JSON));
verify(componentNodeFilterBusinessLogic, times(1))
- .updateNodeFilter(anyString(), anyString(), anyList(), anyBoolean(),
- ArgumentMatchers.any(ComponentTypeEnum.class), ArgumentMatchers.any(NodeFilterConstraintType.class));
+ .updateNodeFilter(anyString(), anyString(), ArgumentMatchers.any(UIConstraint.class),
+ ArgumentMatchers.any(ComponentTypeEnum.class), ArgumentMatchers.any(NodeFilterConstraintType.class),
+ anyInt());
assertThat(response.getStatus()).isEqualTo(HttpStatus.OK_200);
}
@@ -384,9 +402,9 @@ public class ComponentNodeFilterServletTest extends JerseyTest {
@Test
public void updateNodeFilterFailTest() throws BusinessLogicException, JsonProcessingException {
initComponentData();
- final String pathFormat = "/v1/catalog/%s/%s/resourceInstances/%s/nodeFilter/%s";
+ final String pathFormat = "/v1/catalog/%s/%s/componentInstance/%s/%s/%s/nodeFilter";
final String path = String.format(pathFormat, componentType, componentId, componentInstance,
- NodeFilterConstraintType.PROPERTIES_PARAM_NAME);
+ NodeFilterConstraintType.PROPERTIES_PARAM_NAME, 0);
when(userValidations.validateUserExists(user)).thenReturn(user);
when(componentNodeFilterBusinessLogic.validateUser(USER_ID)).thenReturn(user);
@@ -397,8 +415,8 @@ public class ComponentNodeFilterServletTest extends JerseyTest {
.thenReturn(Collections.singletonList(uiConstraint));
when(componentNodeFilterBusinessLogic
- .updateNodeFilter(componentId, componentInstance, Collections.singletonList(constraint),
- true, ComponentTypeEnum.RESOURCE, NodeFilterConstraintType.PROPERTIES))
+ .updateNodeFilter(componentId, componentInstance, uiConstraint,
+ ComponentTypeEnum.RESOURCE, NodeFilterConstraintType.PROPERTIES, 0))
.thenReturn(Optional.empty());
final Response response = target()
.path(path)
@@ -407,9 +425,9 @@ public class ComponentNodeFilterServletTest extends JerseyTest {
.put(Entity.entity(inputJson, MediaType.APPLICATION_JSON));
verify(componentNodeFilterBusinessLogic, times(1))
- .updateNodeFilter(anyString(), anyString(), anyList(), anyBoolean(),
- ArgumentMatchers.any(ComponentTypeEnum.class), ArgumentMatchers.any(NodeFilterConstraintType.class));
-
+ .updateNodeFilter(anyString(), anyString(), ArgumentMatchers.any(UIConstraint.class),
+ ArgumentMatchers.any(ComponentTypeEnum.class), ArgumentMatchers.any(NodeFilterConstraintType.class),
+ anyInt());
assertThat(response.getStatus()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@@ -417,9 +435,9 @@ public class ComponentNodeFilterServletTest extends JerseyTest {
@Test
public void updateNodeFilterFailConstraintParseTest() throws JsonProcessingException {
initComponentData();
- final String pathFormat = "/v1/catalog/%s/%s/resourceInstances/%s/nodeFilter/%s";
+ final String pathFormat = "/v1/catalog/%s/%s/componentInstance/%s/%s/%s/nodeFilter";
final String path = String.format(pathFormat, componentType, componentId, componentInstance,
- NodeFilterConstraintType.PROPERTIES_PARAM_NAME);
+ NodeFilterConstraintType.PROPERTIES_PARAM_NAME, 0);
when(userValidations.validateUserExists(user)).thenReturn(user);
when(componentNodeFilterBusinessLogic.validateUser(USER_ID)).thenReturn(user);
@@ -440,9 +458,9 @@ public class ComponentNodeFilterServletTest extends JerseyTest {
@Test
public void updateNodeFilterFailConvertTest() throws JsonProcessingException {
initComponentData();
- final String pathFormat = "/v1/catalog/%s/%s/resourceInstances/%s/nodeFilter/%s";
+ final String pathFormat = "/v1/catalog/%s/%s/componentInstance/%s/%s/%s/nodeFilter";
final String path = String.format(pathFormat, componentType, componentId, componentInstance,
- NodeFilterConstraintType.PROPERTIES_PARAM_NAME);
+ NodeFilterConstraintType.PROPERTIES_PARAM_NAME, 0);
when(userValidations.validateUserExists(user)).thenReturn(user);
when(componentNodeFilterBusinessLogic.validateUser(USER_ID)).thenReturn(user);
@@ -465,7 +483,7 @@ public class ComponentNodeFilterServletTest extends JerseyTest {
@Test
public void deleteNodeFilterSuccessTest() throws BusinessLogicException, JsonProcessingException {
initComponentData();
- final String pathFormat = "/v1/catalog/%s/%s/resourceInstances/%s/nodeFilter/%s/%s";
+ final String pathFormat = "/v1/catalog/%s/%s/componentInstance/%s/%s/%s/nodeFilter";
final String path = String.format(pathFormat, componentType, componentId, componentInstance,
NodeFilterConstraintType.PROPERTIES_PARAM_NAME, 0);
@@ -497,9 +515,9 @@ public class ComponentNodeFilterServletTest extends JerseyTest {
@Test
public void deleteNodeFilterFailTest() {
- final String pathFormat = "/v1/catalog/%s/%s/resourceInstances/%s/nodeFilter/%s/%s";
+ final String pathFormat = "/v1/catalog/%s/%s/componentInstance/%s/%s/%s/nodeFilter";
final String path = String.format(pathFormat, componentType, componentId, componentInstance,
- NodeFilterConstraintType.PROPERTIES_PARAM_NAME, 1);
+ NodeFilterConstraintType.PROPERTIES_PARAM_NAME, 0);
final Response response = target()
.path(path)
.request(MediaType.APPLICATION_JSON)
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentSubstitutionFilterServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentSubstitutionFilterServletTest.java
index 39259a899f..2da9efbb6d 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentSubstitutionFilterServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentSubstitutionFilterServletTest.java
@@ -403,4 +403,5 @@ public class ComponentSubstitutionFilterServletTest extends JerseyTest {
return mapper.writeValueAsString(uiConstraint);
}
-} \ No newline at end of file
+}
+