summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test/java
diff options
context:
space:
mode:
authorandre.schmid <andre.schmid@est.tech>2022-09-08 18:55:08 +0100
committerMichael Morris <michael.morris@est.tech>2022-09-19 08:38:43 +0000
commit0d38a72c022fa93dba0bf052f893e51fb73d3552 (patch)
tree25f49242e6c6666c39e32abae66e4950fe4e18ed /catalog-be/src/test/java
parent2fe3d879319a34e9802d0bc172fa11fefe771df3 (diff)
Support TOSCA functions in Node Capability Filters
Adds support to use TOSCA functions as value in the node capability filters. Removes the current capability filter component to reuse, with a few changes, the node property filters component. Fixes problems with the edition and deletion of node capability filters. Change-Id: Ic91242d6cbc24e2ce0f60b84c63e104575bef8a9 Issue-ID: SDC-4173 Signed-off-by: André Schmid <andre.schmid@est.tech>
Diffstat (limited to 'catalog-be/src/test/java')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogicTest.java14
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentNodeFilterServletTest.java32
2 files changed, 23 insertions, 23 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 1bf075e2f6..e3e173571e 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
@@ -274,7 +274,7 @@ class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock {
final Optional<CINodeFilterDataDefinition> result = componentNodeFilterBusinessLogic
.addNodeFilter(componentId, componentInstanceId, filterConstraintDto, true, ComponentTypeEnum.RESOURCE,
- NodeFilterConstraintType.PROPERTIES, null);
+ NodeFilterConstraintType.PROPERTIES);
assertThat(result).isPresent();
assertThat(result.get().getProperties().getListToscaDataDefinition()).hasSize(1);
@@ -305,7 +305,7 @@ class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock {
final Optional<CINodeFilterDataDefinition> result = componentNodeFilterBusinessLogic
.addNodeFilter(componentId, componentInstanceId, filterConstraintDto, true, ComponentTypeEnum.RESOURCE,
- NodeFilterConstraintType.CAPABILITIES, capabilityName
+ NodeFilterConstraintType.CAPABILITIES
);
assertThat(result).isPresent();
@@ -342,7 +342,7 @@ class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock {
final BusinessLogicException businessLogicException = assertThrows(BusinessLogicException.class, () -> componentNodeFilterBusinessLogic
.addNodeFilter(componentId, componentInstanceId, filterConstraintDto, true, ComponentTypeEnum.RESOURCE,
- NodeFilterConstraintType.PROPERTIES, capabilityName));
+ NodeFilterConstraintType.PROPERTIES));
assertEquals(expectedResponse, businessLogicException.getResponseFormat());
verify(toscaOperationFacade, times(1)).getToscaElement(componentId);
@@ -370,7 +370,7 @@ class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock {
final BusinessLogicException businessLogicException = assertThrows(BusinessLogicException.class, () -> componentNodeFilterBusinessLogic
.addNodeFilter(componentId, componentInstanceId, filterConstraintDto, true, ComponentTypeEnum.RESOURCE,
- NodeFilterConstraintType.PROPERTIES, capabilityName));
+ NodeFilterConstraintType.PROPERTIES));
assertEquals(expectedResponse, businessLogicException.getResponseFormat());
}
@@ -473,7 +473,7 @@ class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock {
.thenReturn(StorageOperationStatus.OK);
final Optional<CINodeFilterDataDefinition> updateNodeFilterResult = componentNodeFilterBusinessLogic
- .updateNodeFilter(componentId, componentInstanceId, uiConstraint, ComponentTypeEnum.RESOURCE,
+ .updateNodeFilter(componentId, componentInstanceId, filterConstraintDto, ComponentTypeEnum.RESOURCE,
NodeFilterConstraintType.PROPERTIES, 0);
assertThat(updateNodeFilterResult).isPresent();
@@ -505,7 +505,7 @@ class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock {
.thenReturn(StorageOperationStatus.OK);
assertThrows(BusinessLogicException.class, () -> componentNodeFilterBusinessLogic
- .updateNodeFilter(componentId, componentInstanceId, uiConstraint, ComponentTypeEnum.RESOURCE,
+ .updateNodeFilter(componentId, componentInstanceId, filterConstraintDto, ComponentTypeEnum.RESOURCE,
NodeFilterConstraintType.PROPERTIES, 0));
}
@@ -516,7 +516,7 @@ class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock {
.thenReturn(Either.left(true));
assertThrows(BusinessLogicException.class, () -> componentNodeFilterBusinessLogic
- .updateNodeFilter(componentId, componentInstanceId, uiConstraint, ComponentTypeEnum.RESOURCE,
+ .updateNodeFilter(componentId, componentInstanceId, filterConstraintDto, ComponentTypeEnum.RESOURCE,
NodeFilterConstraintType.PROPERTIES, 0));
verify(toscaOperationFacade, times(1)).getToscaElement(componentId);
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 49252109cd..29e3a54133 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
@@ -202,7 +202,7 @@ class ComponentNodeFilterServletTest extends JerseyTest {
doReturn(Optional.of(ciNodeFilterDataDefinition)).when(componentNodeFilterBusinessLogic)
.addNodeFilter(componentId, componentInstance, filterConstraintDto, true, ComponentTypeEnum.RESOURCE,
- NodeFilterConstraintType.PROPERTIES, "");
+ NodeFilterConstraintType.PROPERTIES);
final Response response = target()
.path(path)
@@ -212,7 +212,7 @@ class ComponentNodeFilterServletTest extends JerseyTest {
verify(componentNodeFilterBusinessLogic, times(1))
.addNodeFilter(anyString(), anyString(), any(FilterConstraintDto.class), anyBoolean(), any(ComponentTypeEnum.class),
- any(NodeFilterConstraintType.class), anyString()
+ any(NodeFilterConstraintType.class)
);
assertThat(response.getStatus()).isEqualTo(HttpStatus.OK_200);
@@ -238,7 +238,7 @@ class ComponentNodeFilterServletTest extends JerseyTest {
final FilterConstraintDto filterConstraintDto1 = new FilterConstraintMapper().mapFrom(uiConstraint1);
when(componentNodeFilterBusinessLogic
.addNodeFilter(componentId, componentInstance, filterConstraintDto1, true, ComponentTypeEnum.RESOURCE,
- NodeFilterConstraintType.CAPABILITIES, capabilityName)
+ NodeFilterConstraintType.CAPABILITIES)
).thenReturn(Optional.of(ciNodeFilterDataDefinition));
final Response response = target()
.path(path)
@@ -248,14 +248,14 @@ class ComponentNodeFilterServletTest extends JerseyTest {
verify(componentNodeFilterBusinessLogic, times(1))
.addNodeFilter(componentId, componentInstance, filterConstraintDto1, true, ComponentTypeEnum.RESOURCE,
- NodeFilterConstraintType.CAPABILITIES, capabilityName);
+ NodeFilterConstraintType.CAPABILITIES);
assertThat(response.getStatus()).isEqualTo(HttpStatus.OK_200);
verify(componentNodeFilterBusinessLogic,times(1)).validateUser(USER_ID);
}
@Test
- void addNodeFilterFailTest() throws BusinessLogicException, JsonProcessingException {
+ void addNodeFilterFailTest() {
initComponentData();
final String pathFormat = V_1_CATALOG_S_S_COMPONENT_INSTANCE_S_S_NODE_FILTER;
final String path = String.format(pathFormat, componentType, componentId, componentInstance,
@@ -274,7 +274,7 @@ class ComponentNodeFilterServletTest extends JerseyTest {
}
@Test
- void addNodeFilterFailConstraintParseTest() throws JsonProcessingException {
+ void addNodeFilterFailConstraintParseTest() {
initComponentData();
final String pathFormat = V_1_CATALOG_S_S_COMPONENT_INSTANCE_S_S_NODE_FILTER;
final String path = String.format(pathFormat, componentType, componentId, componentInstance, NodeFilterConstraintType.PROPERTIES_PARAM_NAME);
@@ -292,7 +292,7 @@ class ComponentNodeFilterServletTest extends JerseyTest {
}
@Test
- void addNodeFilterFailConvertTest() throws JsonProcessingException {
+ void addNodeFilterFailConvertTest() {
initComponentData();
final String pathFormat = V_1_CATALOG_S_S_COMPONENT_INSTANCE_S_S_NODE_FILTER;
final String path = String.format(pathFormat, componentType, componentId, componentInstance,
@@ -311,7 +311,7 @@ class ComponentNodeFilterServletTest extends JerseyTest {
}
@Test
- void updateNodeFilterPropertiesSuccessTest() throws BusinessLogicException, JsonProcessingException {
+ void updateNodeFilterPropertiesSuccessTest() throws BusinessLogicException {
initComponentData();
final String pathFormat = V_1_CATALOG_S_S_COMPONENT_INSTANCE_S_S_S_NODE_FILTER;
final String path = String.format(pathFormat, componentType, componentId, componentInstance,
@@ -325,7 +325,7 @@ class ComponentNodeFilterServletTest extends JerseyTest {
doReturn(Optional.of(uiConstraint)).when(componentsUtils)
.parseToConstraint(anyString(), any(User.class), eq(ComponentTypeEnum.RESOURCE));
when(componentNodeFilterBusinessLogic
- .updateNodeFilter(componentId, componentInstance, uiConstraint, ComponentTypeEnum.RESOURCE,
+ .updateNodeFilter(componentId, componentInstance, filterConstraintDto, ComponentTypeEnum.RESOURCE,
NodeFilterConstraintType.PROPERTIES, 0)).thenReturn(Optional.of(ciNodeFilterDataDefinition));
final Response response = target()
.path(path)
@@ -338,7 +338,7 @@ class ComponentNodeFilterServletTest extends JerseyTest {
}
@Test
- void updateNodeFilterCapabilitiesSuccessTest() throws BusinessLogicException, JsonProcessingException {
+ void updateNodeFilterCapabilitiesSuccessTest() throws BusinessLogicException {
initComponentData();
final String pathFormat = V_1_CATALOG_S_S_COMPONENT_INSTANCE_S_S_S_NODE_FILTER;
final String path = String.format(pathFormat, componentType, componentId, componentInstance,
@@ -353,7 +353,7 @@ class ComponentNodeFilterServletTest extends JerseyTest {
when(componentsUtils.getResponseFormat(ActionStatus.OK)).thenReturn(responseFormat);
when(componentNodeFilterBusinessLogic
- .updateNodeFilter(componentId, componentInstance, uiConstraint,
+ .updateNodeFilter(componentId, componentInstance, filterConstraintDto,
ComponentTypeEnum.RESOURCE, NodeFilterConstraintType.CAPABILITIES, 0))
.thenReturn(Optional.of(ciNodeFilterDataDefinition));
@@ -364,7 +364,7 @@ class ComponentNodeFilterServletTest extends JerseyTest {
.put(Entity.entity(inputJson, MediaType.APPLICATION_JSON));
verify(componentNodeFilterBusinessLogic, times(1))
- .updateNodeFilter(anyString(), anyString(), any(UIConstraint.class),
+ .updateNodeFilter(anyString(), anyString(), any(FilterConstraintDto.class),
any(ComponentTypeEnum.class), any(NodeFilterConstraintType.class),
anyInt());
@@ -373,7 +373,7 @@ class ComponentNodeFilterServletTest extends JerseyTest {
}
@Test
- void updateNodeFilterFailTest() throws BusinessLogicException, JsonProcessingException {
+ void updateNodeFilterFailTest() {
initComponentData();
final String pathFormat = V_1_CATALOG_S_S_COMPONENT_INSTANCE_S_S_S_NODE_FILTER;
final String path = String.format(pathFormat, componentType, componentId, componentInstance,
@@ -392,7 +392,7 @@ class ComponentNodeFilterServletTest extends JerseyTest {
}
@Test
- void updateNodeFilterFailConstraintParseTest() throws JsonProcessingException {
+ void updateNodeFilterFailConstraintParseTest() {
initComponentData();
final String pathFormat = V_1_CATALOG_S_S_COMPONENT_INSTANCE_S_S_S_NODE_FILTER;
final String path = String.format(pathFormat, componentType, componentId, componentInstance,
@@ -411,7 +411,7 @@ class ComponentNodeFilterServletTest extends JerseyTest {
}
@Test
- void updateNodeFilterFailConvertTest() throws JsonProcessingException {
+ void updateNodeFilterFailConvertTest() {
initComponentData();
final String pathFormat = V_1_CATALOG_S_S_COMPONENT_INSTANCE_S_S_S_NODE_FILTER;
final String path = String.format(pathFormat, componentType, componentId, componentInstance,
@@ -430,7 +430,7 @@ class ComponentNodeFilterServletTest extends JerseyTest {
}
@Test
- void deleteNodeFilterSuccessTest() throws BusinessLogicException, JsonProcessingException {
+ void deleteNodeFilterSuccessTest() throws BusinessLogicException {
initComponentData();
final String pathFormat = V_1_CATALOG_S_S_COMPONENT_INSTANCE_S_S_S_NODE_FILTER;
final String path = String.format(pathFormat, componentType, componentId, componentInstance,