Github user MikeThomsen commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2601#discussion_r183484608
--- Diff:
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-processors/src/main/java/org/apache/nifi/processors/elasticsearch/QueryElasticsearchHttp.java
---
@@ -267,32 +267,18 @@ public void setup(ProcessContext context) {
@Override
public void onPropertyModified(final PropertyDescriptor descriptor,
final String oldValue, final String newValue) {
- final Set<Relationship> routeQueryInfoRels = new HashSet<>();
- routeQueryInfoRels.add(REL_SUCCESS);
- routeQueryInfoRels.add(REL_FAILURE);
- routeQueryInfoRels.add(REL_RETRY);
-
- final Set<Relationship> successRels = new HashSet<>();
- successRels.add(REL_SUCCESS);
- successRels.add(REL_FAILURE);
- successRels.add(REL_RETRY);
if (ROUTING_QUERY_INFO_STRATEGY.equals(descriptor)) {
- if (ALWAYS.getValue().equalsIgnoreCase(newValue)) {
- routeQueryInfoRels.add(REL_QUERY_INFO);
- this.relationships = routeQueryInfoRels;
-
- this.queryInfoRouteStrategy =
QueryInfoRouteStrategy.ALWAYS;
- } else if (NO_HITS.getValue().equalsIgnoreCase(newValue)) {
- routeQueryInfoRels.add(REL_QUERY_INFO);
- this.relationships = routeQueryInfoRels;
-
- this.queryInfoRouteStrategy = QueryInfoRouteStrategy.NOHIT;
- } else {
- this.relationships = successRels;
+ final Set<Relationship> relationshipSet = new HashSet<>();
+ relationshipSet.add(REL_SUCCESS);
+ relationshipSet.add(REL_FAILURE);
+ relationshipSet.add(REL_RETRY);
- this.queryInfoRouteStrategy = QueryInfoRouteStrategy.NEVER;
+ if (ALWAYS.getValue().equalsIgnoreCase(newValue) ||
NO_HITS.getValue().equalsIgnoreCase(newValue)) {
+ relationshipSet.add(REL_QUERY_INFO);
}
+ this.queryInfoRouteStrategy =
QueryInfoRouteStrategy.valueOf(newValue);
--- End diff --
The newValue value does not correspond to the enum values, so it blows up 3
unit tests.
---