This is an automated email from the ASF dual-hosted git repository.
kdoran pushed a commit to branch NIFI-15258
in repository https://gitbox.apache.org/repos/asf/nifi-api.git
The following commit(s) were added to refs/heads/NIFI-15258 by this push:
new 1d40638 NIFI-15322: Require all property descriptors within a
PropertyGroup / ConfigurationStep are unique (#27)
1d40638 is described below
commit 1d40638ba159ad3b862bb0525d13978dd01509e5
Author: Mark Payne <[email protected]>
AuthorDate: Wed Dec 10 15:52:33 2025 -0500
NIFI-15322: Require all property descriptors within a PropertyGroup /
ConfigurationStep are unique (#27)
* Huge refactoring of Connectors to require that <Step Name, Property Name>
tuple is unique. Requiring that is simple, but now that we enforce that, we can
greatly simplify much of the code.
* Added StepConfiguration to simplify API rather than using Map<String,
ConnectorValueReference> in some places
* Now that we enforce unique property names per step, introduced
StepConfigurationContext to further reduce API complexity
Signed-off-by: Kevin Doran <[email protected]>
---
.../components/connector/AbstractConnector.java | 14 ++---
.../components/connector/ConfigurationStep.java | 12 +++++
.../nifi/components/connector/Connector.java | 7 +--
.../connector/ConnectorConfigurationContext.java | 62 +++++++++++++++++++---
.../connector/ConnectorPropertyDescriptor.java | 2 +-
.../connector/ConnectorPropertyGroup.java | 10 ++++
.../connector/ConnectorValidationContext.java | 2 +-
.../connector/PropertyGroupConfiguration.java | 55 -------------------
.../nifi/components/connector/SecretsManager.java | 3 ++
.../components/connector/StepConfiguration.java | 58 ++++++++++++++++++++
.../connector/StepConfigurationContext.java | 54 +++++++++++++++++++
.../nifi/flow/VersionedConfigurationStep.java | 12 ++---
.../connector/TestAbstractConnector.java | 27 +++++-----
.../connector/TestConnectorPropertyDescriptor.java | 2 +-
14 files changed, 227 insertions(+), 93 deletions(-)
diff --git
a/src/main/java/org/apache/nifi/components/connector/AbstractConnector.java
b/src/main/java/org/apache/nifi/components/connector/AbstractConnector.java
index 1ff7304..4cfac54 100644
--- a/src/main/java/org/apache/nifi/components/connector/AbstractConnector.java
+++ b/src/main/java/org/apache/nifi/components/connector/AbstractConnector.java
@@ -275,7 +275,7 @@ public abstract class AbstractConnector implements
Connector {
final List<ConfigurationStep> configSteps =
getConfigurationSteps(flowContext);
for (final ConfigurationStep configStep : configSteps) {
- final List<ConfigVerificationResult> stepResults =
verifyConfigurationStep(configStep.getName(), List.of(), flowContext);
+ final List<ConfigVerificationResult> stepResults =
verifyConfigurationStep(configStep.getName(), Map.of(), flowContext);
results.addAll(stepResults);
}
@@ -461,7 +461,7 @@ public abstract class AbstractConnector implements
Connector {
final Map<String, ConnectorPropertyDescriptor> descriptorMap =
descriptors.stream()
.collect(Collectors.toMap(ConnectorPropertyDescriptor::getName,
Function.identity()));
- final Function<String, ConnectorPropertyValue> propertyValueLookup
= name -> configurationContext.getProperty(stepName, propertyGroup.getName(),
name);
+ final Function<String, ConnectorPropertyValue> propertyValueLookup
= name -> configurationContext.getProperty(stepName, name);
for (final ConnectorPropertyDescriptor descriptor : descriptors) {
final boolean dependencySatisfied =
isDependencySatisfied(descriptor, descriptorMap::get, propertyValueLookup);
@@ -471,7 +471,7 @@ public abstract class AbstractConnector implements
Connector {
continue;
}
- final ConnectorPropertyValue propertyValue =
configurationContext.getProperty(stepName, propertyGroup.getName(),
descriptor.getName());
+ final ConnectorPropertyValue propertyValue =
configurationContext.getProperty(stepName, descriptor.getName());
if (propertyValue == null || !propertyValue.isSet()) {
if (descriptor.isRequired()) {
final ValidationResult invalidResult = new
ValidationResult.Builder()
@@ -564,13 +564,13 @@ public abstract class AbstractConnector implements
Connector {
}
@Override
- public List<AllowableValue> fetchAllowableValues(final String stepName,
final String groupName, final String propertyName, final FlowContext
flowContext) {
- throw new UnsupportedOperationException("Property %s of Property Group
%s in Configuration Step %s does not support fetching Allowable
Values.".formatted(propertyName, groupName, stepName));
+ public List<AllowableValue> fetchAllowableValues(final String stepName,
final String propertyName, final FlowContext flowContext) {
+ throw new UnsupportedOperationException("Property %s in Configuration
Step %s does not support fetching Allowable Values.".formatted(propertyName,
stepName));
}
@Override
- public List<AllowableValue> fetchAllowableValues(final String stepName,
final String groupName, final String propertyName, final FlowContext
flowContext, final String filter) {
- final List<AllowableValue> allowableValues =
fetchAllowableValues(stepName, groupName, propertyName, flowContext);
+ public List<AllowableValue> fetchAllowableValues(final String stepName,
final String propertyName, final FlowContext flowContext, final String filter) {
+ final List<AllowableValue> allowableValues =
fetchAllowableValues(stepName, propertyName, flowContext);
if (filter == null || filter.isEmpty()) {
return allowableValues;
} else {
diff --git
a/src/main/java/org/apache/nifi/components/connector/ConfigurationStep.java
b/src/main/java/org/apache/nifi/components/connector/ConfigurationStep.java
index 901bef0..6affd8e 100644
--- a/src/main/java/org/apache/nifi/components/connector/ConfigurationStep.java
+++ b/src/main/java/org/apache/nifi/components/connector/ConfigurationStep.java
@@ -19,7 +19,9 @@ package org.apache.nifi.components.connector;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
public final class ConfigurationStep {
private final String name;
@@ -70,6 +72,16 @@ public final class ConfigurationStep {
throw new IllegalStateException("Configuration Step's name
must be provided");
}
+ // Ensure that all Property Descriptor names are unique
+ final Set<String> propertyNames = new HashSet<>();
+ for (final ConnectorPropertyGroup propertyGroup : propertyGroups) {
+ for (final ConnectorPropertyDescriptor descriptor :
propertyGroup.getProperties()) {
+ if (!propertyNames.add(descriptor.getName())) {
+ throw new IllegalStateException("All Property
Descriptor names must be unique within a Configuration Step. Duplicate name
found: " + descriptor.getName());
+ }
+ }
+ }
+
return new ConfigurationStep(this);
}
}
diff --git a/src/main/java/org/apache/nifi/components/connector/Connector.java
b/src/main/java/org/apache/nifi/components/connector/Connector.java
index 62ba714..5de886a 100644
--- a/src/main/java/org/apache/nifi/components/connector/Connector.java
+++ b/src/main/java/org/apache/nifi/components/connector/Connector.java
@@ -24,6 +24,7 @@ import
org.apache.nifi.components.connector.components.FlowContext;
import org.apache.nifi.flow.VersionedExternalFlow;
import java.util.List;
+import java.util.Map;
/**
* <p>
@@ -133,7 +134,7 @@ public interface Connector {
* @return a list of ConfigVerificationResults, each of which may indicate
a check that was performed and any associated explanation
* as to why the configuration step verification succeeded, failed, or was
skipped.
*/
- List<ConfigVerificationResult> verifyConfigurationStep(String stepName,
List<PropertyGroupConfiguration> propertyValueOverrides, FlowContext
flowContext);
+ List<ConfigVerificationResult> verifyConfigurationStep(String stepName,
Map<String, String> propertyValueOverrides, FlowContext flowContext);
/**
* Verifies the overall configuration of the Connector based on the
configuration that has already been provided for the given Flow Context.
@@ -192,7 +193,7 @@ public interface Connector {
*/
void applyUpdate(FlowContext workingFlowContext, FlowContext
activeFlowContext) throws FlowUpdateException;
- List<AllowableValue> fetchAllowableValues(String stepName, String
groupName, String propertyName, FlowContext flowContext);
+ List<AllowableValue> fetchAllowableValues(String stepName, String
propertyName, FlowContext flowContext);
- List<AllowableValue> fetchAllowableValues(String stepName, String
groupName, String propertyName, FlowContext flowContext, String filter);
+ List<AllowableValue> fetchAllowableValues(String stepName, String
propertyName, FlowContext flowContext, String filter);
}
diff --git
a/src/main/java/org/apache/nifi/components/connector/ConnectorConfigurationContext.java
b/src/main/java/org/apache/nifi/components/connector/ConnectorConfigurationContext.java
index 3ae9bc9..a64d533 100644
---
a/src/main/java/org/apache/nifi/components/connector/ConnectorConfigurationContext.java
+++
b/src/main/java/org/apache/nifi/components/connector/ConnectorConfigurationContext.java
@@ -17,21 +17,71 @@
package org.apache.nifi.components.connector;
-import java.util.List;
+import java.util.Map;
+import java.util.Set;
public interface ConnectorConfigurationContext extends Cloneable {
- ConnectorPropertyValue getProperty(String configurationStepName, String
groupName, String propertyName);
+ /**
+ * Returns the property value for the given property name in the specified
configuration step.
+ * @param configurationStepName the name of the configuration step
+ * @param propertyName the name of the property
+ * @return the property value for the given property name in the specified
configuration step
+ */
+ ConnectorPropertyValue getProperty(String configurationStepName, String
propertyName);
+
+ /**
+ * Returns the property value for the given property descriptor in the
specified configuration step.
+ * @param configurationStep the configuration step
+ * @param propertyDescriptor the property descriptor
+ * @return the property value for the given property descriptor in the
specified configuration step
+ */
+ ConnectorPropertyValue getProperty(ConfigurationStep configurationStep,
ConnectorPropertyDescriptor propertyDescriptor);
+
+ /**
+ * Returns a set of all property names for the specified configuration
step.
+ * @param configurationStepName the name of the configuration step
+ * @return a set of all property names for the specified configuration step
+ */
+ Set<String> getPropertyNames(String configurationStepName);
+
+ /**
+ * Returns a set of all property names for the specified configuration
step.
+ * @param configurationStep the configuration step
+ * @return a set of all property names for the specified configuration step
+ */
+ Set<String> getPropertyNames(ConfigurationStep configurationStep);
- ConnectorPropertyValue getProperty(ConfigurationStep configurationStep,
ConnectorPropertyGroup propertyGroup, ConnectorPropertyDescriptor
propertyDescriptor);
+ /**
+ * Returns a view of this configuration context scoped to the provided
step name.
+ * @param stepName the name of the configuration step
+ * @return a StepConfigurationContext scoped to the provided step name
+ */
+ StepConfigurationContext scopedToStep(String stepName);
/**
- * Creates a new ConnectorConfigurationContext based on this context's
values but with the provided property overrides applied.
+ * Returns a view of this configuration context scoped to the provided
configuration step.
+ * @param configurationStep the configuration step
+ * @return a StepConfigurationContext scoped to the provided configuration
step
+ */
+ StepConfigurationContext scopedToStep(ConfigurationStep configurationStep);
+
+ /**
+ * Creates a new ConnectorConfigurationContext based on this context's
values but with the
+ * values for the given step overridden. If the provided map of values
does not override all properties
+ * for the step, the remaining properties will retain their existing
values. Said another way, this is a
+ * "partial override" for the specified step. If the provided map contains
a null value for a property,
+ * the returned context will have that property removed.
+ *
* @param stepName the name of the configuration step for which the
overrides should be applied
- * @param groupConfigurations the list of PropertyGroupConfiguration
objects containing the overrides
+ * @param propertyValues a map of property name to property value
containing the overrides
* @return a new ConnectorConfigurationContext with the overrides applied
*/
- ConnectorConfigurationContext createWithOverrides(String stepName,
List<PropertyGroupConfiguration> groupConfigurations);
+ ConnectorConfigurationContext createWithOverrides(String stepName,
Map<String, String> propertyValues);
+ /**
+ * Creates a deep copy of this ConnectorConfigurationContext.
+ * @return a deep copy of this ConnectorConfigurationContext
+ */
ConnectorConfigurationContext clone();
}
diff --git
a/src/main/java/org/apache/nifi/components/connector/ConnectorPropertyDescriptor.java
b/src/main/java/org/apache/nifi/components/connector/ConnectorPropertyDescriptor.java
index b9304ac..f765d11 100644
---
a/src/main/java/org/apache/nifi/components/connector/ConnectorPropertyDescriptor.java
+++
b/src/main/java/org/apache/nifi/components/connector/ConnectorPropertyDescriptor.java
@@ -99,7 +99,7 @@ public final class ConnectorPropertyDescriptor {
final List<DescribedValue> fetchedAllowableValues;
if (isAllowableValuesFetchable()) {
try {
- fetchedAllowableValues =
validationContext.fetchAllowableValues(stepName, groupName, getName());
+ fetchedAllowableValues =
validationContext.fetchAllowableValues(stepName, getName());
} catch (final Exception e) {
return new ValidationResult.Builder()
.subject(name)
diff --git
a/src/main/java/org/apache/nifi/components/connector/ConnectorPropertyGroup.java
b/src/main/java/org/apache/nifi/components/connector/ConnectorPropertyGroup.java
index fb0fb69..d0f3538 100644
---
a/src/main/java/org/apache/nifi/components/connector/ConnectorPropertyGroup.java
+++
b/src/main/java/org/apache/nifi/components/connector/ConnectorPropertyGroup.java
@@ -18,8 +18,10 @@
package org.apache.nifi.components.connector;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
import java.util.Objects;
+import java.util.Set;
public final class ConnectorPropertyGroup {
private final String name;
@@ -188,6 +190,14 @@ public final class ConnectorPropertyGroup {
throw new IllegalStateException("Property Group's name must be
provided if a description is set");
}
+ // Ensure that all Property Descriptor names are unique within
this group
+ final Set<String> propertyNames = new HashSet<>();
+ for (final ConnectorPropertyDescriptor property : properties) {
+ if (!propertyNames.add(property.getName())) {
+ throw new IllegalStateException("All Property Descriptor
names must be unique within a Property Group. Duplicate name found: " +
property.getName());
+ }
+ }
+
return new ConnectorPropertyGroup(this);
}
}
diff --git
a/src/main/java/org/apache/nifi/components/connector/ConnectorValidationContext.java
b/src/main/java/org/apache/nifi/components/connector/ConnectorValidationContext.java
index bf67b81..842bb33 100644
---
a/src/main/java/org/apache/nifi/components/connector/ConnectorValidationContext.java
+++
b/src/main/java/org/apache/nifi/components/connector/ConnectorValidationContext.java
@@ -26,6 +26,6 @@ public interface ConnectorValidationContext {
ValidationContext createValidationContext(String stepName, String
groupName);
- List<DescribedValue> fetchAllowableValues(String stepName, String
groupName, String propertyName);
+ List<DescribedValue> fetchAllowableValues(String stepName, String
propertyName);
}
diff --git
a/src/main/java/org/apache/nifi/components/connector/PropertyGroupConfiguration.java
b/src/main/java/org/apache/nifi/components/connector/PropertyGroupConfiguration.java
deleted file mode 100644
index ffb4ca3..0000000
---
a/src/main/java/org/apache/nifi/components/connector/PropertyGroupConfiguration.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.nifi.components.connector;
-
-import java.util.Map;
-
-public record PropertyGroupConfiguration(String groupName, Map<String,
ConnectorValueReference> propertyValues) {
-
- /**
- * Retrieves the raw string value for the given property. This method only
returns a value
- * for StringLiteralValue references; for other reference types, it
returns null.
- *
- * @param propertyName the name of the property
- * @return the String value of the property, or null if no value is set or
if the reference is not a StringLiteralValue
- */
- public String getPropertyValue(final String propertyName) {
- final ConnectorValueReference valueReference =
propertyValues.get(propertyName);
- if (valueReference instanceof StringLiteralValue stringLiteral) {
- return stringLiteral.getValue();
- }
- return null;
- }
-
- /**
- * Creates a PropertyGroupConfiguration from raw String values. This is a
convenience method that
- * converts String values to ConnectorValueReference objects with
STRING_LITERAL type.
- *
- * @param groupName the name of the property group
- * @param stringPropertyValues the property values as simple Strings
- * @return a new PropertyGroupConfiguration with the values wrapped as
ConnectorValueReference
- */
- public static PropertyGroupConfiguration fromStringValues(final String
groupName, final Map<String, String> stringPropertyValues) {
- final Map<String, ConnectorValueReference> referenceValues = new
java.util.HashMap<>();
- for (final Map.Entry<String, String> entry :
stringPropertyValues.entrySet()) {
- final String value = entry.getValue();
- referenceValues.put(entry.getKey(), new StringLiteralValue(value));
- }
- return new PropertyGroupConfiguration(groupName, referenceValues);
- }
-}
diff --git
a/src/main/java/org/apache/nifi/components/connector/SecretsManager.java
b/src/main/java/org/apache/nifi/components/connector/SecretsManager.java
index e4b7f60..564b717 100644
--- a/src/main/java/org/apache/nifi/components/connector/SecretsManager.java
+++ b/src/main/java/org/apache/nifi/components/connector/SecretsManager.java
@@ -19,10 +19,13 @@ package org.apache.nifi.components.connector;
import java.io.IOException;
import java.util.List;
+import java.util.Optional;
import java.util.Set;
public interface SecretsManager {
+ Optional<Secret> getSecret(SecretReference secretReference) throws
IOException;
+
List<Secret> getAllSecrets() throws IOException;
Set<SecretProvider> getSecretProviders();
diff --git
a/src/main/java/org/apache/nifi/components/connector/StepConfiguration.java
b/src/main/java/org/apache/nifi/components/connector/StepConfiguration.java
new file mode 100644
index 0000000..ad31a78
--- /dev/null
+++ b/src/main/java/org/apache/nifi/components/connector/StepConfiguration.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.components.connector;
+
+import java.util.Map;
+import java.util.Objects;
+
+public class StepConfiguration {
+ private final Map<String, ConnectorValueReference> propertyValues;
+
+ public StepConfiguration(final Map<String, ConnectorValueReference>
propertyValues) {
+ this.propertyValues = propertyValues;
+ }
+
+ public Map<String, ConnectorValueReference> getPropertyValues() {
+ return propertyValues;
+ }
+
+ public ConnectorValueReference getPropertyValue(final String propertyName)
{
+ return propertyValues.get(propertyName);
+ }
+
+ @Override
+ public String toString() {
+ return "StepConfiguration[" +
+ "propertyValues=" + propertyValues +
+ "]";
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final StepConfiguration that = (StepConfiguration) o;
+ return Objects.equals(propertyValues, that.propertyValues);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(propertyValues);
+ }
+}
diff --git
a/src/main/java/org/apache/nifi/components/connector/StepConfigurationContext.java
b/src/main/java/org/apache/nifi/components/connector/StepConfigurationContext.java
new file mode 100644
index 0000000..23220e1
--- /dev/null
+++
b/src/main/java/org/apache/nifi/components/connector/StepConfigurationContext.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.components.connector;
+
+import java.util.Map;
+
+/**
+ * A view of a ConnectorConfigurationContext scoped to a specific
configuration step.
+ * Any changes to the underlying ConnectorConfigurationContext will be
reflected in this context.
+ */
+public interface StepConfigurationContext {
+
+ /**
+ * Returns the value of the property with the given name.
+ * @param propertyName the name of the property
+ * @return the value of the property with the given name
+ */
+ ConnectorPropertyValue getProperty(String propertyName);
+
+ /**
+ * Returns the value of the property specified by the given descriptor.
+ * @param propertyDescriptor the property descriptor
+ * @return the value of the property specified by the given descriptor
+ */
+ ConnectorPropertyValue getProperty(ConnectorPropertyDescriptor
propertyDescriptor);
+
+ /**
+ * Creates a new ConnectorConfigurationContext based on this context's
values but with the provided property overrides applied.
+ * @param propertyValues a map of property name to property value
containing the overrides
+ * @return a new ConnectorConfigurationContext with the overrides applied
+ */
+ StepConfigurationContext createWithOverrides(Map<String, String>
propertyValues);
+
+ /**
+ * Returns a map of all property names to their corresponding values
+ * @return a map of all property names to their corresponding values
+ */
+ Map<String, ConnectorPropertyValue> getProperties();
+}
diff --git a/src/main/java/org/apache/nifi/flow/VersionedConfigurationStep.java
b/src/main/java/org/apache/nifi/flow/VersionedConfigurationStep.java
index 1921020..f2c6bac 100644
--- a/src/main/java/org/apache/nifi/flow/VersionedConfigurationStep.java
+++ b/src/main/java/org/apache/nifi/flow/VersionedConfigurationStep.java
@@ -17,11 +17,11 @@
package org.apache.nifi.flow;
-import java.util.List;
+import java.util.Map;
public class VersionedConfigurationStep {
private String name;
- private List<VersionedConnectorPropertyGroup> propertyGroups;
+ private Map<String, VersionedConnectorValueReference> properties;
public String getName() {
return name;
@@ -31,11 +31,11 @@ public class VersionedConfigurationStep {
this.name = name;
}
- public List<VersionedConnectorPropertyGroup> getPropertyGroups() {
- return propertyGroups;
+ public Map<String, VersionedConnectorValueReference> getProperties() {
+ return properties;
}
- public void setPropertyGroups(final List<VersionedConnectorPropertyGroup>
propertyGroups) {
- this.propertyGroups = propertyGroups;
+ public void setProperties(final Map<String,
VersionedConnectorValueReference> properties) {
+ this.properties = properties;
}
}
diff --git
a/src/test/java/org/apache/nifi/components/connector/TestAbstractConnector.java
b/src/test/java/org/apache/nifi/components/connector/TestAbstractConnector.java
index 7e3257f..c4d96bf 100644
---
a/src/test/java/org/apache/nifi/components/connector/TestAbstractConnector.java
+++
b/src/test/java/org/apache/nifi/components/connector/TestAbstractConnector.java
@@ -36,6 +36,7 @@ import org.mockito.quality.Strictness;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -103,7 +104,7 @@ public class TestAbstractConnector {
.build();
connector.setConfigurationSteps(List.of(configStep));
- when(configurationContext.getProperty("Test Step", "Test Group",
"Required Property")).thenReturn(null);
+ when(configurationContext.getProperty("Test Step", "Required
Property")).thenReturn(null);
final List<ValidationResult> results = connector.validate(flowContext,
validationContext);
@@ -135,7 +136,7 @@ public class TestAbstractConnector {
.build();
connector.setConfigurationSteps(List.of(configStep));
- when(configurationContext.getProperty("Test Step", "Test Group",
"Optional Property")).thenReturn(null);
+ when(configurationContext.getProperty("Test Step", "Optional
Property")).thenReturn(null);
final List<ValidationResult> results = connector.validate(flowContext,
validationContext);
@@ -164,7 +165,7 @@ public class TestAbstractConnector {
connector.setConfigurationSteps(List.of(configStep));
when(mockPropertyValue.getValue()).thenReturn("");
- when(configurationContext.getProperty("Test Step", "Test Group",
"Validated Property")).thenReturn(mockPropertyValue);
+ when(configurationContext.getProperty("Test Step", "Validated
Property")).thenReturn(mockPropertyValue);
final List<ValidationResult> results = connector.validate(flowContext,
validationContext);
@@ -197,7 +198,7 @@ public class TestAbstractConnector {
connector.setConfigurationSteps(List.of(configStep));
when(mockPropertyValue.getValue()).thenReturn("valid-value");
when(mockPropertyValue.isSet()).thenReturn(true);
- when(configurationContext.getProperty("Test Step", "Test Group",
"Valid Property")).thenReturn(mockPropertyValue);
+ when(configurationContext.getProperty("Test Step", "Valid
Property")).thenReturn(mockPropertyValue);
final List<ValidationResult> results = connector.validate(flowContext,
validationContext);
@@ -233,7 +234,7 @@ public class TestAbstractConnector {
connector.setConfigurationSteps(List.of(configStep));
when(mockPropertyValue.getValue()).thenReturn("Wrong Value");
- when(configurationContext.getProperty("Test Step", "Test Group",
"Dependency Property")).thenReturn(mockPropertyValue);
+ when(configurationContext.getProperty("Test Step", "Dependency
Property")).thenReturn(mockPropertyValue);
final List<ValidationResult> results = connector.validate(flowContext,
validationContext);
@@ -270,8 +271,8 @@ public class TestAbstractConnector {
connector.setConfigurationSteps(List.of(configStep));
final ConnectorPropertyValue dependencyValue =
mock(ConnectorPropertyValue.class);
when(dependencyValue.getValue()).thenReturn("Required Value");
- when(configurationContext.getProperty("Test Step", "Test Group",
"Dependency Property")).thenReturn(dependencyValue);
- when(configurationContext.getProperty("Test Step", "Test Group",
"Dependent Property")).thenReturn(null);
+ when(configurationContext.getProperty("Test Step", "Dependency
Property")).thenReturn(dependencyValue);
+ when(configurationContext.getProperty("Test Step", "Dependent
Property")).thenReturn(null);
final List<ValidationResult> results = connector.validate(flowContext,
validationContext);
@@ -324,8 +325,8 @@ public class TestAbstractConnector {
final ConnectorPropertyValue invalidValue =
mock(ConnectorPropertyValue.class);
when(invalidValue.getValue()).thenReturn("");
when(invalidValue.isSet()).thenReturn(true);
- when(configurationContext.getProperty("Step One", "Group One",
"Property One")).thenReturn(validValue);
- when(configurationContext.getProperty("Step Two", "Group Two",
"Property Two")).thenReturn(invalidValue);
+ when(configurationContext.getProperty("Step One", "Property
One")).thenReturn(validValue);
+ when(configurationContext.getProperty("Step Two", "Property
Two")).thenReturn(invalidValue);
final List<ValidationResult> results = connector.validate(flowContext,
validationContext);
@@ -420,8 +421,8 @@ public class TestAbstractConnector {
when(value1.getValue()).thenReturn("Value One");
final ConnectorPropertyValue value2 =
mock(ConnectorPropertyValue.class);
when(value2.getValue()).thenReturn("Value Two");
- when(configurationContext.getProperty("Test Step", "Group One",
"Property One")).thenReturn(value1);
- when(configurationContext.getProperty("Test Step", "Group Two",
"Property Two")).thenReturn(value2);
+ when(configurationContext.getProperty("Test Step", "Property
One")).thenReturn(value1);
+ when(configurationContext.getProperty("Test Step", "Property
Two")).thenReturn(value2);
final List<ValidationResult> results = connector.validate(flowContext,
validationContext);
@@ -475,7 +476,7 @@ public class TestAbstractConnector {
}
@Override
- public List<ConfigVerificationResult> verifyConfigurationStep(final
String stepName, final List<PropertyGroupConfiguration> overrides, final
FlowContext flowContext) {
+ public List<ConfigVerificationResult> verifyConfigurationStep(final
String stepName, final Map<String, String> overrides, final FlowContext
flowContext) {
return Collections.emptyList();
}
@@ -516,7 +517,7 @@ public class TestAbstractConnector {
}
@Override
- public List<DescribedValue> fetchAllowableValues(final String
stepName, final String groupName, final String propertyName) {
+ public List<DescribedValue> fetchAllowableValues(final String
stepName, final String propertyName) {
// Return empty list as we don't need to fetch dynamic allowable
values in these tests
return Collections.emptyList();
}
diff --git
a/src/test/java/org/apache/nifi/components/connector/TestConnectorPropertyDescriptor.java
b/src/test/java/org/apache/nifi/components/connector/TestConnectorPropertyDescriptor.java
index d9aaaa4..823c3ef 100644
---
a/src/test/java/org/apache/nifi/components/connector/TestConnectorPropertyDescriptor.java
+++
b/src/test/java/org/apache/nifi/components/connector/TestConnectorPropertyDescriptor.java
@@ -221,7 +221,7 @@ public class TestConnectorPropertyDescriptor {
}
@Override
- public List<DescribedValue> fetchAllowableValues(final String
stepName, final String groupName, final String propertyName) {
+ public List<DescribedValue> fetchAllowableValues(final String
stepName, final String propertyName) {
// Return empty list as we don't need to fetch dynamic allowable
values in these tests
return Collections.emptyList();
}