exceptionfactory commented on code in PR #11573:
URL: https://github.com/apache/nifi/pull/11573#discussion_r3823780716
##########
nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterNameValidator.java:
##########
@@ -0,0 +1,17 @@
+package org.apache.nifi.web.api.dto;
+
+import java.util.regex.Pattern;
+
+public final class ParameterNameValidator {
Review Comment:
Placing in this class in the `nifi-client-dto` does not seem like the best
place, it should go into `nifi-web-api`.
##########
nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ParameterNameValidator.java:
##########
@@ -0,0 +1,17 @@
+package org.apache.nifi.web.api.dto;
Review Comment:
This class is missing a license header.
##########
nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/ParameterContextResourceTest.java:
##########
@@ -0,0 +1,54 @@
+package org.apache.nifi.web.api;
+
+import org.apache.nifi.web.api.dto.ParameterContextDTO;
+import org.apache.nifi.web.api.dto.ParameterDTO;
+import org.apache.nifi.web.api.entity.ParameterEntity;
+import org.junit.jupiter.api.Test;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Set;
+
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+class ParameterContextResourceTest {
+ @Test
+ void testMutationAllowsRemovalOfParameterNameLoadedFromVersionedFlow()
throws NoSuchMethodException {
+ final String invalidParameterName = "OPENFLOW_NETJETS_SECRET_{{ envi
}}";
+ final ParameterDTO parameter = new ParameterDTO();
+ parameter.setName(invalidParameterName);
+
+ final ParameterEntity parameterEntity = new ParameterEntity();
+ parameterEntity.setParameter(parameter);
+
+ final ParameterContextDTO parameterContext = new ParameterContextDTO();
+ parameterContext.setParameters(Set.of(parameterEntity));
+
+ final Method validateParameterNames =
ParameterContextResource.class.getDeclaredMethod("validateParameterNames",
ParameterContextDTO.class);
+ validateParameterNames.setAccessible(true);
Review Comment:
Using reflection in test should be avoided in general.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]