[nifi] branch analytics-framework updated (7713be3 -> ab26522)

2019-09-06 Thread ymdavis
This is an automated email from the ASF dual-hosted git repository.

ymdavis pushed a change to branch analytics-framework
in repository https://gitbox.apache.org/repos/asf/nifi.git.


from 7713be3  NIFI-6510 - dto updates to check for -1 value
 add ab26522  NIFI-6510 - checkstyle fix

No new revisions were added by this update.

Summary of changes:
 .../src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)



[nifi] branch analytics-framework updated (6ed10bf -> 7713be3)

2019-09-06 Thread ymdavis
This is an automated email from the ASF dual-hosted git repository.

ymdavis pushed a change to branch analytics-framework
in repository https://gitbox.apache.org/repos/asf/nifi.git.


from 6ed10bf  NIFI-6510 Rip out useless members
 add 7713be3  NIFI-6510 - dto updates to check for -1 value

No new revisions were added by this update.

Summary of changes:
 .../java/org/apache/nifi/web/api/dto/DtoFactory.java | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)



[nifi] branch master updated: NIFI-6384: - Adding auditing of parameter contexts.

2019-09-06 Thread markap14
This is an automated email from the ASF dual-hosted git repository.

markap14 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/master by this push:
 new f867e92  NIFI-6384: - Adding auditing of parameter contexts.
f867e92 is described below

commit f867e9260656bad306612b0a94219370c8390525
Author: Matt Gilman 
AuthorDate: Tue Sep 3 16:38:35 2019 -0400

NIFI-6384:
- Adding auditing of parameter contexts.

This closes #3699.

Signed-off-by: Mark Payne 
---
 .../java/org/apache/nifi/action/Component.java |   1 +
 .../apache/nifi/audit/ParameterContextAuditor.java | 284 +
 .../org/apache/nifi/audit/ProcessGroupAuditor.java |  35 ++-
 .../apache/nifi/web/StandardNiFiServiceFacade.java |   3 +
 .../src/main/resources/nifi-web-api-context.xml|   5 +
 5 files changed, 326 insertions(+), 2 deletions(-)

diff --git a/nifi-api/src/main/java/org/apache/nifi/action/Component.java 
b/nifi-api/src/main/java/org/apache/nifi/action/Component.java
index a25525f..95d8ba0 100644
--- a/nifi-api/src/main/java/org/apache/nifi/action/Component.java
+++ b/nifi-api/src/main/java/org/apache/nifi/action/Component.java
@@ -31,6 +31,7 @@ public enum Component {
 Connection,
 ControllerService,
 ReportingTask,
+ParameterContext,
 AccessPolicy,
 User,
 UserGroup;
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ParameterContextAuditor.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ParameterContextAuditor.java
new file mode 100644
index 000..223ada6
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ParameterContextAuditor.java
@@ -0,0 +1,284 @@
+/*
+ * 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.audit;
+
+import org.apache.nifi.action.Action;
+import org.apache.nifi.action.Component;
+import org.apache.nifi.action.FlowChangeAction;
+import org.apache.nifi.action.Operation;
+import org.apache.nifi.action.details.FlowChangeConfigureDetails;
+import org.apache.nifi.authorization.user.NiFiUser;
+import org.apache.nifi.authorization.user.NiFiUserUtils;
+import org.apache.nifi.parameter.Parameter;
+import org.apache.nifi.parameter.ParameterContext;
+import org.apache.nifi.web.api.dto.ParameterContextDTO;
+import org.apache.nifi.web.api.dto.ParameterDTO;
+import org.apache.nifi.web.dao.ParameterContextDAO;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Audits processor creation/removal and configuration changes.
+ */
+@Aspect
+public class ParameterContextAuditor extends NiFiAuditor {
+
+private static final Logger logger = 
LoggerFactory.getLogger(ParameterContextAuditor.class);
+
+/**
+ * Audits the creation of parameter contexts via createParameterContext().
+ *
+ * @param proceedingJoinPoint join point
+ * @param parameterContextDTO dto
+ * @param parameterContextDAO dao
+ * @return context
+ * @throws Throwable ex
+ */
+@Around("within(org.apache.nifi.web.dao.ParameterContextDAO+) && "
++ "execution(org.apache.nifi.parameter.ParameterContext 
createParameterContext(org.apache.nifi.web.api.dto.ParameterContextDTO)) && "
++ "args(parameterContextDTO) && "
++ "target(parameterContextDAO)")
+public ParameterContext createParameterContextAdvice(ProceedingJoinPoint 
proceedingJoinPoint, ParameterContextDTO parameterContextDTO, 
ParameterContextDAO parameterContextDAO) throws Throwable {
+// update the processor state
+ParameterContext parameterContext = (ParameterContext) 
proceedingJoinPoint.proceed();
+
+// get the current user
+

[nifi] branch analytics-framework updated: NIFI-6510 Rip out useless members

2019-09-06 Thread aichrist
This is an automated email from the ASF dual-hosted git repository.

aichrist pushed a commit to branch analytics-framework
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/analytics-framework by this 
push:
 new 6ed10bf  NIFI-6510 Rip out useless members
6ed10bf is described below

commit 6ed10bf6685235d1e52413c75459bb2e5906bcde
Author: Andrew I. Christianson 
AuthorDate: Fri Sep 6 15:14:58 2019 -0400

NIFI-6510 Rip out useless members
---
 .../api/dto/status/ConnectionStatisticsDTO.java| 67 --
 .../org/apache/nifi/web/api/dto/DtoFactory.java|  6 --
 2 files changed, 73 deletions(-)

diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatisticsDTO.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatisticsDTO.java
index 79ae947..239d861 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatisticsDTO.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/status/ConnectionStatisticsDTO.java
@@ -29,15 +29,8 @@ import java.util.List;
 @XmlType(name = "connectionStatistics")
 public class ConnectionStatisticsDTO implements Cloneable {
 private String id;
-private String groupId;
-private String name;
 private Date statsLastRefreshed;
 
-private String sourceId;
-private String sourceName;
-private String destinationId;
-
-private String destinationName;
 private ConnectionStatisticsSnapshotDTO aggregateSnapshot;
 
 private List nodeSnapshots;
@@ -51,60 +44,6 @@ public class ConnectionStatisticsDTO implements Cloneable {
 this.id = id;
 }
 
-@ApiModelProperty("The ID of the Process Group that the connection belongs 
to")
-public String getGroupId() {
-return groupId;
-}
-
-public void setGroupId(String groupId) {
-this.groupId = groupId;
-}
-
-@ApiModelProperty("The name of the connection")
-public String getName() {
-return name;
-}
-
-public void setName(String name) {
-this.name = name;
-}
-
-@ApiModelProperty("The ID of the source component")
-public String getSourceId() {
-return sourceId;
-}
-
-public void setSourceId(String sourceId) {
-this.sourceId = sourceId;
-}
-
-@ApiModelProperty("The name of the source component")
-public String getSourceName() {
-return sourceName;
-}
-
-public void setSourceName(String sourceName) {
-this.sourceName = sourceName;
-}
-
-@ApiModelProperty("The ID of the destination component")
-public String getDestinationId() {
-return destinationId;
-}
-
-public void setDestinationId(String destinationId) {
-this.destinationId = destinationId;
-}
-
-@ApiModelProperty("The name of the destination component")
-public String getDestinationName() {
-return destinationName;
-}
-
-public void setDestinationName(String destinationName) {
-this.destinationName = destinationName;
-}
-
 @ApiModelProperty("The status snapshot that represents the aggregate stats 
of the cluster")
 public ConnectionStatisticsSnapshotDTO getAggregateSnapshot() {
 return aggregateSnapshot;
@@ -139,13 +78,7 @@ public class ConnectionStatisticsDTO implements Cloneable {
 @Override
 public ConnectionStatisticsDTO clone() {
 final ConnectionStatisticsDTO other = new ConnectionStatisticsDTO();
-other.setDestinationId(getDestinationId());
-other.setDestinationName(getDestinationName());
-other.setGroupId(getGroupId());
 other.setId(getId());
-other.setName(getName());
-other.setSourceId(getSourceId());
-other.setSourceName(getSourceName());
 other.setAggregateSnapshot(getAggregateSnapshot().clone());
 
 
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
index 53b3ba2..42253d7 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
@@ -1222,13 +1222,7 @@ public final class DtoFactory {
 public ConnectionStatisticsDTO createConnectionStatisticsDto(final 
Connection connection, final StatusAnalytics statusAnalytics) {
 final ConnectionStatisticsDTO 

[nifi] branch master updated: NIFI-6637 - Display Parameter Context Id on Update Parameter Context dialog.

2019-09-06 Thread mcgilman
This is an automated email from the ASF dual-hosted git repository.

mcgilman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/master by this push:
 new 7af710f  NIFI-6637 - Display Parameter Context Id on Update Parameter 
Context dialog.
7af710f is described below

commit 7af710f168716767706dc6bcade3a35f3c68ea9c
Author: Rob Fellows 
AuthorDate: Fri Sep 6 10:26:35 2019 -0400

NIFI-6637 - Display Parameter Context Id on Update Parameter Context dialog.

This closes #3701
---
 .../WEB-INF/partials/canvas/new-parameter-context-dialog.jsp  |  6 ++
 .../src/main/webapp/js/nf/canvas/nf-parameter-contexts.js | 11 +++
 2 files changed, 17 insertions(+)

diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/new-parameter-context-dialog.jsp
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/new-parameter-context-dialog.jsp
index 1d56304..dd531838 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/new-parameter-context-dialog.jsp
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/new-parameter-context-dialog.jsp
@@ -22,6 +22,12 @@
 
 
 
+
+Id
+
+
+
+
 
 Name
 
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js
index 88399a2..a4561cf 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js
@@ -2170,6 +2170,11 @@
 $('#new-parameter-context').on('click', function () {
 resetUsage();
 
+// new parameter contexts do not have an ID to show
+if (!$('#parameter-context-id-setting').hasClass('hidden')) {
+$('#parameter-context-id-setting').addClass('hidden');
+}
+
 $('#parameter-context-dialog').modal('setHeaderText', 'Add 
Parameter Context').modal('setButtonModel', [{
 buttonText: 'Apply',
 color: {
@@ -2316,6 +2321,12 @@
 
$('#parameter-context-name').val(parameterContextEntity.component.name);
 
$('#parameter-context-description-field').val(parameterContextEntity.component.description);
 
+// show the parameter context id
+if ($('#parameter-context-id-setting').hasClass('hidden')) {
+$('#parameter-context-id-setting').removeClass('hidden');
+}
+
$('#parameter-context-id-field').text(parameterContextEntity.id);
+
 loadParameters(parameterContextEntity);
 
 // show the context



[nifi] branch master updated: NIFI-6632 - Add tooltip to parameter value field indication it does not support EL or parameter references.

2019-09-06 Thread scottyaslan
This is an automated email from the ASF dual-hosted git repository.

scottyaslan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/master by this push:
 new b9c0f51  NIFI-6632 - Add tooltip to parameter value field indication 
it does not support EL or parameter references.
b9c0f51 is described below

commit b9c0f513560298acab3ab5630910b504a0abf984
Author: Rob Fellows 
AuthorDate: Fri Sep 6 11:19:06 2019 -0400

NIFI-6632 - Add tooltip to parameter value field indication it does not 
support EL or parameter references.

This closes #3703

Signed-off-by: Scott Aslan 
---
 .../webapp/WEB-INF/partials/canvas/new-parameter-context-dialog.jsp  | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/new-parameter-context-dialog.jsp
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/new-parameter-context-dialog.jsp
index cf1f56b..1d56304 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/new-parameter-context-dialog.jsp
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/new-parameter-context-dialog.jsp
@@ -91,7 +91,10 @@
 
 
 
-Value
+
+Value
+
+
 
 
 



[nifi] branch master updated: NIFI-6626: Fixed the order of arguments passed to the ComponentDetails constructor when creating the Component Details for a connection. Also noticed that null fields are

2019-09-06 Thread mcgilman
This is an automated email from the ASF dual-hosted git repository.

mcgilman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/master by this push:
 new 731df87  NIFI-6626: Fixed the order of arguments passed to the 
ComponentDetails constructor when creating the Component Details for a 
connection. Also noticed that null fields are being added to the map when 
calling ComponentDetails.toMap() and this causes the UI to display these fields 
even though they have no value, so avoided populating the map with fields whose 
values are null
731df87 is described below

commit 731df87f22d5028f044c3c6d5f34a3a6da4972ca
Author: Mark Payne 
AuthorDate: Thu Sep 5 15:05:42 2019 -0400

NIFI-6626: Fixed the order of arguments passed to the ComponentDetails 
constructor when creating the Component Details for a connection. Also noticed 
that null fields are being added to the map when calling 
ComponentDetails.toMap() and this causes the UI to display these fields even 
though they have no value, so avoided populating the map with fields whose 
values are null

This closes #3696
---
 .../status/history/ComponentDetails.java   | 22 ++
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/ComponentDetails.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/ComponentDetails.java
index 68a79b9..e7a93fa 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/ComponentDetails.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/ComponentDetails.java
@@ -58,7 +58,7 @@ public class ComponentDetails {
 }
 
 public static ComponentDetails forConnection(final String id, final String 
groupId, final String connectionName, final String sourceName, final String 
destinationName) {
-return new ComponentDetails(id, groupId, connectionName, sourceName, 
destinationName, null, null);
+return new ComponentDetails(id, groupId, connectionName, null, 
sourceName, destinationName, null);
 }
 
 public static ComponentDetails forProcessGroup(final ProcessGroupStatus 
status) {
@@ -111,13 +111,19 @@ public class ComponentDetails {
  */
 public Map toMap() {
 final Map map = new HashMap<>();
-map.put(ComponentStatusRepository.COMPONENT_DETAIL_ID, componentId);
-map.put(ComponentStatusRepository.COMPONENT_DETAIL_GROUP_ID, groupId);
-map.put(ComponentStatusRepository.COMPONENT_DETAIL_NAME, 
componentName);
-map.put(ComponentStatusRepository.COMPONENT_DETAIL_TYPE, 
componentType);
-map.put(ComponentStatusRepository.COMPONENT_DETAIL_SOURCE_NAME, 
sourceName);
-map.put(ComponentStatusRepository.COMPONENT_DETAIL_DESTINATION_NAME, 
destinationName);
-map.put(ComponentStatusRepository.COMPONENT_DETAIL_URI, targetUri);
+addToMap(map, ComponentStatusRepository.COMPONENT_DETAIL_ID, 
componentId);
+addToMap(map, ComponentStatusRepository.COMPONENT_DETAIL_GROUP_ID, 
groupId);
+addToMap(map, ComponentStatusRepository.COMPONENT_DETAIL_NAME, 
componentName);
+addToMap(map, ComponentStatusRepository.COMPONENT_DETAIL_TYPE, 
componentType);
+addToMap(map, ComponentStatusRepository.COMPONENT_DETAIL_SOURCE_NAME, 
sourceName);
+addToMap(map, 
ComponentStatusRepository.COMPONENT_DETAIL_DESTINATION_NAME, destinationName);
+addToMap(map, ComponentStatusRepository.COMPONENT_DETAIL_URI, 
targetUri);
 return map;
 }
+
+private void addToMap(final Map map, final String key, 
final String value) {
+if (value != null) {
+map.put(key, value);
+}
+}
 }



[nifi] branch analytics-framework updated: NIFI-6510 - Fix issue displaying estimated time to back pressure in connection summary table when only one of the predictions is known.

2019-09-06 Thread mattyb149
This is an automated email from the ASF dual-hosted git repository.

mattyb149 pushed a commit to branch analytics-framework
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/analytics-framework by this 
push:
 new 60d9ce4  NIFI-6510 - Fix issue displaying estimated time to back 
pressure in connection summary table when only one of the predictions is known.
60d9ce4 is described below

commit 60d9ce427c2b1af9b291d09e19b47de4edeba753
Author: Rob Fellows 
AuthorDate: Fri Sep 6 13:03:45 2019 -0400

NIFI-6510 - Fix issue displaying estimated time to back pressure in 
connection summary table when only one of the predictions is known.

Signed-off-by: Matthew Burgess 

This closes #3705
---
 .../src/main/webapp/js/nf/summary/nf-summary-table.js | 15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js
index b665bbd..3585356 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js
@@ -103,17 +103,26 @@
 { label: 'size', percent: percentUseBytes }
 ];
 
-var minPrediction = _.minBy(predictions, 'timeToBackPressure');
+// if one of the queues is already at backpressure, return now as the 
prediction
 var maxActual = _.maxBy(actualQueuePercents, 'percent');
-
 if (maxActual.percent >= 100) {
 // currently experiencing back pressure
 return 'now (' + maxActual.label + ')';
-} else if (minPrediction.timeToBackPressure < 0) {
+}
+
+// filter out the predictions that are unknown
+var knownPredictions = predictions.filter(function(p) {
+return p.timeToBackPressure >= 0;
+});
+
+if (_.isEmpty(knownPredictions)) {
 // there is not a valid time-to-back-pressure prediction available
 return 'NA';
 }
 
+// there is at least one valid prediction, return the minimum time to 
back pressure
+var minPrediction = _.minBy(knownPredictions, 'timeToBackPressure');
+
 var formatted = 
nfCommon.formatPredictedDuration(minPrediction.timeToBackPressure);
 return nfCommon.escapeHtml(formatted) + ' (' + minPrediction.label + 
')';
 };



[nifi] branch master updated: NIFI-6621: Add support for Druid schema-less dimensions

2019-09-06 Thread mattyb149
This is an automated email from the ASF dual-hosted git repository.

mattyb149 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/master by this push:
 new a672294  NIFI-6621: Add support for Druid schema-less dimensions
a672294 is described below

commit a672294f3f3edf2f3fbd05a20d0585dc1a431c79
Author: samhjelmfelt 
AuthorDate: Wed Sep 4 16:20:27 2019 -0500

NIFI-6621: Add support for Druid schema-less dimensions

NIFI-6621: Small change to fix failing tests

NIFI-6621: Minor style changes
Signed-off-by: Matthew Burgess 

This closes #3693
---
 .../controller/druid/DruidTranquilityController.java   | 18 +++---
 .../druid/DruidTranquilityControllerTest.java  |  2 --
 .../druid/MockDruidTranquilityController.java  |  3 ++-
 3 files changed, 13 insertions(+), 10 deletions(-)

diff --git 
a/nifi-nar-bundles/nifi-druid-bundle/nifi-druid-controller-service/src/main/java/org/apache/nifi/controller/druid/DruidTranquilityController.java
 
b/nifi-nar-bundles/nifi-druid-bundle/nifi-druid-controller-service/src/main/java/org/apache/nifi/controller/druid/DruidTranquilityController.java
index 78aab4c..4d69699 100644
--- 
a/nifi-nar-bundles/nifi-druid-bundle/nifi-druid-controller-service/src/main/java/org/apache/nifi/controller/druid/DruidTranquilityController.java
+++ 
b/nifi-nar-bundles/nifi-druid-bundle/nifi-druid-controller-service/src/main/java/org/apache/nifi/controller/druid/DruidTranquilityController.java
@@ -231,8 +231,7 @@ public class DruidTranquilityController extends 
AbstractControllerService implem
 public static final PropertyDescriptor DIMENSIONS_LIST = new 
PropertyDescriptor.Builder()
 .name("druid-cs-dimensions-list")
 .displayName("Dimension Fields")
-.description("A comma separated list of field names that will be 
stored as dimensions on ingest.")
-.required(true)
+.description("A comma separated list of field names that will be 
stored as dimensions on ingest. Set to empty string for schema-less 
dimensions.")
 .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
 
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
 .build();
@@ -400,7 +399,7 @@ public class DruidTranquilityController extends 
AbstractControllerService implem
 
 transitUri = String.format(FIREHOSE_PATTERN, dataSource) + 
";indexServicePath=" + indexService;
 
-final List dimensions = getDimensions(dimensionsStringList);
+final DruidDimensions dimensions = getDimensions(dimensionsStringList);
 final List aggregator = 
getAggregatorList(aggregatorJSON);
 
 final Timestamper> timestamper = new 
Timestamper>() {
@@ -446,14 +445,14 @@ public class DruidTranquilityController extends 
AbstractControllerService implem
 }
 
 Beam> buildBeam(String dataSource, String 
indexService, String discoveryPath, int clusterPartitions, int 
clusterReplication,
-String segmentGranularity, String 
queryGranularity, String windowPeriod, String firehoseGracePeriod, String 
indexRetryPeriod, List dimensions,
+String segmentGranularity, String 
queryGranularity, String windowPeriod, String firehoseGracePeriod, String 
indexRetryPeriod, DruidDimensions dimensions,
 List aggregator, 
Timestamper> timestamper, TimestampSpec timestampSpec) {
 return DruidBeams.builder(timestamper)
 .curator(curator)
 .discoveryPath(discoveryPath)
 
.location(DruidLocation.create(DruidEnvironment.create(indexService, 
FIREHOSE_PATTERN), dataSource))
 .timestampSpec(timestampSpec)
-
.rollup(DruidRollup.create(DruidDimensions.specific(dimensions), aggregator, 
QueryGranularity.fromString(queryGranularity)))
+.rollup(DruidRollup.create(dimensions, aggregator, 
QueryGranularity.fromString(queryGranularity)))
 .tuning(
 ClusteredBeamTuning
 .builder()
@@ -518,7 +517,7 @@ public class DruidTranquilityController extends 
AbstractControllerService implem
 }
 }
 
-private List getDimensions(String dimensionStringList) {
+private DruidDimensions getDimensions(String dimensionStringList) {
 List dimensionList = new ArrayList<>();
 if (dimensionStringList != null) {
 Arrays.stream(dimensionStringList.split(","))
@@ -526,7 +525,12 @@ public class DruidTranquilityController extends 
AbstractControllerService implem
 .map(String::trim)
 .forEach(dimensionList::add);
 }
-return dimensionList;
+if(dimensionList.isEmpty()) {
+getLogger().debug("Using schema-less 

[nifi-registry] branch master updated: NIFIREG-317 Improve logging for errors that occur when creating providers

2019-09-06 Thread kdoran
This is an automated email from the ASF dual-hosted git repository.

kdoran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi-registry.git


The following commit(s) were added to refs/heads/master by this push:
 new f530195  NIFIREG-317 Improve logging for errors that occur when 
creating providers
f530195 is described below

commit f530195d543d1fcef682048f727b4fb0ad600218
Author: Bryan Bende 
AuthorDate: Wed Sep 4 14:46:42 2019 -0400

NIFIREG-317 Improve logging for errors that occur when creating providers
---
 .../org/apache/nifi/registry/provider/StandardProviderFactory.java| 4 
 1 file changed, 4 insertions(+)

diff --git 
a/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/StandardProviderFactory.java
 
b/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/StandardProviderFactory.java
index c9eb9f5..3d14d67 100644
--- 
a/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/StandardProviderFactory.java
+++ 
b/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/StandardProviderFactory.java
@@ -121,6 +121,7 @@ public class StandardProviderFactory implements 
ProviderFactory, DisposableBean
 final JAXBElement element = 
unmarshaller.unmarshal(new StreamSource(providersConfigFile), Providers.class);
 providersHolder.set(element.getValue());
 } catch (SAXException | JAXBException e) {
+LOGGER.error(e.getMessage(), e);
 throw new ProviderFactoryException("Unable to load the 
providers configuration file at: " + providersConfigFile.getAbsolutePath(), e);
 }
 } else {
@@ -157,6 +158,7 @@ public class StandardProviderFactory implements 
ProviderFactory, DisposableBean
 
 LOGGER.info("Instantiated FlowPersistenceProvider with class 
name {}", new Object[]{flowProviderClassName});
 } catch (Exception e) {
+LOGGER.error(e.getMessage(), e);
 throw new ProviderFactoryException("Error creating 
FlowPersistenceProvider with class name: " + flowProviderClassName, e);
 }
 
@@ -207,6 +209,7 @@ public class StandardProviderFactory implements 
ProviderFactory, DisposableBean
 
 LOGGER.info("Instantiated EventHookProvider with class 
name {}", new Object[] {hookProviderClassName});
 } catch (Exception e) {
+LOGGER.error(e.getMessage(), e);
 throw new ProviderFactoryException("Error creating 
EventHookProvider with class name: " + hookProviderClassName, e);
 }
 
@@ -250,6 +253,7 @@ public class StandardProviderFactory implements 
ProviderFactory, DisposableBean
 
 LOGGER.info("Instantiated BundlePersistenceProvider with class 
name {}", new Object[] {extensionBundleProviderClassName});
 } catch (Exception e) {
+LOGGER.error(e.getMessage(), e);
 throw new ProviderFactoryException("Error creating 
BundlePersistenceProvider with class name: " + 
extensionBundleProviderClassName, e);
 }
 



[nifi-registry] branch master updated: Update .travis.yml

2019-09-06 Thread kdoran
This is an automated email from the ASF dual-hosted git repository.

kdoran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi-registry.git


The following commit(s) were added to refs/heads/master by this push:
 new 6a4a606  Update .travis.yml
6a4a606 is described below

commit 6a4a606d64c4aa3ea2a0b5e9a630e4dc8b1555d3
Author: Bryan Bende 
AuthorDate: Wed Sep 4 15:01:46 2019 -0400

Update .travis.yml
---
 .travis.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index a85ddbd..1cfe9be 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -57,5 +57,5 @@ install: true
 
 #build commands
 script:
-- mvn -T 2C clean install -Pintegration-tests,contrib-check,jsUnitTests | 
grep -v -F -f .travis-output-filters && exit ${PIPESTATUS[0]}
+- mvn clean install -Pintegration-tests,contrib-check,jsUnitTests | grep 
-v -F -f .travis-output-filters && exit ${PIPESTATUS[0]}
 



[nifi] branch master updated: NIFI-6380: Fixed partial updates to parameters

2019-09-06 Thread mcgilman
This is an automated email from the ASF dual-hosted git repository.

mcgilman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/master by this push:
 new 4868308  NIFI-6380: Fixed partial updates to parameters
4868308 is described below

commit 4868308fd8e3e630c8dfaa9c418aa64f1f8a74b4
Author: Mark Payne 
AuthorDate: Wed Sep 4 11:48:56 2019 -0400

NIFI-6380: Fixed partial updates to parameters

This closes #3692
---
 .../nifi/parameter/StandardParameterContext.java   | 46 +-
 1 file changed, 44 insertions(+), 2 deletions(-)

diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/parameter/StandardParameterContext.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/parameter/StandardParameterContext.java
index 04cfb8a..ecd8cfa 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/parameter/StandardParameterContext.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/parameter/StandardParameterContext.java
@@ -112,8 +112,10 @@ public class StandardParameterContext implements 
ParameterContext {
 parameters.remove(parameterDescriptor);
 changeAffectingComponents = true;
 } else {
-final Parameter oldParameter = 
parameters.put(parameter.getDescriptor(), parameter);
-if (oldParameter == null || 
!Objects.equals(oldParameter.getValue(), parameter.getValue())) {
+final Parameter updatedParameter = 
createFullyPopulatedParameter(parameter);
+
+final Parameter oldParameter = 
parameters.put(updatedParameter.getDescriptor(), updatedParameter);
+if (oldParameter == null || 
!Objects.equals(oldParameter.getValue(), updatedParameter.getValue())) {
 changeAffectingComponents = true;
 }
 }
@@ -133,6 +135,46 @@ public class StandardParameterContext implements 
ParameterContext {
 }
 }
 
+/**
+ * When updating a Parameter, the provided 'updated' Parameter may or may 
not contain a value. This is done because once a Parameter is set,
+ * a user may want to change the description of the Parameter but cannot 
include the value of the Parameter in the request if the Parameter is sensitive 
(because
+ * the value of the Parameter, when retrieved, is masked for sensitive 
Parameters). As a result, a call may be made to {@link #setParameters(Map)} 
that includes
+ * a Parameter whose value is null. If we encounter this, we 
do not want to change the value of the Parameter, so we want to insert into our 
Map
+ * a Parameter object whose value is equal to the current value for that 
Parameter (if any). This method, then, takes a Parameter whose value may or may 
not be
+ * populated and returns a Parameter whose value is populated, if there is 
an appropriate value to populate it with.
+ *
+ * @param proposedParameter the proposed parameter
+ * @return a Parameter whose descriptor is the same as the given proposed 
parameter but whose value has been populated based on the existing value for 
that Parameter (if any)
+ * if the given proposed parameter does not have its value populated
+ */
+private Parameter createFullyPopulatedParameter(final Parameter 
proposedParameter) {
+final ParameterDescriptor descriptor = 
getFullyPopulatedDescriptor(proposedParameter);
+final String value = getFullyPopulatedValue(proposedParameter);
+return new Parameter(descriptor, value);
+}
+
+private String getFullyPopulatedValue(final Parameter proposedParameter) {
+if (proposedParameter.getValue() != null) {
+return proposedParameter.getValue();
+}
+
+final Parameter oldParameter = 
parameters.get(proposedParameter.getDescriptor());
+return oldParameter == null ? null : oldParameter.getValue();
+}
+
+private ParameterDescriptor getFullyPopulatedDescriptor(final Parameter 
proposedParameter) {
+final ParameterDescriptor descriptor = 
proposedParameter.getDescriptor();
+if (descriptor.getDescription() != null) {
+return descriptor;
+}
+
+final Parameter oldParameter = 
parameters.get(proposedParameter.getDescriptor());
+
+// We know that the Parameters have the same name, since this is what 
the Descriptor's hashCode & equality are based on. The only thing that may be 
different
+// is the description. And since the proposed Parameter does not have 
a Description, we want to use whatever is currently set.
+return oldParameter == null ? null : 

[nifi] 02/02: NIFI-6623 - enter process group before navigating to the controller service

2019-09-06 Thread scottyaslan
This is an automated email from the ASF dual-hosted git repository.

scottyaslan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git

commit 9aed19137c739ff766ed5a37510bc02f6cf361cd
Author: Rob Fellows 
AuthorDate: Thu Sep 5 16:55:12 2019 -0400

NIFI-6623 - enter process group before navigating to the controller service

This closes #3695

Signed-off-by: Scott Aslan 
---
 .../nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js| 1 +
 .../nifi-web-ui/src/main/webapp/js/nf/canvas/nf-variable-registry.js | 1 +
 2 files changed, 2 insertions(+)

diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js
index 79c3bef..88399a2 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js
@@ -706,6 +706,7 @@
 
nfCanvasUtils.showComponent(unauthorizedReferencingComponentEntity.processGroup.id,
 unauthorizedReferencingComponentEntity.id);
 } else if 
(unauthorizedReferencingComponentEntity.referenceType === 'CONTROLLER_SERVICE') 
{
 
nfProcessGroupConfiguration.showConfiguration(unauthorizedReferencingComponentEntity.processGroup.id).done(function
 () {
+
nfProcessGroup.enterGroup(unauthorizedReferencingComponentEntity.processGroup.id);
 
nfProcessGroupConfiguration.selectControllerService(unauthorizedReferencingComponentEntity.id);
 });
 }
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-variable-registry.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-variable-registry.js
index f84537e..f91f4a4 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-variable-registry.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-variable-registry.js
@@ -926,6 +926,7 @@
 
nfCanvasUtils.showComponent(unauthorizedAffectedComponentEntity.processGroup.id,
 unauthorizedAffectedComponentEntity.id);
 } else if 
(unauthorizedAffectedComponentEntity.referenceType === 'CONTROLLER_SERVICE') {
 
nfProcessGroupConfiguration.showConfiguration(unauthorizedAffectedComponentEntity.processGroup.id).done(function
 () {
+
nfProcessGroup.enterGroup(unauthorizedAffectedComponentEntity.processGroup.id);
 
nfProcessGroupConfiguration.selectControllerService(unauthorizedAffectedComponentEntity.id);
 });
 }



[nifi] 01/02: NIFI-6623 - Support linking to unauthorized components from referencing components

2019-09-06 Thread scottyaslan
This is an automated email from the ASF dual-hosted git repository.

scottyaslan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git

commit 710c02c673570d09a7e61ea6f95015b6c36382cd
Author: Rob Fellows 
AuthorDate: Thu Sep 5 14:10:24 2019 -0400

NIFI-6623 - Support linking to unauthorized components from referencing 
components
---
 .../web/api/entity/AffectedComponentEntity.java| 13 ++
 .../org/apache/nifi/web/api/dto/EntityFactory.java |  1 +
 .../webapp/js/nf/canvas/nf-parameter-contexts.js   | 30 ++
 .../webapp/js/nf/canvas/nf-variable-registry.js| 21 ++-
 4 files changed, 54 insertions(+), 11 deletions(-)

diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AffectedComponentEntity.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AffectedComponentEntity.java
index 737d9c0..7ef93a7 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AffectedComponentEntity.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AffectedComponentEntity.java
@@ -31,6 +31,7 @@ public class AffectedComponentEntity extends ComponentEntity 
implements Permissi
 
 private AffectedComponentDTO component;
 private ProcessGroupNameDTO processGroup;
+private String referenceType;
 
 /**
  * @return variable referencing components that is being serialized
@@ -54,6 +55,18 @@ public class AffectedComponentEntity extends ComponentEntity 
implements Permissi
 this.processGroup = processGroup;
 }
 
+@ApiModelProperty(value="The type of component referenced",
+allowableValues = AffectedComponentDTO.COMPONENT_TYPE_PROCESSOR + "," 
+ AffectedComponentDTO.COMPONENT_TYPE_CONTROLLER_SERVICE + ", "
++ AffectedComponentDTO.COMPONENT_TYPE_INPUT_PORT + ", " + 
AffectedComponentDTO.COMPONENT_TYPE_OUTPUT_PORT + ", "
++ AffectedComponentDTO.COMPONENT_TYPE_REMOTE_INPUT_PORT + ", " 
+ AffectedComponentDTO.COMPONENT_TYPE_REMOTE_OUTPUT_PORT)
+public String getReferenceType() {
+return referenceType;
+}
+
+public void setReferenceType(String referenceType) {
+this.referenceType = referenceType;
+}
+
 @Override
 public String toString() {
 return component == null ? "AffectedComponent[No Component]" : 
component.toString();
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/EntityFactory.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/EntityFactory.java
index 20de5e5..08c28d1 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/EntityFactory.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/EntityFactory.java
@@ -370,6 +370,7 @@ public final class EntityFactory {
 if (dto != null) {
 entity.setPermissions(permissions);
 entity.setId(dto.getId());
+entity.setReferenceType(dto.getReferenceType());
 
 if (permissions != null && permissions.getCanRead()) {
 entity.setComponent(dto);
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js
index 161bb64..79c3bef 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js
@@ -692,16 +692,26 @@
 }
 } else {
 var 
referencingUnauthorizedComponentContainer = $('').appendTo(unauthorizedComponentsContainer);
-$('').prop('title', 
unauthorizedReferencingComponentEntity.id).text(unauthorizedReferencingComponentEntity.id).on('click',
 function () {
-// check if there are outstanding 
changes
-
handleOutstandingChanges().done(function () {
-// close the shell
-
$('#shell-dialog').modal('hide');
-
-// show the component 

[nifi] branch master updated (f01668e -> 9aed191)

2019-09-06 Thread scottyaslan
This is an automated email from the ASF dual-hosted git repository.

scottyaslan pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git.


from f01668e  NIFI-6530 - HTTP SiteToSite server returns 201 in case no 
data is available
 new 710c02c  NIFI-6623 - Support linking to unauthorized components from 
referencing components
 new 9aed191  NIFI-6623 - enter process group before navigating to the 
controller service

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../web/api/entity/AffectedComponentEntity.java| 13 +
 .../org/apache/nifi/web/api/dto/EntityFactory.java |  1 +
 .../webapp/js/nf/canvas/nf-parameter-contexts.js   | 31 +++---
 .../webapp/js/nf/canvas/nf-variable-registry.js| 22 ++-
 4 files changed, 56 insertions(+), 11 deletions(-)



[nifi] branch master updated: NIFI-6530 - HTTP SiteToSite server returns 201 in case no data is available

2019-09-06 Thread ijokarumawak
This is an automated email from the ASF dual-hosted git repository.

ijokarumawak pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/master by this push:
 new f01668e  NIFI-6530 - HTTP SiteToSite server returns 201 in case no 
data is available
f01668e is described below

commit f01668e66ad2e45197915769e966a4be27e1592e
Author: Arpad Boda 
AuthorDate: Mon Aug 12 17:30:30 2019 +0200

NIFI-6530 - HTTP SiteToSite server returns 201 in case no data is available

This closes #3647.

Signed-off-by: Koji Kawamura 
---
 .../apache/nifi/remote/client/PeerSelector.java| 22 +++-
 .../apache/nifi/remote/client/http/HttpClient.java | 22 ++--
 .../http/TransportProtocolVersionNegotiator.java   |  1 +
 .../client/socket/EndpointConnectionPool.java  | 19 ---
 .../nifi/remote/client/socket/SocketClient.java|  6 +--
 .../nifi/remote/exception/NoContentException.java  | 39 ++
 .../remote/exception/NoValidPeerException.java | 40 ++
 .../protocol/socket/SocketClientTransaction.java   |  4 ++
 .../nifi/remote/util/SiteToSiteRestApiClient.java  |  6 ++-
 .../nifi/remote/client/TestPeerSelector.java   | 31 ++-
 .../nifi/remote/client/http/TestHttpClient.java| 63 +++---
 .../socket/TestSocketClientTransaction.java| 17 +++---
 .../java/org/apache/nifi/spark/NiFiReceiver.java   |  7 +++
 .../nifi/remote/StandardRemoteGroupPort.java   | 15 --
 .../apache/nifi/web/api/DataTransferResource.java  | 19 ++-
 .../stateless/core/StatelessRemoteOutputPort.java  |  8 ++-
 .../apache/nifi/toolkit/s2s/SiteToSiteCliMain.java |  3 ++
 .../nifi/toolkit/s2s/SiteToSiteReceiver.java   |  4 ++
 18 files changed, 253 insertions(+), 73 deletions(-)

diff --git 
a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/PeerSelector.java
 
b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/PeerSelector.java
index a443967..14c163b 100644
--- 
a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/PeerSelector.java
+++ 
b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/PeerSelector.java
@@ -262,7 +262,7 @@ public class PeerSelector {
  *  for RECEIVE, a peer with more flow files is preferred
  * @return a selected peer, if there is no available peer or all peers are 
penalized, then return null
  */
-public PeerStatus getNextPeerStatus(final TransferDirection direction) {
+public ArrayList getPeerStatuses(final TransferDirection 
direction) {
 List peerList = peerStatuses;
 if (isPeerRefreshNeeded(peerList)) {
 peerRefreshLock.lock();
@@ -289,25 +289,15 @@ public class PeerSelector {
 }
 }
 
+
 if (peerList == null || peerList.isEmpty()) {
-return null;
+return new ArrayList();
 }
 
-PeerStatus peerStatus;
-for (int i = 0; i < peerList.size(); i++) {
-final long idx = peerIndex.getAndIncrement();
-final int listIndex = (int) (idx % peerList.size());
-peerStatus = peerList.get(listIndex);
-
-if (isPenalized(peerStatus)) {
-logger.debug("{} {} is penalized; will not communicate with 
this peer", this, peerStatus);
-} else {
-return peerStatus;
-}
-}
+ArrayList retVal = new ArrayList<>(peerList);
+retVal.removeIf(p -> isPenalized(p));
 
-logger.debug("{} All peers appear to be penalized; returning null", 
this);
-return null;
+return retVal;
 }
 
 private List createPeerStatusList(final TransferDirection 
direction) throws IOException {
diff --git 
a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/http/HttpClient.java
 
b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/http/HttpClient.java
index 4213dac..e1516d2 100644
--- 
a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/http/HttpClient.java
+++ 
b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/http/HttpClient.java
@@ -27,6 +27,8 @@ import org.apache.nifi.remote.client.PeerSelector;
 import org.apache.nifi.remote.client.PeerStatusProvider;
 import org.apache.nifi.remote.client.SiteToSiteClientConfig;
 import org.apache.nifi.remote.exception.HandshakeException;
+import org.apache.nifi.remote.exception.NoContentException;
+import org.apache.nifi.remote.exception.NoValidPeerException;
 import org.apache.nifi.remote.exception.PortNotRunningException;
 import org.apache.nifi.remote.exception.ProtocolException;
 import org.apache.nifi.remote.exception.UnknownPortException;
@@ -40,6 +42,7 @@ import org.slf4j.LoggerFactory;
 
 import