nifi-minifi-cpp git commit: MINIFICPP-693 - getProperty should rely on user provided allocated buffers.

2018-12-11 Thread phrocker
Repository: nifi-minifi-cpp
Updated Branches:
  refs/heads/master 524118e13 -> 2caa58709


MINIFICPP-693 - getProperty should rely on user provided allocated buffers.

This closes #458.

Signed-off-by: Marc Parisi 


Project: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/commit/2caa5870
Tree: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/tree/2caa5870
Diff: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/diff/2caa5870

Branch: refs/heads/master
Commit: 2caa587097ae08b199596afe5e7b76b06552de41
Parents: 524118e
Author: Arpad Boda 
Authored: Fri Dec 7 13:30:10 2018 +0100
Committer: Marc Parisi 
Committed: Tue Dec 11 21:26:47 2018 -0500

--
 nanofi/examples/generate_flow.c |  3 ++-
 nanofi/include/api/nanofi.h | 10 +++---
 nanofi/src/api/nanofi.cpp   | 12 
 nanofi/tests/CAPITests.cpp  |  7 +++
 4 files changed, 24 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2caa5870/nanofi/examples/generate_flow.c
--
diff --git a/nanofi/examples/generate_flow.c b/nanofi/examples/generate_flow.c
index 707de11..596d65b 100644
--- a/nanofi/examples/generate_flow.c
+++ b/nanofi/examples/generate_flow.c
@@ -42,7 +42,8 @@ int main(int argc, char **argv) {
 
   nifi_instance *instance = create_instance(instance_str, );
 
-  flow *new_flow = create_flow(instance, "GenerateFlowFile");
+  flow *new_flow = create_new_flow(instance);
+  processor *generate_proc = add_processor(new_flow, "GenerateFlowFile");
 
   flow_file_record *record = get_next_flow_file(instance, new_flow);
 

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2caa5870/nanofi/include/api/nanofi.h
--
diff --git a/nanofi/include/api/nanofi.h b/nanofi/include/api/nanofi.h
index 99eadf8..0650492 100644
--- a/nanofi/include/api/nanofi.h
+++ b/nanofi/include/api/nanofi.h
@@ -196,12 +196,16 @@ int set_instance_property(nifi_instance *instance, const 
char * name, const char
 
 /**
  * Get a property. Should be used in custom processor logic callbacks.
- * @attention The returned value transfers ownership, it's the callers 
responsibility to free it!
+ * Writes the value of the property to the buffer.
+ * Nothing is written to the buffer in case the property is not found (return 
value != 0)
+ * The result is always null-terminated, at most size-1 characters are written 
to the buffer.
  * @param context the current processor context
  * @param name name of the property
- * @return null-terminated char* in case of success, nullptr otherwise
+ * @param buffer buffer to write the value of the property
+ * @param size size of the buffer
+ * @return 0 in case of success (property found), -1 otherwise
  **/
-char * get_property(const processor_context * context, const char * name);
+uint8_t get_property(const processor_context * context, const char * name, 
char * buffer, size_t size);
 
 /**
  * Free a flow

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2caa5870/nanofi/src/api/nanofi.cpp
--
diff --git a/nanofi/src/api/nanofi.cpp b/nanofi/src/api/nanofi.cpp
index 78d1c09..aa957ac 100644
--- a/nanofi/src/api/nanofi.cpp
+++ b/nanofi/src/api/nanofi.cpp
@@ -461,6 +461,18 @@ int set_standalone_property(standalone_processor *proc, 
const char *name, const
   return -1;
 }
 
+uint8_t get_property(const processor_context * context, const char * name, 
char * buffer, size_t size) {
+  std::string value;
+  if(!context->getDynamicProperty(name, value)) {
+return -1;
+  }
+  size_t chars_to_copy = std::min(value.length(), size-1);
+
+  strncpy(buffer, value.data(), chars_to_copy);
+  buffer[chars_to_copy] = '\0';
+  return 0;
+}
+
 char * get_property(const processor_context *  context, const char * name) {
   std::string value;
   if(!context->getDynamicProperty(name, value)) {

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2caa5870/nanofi/tests/CAPITests.cpp
--
diff --git a/nanofi/tests/CAPITests.cpp b/nanofi/tests/CAPITests.cpp
index 721a0cd..ca24ba8 100644
--- a/nanofi/tests/CAPITests.cpp
+++ b/nanofi/tests/CAPITests.cpp
@@ -71,12 +71,11 @@ void custom_processor_logic(processor_session * ps, 
processor_context * ctx) {
 
   REQUIRE(add_attribute(ffr, "custom attribute", (void*)custom_value, 
strlen(custom_value)) == 0);
 
-  char * prop_value = get_property(ctx, "Some test propery");
+  char prop_value[20];
 
-  REQUIRE(prop_value != nullptr);
-  REQUIRE(strncmp("test value", prop_value, strlen(prop_value)) == 0);
+  REQUIRE(get_property(ctx, "Some test propery", 

nifi git commit: NIFI-5889 - changed the wording about Destination URL in S2S RTs

2018-12-11 Thread ijokarumawak
Repository: nifi
Updated Branches:
  refs/heads/master 13a7f1686 -> 85cc5aa9e


NIFI-5889 - changed the wording about Destination URL in S2S RTs

This closes #3215.

Signed-off-by: Koji Kawamura 


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/85cc5aa9
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/85cc5aa9
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/85cc5aa9

Branch: refs/heads/master
Commit: 85cc5aa9eb99fce8268a476fa8a645184478be1d
Parents: 13a7f16
Author: Pierre Villard 
Authored: Tue Dec 11 17:36:45 2018 +0100
Committer: Koji Kawamura 
Committed: Wed Dec 12 11:15:48 2018 +0900

--
 .../apache/nifi/reporting/AbstractSiteToSiteReportingTask.java  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/nifi/blob/85cc5aa9/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/AbstractSiteToSiteReportingTask.java
--
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/AbstractSiteToSiteReportingTask.java
 
b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/AbstractSiteToSiteReportingTask.java
index 21bb397..8fdf483 100644
--- 
a/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/AbstractSiteToSiteReportingTask.java
+++ 
b/nifi-nar-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/AbstractSiteToSiteReportingTask.java
@@ -95,8 +95,9 @@ public abstract class AbstractSiteToSiteReportingTask extends 
AbstractReportingT
 static final PropertyDescriptor DESTINATION_URL = new 
PropertyDescriptor.Builder()
 .name("Destination URL")
 .displayName("Destination URL")
-.description("The URL of the destination NiFi instance to send 
data to, " +
-"should be a comma-separated list of address in the format 
of http(s)://host:port/nifi.")
+.description("The URL of the destination NiFi instance or, if 
clustered, a comma-separated list of address in the format "
++ "of http(s)://host:port/nifi. This destination URL will 
only be used to initiate the Site-to-Site connection. The "
++ "data sent by this reporting task will be load-balanced 
on all the nodes of the destination (if clustered).")
 .required(true)
 
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
 .addValidator(new NiFiUrlValidator())



nifi git commit: NIFI-5890 Added a unit test that proves that 1.9 fixes a bug in the date conversion behavior in 1.8.

2018-12-11 Thread ijokarumawak
Repository: nifi
Updated Branches:
  refs/heads/master 1a937b651 -> 13a7f1686


NIFI-5890 Added a unit test that proves that 1.9 fixes a bug in the date 
conversion behavior in 1.8.

This closes #3214.

Signed-off-by: Koji Kawamura 


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/13a7f168
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/13a7f168
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/13a7f168

Branch: refs/heads/master
Commit: 13a7f168604f20da3c837ce3bf91a3472a9708f1
Parents: 1a937b6
Author: Mike Thomsen 
Authored: Tue Dec 11 11:18:52 2018 -0500
Committer: Koji Kawamura 
Committed: Wed Dec 12 11:08:18 2018 +0900

--
 .../nifi/serialization/record/TestDataTypeUtils.java | 15 +++
 1 file changed, 15 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/nifi/blob/13a7f168/nifi-commons/nifi-record/src/test/java/org/apache/nifi/serialization/record/TestDataTypeUtils.java
--
diff --git 
a/nifi-commons/nifi-record/src/test/java/org/apache/nifi/serialization/record/TestDataTypeUtils.java
 
b/nifi-commons/nifi-record/src/test/java/org/apache/nifi/serialization/record/TestDataTypeUtils.java
index 5f15fc2..45b65b4 100644
--- 
a/nifi-commons/nifi-record/src/test/java/org/apache/nifi/serialization/record/TestDataTypeUtils.java
+++ 
b/nifi-commons/nifi-record/src/test/java/org/apache/nifi/serialization/record/TestDataTypeUtils.java
@@ -54,6 +54,21 @@ public class TestDataTypeUtils {
 assertEquals("Times didn't match", ts.getTime(), sDate.getTime());
 }
 
+/*
+ * This was a bug in NiFi 1.8 where converting from a Timestamp to a Date 
with the record path API
+ * would throw an exception.
+ */
+@Test
+public void testTimestampToDate() {
+java.util.Date date = new java.util.Date();
+Timestamp ts = DataTypeUtils.toTimestamp(date, null, null);
+assertNotNull(ts);
+
+java.sql.Date output = DataTypeUtils.toDate(ts, null, null);
+assertNotNull(output);
+assertEquals("Timestamps didn't match", output.getTime(), 
ts.getTime());
+}
+
 @Test
 public void testConvertRecordMapToJavaMap() {
 assertNull(DataTypeUtils.convertRecordMapToJavaMap(null, null));



[jira] [Created] (MINIFI-490) Generically support reporting tasks

2018-12-11 Thread Aldrin Piri (JIRA)
Aldrin Piri created MINIFI-490:
--

 Summary: Generically support reporting tasks
 Key: MINIFI-490
 URL: https://issues.apache.org/jira/browse/MINIFI-490
 Project: Apache NiFi MiNiFi
  Issue Type: Improvement
Reporter: Aldrin Piri






--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (MINIFI-491) Add a Site to Site periodic status reporter implementation

2018-12-11 Thread Aldrin Piri (JIRA)
Aldrin Piri created MINIFI-491:
--

 Summary: Add a Site to Site periodic status reporter implementation
 Key: MINIFI-491
 URL: https://issues.apache.org/jira/browse/MINIFI-491
 Project: Apache NiFi MiNiFi
  Issue Type: Improvement
Reporter: Aldrin Piri






--
This message was sent by Atlassian JIRA
(v7.6.3#76005)