You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by jo...@apache.org on 2020/02/14 18:31:33 UTC
[nifi] branch support/nifi-1.11.x updated (d088123 -> c12aecf)
This is an automated email from the ASF dual-hosted git repository.
joewitt pushed a change to branch support/nifi-1.11.x
in repository https://gitbox.apache.org/repos/asf/nifi.git.
from d088123 NIFI-7078 bumping dockerfile versions for next nifi release to 1.11.2
new c2c1a35 NIFI-7117: When SocketLoadBalancedFlowFileQueue creates its array of Queue Partitions in the constructor, it added the local partition as the first element in that list. This list should be ordered the same across all nodes in the cluster. By making the local partition the first in the array, each node had a different ordering of these partitions. As a result, Partition by Attribute strategy would constantly rebalance flowfiles that it received to other node, and Single [...]
new 6c7aa59 NIFI-6491 Improve installation instructions in Admin Guide and Getting Starting Guide Clarified homebrew install instructions.
new b485d0e NIFI-6958: - Addressing issue causing errors preventing version changes when there is a processor to enable or disable in a sub process group.
new 136ed8f NIFI-6968 Create Connection Model Allows Multiple Adds
new 85cc568 NIFI-7053 Update Toolkit Guide with macOS 10.15 requirements for trus… (#4018)
new a16754b NIFI-7082 Updated tls-toolkit default server and client certificates validity days to 825 days. (#4046)
new b7c7d2f NIFI-7105 - fix NPE for counters in SiteToSiteStatusReportingTask (#4038)
new 948fda3 NIFI-7106 - Add parent name and parent path in SiteToSiteStatusReportingTask
new 8c4c00f NIFI-7108 - Upgrade com.puppycrawl.tools:checkstyle (#4041)
new 82e4667 NIFI-7075 Add missing FlowFile core attributes to Developer Guide (#4030)
new 281c7e9 NIFI-7132: fix handling of UUIDs in PutCassandraQL
new cfe1598 NIFI-7095: ResetSetRecordSet: handle java.sql.Array Types in normalizeValue method
new d25d2fe NIFI-4792: Add support for querying array fields in QueryRecord
new c12aecf NIFI-7067 Allow a user and group with the same name/identity to exist
The 14 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:
.../serialization/record/ResultSetRecordSet.java | 6 +-
.../src/main/asciidoc/administration-guide.adoc | 15 +-
nifi-docs/src/main/asciidoc/developer-guide.adoc | 6 +
nifi-docs/src/main/asciidoc/getting-started.adoc | 20 ++-
nifi-docs/src/main/asciidoc/toolkit-guide.adoc | 2 +
.../nifi/processors/cassandra/PutCassandraQL.java | 6 +-
.../processors/cassandra/PutCassandraQLTest.java | 72 ++++++++++
.../nifi/authorization/AuthorizerFactory.java | 36 +++--
.../nifi/authorization/AuthorizerFactoryBean.java | 21 ++-
.../nifi/authorization/AuthorizerFactoryTest.java | 15 +-
.../clustered/SocketLoadBalancedFlowFileQueue.java | 10 +-
.../partition/CorrelationAttributePartitioner.java | 17 +++
.../apache/nifi/groups/StandardProcessGroup.java | 4 +-
.../js/nf/canvas/nf-connection-configuration.js | 74 +++++++++-
.../reporting/SiteToSiteStatusReportingTask.java | 62 ++++----
.../additionalDetails.html | 4 +-
.../src/main/resources/schema-status.avsc | 4 +-
.../TestSiteToSiteStatusReportingTask.java | 5 +
.../nifi/processors/standard/QueryRecord.java | 36 ++++-
.../nifi/queryrecord/FlowFileEnumerator.java | 19 ++-
.../org/apache/nifi/queryrecord/FlowFileTable.java | 5 +-
.../nifi/processors/standard/TestQueryRecord.java | 158 +++++++++++++++++++++
nifi-nar-bundles/nifi-standard-bundle/pom.xml | 2 +-
.../apache/nifi/tests/system/NiFiClientUtil.java | 5 +-
.../tests/system/loadbalance/LoadBalanceIT.java | 61 ++++++++
.../src/main/resources/conf/config-client.json | 2 +-
.../src/main/resources/conf/config-server.json | 2 +-
.../cli/impl/client/nifi/ConnectionClient.java | 2 +
.../client/nifi/impl/JerseyConnectionClient.java | 13 +-
.../nifi/toolkit/tls/configuration/TlsConfig.java | 2 +-
pom.xml | 2 +-
31 files changed, 595 insertions(+), 93 deletions(-)
[nifi] 13/14: NIFI-4792: Add support for querying array fields in
QueryRecord
Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
joewitt pushed a commit to branch support/nifi-1.11.x
in repository https://gitbox.apache.org/repos/asf/nifi.git
commit d25d2fea9950b4bba0f6cf7e3b36b413b2ed8395
Author: David Savage <da...@gmail.com>
AuthorDate: Sat Jan 25 17:27:47 2020 +0000
NIFI-4792: Add support for querying array fields in QueryRecord
Work in progress adding support for array based queries
updated calcite dependency
tidy up unused imports highlighted by checkstyle in travis build
tidy up }s highlighted by checkstyle in travis build
Add test for use case referenced in NIFI-4792
Bumped Calcite version to 1.21.0
Signed-off-by: Matthew Burgess <ma...@apache.org>
This closes #4015
---
.../nifi/processors/standard/QueryRecord.java | 36 ++++-
.../nifi/queryrecord/FlowFileEnumerator.java | 19 ++-
.../org/apache/nifi/queryrecord/FlowFileTable.java | 5 +-
.../nifi/processors/standard/TestQueryRecord.java | 158 +++++++++++++++++++++
nifi-nar-bundles/nifi-standard-bundle/pom.xml | 2 +-
5 files changed, 214 insertions(+), 6 deletions(-)
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/QueryRecord.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/QueryRecord.java
index 5136e67..82aea6f 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/QueryRecord.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/QueryRecord.java
@@ -610,14 +610,15 @@ public class QueryRecord extends AbstractProcessor {
if (record == null) {
return null;
}
-
if (record instanceof Record) {
return eval((Record) record, recordPath);
}
if (record instanceof Record[]) {
return eval((Record[]) record, recordPath);
}
-
+ if (record instanceof Iterable) {
+ return eval((Iterable<Record>) record, recordPath);
+ }
if (record instanceof Map) {
return eval((Map<?, ?>) record, recordPath);
}
@@ -645,6 +646,18 @@ public class QueryRecord extends AbstractProcessor {
return evalResults(selectedFields);
}
+ private Object eval(final Iterable<Record> records, final String recordPath) {
+ final RecordPath compiled = RECORD_PATH_CACHE.getCompiled(recordPath);
+
+ final List<FieldValue> selectedFields = new ArrayList<>();
+ for (final Record record : records) {
+ final RecordPathResult result = compiled.evaluate(record);
+ result.getSelectedFields().forEach(selectedFields::add);
+ }
+
+ return evalResults(selectedFields);
+ }
+
private Object eval(final Record[] records, final String recordPath) {
final RecordPath compiled = RECORD_PATH_CACHE.getCompiled(recordPath);
@@ -794,6 +807,8 @@ public class QueryRecord extends AbstractProcessor {
return eval((Record) record, recordPath, transform);
} else if (record instanceof Record[]) {
return eval((Record[]) record, recordPath, transform);
+ } else if (record instanceof Iterable) {
+ return eval((Iterable<Record>) record, recordPath, transform);
} else if (record instanceof Map) {
return eval((Map<?, ?>) record, recordPath, transform);
}
@@ -837,6 +852,23 @@ public class QueryRecord extends AbstractProcessor {
return evalResults(selectedFields.stream(), transform, () -> "RecordPath " + recordPath + " resulted in more than one return value. The RecordPath must be further constrained.");
}
+ private <T> T eval(final Iterable<Record> records, final String recordPath, final Function<Object, T> transform) {
+ final RecordPath compiled = RECORD_PATH_CACHE.getCompiled(recordPath);
+
+ final List<FieldValue> selectedFields = new ArrayList<>();
+ for (final Record record : records) {
+ final RecordPathResult result = compiled.evaluate(record);
+ result.getSelectedFields().forEach(selectedFields::add);
+ }
+
+ if (selectedFields.isEmpty()) {
+ return null;
+ }
+
+ return evalResults(selectedFields.stream(), transform, () -> "RecordPath " + recordPath + " resulted in more than one return value. The RecordPath must be further constrained.");
+ }
+
+
private <T> T evalResults(final Stream<FieldValue> fields, final Function<Object, T> transform, final Supplier<String> multipleReturnValueErrorSupplier) {
return fields.map(FieldValue::getValue)
.filter(Objects::nonNull)
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/queryrecord/FlowFileEnumerator.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/queryrecord/FlowFileEnumerator.java
index 06ffb76..e4814ec 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/queryrecord/FlowFileEnumerator.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/queryrecord/FlowFileEnumerator.java
@@ -27,6 +27,9 @@ import org.apache.nifi.serialization.RecordReaderFactory;
import org.apache.nifi.serialization.record.Record;
import java.io.InputStream;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.List;
public class FlowFileEnumerator implements Enumerator<Object> {
private final ProcessSession session;
@@ -111,12 +114,26 @@ public class FlowFileEnumerator implements Enumerator<Object> {
final Object[] filtered = new Object[fields.length];
for (int i = 0; i < fields.length; i++) {
final int indexToKeep = fields[i];
- filtered[i] = row[indexToKeep];
+ filtered[i] = cast(row[indexToKeep]);
}
return filtered;
}
+ private Object cast(Object o) {
+ if (o == null) {
+ return null;
+ } else if (o.getClass().isArray()) {
+ List<Object> l = new ArrayList(Array.getLength(o));
+ for (int i = 0; i < Array.getLength(o); i++) {
+ l.add(Array.get(o, i));
+ }
+ return l;
+ } else {
+ return o;
+ }
+ }
+
@Override
public void reset() {
if (rawIn != null) {
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/queryrecord/FlowFileTable.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/queryrecord/FlowFileTable.java
index 8c0e2ce..3030008 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/queryrecord/FlowFileTable.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/queryrecord/FlowFileTable.java
@@ -42,6 +42,7 @@ import org.apache.nifi.serialization.record.DataType;
import org.apache.nifi.serialization.record.Record;
import org.apache.nifi.serialization.record.RecordField;
import org.apache.nifi.serialization.record.RecordSchema;
+import org.apache.nifi.serialization.record.type.ArrayDataType;
import java.lang.reflect.Type;
import java.math.BigInteger;
@@ -51,7 +52,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
-
public class FlowFileTable extends AbstractTable implements QueryableTable, TranslatableTable {
private final RecordReaderFactory recordReaderFactory;
@@ -214,7 +214,8 @@ public class FlowFileTable extends AbstractTable implements QueryableTable, Tran
case STRING:
return typeFactory.createJavaType(String.class);
case ARRAY:
- return typeFactory.createJavaType(Object[].class);
+ ArrayDataType array = (ArrayDataType) fieldType;
+ return typeFactory.createArrayType(getRelDataType(array.getElementType(), typeFactory), -1);
case RECORD:
return typeFactory.createJavaType(Record.class);
case MAP:
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestQueryRecord.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestQueryRecord.java
index 5b17327..0c26980 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestQueryRecord.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestQueryRecord.java
@@ -42,6 +42,7 @@ import org.junit.Test;
import java.io.IOException;
import java.io.OutputStream;
import java.sql.SQLException;
+import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
@@ -213,6 +214,132 @@ public class TestQueryRecord {
}
@Test
+ public void testCollectionFunctionsWithArray() throws InitializationException {
+ final Record record = createHierarchicalArrayRecord();
+ final ArrayListRecordReader recordReader = new ArrayListRecordReader(record.getSchema());
+ recordReader.addRecord(record);
+
+ final ArrayListRecordWriter writer = new ArrayListRecordWriter(record.getSchema());
+
+ TestRunner runner = getRunner();
+ runner.addControllerService("reader", recordReader);
+ runner.enableControllerService(recordReader);
+ runner.addControllerService("writer", writer);
+ runner.enableControllerService(writer);
+
+ runner.setProperty(QueryRecord.RECORD_READER_FACTORY, "reader");
+ runner.setProperty(QueryRecord.RECORD_WRITER_FACTORY, "writer");
+ runner.setProperty(REL_NAME,
+ "SELECT title, name" +
+ " FROM FLOWFILE" +
+ " WHERE CARDINALITY(addresses) > 1");
+
+ runner.enqueue(new byte[0]);
+
+ runner.run();
+
+ runner.assertTransferCount(REL_NAME, 1);
+
+ final List<Record> written = writer.getRecordsWritten();
+ assertEquals(1, written.size());
+
+ final Record output = written.get(0);
+ assertEquals("John Doe", output.getValue("name"));
+ assertEquals("Software Engineer", output.getValue("title"));
+ }
+
+ @Test
+ public void testCollectionFunctionsWithWhereClause() throws InitializationException {
+ final Record sample = createTaggedRecord("1", "a", "b", "c");
+
+ final ArrayListRecordReader recordReader = new ArrayListRecordReader(sample.getSchema());
+ recordReader.addRecord(createTaggedRecord("1", "a", "d", "g"));
+ recordReader.addRecord(createTaggedRecord("2", "b", "e"));
+ recordReader.addRecord(createTaggedRecord("3", "c", "f", "h"));
+
+
+ final ArrayListRecordWriter writer = new ArrayListRecordWriter(sample.getSchema());
+
+ TestRunner runner = getRunner();
+ runner.addControllerService("reader", recordReader);
+ runner.enableControllerService(recordReader);
+ runner.addControllerService("writer", writer);
+ runner.enableControllerService(writer);
+
+ runner.setProperty(QueryRecord.RECORD_READER_FACTORY, "reader");
+ runner.setProperty(QueryRecord.RECORD_WRITER_FACTORY, "writer");
+ runner.setProperty(REL_NAME,
+ "SELECT id, tags FROM FLOWFILE CROSS JOIN UNNEST(FLOWFILE.tags) AS f(tag) WHERE tag IN ('a','b')");
+ runner.enqueue(new byte[0]);
+
+ runner.run();
+
+ runner.assertTransferCount(REL_NAME, 1);
+
+ final List<Record> written = writer.getRecordsWritten();
+ assertEquals(2, written.size());
+
+ final Record output0 = written.get(0);
+ assertEquals("1", output0.getValue("id"));
+ assertArrayEquals(new Object[]{"a", "d", "g"}, (Object[]) output0.getValue("tags"));
+
+ final Record output1 = written.get(1);
+ assertEquals("2", output1.getValue("id"));
+ assertArrayEquals(new Object[]{"b", "e"}, (Object[]) output1.getValue("tags"));
+ }
+
+
+ @Test
+ public void testArrayColumnWithIndex() throws InitializationException {
+ final Record sample = createTaggedRecord("1", "a", "b", "c");
+
+ final ArrayListRecordReader recordReader = new ArrayListRecordReader(sample.getSchema());
+ recordReader.addRecord(createTaggedRecord("1", "a", "d", "g"));
+ recordReader.addRecord(createTaggedRecord("2", "b", "e"));
+ recordReader.addRecord(createTaggedRecord("3", "c", "f", "h"));
+
+
+ final ArrayListRecordWriter writer = new ArrayListRecordWriter(sample.getSchema());
+
+ TestRunner runner = getRunner();
+ runner.addControllerService("reader", recordReader);
+ runner.enableControllerService(recordReader);
+ runner.addControllerService("writer", writer);
+ runner.enableControllerService(writer);
+
+ runner.setProperty(QueryRecord.RECORD_READER_FACTORY, "reader");
+ runner.setProperty(QueryRecord.RECORD_WRITER_FACTORY, "writer");
+ runner.setProperty(REL_NAME,
+ "SELECT id, tags[1] as first, tags[2] as \"second\", tags[CARDINALITY(tags)] as last FROM FLOWFILE");
+ runner.enqueue(new byte[0]);
+
+ runner.run();
+
+ runner.assertTransferCount(REL_NAME, 1);
+
+ final List<Record> written = writer.getRecordsWritten();
+ assertEquals(3, written.size());
+
+ final Record output0 = written.get(0);
+ assertEquals("1", output0.getValue("id"));
+ assertEquals("a", output0.getValue("first"));
+ assertEquals("d", output0.getValue("second"));
+ assertEquals("g", output0.getValue("last"));
+
+ final Record output1 = written.get(1);
+ assertEquals("2", output1.getValue("id"));
+ assertEquals("b", output1.getValue("first"));
+ assertEquals("e", output1.getValue("second"));
+ assertEquals("e", output1.getValue("last"));
+
+ final Record output2 = written.get(2);
+ assertEquals("3", output2.getValue("id"));
+ assertEquals("c", output2.getValue("first"));
+ assertEquals("f", output2.getValue("second"));
+ assertEquals("h", output2.getValue("last"));
+ }
+
+ @Test
public void testCompareResultsOfTwoRecordPathsAgainstArray() throws InitializationException {
final Record record = createHierarchicalArrayRecord();
@@ -382,6 +509,12 @@ public class TestQueryRecord {
* "mother": {
* "name": "Jane Doe"
* }
+ * },
+ * "favouriteThings": {
+ * "sport": "basketball",
+ * "color": "green",
+ * "roses": "raindrops",
+ * "kittens": "whiskers"
* }
* }
* </pre></code>
@@ -441,6 +574,31 @@ public class TestQueryRecord {
/**
* Returns a Record that, if written in JSON, would look like:
* <code><pre>
+ * {
+ * "id": >id<,
+ * "tags": [>tag1<,>tag2<...]
+ * }
+ * </pre></code>
+ *
+ * @return the Record
+ */
+ private Record createTaggedRecord(String id, String...tags) {
+ final List<RecordField> recordSchemaFields = new ArrayList<>();
+ recordSchemaFields.add(new RecordField("id", RecordFieldType.STRING.getDataType()));
+ recordSchemaFields.add(new RecordField("tags", RecordFieldType.ARRAY.getArrayDataType(RecordFieldType.STRING.getDataType())));
+ final RecordSchema recordSchema = new SimpleRecordSchema(recordSchemaFields);
+
+ final Map<String, Object> map = new HashMap<>();
+ map.put("id", id);
+ map.put("tags", Arrays.asList(tags));
+
+ final Record record = new MapRecord(recordSchema, map);
+ return record;
+ }
+
+ /**
+ * Returns a Record that, if written in JSON, would look like:
+ * <code><pre>
* {
* "name": "John Doe",
* "title": "Software Engineer",
diff --git a/nifi-nar-bundles/nifi-standard-bundle/pom.xml b/nifi-nar-bundles/nifi-standard-bundle/pom.xml
index cc36dfe..7691cbe 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/pom.xml
+++ b/nifi-nar-bundles/nifi-standard-bundle/pom.xml
@@ -372,7 +372,7 @@
<dependency>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite-core</artifactId>
- <version>1.17.0</version>
+ <version>1.21.0</version>
</dependency>
<dependency>
<groupId>org.apache.avro</groupId>
[nifi] 03/14: NIFI-6958: - Addressing issue causing errors
preventing version changes when there is a processor to enable or disable
in a sub process group.
Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
joewitt pushed a commit to branch support/nifi-1.11.x
in repository https://gitbox.apache.org/repos/asf/nifi.git
commit b485d0e26b22c8879f7e8ad55b0b0851e5946490
Author: Matt Gilman <ma...@gmail.com>
AuthorDate: Wed Feb 5 12:49:01 2020 -0500
NIFI-6958:
- Addressing issue causing errors preventing version changes when there is a processor to enable or disable in a sub process group.
---
.../src/main/java/org/apache/nifi/groups/StandardProcessGroup.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java
index fbcf664..dedb6a9 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java
@@ -4633,9 +4633,9 @@ public final class StandardProcessGroup implements ProcessGroup {
processor.setPosition(new Position(proposed.getPosition().getX(), proposed.getPosition().getY()));
if (proposed.getScheduledState() == org.apache.nifi.registry.flow.ScheduledState.DISABLED) {
- disableProcessor(processor);
+ processor.getProcessGroup().disableProcessor(processor);
} else if (processor.getScheduledState() == ScheduledState.DISABLED) {
- enableProcessor(processor);
+ processor.getProcessGroup().enableProcessor(processor);
}
if (!isEqual(processor.getBundleCoordinate(), proposed.getBundle())) {
[nifi] 09/14: NIFI-7108 - Upgrade com.puppycrawl.tools:checkstyle
(#4041)
Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
joewitt pushed a commit to branch support/nifi-1.11.x
in repository https://gitbox.apache.org/repos/asf/nifi.git
commit 8c4c00fda2ab3939f454d01d938234123e6a535d
Author: Pierre Villard <pi...@gmail.com>
AuthorDate: Wed Feb 5 14:13:00 2020 -0500
NIFI-7108 - Upgrade com.puppycrawl.tools:checkstyle (#4041)
Signed-off-by: Andy LoPresto <al...@apache.org>
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 9b19852..aa87ab3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -487,7 +487,7 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
- <version>8.28</version>
+ <version>8.29</version>
</dependency>
</dependencies>
</plugin>
[nifi] 14/14: NIFI-7067 Allow a user and group with the same
name/identity to exist
Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
joewitt pushed a commit to branch support/nifi-1.11.x
in repository https://gitbox.apache.org/repos/asf/nifi.git
commit c12aecf6a03a462aa44824928306630a3af1aee5
Author: Bryan Bende <bb...@apache.org>
AuthorDate: Mon Jan 27 11:13:16 2020 -0500
NIFI-7067 Allow a user and group with the same name/identity to exist
This closes #4019
---
.../nifi/authorization/AuthorizerFactory.java | 36 ++++++++++++++--------
.../nifi/authorization/AuthorizerFactoryBean.java | 21 ++++++++++++-
.../nifi/authorization/AuthorizerFactoryTest.java | 15 ++-------
3 files changed, 46 insertions(+), 26 deletions(-)
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/main/java/org/apache/nifi/authorization/AuthorizerFactory.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/main/java/org/apache/nifi/authorization/AuthorizerFactory.java
index 812ea17..b826cf1 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/main/java/org/apache/nifi/authorization/AuthorizerFactory.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/main/java/org/apache/nifi/authorization/AuthorizerFactory.java
@@ -47,14 +47,14 @@ public final class AuthorizerFactory {
}
/**
- * Checks if another tenant (user or group) exists with the same identity.
+ * Checks if another user exists with the same identity.
*
- * @param userGroupProvider the userGroupProvider to use to lookup the tenant
- * @param identifier identity of the tenant
- * @param identity identity of the tenant
- * @return true if another tenant exists with the same identity, false otherwise
+ * @param userGroupProvider the userGroupProvider to use to lookup the user
+ * @param identifier identity of the user
+ * @param identity identity of the user
+ * @return true if another user exists with the same identity, false otherwise
*/
- private static boolean tenantExists(final UserGroupProvider userGroupProvider, final String identifier, final String identity) {
+ private static boolean userExists(final UserGroupProvider userGroupProvider, final String identifier, final String identity) {
for (User user : userGroupProvider.getUsers()) {
if (!user.getIdentifier().equals(identifier)
&& user.getIdentity().equals(identity)) {
@@ -62,6 +62,18 @@ public final class AuthorizerFactory {
}
}
+ return false;
+ }
+
+ /**
+ * Checks if another group exists with the same identity.
+ *
+ * @param userGroupProvider the userGroupProvider to use to lookup the group
+ * @param identifier identity of the group
+ * @param identity identity of the group
+ * @return true if another group exists with the same identity, false otherwise
+ */
+ private static boolean groupExists(final UserGroupProvider userGroupProvider, final String identifier, final String identity) {
for (Group group : userGroupProvider.getGroups()) {
if (!group.getIdentifier().equals(identifier)
&& group.getName().equals(identity)) {
@@ -209,7 +221,7 @@ public final class AuthorizerFactory {
@Override
public User addUser(User user) throws AuthorizationAccessException {
- if (tenantExists(baseConfigurableUserGroupProvider, user.getIdentifier(), user.getIdentity())) {
+ if (userExists(baseConfigurableUserGroupProvider, user.getIdentifier(), user.getIdentity())) {
throw new IllegalStateException(String.format("User/user group already exists with the identity '%s'.", user.getIdentity()));
}
return baseConfigurableUserGroupProvider.addUser(user);
@@ -222,7 +234,7 @@ public final class AuthorizerFactory {
@Override
public User updateUser(User user) throws AuthorizationAccessException {
- if (tenantExists(baseConfigurableUserGroupProvider, user.getIdentifier(), user.getIdentity())) {
+ if (userExists(baseConfigurableUserGroupProvider, user.getIdentifier(), user.getIdentity())) {
throw new IllegalStateException(String.format("User/user group already exists with the identity '%s'.", user.getIdentity()));
}
if (!baseConfigurableUserGroupProvider.isConfigurable(user)) {
@@ -241,7 +253,7 @@ public final class AuthorizerFactory {
@Override
public Group addGroup(Group group) throws AuthorizationAccessException {
- if (tenantExists(baseConfigurableUserGroupProvider, group.getIdentifier(), group.getName())) {
+ if (groupExists(baseConfigurableUserGroupProvider, group.getIdentifier(), group.getName())) {
throw new IllegalStateException(String.format("User/user group already exists with the identity '%s'.", group.getName()));
}
if (!allGroupUsersExist(baseConfigurableUserGroupProvider, group)) {
@@ -257,7 +269,7 @@ public final class AuthorizerFactory {
@Override
public Group updateGroup(Group group) throws AuthorizationAccessException {
- if (tenantExists(baseConfigurableUserGroupProvider, group.getIdentifier(), group.getName())) {
+ if (groupExists(baseConfigurableUserGroupProvider, group.getIdentifier(), group.getName())) {
throw new IllegalStateException(String.format("User/user group already exists with the identity '%s'.", group.getName()));
}
if (!allGroupUsersExist(baseConfigurableUserGroupProvider, group)) {
@@ -378,14 +390,14 @@ public final class AuthorizerFactory {
// ensure that only one group exists per identity
for (User user : userGroupProvider.getUsers()) {
- if (tenantExists(userGroupProvider, user.getIdentifier(), user.getIdentity())) {
+ if (userExists(userGroupProvider, user.getIdentifier(), user.getIdentity())) {
throw new AuthorizerCreationException(String.format("Found multiple users/user groups with identity '%s'.", user.getIdentity()));
}
}
// ensure that only one group exists per identity
for (Group group : userGroupProvider.getGroups()) {
- if (tenantExists(userGroupProvider, group.getIdentifier(), group.getName())) {
+ if (groupExists(userGroupProvider, group.getIdentifier(), group.getName())) {
throw new AuthorizerCreationException(String.format("Found multiple users/user groups with name '%s'.", group.getName()));
}
}
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/main/java/org/apache/nifi/authorization/AuthorizerFactoryBean.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/main/java/org/apache/nifi/authorization/AuthorizerFactoryBean.java
index 9d18e03..ec3ab96 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/main/java/org/apache/nifi/authorization/AuthorizerFactoryBean.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/main/java/org/apache/nifi/authorization/AuthorizerFactoryBean.java
@@ -161,8 +161,11 @@ public class AuthorizerFactoryBean implements FactoryBean, DisposableBean, UserG
authorizers.put(authorizer.getIdentifier(), createAuthorizer(authorizer.getIdentifier(), authorizer.getClazz(), authorizer.getClasspath()));
}
- // configure each authorizer
+ // configure each authorizer, except the authorizer that is selected in nifi.properties
for (final org.apache.nifi.authorization.generated.Authorizer provider : authorizerConfiguration.getAuthorizer()) {
+ if (provider.getIdentifier().equals(authorizerIdentifier)) {
+ continue;
+ }
final Authorizer instance = authorizers.get(provider.getIdentifier());
instance.onConfigured(loadAuthorizerConfiguration(provider.getIdentifier(), provider.getProperty()));
}
@@ -174,7 +177,23 @@ public class AuthorizerFactoryBean implements FactoryBean, DisposableBean, UserG
if (authorizer == null) {
throw new Exception(String.format("The specified authorizer '%s' could not be found.", authorizerIdentifier));
} else {
+ // install integrity checks
authorizer = AuthorizerFactory.installIntegrityChecks(authorizer);
+
+ // configure authorizer after integrity checks are installed
+ AuthorizerConfigurationContext authorizerConfigurationContext = null;
+ for (final org.apache.nifi.authorization.generated.Authorizer provider : authorizerConfiguration.getAuthorizer()) {
+ if (provider.getIdentifier().equals(authorizerIdentifier)) {
+ authorizerConfigurationContext = loadAuthorizerConfiguration(provider.getIdentifier(), provider.getProperty());
+ break;
+ }
+ }
+
+ if (authorizerConfigurationContext == null) {
+ throw new IllegalStateException("Unable to load configuration for authorizer with id: " + authorizerIdentifier);
+ }
+
+ authorizer.onConfigured(authorizerConfigurationContext);
}
}
}
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/test/java/org/apache/nifi/authorization/AuthorizerFactoryTest.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/test/java/org/apache/nifi/authorization/AuthorizerFactoryTest.java
index 167a7d4..6dbe4bb 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/test/java/org/apache/nifi/authorization/AuthorizerFactoryTest.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-authorizer/src/test/java/org/apache/nifi/authorization/AuthorizerFactoryTest.java
@@ -185,13 +185,7 @@ public class AuthorizerFactoryTest {
userGroupProvider.addGroup(group1);
User user = new User.Builder().identifier("user-id-2").identity("abc").build();
-
- try {
- userGroupProvider.addUser(user);
- Assert.fail("Should have thrown exception");
- } catch (IllegalStateException e) {
-
- }
+ userGroupProvider.addUser(user);
}
@Test
@@ -208,12 +202,7 @@ public class AuthorizerFactoryTest {
userGroupProvider.addUser(user);
Group group1 = new Group.Builder().identifier("group-id-1").name("abc").build();
- try {
- userGroupProvider.addGroup(group1);
- Assert.fail("Should have thrown exception");
- } catch (IllegalStateException e) {
-
- }
+ userGroupProvider.addGroup(group1);
}
@Test
[nifi] 12/14: NIFI-7095: ResetSetRecordSet: handle java.sql.Array
Types in normalizeValue method
Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
joewitt pushed a commit to branch support/nifi-1.11.x
in repository https://gitbox.apache.org/repos/asf/nifi.git
commit cfe1598641e0d760d695126add3fbe61a84a4f60
Author: Christian Zügner <ch...@osram-os.com>
AuthorDate: Tue Feb 4 10:34:07 2020 +0100
NIFI-7095: ResetSetRecordSet: handle java.sql.Array Types in normalizeValue method
Some jdbc drivers e.g. Oracle returns java.sql.Array objects for array types, not just Lists.
This commit also handles these cases, and extracts the primitive java arrays out of this jdbc holder class.
Signed-off-by: Pierre Villard <pi...@gmail.com>
This closes #4034.
---
.../org/apache/nifi/serialization/record/ResultSetRecordSet.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/ResultSetRecordSet.java b/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/ResultSetRecordSet.java
index ee47c63..953b511 100644
--- a/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/ResultSetRecordSet.java
+++ b/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/ResultSetRecordSet.java
@@ -128,7 +128,7 @@ public class ResultSetRecordSet implements RecordSet, Closeable {
}
@SuppressWarnings("rawtypes")
- private Object normalizeValue(final Object value) {
+ private Object normalizeValue(final Object value) throws SQLException {
if (value == null) {
return null;
}
@@ -137,6 +137,10 @@ public class ResultSetRecordSet implements RecordSet, Closeable {
return ((List) value).toArray();
}
+ if (value instanceof Array) {
+ return ((Array) value).getArray();
+ }
+
return value;
}
[nifi] 01/14: NIFI-7117: When SocketLoadBalancedFlowFileQueue
creates its array of Queue Partitions in the constructor,
it added the local partition as the first element in that list. This list
should be ordered the same across all nodes in the cluster. By making the
local partition the first in the array,
each node had a different ordering of these partitions. As a result,
Partition by Attribute strategy would constantly rebalance flowfiles that it
received to other node, and Single Node always transfe [...]
Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
joewitt pushed a commit to branch support/nifi-1.11.x
in repository https://gitbox.apache.org/repos/asf/nifi.git
commit c2c1a359a895bd2e88c1eb7d8862eceb1e9fec71
Author: Mark Payne <ma...@hotmail.com>
AuthorDate: Mon Feb 10 14:15:46 2020 -0500
NIFI-7117: When SocketLoadBalancedFlowFileQueue creates its array of Queue Partitions in the constructor, it added the local partition as the first element in that list. This list should be ordered the same across all nodes in the cluster. By making the local partition the first in the array, each node had a different ordering of these partitions. As a result, Partition by Attribute strategy would constantly rebalance flowfiles that it received to other node, and Single Node always tr [...]
Signed-off-by: Pierre Villard <pi...@gmail.com>
This closes #4045.
---
.../clustered/SocketLoadBalancedFlowFileQueue.java | 10 ++--
.../partition/CorrelationAttributePartitioner.java | 17 ++++++
.../apache/nifi/tests/system/NiFiClientUtil.java | 5 +-
.../tests/system/loadbalance/LoadBalanceIT.java | 61 ++++++++++++++++++++++
.../cli/impl/client/nifi/ConnectionClient.java | 2 +
.../client/nifi/impl/JerseyConnectionClient.java | 13 ++++-
6 files changed, 103 insertions(+), 5 deletions(-)
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/SocketLoadBalancedFlowFileQueue.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/SocketLoadBalancedFlowFileQueue.java
index e69daad..06c86d1 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/SocketLoadBalancedFlowFileQueue.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/SocketLoadBalancedFlowFileQueue.java
@@ -151,15 +151,19 @@ public class SocketLoadBalancedFlowFileQueue extends AbstractFlowFileQueue imple
// that is not the local node identifier. If the Local Node Identifier is not yet known, that's okay. When it becomes known,
// the queuePartitions array will be recreated with the appropriate partitions.
final List<QueuePartition> partitionList = new ArrayList<>();
- partitionList.add(localPartition);
final NodeIdentifier localNodeId = clusterCoordinator.getLocalNodeIdentifier();
for (final NodeIdentifier nodeId : sortedNodeIdentifiers) {
if (nodeId.equals(localNodeId)) {
- continue;
+ partitionList.add(localPartition);
+ } else {
+ partitionList.add(createRemotePartition(nodeId));
}
+ }
- partitionList.add(createRemotePartition(nodeId));
+ // Ensure that our list of queue partitions always contains the local partition.
+ if (!partitionList.contains(localPartition)) {
+ partitionList.add(localPartition);
}
queuePartitions = partitionList.toArray(new QueuePartition[0]);
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/partition/CorrelationAttributePartitioner.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/partition/CorrelationAttributePartitioner.java
index 7529098..70172ca 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/partition/CorrelationAttributePartitioner.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/partition/CorrelationAttributePartitioner.java
@@ -19,8 +19,16 @@ package org.apache.nifi.controller.queue.clustered.partition;
import com.google.common.hash.Hashing;
import org.apache.nifi.controller.repository.FlowFileRecord;
+import org.apache.nifi.flowfile.attributes.CoreAttributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.List;
public class CorrelationAttributePartitioner implements FlowFilePartitioner {
+ private static final Logger logger = LoggerFactory.getLogger(CorrelationAttributePartitioner.class);
+
private final String partitioningAttribute;
public CorrelationAttributePartitioner(final String partitioningAttribute) {
@@ -41,6 +49,15 @@ public class CorrelationAttributePartitioner implements FlowFilePartitioner {
index = Hashing.consistentHash(hash, partitions.length);
}
+ if (logger.isDebugEnabled()) {
+ final List<String> partitionDescriptions = new ArrayList<>(partitions.length);
+ for (final QueuePartition partition : partitions) {
+ partitionDescriptions.add(partition.getSwapPartitionName());
+ }
+
+ logger.debug("Assigning Partition {} to {} based on {}", index, flowFile.getAttribute(CoreAttributes.UUID.key()), partitionDescriptions);
+ }
+
return partitions[index];
}
diff --git a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/NiFiClientUtil.java b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/NiFiClientUtil.java
index 03e14c6..cd268b0 100644
--- a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/NiFiClientUtil.java
+++ b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/NiFiClientUtil.java
@@ -691,8 +691,11 @@ public class NiFiClientUtil {
final FlowFileSummaryDTO flowFileSummary = flowFileSummaries.get(flowFileIndex);
final String uuid = flowFileSummary.getUuid();
+ final String nodeId = flowFileSummary.getClusterNodeId();
- return nifiClient.getConnectionClient().getFlowFile(connectionId, uuid);
+ final FlowFileEntity flowFileEntity = nifiClient.getConnectionClient().getFlowFile(connectionId, uuid, nodeId);
+ flowFileEntity.getFlowFile().setClusterNodeId(nodeId);
+ return flowFileEntity;
}
public VariableRegistryUpdateRequestEntity updateVariableRegistry(final ProcessGroupEntity processGroup, final Map<String, String> variables) throws NiFiClientException, IOException {
diff --git a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/loadbalance/LoadBalanceIT.java b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/loadbalance/LoadBalanceIT.java
index 2a8b698..a0e93aa 100644
--- a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/loadbalance/LoadBalanceIT.java
+++ b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/loadbalance/LoadBalanceIT.java
@@ -31,6 +31,7 @@ import org.apache.nifi.web.api.dto.status.NodeConnectionStatusSnapshotDTO;
import org.apache.nifi.web.api.entity.ClusterEntity;
import org.apache.nifi.web.api.entity.ConnectionEntity;
import org.apache.nifi.web.api.entity.ConnectionStatusEntity;
+import org.apache.nifi.web.api.entity.FlowFileEntity;
import org.apache.nifi.web.api.entity.ProcessorEntity;
import org.junit.Assert;
import org.junit.Test;
@@ -38,8 +39,10 @@ import org.junit.Test;
import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.LongSummaryStatistics;
import java.util.Map;
+import java.util.Set;
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertEquals;
@@ -158,6 +161,64 @@ public class LoadBalanceIT extends NiFiSystemIT {
}
@Test
+ public void testPartitionByAttribute() throws NiFiClientException, IOException, InterruptedException {
+ final ProcessorEntity generate = getClientUtil().createProcessor("GenerateFlowFile");
+ final ProcessorEntity count = getClientUtil().createProcessor("CountEvents");
+
+ final ConnectionEntity connection = getClientUtil().createConnection(generate, count, "success");
+ getClientUtil().setAutoTerminatedRelationships(count, "success");
+
+ // Configure Processor to generate 10 FlowFiles, each 1 MB, on each node, for a total of 20 FlowFiles.
+ final Map<String, String> generateProperties = new HashMap<>();
+ generateProperties.put("File Size", "1 MB");
+ generateProperties.put("Batch Size", "10");
+ generateProperties.put("number", "0");
+ getClientUtil().updateProcessorProperties(generate, generateProperties);
+ getClientUtil().updateProcessorExecutionNode(generate, ExecutionNode.PRIMARY);
+
+ // Round Robin between nodes. This should result in 10 FlowFiles on each node.
+ getClientUtil().updateConnectionLoadBalancing(connection, LoadBalanceStrategy.PARTITION_BY_ATTRIBUTE, LoadBalanceCompression.DO_NOT_COMPRESS, "number");
+
+ // Queue 100 FlowFiles. 10 with number=0, 10 with number=1, 10 with number=2, etc. to up 10 with number=9
+ for (int i=1; i <= 10; i++) {
+ // Generate the data.
+ getNifiClient().getProcessorClient().startProcessor(generate);
+
+ final int expectedQueueSize = 10 * i;
+
+ // Wait until all 10 FlowFiles are queued up.
+ waitFor(() -> {
+ final ConnectionStatusEntity statusEntity = getConnectionStatus(connection.getId());
+ return statusEntity.getConnectionStatus().getAggregateSnapshot().getFlowFilesQueued() == expectedQueueSize;
+ });
+
+
+ getNifiClient().getProcessorClient().stopProcessor(generate);
+ getClientUtil().waitForStoppedProcessor(generate.getId());
+
+ generateProperties.put("number", String.valueOf(i));
+ getClientUtil().updateProcessorProperties(generate, generateProperties);
+ }
+
+ // Wait until load balancing is complete
+ waitFor(() -> isConnectionDoneLoadBalancing(connection.getId()));
+
+ final Map<String, Set<String>> nodesByAttribute = new HashMap<>();
+ for (int i=0; i < 100; i++) {
+ final FlowFileEntity flowFile = getClientUtil().getQueueFlowFile(connection.getId(), i);
+ final String numberValue = flowFile.getFlowFile().getAttributes().get("number");
+ final Set<String> nodes = nodesByAttribute.computeIfAbsent(numberValue, key -> new HashSet<>());
+ nodes.add(flowFile.getFlowFile().getClusterNodeId());
+ }
+
+ assertEquals(10, nodesByAttribute.size());
+ for (final Map.Entry<String, Set<String>> entry : nodesByAttribute.entrySet()) {
+ final Set<String> nodes = entry.getValue();
+ assertEquals("FlowFile with attribute number=" + entry.getKey() + " went to nodes " + nodes, 1, nodes.size());
+ }
+ }
+
+ @Test
public void testOffload() throws NiFiClientException, IOException, InterruptedException {
final ProcessorEntity generate = getClientUtil().createProcessor("GenerateFlowFile");
final ProcessorEntity count = getClientUtil().createProcessor("CountEvents");
diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/client/nifi/ConnectionClient.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/client/nifi/ConnectionClient.java
index a486a65..f5c07d1 100644
--- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/client/nifi/ConnectionClient.java
+++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/client/nifi/ConnectionClient.java
@@ -47,4 +47,6 @@ public interface ConnectionClient {
ListingRequestEntity deleteListingRequest(String connectionId, String listingRequestId) throws NiFiClientException, IOException;
FlowFileEntity getFlowFile(String connectionId, String flowFileUuid) throws NiFiClientException, IOException;
+
+ FlowFileEntity getFlowFile(String connectionId, String flowFileUuid, String nodeId) throws NiFiClientException, IOException;
}
diff --git a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/client/nifi/impl/JerseyConnectionClient.java b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/client/nifi/impl/JerseyConnectionClient.java
index f4180fe..ffe038e 100644
--- a/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/client/nifi/impl/JerseyConnectionClient.java
+++ b/nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/client/nifi/impl/JerseyConnectionClient.java
@@ -242,8 +242,15 @@ public class JerseyConnectionClient extends AbstractJerseyClient implements Conn
});
}
+
@Override
public FlowFileEntity getFlowFile(final String connectionId, final String flowFileUuid) throws NiFiClientException, IOException {
+ return getFlowFile(connectionId, flowFileUuid, null);
+ }
+
+
+ @Override
+ public FlowFileEntity getFlowFile(final String connectionId, final String flowFileUuid, final String nodeId) throws NiFiClientException, IOException {
if (connectionId == null) {
throw new IllegalArgumentException("Connection ID cannot be null");
}
@@ -252,11 +259,15 @@ public class JerseyConnectionClient extends AbstractJerseyClient implements Conn
}
return executeAction("Error retrieving FlowFile", () -> {
- final WebTarget target = flowFileQueueTarget
+ WebTarget target = flowFileQueueTarget
.path("flowfiles/{uuid}")
.resolveTemplate("id", connectionId)
.resolveTemplate("uuid", flowFileUuid);
+ if (nodeId != null) {
+ target = target.queryParam("clusterNodeId", nodeId);
+ }
+
return getRequestBuilder(target).get(FlowFileEntity.class);
});
}
[nifi] 10/14: NIFI-7075 Add missing FlowFile core attributes to
Developer Guide (#4030)
Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
joewitt pushed a commit to branch support/nifi-1.11.x
in repository https://gitbox.apache.org/repos/asf/nifi.git
commit 82e46674c67bc12424ff53f4232fab9762c2cf97
Author: Andrew Lim <an...@gmail.com>
AuthorDate: Thu Feb 6 14:17:39 2020 -0500
NIFI-7075 Add missing FlowFile core attributes to Developer Guide (#4030)
Signed-off-by: Andy LoPresto <al...@apache.org>
---
nifi-docs/src/main/asciidoc/developer-guide.adoc | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/nifi-docs/src/main/asciidoc/developer-guide.adoc b/nifi-docs/src/main/asciidoc/developer-guide.adoc
index c0c98df..2a2c93c 100644
--- a/nifi-docs/src/main/asciidoc/developer-guide.adoc
+++ b/nifi-docs/src/main/asciidoc/developer-guide.adoc
@@ -132,12 +132,18 @@ attribute within the `CoreAttributes` enum.
- Filename ("filename"): The filename of the FlowFile. The filename should not contain any directory structure.
+- File Size ("fileSize"): The file size of the FlowFile in bytes.
+
- UUID ("uuid"): A Universally Unique Identifier assigned to this FlowFile that distinguishes the FlowFile from other FlowFiles in the system.
- Path ("path"): The FlowFile's path indicates the relative directory to which a FlowFile belongs and does not contain the filename.
- Absolute Path ("absolute.path"): The FlowFile's absolute path indicates the absolute directory to which a FlowFile belongs and does not contain the filename.
+- Entry Date ("entryDate"): The date and time at which the FlowFile entered the system (i.e., was created). The value of this attribute is a number that represents the number of milliseconds since midnight, Jan. 1, 1970 (UTC).
+
+- Lineage Start Date ("lineageStartDate"): Any time that a FlowFile is cloned, merged, or split, this results in a "child" FlowFile being created. As those children are then cloned, merged, or split, a chain of ancestors is built. This value represents the date and time at which the oldest ancestor entered the system. Another way to think about this is that this attribute represents the latency of the FlowFile through the system. The value is a number that represents the number of millis [...]
+
- Priority ("priority"): A numeric value indicating the FlowFile priority.
- MIME Type ("mime.type"): The MIME Type of this FlowFile.
[nifi] 06/14: NIFI-7082 Updated tls-toolkit default server and
client certificates validity days to 825 days. (#4046)
Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
joewitt pushed a commit to branch support/nifi-1.11.x
in repository https://gitbox.apache.org/repos/asf/nifi.git
commit a16754b18baffef45bdcd4768f14b2373052616d
Author: M Tien <56...@users.noreply.github.com>
AuthorDate: Mon Feb 10 20:22:49 2020 -0500
NIFI-7082 Updated tls-toolkit default server and client certificates validity days to 825 days. (#4046)
Signed-off-by: Andy LoPresto <al...@apache.org>
---
.../nifi-toolkit-assembly/src/main/resources/conf/config-client.json | 2 +-
.../nifi-toolkit-assembly/src/main/resources/conf/config-server.json | 2 +-
.../main/java/org/apache/nifi/toolkit/tls/configuration/TlsConfig.java | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/nifi-toolkit/nifi-toolkit-assembly/src/main/resources/conf/config-client.json b/nifi-toolkit/nifi-toolkit-assembly/src/main/resources/conf/config-client.json
index e572bc1..ea0d333 100644
--- a/nifi-toolkit/nifi-toolkit-assembly/src/main/resources/conf/config-client.json
+++ b/nifi-toolkit/nifi-toolkit-assembly/src/main/resources/conf/config-client.json
@@ -7,7 +7,7 @@
"caHostname" : "localhost",
"trustStore" : "clientTrustStore",
"trustStoreType" : "jks",
- "days" : 1095,
+ "days" : 825,
"keySize" : 2048,
"keyPairAlgorithm" : "RSA",
"signingAlgorithm" : "SHA256WITHRSA"
diff --git a/nifi-toolkit/nifi-toolkit-assembly/src/main/resources/conf/config-server.json b/nifi-toolkit/nifi-toolkit-assembly/src/main/resources/conf/config-server.json
index fae89ed..8044a6d 100644
--- a/nifi-toolkit/nifi-toolkit-assembly/src/main/resources/conf/config-server.json
+++ b/nifi-toolkit/nifi-toolkit-assembly/src/main/resources/conf/config-server.json
@@ -4,7 +4,7 @@
"token" : "myTestTokenUseSomethingStronger",
"caHostname" : "localhost",
"port" : 8443,
- "days" : 1095,
+ "days" : 825,
"keySize" : 2048,
"keyPairAlgorithm" : "RSA",
"signingAlgorithm" : "SHA256WITHRSA"
diff --git a/nifi-toolkit/nifi-toolkit-tls/src/main/java/org/apache/nifi/toolkit/tls/configuration/TlsConfig.java b/nifi-toolkit/nifi-toolkit-tls/src/main/java/org/apache/nifi/toolkit/tls/configuration/TlsConfig.java
index 5e440a7..2b7f8a1 100644
--- a/nifi-toolkit/nifi-toolkit-tls/src/main/java/org/apache/nifi/toolkit/tls/configuration/TlsConfig.java
+++ b/nifi-toolkit/nifi-toolkit-tls/src/main/java/org/apache/nifi/toolkit/tls/configuration/TlsConfig.java
@@ -28,7 +28,7 @@ public class TlsConfig {
public static final String DEFAULT_HOSTNAME = "localhost";
public static final String DEFAULT_KEY_STORE_TYPE = "jks";
public static final int DEFAULT_PORT = 8443;
- public static final int DEFAULT_DAYS = 3 * 365;
+ public static final int DEFAULT_DAYS = 825;
public static final int DEFAULT_KEY_SIZE = 2048;
public static final String DEFAULT_KEY_PAIR_ALGORITHM = "RSA";
public static final String DEFAULT_SIGNING_ALGORITHM = "SHA256WITHRSA";
[nifi] 02/14: NIFI-6491 Improve installation instructions in Admin
Guide and Getting Starting Guide Clarified homebrew install instructions.
Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
joewitt pushed a commit to branch support/nifi-1.11.x
in repository https://gitbox.apache.org/repos/asf/nifi.git
commit 6c7aa59532f65bb1a7d7a09ef8797e8804585b7f
Author: Andrew Lim <an...@gmail.com>
AuthorDate: Fri Jan 31 12:12:29 2020 -0500
NIFI-6491 Improve installation instructions in Admin Guide and Getting Starting Guide
Clarified homebrew install instructions.
This closes #4029.
Signed-off-by: Andy LoPresto <al...@apache.org>
---
.../src/main/asciidoc/administration-guide.adoc | 15 ++++++++-------
nifi-docs/src/main/asciidoc/getting-started.adoc | 20 +++++++++++++-------
2 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/nifi-docs/src/main/asciidoc/administration-guide.adoc b/nifi-docs/src/main/asciidoc/administration-guide.adoc
index 54f0d1c..7093fbd 100644
--- a/nifi-docs/src/main/asciidoc/administration-guide.adoc
+++ b/nifi-docs/src/main/asciidoc/administration-guide.adoc
@@ -19,10 +19,11 @@ Apache NiFi Team <de...@nifi.apache.org>
:homepage: http://nifi.apache.org
:linkattrs:
+[[system_requirements]]
== System Requirements
Apache NiFi can run on something as simple as a laptop, but it can also be clustered across many enterprise-class servers. Therefore, the amount of hardware and memory needed will depend on the size and nature of the dataflow involved. The data is stored on disk while NiFi is processing it. So NiFi needs to have sufficient disk space allocated for its various repositories, particularly the content repository, flowfile repository, and provenance repository (see the <<system_properties>> s [...]
-* Requires Java 8 or newer
+* Requires Java 8 or Java 11
* Supported Operating Systems:
** Linux
** Unix
@@ -34,7 +35,7 @@ Apache NiFi can run on something as simple as a laptop, but it can also be clust
** Google Chrome: Current & (Current - 1)
** Safari: Current & (Current - 1)
-**Note** Under sustained and extremely high throughput the CodeCache settings may need to be tuned to avoid sudden performance loss. See the <<bootstrap_properties>> section for more information.
+NOTE: Under sustained and extremely high throughput the CodeCache settings may need to be tuned to avoid sudden performance loss. See the <<bootstrap_properties>> section for more information.
== How to install and start NiFi
@@ -43,11 +44,11 @@ Apache NiFi can run on something as simple as a laptop, but it can also be clust
** Make any desired edits in files found under `<installdir>/conf`
*** At a minimum, we recommend editing the _nifi.properties_ file and entering a password for the `nifi.sensitive.props.key` (see <<system_properties>> below)
** From the `<installdir>/bin` directory, execute the following commands by typing `./nifi.sh <command>`:
-*** start: starts NiFi in the background
-*** stop: stops NiFi that is running in the background
-*** status: provides the current status of NiFi
-*** run: runs NiFi in the foreground and waits for a Ctrl-C to initiate shutdown of NiFi
-*** install: installs NiFi as a service that can then be controlled via
+*** `start`: starts NiFi in the background
+*** `stop`: stops NiFi that is running in the background
+*** `status`: provides the current status of NiFi
+*** `run`: runs NiFi in the foreground and waits for a Ctrl-C to initiate shutdown of NiFi
+*** `install`: installs NiFi as a service that can then be controlled via
**** `service nifi start`
**** `service nifi stop`
**** `service nifi status`
diff --git a/nifi-docs/src/main/asciidoc/getting-started.adoc b/nifi-docs/src/main/asciidoc/getting-started.adoc
index bcb0d5e..c5ce13a 100644
--- a/nifi-docs/src/main/asciidoc/getting-started.adoc
+++ b/nifi-docs/src/main/asciidoc/getting-started.adoc
@@ -58,14 +58,20 @@ dataflows.
== Downloading and Installing NiFi
-NiFi can be downloaded from the link:http://nifi.apache.org/download.html[NiFi Downloads Page^]. There are two packaging options
-available: a "tarball" that is tailored more to Linux and a zip file that is more applicable for Windows users. Mac OS X users
-may also use the tarball or can install via Homebrew.
+WARNING: Before proceeding, check the Admin Guide to confirm you have the <<administration-guide.adoc#system_requirements,minimum system requirements>> to install and run NiFi.
-To install via Homebrew, simply run the command `brew install nifi`.
+NiFi can be downloaded from the link:http://nifi.apache.org/download.html[NiFi Downloads page^]. There are two packaging options
+available:
+
+- a "tarball" (tar.gz) that is tailored more to Linux
+- a zip file that is more applicable for Windows users
+
+Mac OS X users may also use the tarball or can install via link:https://brew.sh[Homebrew^] by simply running the command `brew install nifi` from the command line terminal.
+
+NOTE: NiFi requires Java 8 or 11. It is recommended that you have installed one of these Java versions prior to installing NiFi via Homebrew. Homebrew is aware NiFi depends on Java but not the specific supported versions, so it may prompt to install an incompatible JDK as part of its NiFi install.
For users who are not running OS X or do not have Homebrew installed, after downloading the version of NiFi that you
-would like to use simply extract the archive to the location that you wish to run the application from.
+would like to use, simply extract the archive to the location that you wish to run the application from.
For information on how to configure the instance of NiFi (for example, to configure security, data storage
configuration, or the port that NiFi is running on), see the link:administration-guide.html[Admin Guide].
@@ -92,9 +98,9 @@ To run NiFi in the foreground, run `bin/nifi.sh run`. This will leave the applic
the user presses Ctrl-C. At that time, it will initiate shutdown of the application.
To run NiFi in the background, instead run `bin/nifi.sh start`. This will initiate the application to
-begin running. To check the status and see if NiFi is currently running, execute the command `bin/nifi.sh status`.
-NiFi can be shutdown by executing the command `bin/nifi.sh stop`.
+begin running. To check the status and see if NiFi is currently running, execute the command `bin/nifi.sh status`. NiFi can be shutdown by executing the command `bin/nifi.sh stop`.
+If NiFi was installed with Homebrew, run the commands `nifi start` or `nifi stop` from anywhere in your file system to start or stop NiFi.
=== Installing as a Service
[nifi] 08/14: NIFI-7106 - Add parent name and parent path in
SiteToSiteStatusReportingTask
Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
joewitt pushed a commit to branch support/nifi-1.11.x
in repository https://gitbox.apache.org/repos/asf/nifi.git
commit 948fda38169835ec9e7e1732e6a439140e5165e6
Author: Pierre Villard <pi...@gmail.com>
AuthorDate: Tue Feb 4 22:35:11 2020 -0500
NIFI-7106 - Add parent name and parent path in SiteToSiteStatusReportingTask
Signed-off-by: Matthew Burgess <ma...@apache.org>
This closes #4039
---
.../reporting/SiteToSiteStatusReportingTask.java | 62 +++++++++++++---------
.../additionalDetails.html | 2 +
.../src/main/resources/schema-status.avsc | 2 +
.../TestSiteToSiteStatusReportingTask.java | 5 ++
4 files changed, 46 insertions(+), 25 deletions(-)
diff --git a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/SiteToSiteStatusReportingTask.java b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/SiteToSiteStatusReportingTask.java
index 2466827..31009f8 100644
--- a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/SiteToSiteStatusReportingTask.java
+++ b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/SiteToSiteStatusReportingTask.java
@@ -94,6 +94,7 @@ public class SiteToSiteStatusReportingTask extends AbstractSiteToSiteReportingTa
private volatile Pattern componentTypeFilter;
private volatile Pattern componentNameFilter;
+ private volatile Map<String,String> processGroupIDToPath;
public SiteToSiteStatusReportingTask() throws IOException {
final InputStream schema = getClass().getClassLoader().getResourceAsStream("schema-status.avsc");
@@ -122,6 +123,9 @@ public class SiteToSiteStatusReportingTask extends AbstractSiteToSiteReportingTa
componentTypeFilter = Pattern.compile(context.getProperty(COMPONENT_TYPE_FILTER_REGEX).evaluateAttributeExpressions().getValue());
componentNameFilter = Pattern.compile(context.getProperty(COMPONENT_NAME_FILTER_REGEX).evaluateAttributeExpressions().getValue());
+ // initialize the map
+ processGroupIDToPath = new HashMap<String,String>();
+
final ProcessGroupStatus procGroupStatus = context.getEventAccess().getControllerStatus();
final String rootGroupName = procGroupStatus == null ? null : procGroupStatus.getName();
@@ -145,8 +149,8 @@ public class SiteToSiteStatusReportingTask extends AbstractSiteToSiteReportingTa
df.setTimeZone(TimeZone.getTimeZone("Z"));
final JsonArrayBuilder arrayBuilder = factory.createArrayBuilder();
- serializeProcessGroupStatus(arrayBuilder, factory, procGroupStatus, df, hostname, rootGroupName,
- platform, null, new Date(), allowNullValues);
+ serializeProcessGroupStatus(arrayBuilder, factory, procGroupStatus, df,
+ hostname, rootGroupName, platform, null, new Date(), allowNullValues);
final JsonArray jsonArray = arrayBuilder.build();
@@ -230,22 +234,26 @@ public class SiteToSiteStatusReportingTask extends AbstractSiteToSiteReportingTa
* The root process group name
* @param platform
* The configured platform
- * @param parentId
- * The parent's component id
+ * @param parent
+ * The parent's process group status object
* @param currentDate
* The current date
* @param allowNullValues
* Allow null values
*/
private void serializeProcessGroupStatus(final JsonArrayBuilder arrayBuilder, final JsonBuilderFactory factory,
- final ProcessGroupStatus status, final DateFormat df,
- final String hostname, final String applicationName, final String platform, final String parentId, final Date currentDate, Boolean allowNullValues) {
+ final ProcessGroupStatus status, final DateFormat df, final String hostname, final String applicationName,
+ final String platform, final ProcessGroupStatus parent, final Date currentDate, Boolean allowNullValues) {
final JsonObjectBuilder builder = factory.createObjectBuilder();
- final String componentType = (parentId == null) ? "RootProcessGroup" : "ProcessGroup";
+ final String componentType = parent == null ? "RootProcessGroup" : "ProcessGroup";
final String componentName = status.getName();
+ if(parent == null) {
+ processGroupIDToPath.put(status.getId(), "NiFi Flow");
+ }
+
if (componentMatchesFilters(componentType, componentName)) {
- addCommonFields(builder, df, hostname, applicationName, platform, parentId, currentDate,
+ addCommonFields(builder, df, hostname, applicationName, platform, parent, currentDate,
componentType, componentName, allowNullValues);
addField(builder, "componentId", status.getId(), allowNullValues);
@@ -271,40 +279,43 @@ public class SiteToSiteStatusReportingTask extends AbstractSiteToSiteReportingTa
}
for(ProcessGroupStatus childGroupStatus : status.getProcessGroupStatus()) {
+
+ processGroupIDToPath.put(childGroupStatus.getId(), processGroupIDToPath.get(status.getId()) + " / " + childGroupStatus.getName());
+
serializeProcessGroupStatus(arrayBuilder, factory, childGroupStatus, df, hostname,
- applicationName, platform, status.getId(), currentDate, allowNullValues);
+ applicationName, platform, status, currentDate, allowNullValues);
}
for(ProcessorStatus processorStatus : status.getProcessorStatus()) {
serializeProcessorStatus(arrayBuilder, factory, processorStatus, df, hostname,
- applicationName, platform, status.getId(), currentDate, allowNullValues);
+ applicationName, platform, status, currentDate, allowNullValues);
}
for(ConnectionStatus connectionStatus : status.getConnectionStatus()) {
serializeConnectionStatus(arrayBuilder, factory, connectionStatus, df, hostname,
- applicationName, platform, status.getId(), currentDate, allowNullValues);
+ applicationName, platform, status, currentDate, allowNullValues);
}
for(PortStatus portStatus : status.getInputPortStatus()) {
serializePortStatus("InputPort", arrayBuilder, factory, portStatus, df,
- hostname, applicationName, platform, status.getId(), currentDate, allowNullValues);
+ hostname, applicationName, platform, status, currentDate, allowNullValues);
}
for(PortStatus portStatus : status.getOutputPortStatus()) {
serializePortStatus("OutputPort", arrayBuilder, factory, portStatus, df,
- hostname, applicationName, platform, status.getId(), currentDate, allowNullValues);
+ hostname, applicationName, platform, status, currentDate, allowNullValues);
}
for(RemoteProcessGroupStatus remoteProcessGroupStatus : status.getRemoteProcessGroupStatus()) {
serializeRemoteProcessGroupStatus(arrayBuilder, factory, remoteProcessGroupStatus, df, hostname,
- applicationName, platform, status.getId(), currentDate, allowNullValues);
+ applicationName, platform, status, currentDate, allowNullValues);
}
}
private void serializeRemoteProcessGroupStatus(final JsonArrayBuilder arrayBuilder, final JsonBuilderFactory factory,
final RemoteProcessGroupStatus status, final DateFormat df, final String hostname, final String applicationName,
- final String platform, final String parentId, final Date currentDate, final Boolean allowNullValues) {
+ final String platform, final ProcessGroupStatus parent, final Date currentDate, final Boolean allowNullValues) {
final JsonObjectBuilder builder = factory.createObjectBuilder();
final String componentType = "RemoteProcessGroup";
final String componentName = status.getName();
if (componentMatchesFilters(componentType, componentName)) {
- addCommonFields(builder, df, hostname, applicationName, platform, parentId, currentDate,
+ addCommonFields(builder, df, hostname, applicationName, platform, parent, currentDate,
componentType, componentName, allowNullValues);
addField(builder, "componentId", status.getId(), allowNullValues);
@@ -324,12 +335,12 @@ public class SiteToSiteStatusReportingTask extends AbstractSiteToSiteReportingTa
}
private void serializePortStatus(final String componentType, final JsonArrayBuilder arrayBuilder, final JsonBuilderFactory factory, final PortStatus status,
- final DateFormat df, final String hostname, final String applicationName, final String platform, final String parentId, final Date currentDate, final Boolean allowNullValues) {
+ final DateFormat df, final String hostname, final String applicationName, final String platform, final ProcessGroupStatus parent, final Date currentDate, final Boolean allowNullValues) {
final JsonObjectBuilder builder = factory.createObjectBuilder();
final String componentName = status.getName();
if (componentMatchesFilters(componentType, componentName)) {
- addCommonFields(builder, df, hostname, applicationName, platform, parentId, currentDate,
+ addCommonFields(builder, df, hostname, applicationName, platform, parent, currentDate,
componentType, componentName, allowNullValues);
addField(builder, "componentId", status.getId(), allowNullValues);
@@ -350,13 +361,13 @@ public class SiteToSiteStatusReportingTask extends AbstractSiteToSiteReportingTa
}
private void serializeConnectionStatus(final JsonArrayBuilder arrayBuilder, final JsonBuilderFactory factory, final ConnectionStatus status, final DateFormat df,
- final String hostname, final String applicationName, final String platform, final String parentId, final Date currentDate, final Boolean allowNullValues) {
+ final String hostname, final String applicationName, final String platform, final ProcessGroupStatus parent, final Date currentDate, final Boolean allowNullValues) {
final JsonObjectBuilder builder = factory.createObjectBuilder();
final String componentType = "Connection";
final String componentName = status.getName();
if (componentMatchesFilters(componentType, componentName)) {
- addCommonFields(builder, df, hostname, applicationName, platform, parentId, currentDate,
+ addCommonFields(builder, df, hostname, applicationName, platform, parent, currentDate,
componentType, componentName, allowNullValues);
addField(builder, "componentId", status.getId(), allowNullValues);
@@ -383,13 +394,13 @@ public class SiteToSiteStatusReportingTask extends AbstractSiteToSiteReportingTa
}
private void serializeProcessorStatus(final JsonArrayBuilder arrayBuilder, final JsonBuilderFactory factory, final ProcessorStatus status, final DateFormat df,
- final String hostname, final String applicationName, final String platform, final String parentId, final Date currentDate, final Boolean allowNullValues) {
+ final String hostname, final String applicationName, final String platform, final ProcessGroupStatus parent, final Date currentDate, final Boolean allowNullValues) {
final JsonObjectBuilder builder = factory.createObjectBuilder();
final String componentType = "Processor";
final String componentName = status.getName();
if (componentMatchesFilters(componentType, componentName)) {
- addCommonFields(builder, df, hostname, applicationName, platform, parentId, currentDate, componentType, componentName, allowNullValues);
+ addCommonFields(builder, df, hostname, applicationName, platform, parent, currentDate, componentType, componentName, allowNullValues);
addField(builder, "componentId", status.getId(), allowNullValues);
addField(builder, "processorType", status.getType(), allowNullValues);
@@ -418,7 +429,7 @@ public class SiteToSiteStatusReportingTask extends AbstractSiteToSiteReportingTa
}
private void addCommonFields(final JsonObjectBuilder builder, final DateFormat df, final String hostname,
- final String applicationName, final String platform, final String parentId, final Date currentDate,
+ final String applicationName, final String platform, final ProcessGroupStatus parent, final Date currentDate,
final String componentType, final String componentName, Boolean allowNullValues) {
addField(builder, "statusId", UUID.randomUUID().toString(), allowNullValues);
addField(builder, "timestampMillis", currentDate.getTime(), allowNullValues);
@@ -426,12 +437,13 @@ public class SiteToSiteStatusReportingTask extends AbstractSiteToSiteReportingTa
addField(builder, "actorHostname", hostname, allowNullValues);
addField(builder, "componentType", componentType, allowNullValues);
addField(builder, "componentName", componentName, allowNullValues);
- addField(builder, "parentId", parentId, allowNullValues);
+ addField(builder, "parentId", parent == null ? null : parent.getId(), allowNullValues);
+ addField(builder, "parentName", parent == null ? null : parent.getName(), allowNullValues);
+ addField(builder, "parentPath", parent == null ? null : processGroupIDToPath.get(parent.getId()), allowNullValues);
addField(builder, "platform", platform, allowNullValues);
addField(builder, "application", applicationName, allowNullValues);
}
-
private static void addField(final JsonObjectBuilder builder, final JsonBuilderFactory factory, final String key, final Map<String, Long> values, final Boolean allowNullValues) {
if (values != null) {
diff --git a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/docs/org.apache.nifi.reporting.SiteToSiteStatusReportingTask/additionalDetails.html b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/docs/org.apache.nifi.reporting.SiteToSiteStatusReportingTask/additionalDetails.html
index dad5656..f6dca55 100644
--- a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/docs/org.apache.nifi.reporting.SiteToSiteStatusReportingTask/additionalDetails.html
+++ b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/docs/org.apache.nifi.reporting.SiteToSiteStatusReportingTask/additionalDetails.html
@@ -51,6 +51,8 @@
{ "name" : "componentType", "type" : "string"},
{ "name" : "componentName", "type" : "string"},
{ "name" : "parentId", "type" : ["string", "null"]},
+ { "name" : "parentName", "type" : ["string", "null"]},
+ { "name" : "parentPath", "type" : ["string", "null"]},
{ "name" : "platform", "type" : "string"},
{ "name" : "application", "type" : "string"},
{ "name" : "componentId", "type" : "string"},
diff --git a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/schema-status.avsc b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/schema-status.avsc
index 1932c7e..70e4af1 100644
--- a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/schema-status.avsc
+++ b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/schema-status.avsc
@@ -12,6 +12,8 @@
{ "name" : "componentType", "type" : "string"},
{ "name" : "componentName", "type" : "string"},
{ "name" : "parentId", "type" : ["string", "null"]},
+ { "name" : "parentName", "type" : ["string", "null"]},
+ { "name" : "parentPath", "type" : ["string", "null"]},
{ "name" : "platform", "type" : "string"},
{ "name" : "application", "type" : "string"},
{ "name" : "componentId", "type" : "string"},
diff --git a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteStatusReportingTask.java b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteStatusReportingTask.java
index 9914bf1..3dfab49 100644
--- a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteStatusReportingTask.java
+++ b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/test/java/org/apache/nifi/reporting/TestSiteToSiteStatusReportingTask.java
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
import java.io.ByteArrayInputStream;
@@ -333,6 +334,10 @@ public class TestSiteToSiteStatusReportingTask {
final String msg = new String(task.dataSent.get(0), StandardCharsets.UTF_8);
JsonReader jsonReader = Json.createReader(new ByteArrayInputStream(msg.getBytes()));
JsonObject object = jsonReader.readArray().getJsonObject(0);
+ JsonString parentName = object.getJsonString("parentName");
+ assertTrue(parentName.getString().startsWith("Awesome.1-"));
+ JsonString parentPath = object.getJsonString("parentPath");
+ assertTrue(parentPath.getString().startsWith("NiFi Flow / Awesome.1"));
JsonString runStatus = object.getJsonString("runStatus");
assertEquals(RunStatus.Running.name(), runStatus.getString());
JsonNumber inputBytes = object.getJsonNumber("inputBytes");
[nifi] 05/14: NIFI-7053 Update Toolkit Guide with macOS 10.15 requirements for trus… (#4018)
Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
joewitt pushed a commit to branch support/nifi-1.11.x
in repository https://gitbox.apache.org/repos/asf/nifi.git
commit 85cc5689e636bd3e727872e8feb2834cd7ffeb7a
Author: Andrew Lim <an...@gmail.com>
AuthorDate: Fri Jan 31 13:18:05 2020 -0500
NIFI-7053 Update Toolkit Guide with macOS 10.15 requirements for trus… (#4018)
* NIFI-7053 Update Toolkit Guide with macOS 10.15 requirements for trusted certificates
* Simplified note about trusted certs in macOS 10.15
Signed-off-by: Andy LoPresto <al...@apache.org>
---
nifi-docs/src/main/asciidoc/toolkit-guide.adoc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/nifi-docs/src/main/asciidoc/toolkit-guide.adoc b/nifi-docs/src/main/asciidoc/toolkit-guide.adoc
index 44e67e2..baaf555 100644
--- a/nifi-docs/src/main/asciidoc/toolkit-guide.adoc
+++ b/nifi-docs/src/main/asciidoc/toolkit-guide.adoc
@@ -721,6 +721,8 @@ Example usage to send a FlowFile with the contents of "hey nifi" to a local unse
== TLS Toolkit
In order to facilitate the secure setup of NiFi, you can use the `tls-toolkit` command line utility to automatically generate the required keystores, truststore, and relevant configuration files. This is especially useful for securing multiple NiFi nodes, which can be a tedious and error-prone process.
+NOTE: Please note that there are new requirements for trusted certificates in macOS 10.15. Details can be found link:https://support.apple.com/en-us/HT210176[here^], but of particular importance is that all TLS server certificates issued after July 1, 2019 must have a validity period of 825 days or less.
+
[[wildcard_certificates]]
=== Wildcard Certificates
Wildcard certificates (i.e. two nodes `node1.nifi.apache.org` and `node2.nifi.apache.org` being assigned the same certificate with a CN or SAN entry of `+*.nifi.apache.org+`) are *not officially supported* and *not recommended*. There are numerous disadvantages to using wildcard certificates, and a cluster working with wildcard certificates has occurred in previous versions out of lucky accidents, not intentional support. Wildcard SAN entries are acceptable *if* each cert maintains an ad [...]
[nifi] 07/14: NIFI-7105 - fix NPE for counters in
SiteToSiteStatusReportingTask (#4038)
Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
joewitt pushed a commit to branch support/nifi-1.11.x
in repository https://gitbox.apache.org/repos/asf/nifi.git
commit b7c7d2fa589b15695744ee7bcb24562cbe7db486
Author: Pierre Villard <pi...@gmail.com>
AuthorDate: Thu Feb 6 14:10:48 2020 -0500
NIFI-7105 - fix NPE for counters in SiteToSiteStatusReportingTask (#4038)
Signed-off-by: Andy LoPresto <al...@apache.org>
---
.../additionalDetails.html | 2 +-
.../src/main/resources/schema-status.avsc | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/docs/org.apache.nifi.reporting.SiteToSiteStatusReportingTask/additionalDetails.html b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/docs/org.apache.nifi.reporting.SiteToSiteStatusReportingTask/additionalDetails.html
index ab32bad..dad5656 100644
--- a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/docs/org.apache.nifi.reporting.SiteToSiteStatusReportingTask/additionalDetails.html
+++ b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/docs/org.apache.nifi.reporting.SiteToSiteStatusReportingTask/additionalDetails.html
@@ -123,7 +123,7 @@
{ "name" : "invocations", "type" : ["long", "null"]},
{ "name" : "processingNanos", "type" : ["long", "null"]},
{ "name" : "executionNode", "type" : ["string", "null"]},
- { "name" : "counters", "type": { "type": "map", "values": "string" }}
+ { "name" : "counters", "type": ["null", { "type": "map", "values": "string" }]}
]
}
</code>
diff --git a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/schema-status.avsc b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/schema-status.avsc
index 4190015..1932c7e 100644
--- a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/schema-status.avsc
+++ b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/resources/schema-status.avsc
@@ -84,6 +84,6 @@
{ "name" : "invocations", "type" : ["long", "null"]},
{ "name" : "processingNanos", "type" : ["long", "null"]},
{ "name" : "executionNode", "type" : ["string", "null"]},
- { "name" : "counters", "type": { "type": "map", "values": "string" }}
+ { "name" : "counters", "type": ["null", { "type": "map", "values": "string" }]}
]
}
[nifi] 04/14: NIFI-6968 Create Connection Model Allows Multiple Adds
Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
joewitt pushed a commit to branch support/nifi-1.11.x
in repository https://gitbox.apache.org/repos/asf/nifi.git
commit 136ed8f84b839ca9f2f861547c72c0c77e932ed1
Author: nagasivanath <na...@gmail.com>
AuthorDate: Thu Jan 23 23:08:18 2020 +0530
NIFI-6968 Create Connection Model Allows Multiple Adds
This closes #4013.
Signed-off-by: Andy LoPresto <al...@apache.org>
---
.../js/nf/canvas/nf-connection-configuration.js | 74 ++++++++++++++++++++--
1 file changed, 68 insertions(+), 6 deletions(-)
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connection-configuration.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connection-configuration.js
index 3a4ad97..486d2d3 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connection-configuration.js
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connection-configuration.js
@@ -65,6 +65,8 @@
var CONNECTION_OFFSET_Y_INCREMENT = 75;
var CONNECTION_OFFSET_X_INCREMENT = 200;
+ var connectionUpsertionInProgress = false;
+
var config = {
urls: {
api: '../nifi-api',
@@ -123,8 +125,8 @@
text: '#ffffff'
},
disabled: function () {
- // ensure some relationships were selected
- return getSelectedRelationships().length === 0;
+ // ensure some relationships were selected, also check create or updation in progress
+ return getSelectedRelationships().length === 0 || isConnectionUpsertionInProgess();
},
handler: {
click: function () {
@@ -139,6 +141,10 @@
hover: '#C7D2D7',
text: '#004849'
},
+ disabled: function() {
+ // when add button is clicked, should disable until the addition action is completed
+ return isConnectionUpsertionInProgess();
+ },
handler: {
click: function () {
$('#connection-configuration').modal('hide');
@@ -188,6 +194,10 @@
hover: '#004849',
text: '#ffffff'
},
+ disabled : function(){
+ // when network is slow, should disable the button
+ return isConnectionUpsertionInProgess();
+ },
handler: {
click: function () {
// add the connection
@@ -202,6 +212,9 @@
hover: '#C7D2D7',
text: '#004849'
},
+ disabled : function(){
+ return isConnectionUpsertionInProgess();
+ },
handler: {
click: function () {
$('#connection-configuration').modal('hide');
@@ -783,11 +796,36 @@
};
/**
+ * To set or reset the connection addition/update in progress
+ * @param {boolean} status the status of connection addition/update
+ */
+ var setConnectionUpsertionInProgess = function(status)
+ {
+ var needToUpdateDOM = (connectionUpsertionInProgress !== status) ;
+ connectionUpsertionInProgress = status;
+ if(needToUpdateDOM){
+ $('#connection-configuration').modal('refreshButtons');
+ }
+ }
+
+ /**
+ * returns whether the connection addition/update in progress
+ */
+ var isConnectionUpsertionInProgess = function()
+ {
+ return connectionUpsertionInProgress;
+ }
+
+ /**
* Adds a new connection.
*
* @argument {array} selectedRelationships The selected relationships
*/
var addConnection = function (selectedRelationships) {
+ // to handle the case of slow network
+ //the add/cancel buttons should be disabled
+ setConnectionUpsertionInProgess(true);
+
// get the connection details
var sourceId = $('#connection-source-id').val();
var destinationId = $('#connection-destination-id').val();
@@ -984,6 +1022,8 @@
'selectAll': true
});
+ setConnectionUpsertionInProgess(false);
+
// close the dialog
$('#connection-configuration').modal('hide');
@@ -995,7 +1035,12 @@
// update the birdseye
nfBirdseye.refresh();
- }).fail(nfErrorHandler.handleConfigurationUpdateAjaxError);
+ }).fail(function(xhr, status, error){
+
+ // update the button status
+ setConnectionUpsertionInProgess(false);
+ nfErrorHandler.handleConfigurationUpdateAjaxError(xhr, status, error);
+ });
}
};
@@ -1005,6 +1050,9 @@
* @argument {array} selectedRelationships The selected relationships
*/
var updateConnection = function (selectedRelationships) {
+ //apply, cancel buttons should be disabled, while the connection update is in progress
+ setConnectionUpsertionInProgess(true);
+
// get the connection details
var connectionId = $('#connection-id').text();
var connectionUri = $('#connection-uri').val();
@@ -1064,6 +1112,9 @@
dataType: 'json',
contentType: 'application/json'
}).done(function (response) {
+ //update updation progress status
+ setConnectionUpsertionInProgess(false);
+
// close the dialog
$('#connection-configuration').modal('hide');
@@ -1072,7 +1123,10 @@
// reload the connections source/destination components
nfCanvasUtils.reloadConnectionSourceAndDestination(sourceComponentId, destinationComponentId);
- }).fail(nfErrorHandler.handleConfigurationUpdateAjaxError);
+ }).fail(function(xhr, status, error){
+ setConnectionUpsertionInProgess(false);
+ nfErrorHandler.handleConfigurationUpdateAjaxError(xhr, status, error);
+ });
} else {
return $.Deferred(function (deferred) {
deferred.reject();
@@ -1492,12 +1546,13 @@
disabled: function () {
// ensure some relationships were selected with a processor as the source
if (nfCanvasUtils.isProcessor(source)) {
- return getSelectedRelationships().length === 0;
+ return getSelectedRelationships().length === 0 || isConnectionUpsertionInProgess();
}
- return false;
+ return isConnectionUpsertionInProgess();
},
handler: {
click: function () {
+ setConnectionUpsertionInProgess(true);
// see if we're working with a processor as the source
if (nfCanvasUtils.isProcessor(source)) {
// update the selected relationships
@@ -1505,6 +1560,8 @@
deferred.resolve();
}).fail(function () {
deferred.reject();
+ }).always(function(){
+ setConnectionUpsertionInProgess(false);
});
} else {
// there are no relationships, but the source wasn't a processor, so update anyway
@@ -1512,6 +1569,8 @@
deferred.resolve();
}).fail(function () {
deferred.reject();
+ }).always(function(){
+ setConnectionUpsertionInProgess(false);
});
}
}
@@ -1524,6 +1583,9 @@
hover: '#C7D2D7',
text: '#004849'
},
+ disabled: function(){
+ return isConnectionUpsertionInProgess();
+ },
handler: {
click: function () {
// hide the dialog
[nifi] 11/14: NIFI-7132: fix handling of UUIDs in PutCassandraQL
Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
joewitt pushed a commit to branch support/nifi-1.11.x
in repository https://gitbox.apache.org/repos/asf/nifi.git
commit 281c7e9306fd30f0cb78321bf0b6406796bbd7cb
Author: Wouter de Vries <wo...@tesorion.nl>
AuthorDate: Tue Feb 11 09:51:12 2020 +0100
NIFI-7132: fix handling of UUIDs in PutCassandraQL
Signed-off-by: Pierre Villard <pi...@gmail.com>
This closes #4048.
---
.../nifi/processors/cassandra/PutCassandraQL.java | 6 +-
.../processors/cassandra/PutCassandraQLTest.java | 72 ++++++++++++++++++++++
2 files changed, 76 insertions(+), 2 deletions(-)
diff --git a/nifi-nar-bundles/nifi-cassandra-bundle/nifi-cassandra-processors/src/main/java/org/apache/nifi/processors/cassandra/PutCassandraQL.java b/nifi-nar-bundles/nifi-cassandra-bundle/nifi-cassandra-processors/src/main/java/org/apache/nifi/processors/cassandra/PutCassandraQL.java
index 5edc973..0bbe00d 100644
--- a/nifi-nar-bundles/nifi-cassandra-bundle/nifi-cassandra-processors/src/main/java/org/apache/nifi/processors/cassandra/PutCassandraQL.java
+++ b/nifi-nar-bundles/nifi-cassandra-bundle/nifi-cassandra-processors/src/main/java/org/apache/nifi/processors/cassandra/PutCassandraQL.java
@@ -63,6 +63,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.UUID;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@@ -327,8 +328,6 @@ public class PutCassandraQL extends AbstractCassandraProcessor {
if (mainType.equals(DataType.ascii())
|| mainType.equals(DataType.text())
|| mainType.equals(DataType.varchar())
- || mainType.equals(DataType.timeuuid())
- || mainType.equals(DataType.uuid())
|| mainType.equals(DataType.inet())
|| mainType.equals(DataType.varint())) {
// These are strings, so just use the paramValue
@@ -355,6 +354,9 @@ public class PutCassandraQL extends AbstractCassandraProcessor {
} else if (mainType.equals(DataType.timestamp())) {
statement.setTimestamp(paramIndex, (Date) typeCodec.parse(paramValue));
+ } else if (mainType.equals(DataType.timeuuid())
+ || mainType.equals(DataType.uuid())) {
+ statement.setUUID(paramIndex, (UUID) typeCodec.parse(paramValue));
}
return;
} else {
diff --git a/nifi-nar-bundles/nifi-cassandra-bundle/nifi-cassandra-processors/src/test/java/org/apache/nifi/processors/cassandra/PutCassandraQLTest.java b/nifi-nar-bundles/nifi-cassandra-bundle/nifi-cassandra-processors/src/test/java/org/apache/nifi/processors/cassandra/PutCassandraQLTest.java
index 007172c..e8e871b 100644
--- a/nifi-nar-bundles/nifi-cassandra-bundle/nifi-cassandra-processors/src/test/java/org/apache/nifi/processors/cassandra/PutCassandraQLTest.java
+++ b/nifi-nar-bundles/nifi-cassandra-bundle/nifi-cassandra-processors/src/test/java/org/apache/nifi/processors/cassandra/PutCassandraQLTest.java
@@ -253,6 +253,78 @@ public class PutCassandraQLTest {
}
@Test
+ public void testProcessorUuid() {
+ setUpStandardTestConfig();
+
+ testRunner.enqueue("INSERT INTO users (user_id, first_name, last_name, properties, bits, scaleset, largenum, scale, byteobject, ts) VALUES ?, ?, ?, ?, ?, ?, ?, ?, ?, ?",
+ new HashMap<String, String>() {
+ {
+ put("cql.args.1.type", "int");
+ put("cql.args.1.value", "1");
+ put("cql.args.2.type", "text");
+ put("cql.args.2.value", "Joe");
+ put("cql.args.3.type", "text");
+ // No value for arg 3 to test setNull
+ put("cql.args.4.type", "map<text,text>");
+ put("cql.args.4.value", "{'a':'Hello', 'b':'World'}");
+ put("cql.args.5.type", "list<boolean>");
+ put("cql.args.5.value", "[true,false,true]");
+ put("cql.args.6.type", "set<double>");
+ put("cql.args.6.value", "{1.0, 2.0}");
+ put("cql.args.7.type", "bigint");
+ put("cql.args.7.value", "20000000");
+ put("cql.args.8.type", "float");
+ put("cql.args.8.value", "1.0");
+ put("cql.args.9.type", "blob");
+ put("cql.args.9.value", "0xDEADBEEF");
+ put("cql.args.10.type", "uuid");
+ put("cql.args.10.value", "5442b1f6-4c16-11ea-87f5-45a32dbc5199");
+
+ }
+ });
+
+ testRunner.run(1, true, true);
+ testRunner.assertAllFlowFilesTransferred(PutCassandraQL.REL_SUCCESS, 1);
+ testRunner.clearTransferState();
+ }
+
+ @Test
+ public void testProcessorBadUuid() {
+ setUpStandardTestConfig();
+
+ testRunner.enqueue("INSERT INTO users (user_id, first_name, last_name, properties, bits, scaleset, largenum, scale, byteobject, ts) VALUES ?, ?, ?, ?, ?, ?, ?, ?, ?, ?",
+ new HashMap<String, String>() {
+ {
+ put("cql.args.1.type", "int");
+ put("cql.args.1.value", "1");
+ put("cql.args.2.type", "text");
+ put("cql.args.2.value", "Joe");
+ put("cql.args.3.type", "text");
+ // No value for arg 3 to test setNull
+ put("cql.args.4.type", "map<text,text>");
+ put("cql.args.4.value", "{'a':'Hello', 'b':'World'}");
+ put("cql.args.5.type", "list<boolean>");
+ put("cql.args.5.value", "[true,false,true]");
+ put("cql.args.6.type", "set<double>");
+ put("cql.args.6.value", "{1.0, 2.0}");
+ put("cql.args.7.type", "bigint");
+ put("cql.args.7.value", "20000000");
+ put("cql.args.8.type", "float");
+ put("cql.args.8.value", "1.0");
+ put("cql.args.9.type", "blob");
+ put("cql.args.9.value", "0xDEADBEEF");
+ put("cql.args.10.type", "uuid");
+ put("cql.args.10.value", "bad-uuid");
+
+ }
+ });
+
+ testRunner.run(1, true, true);
+ testRunner.assertAllFlowFilesTransferred(PutCassandraQL.REL_FAILURE, 1);
+ testRunner.clearTransferState();
+ }
+
+ @Test
public void testProcessorInvalidQueryException() {
setUpStandardTestConfig();