Repository: nifi-minifi-cpp
Updated Branches:
  refs/heads/master 678c602c8 -> 53f094622


MINIFI-274 Use external project with existing source for jsoncpp to
avoid contamination of core project build.

Adding needed libcurl to travis build.

Adjusting request method handling in InvokeHTTP

Adjusting timing for http get integration test

Signed-off-by: Bryan Rosander <[email protected]>


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/35e24a38
Tree: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/tree/35e24a38
Diff: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/diff/35e24a38

Branch: refs/heads/master
Commit: 35e24a38818108098a9f3ead17240778f57294b8
Parents: 678c602
Author: Aldrin Piri <[email protected]>
Authored: Thu Apr 27 14:26:48 2017 -0400
Committer: Bryan Rosander <[email protected]>
Committed: Tue May 2 12:08:42 2017 -0400

----------------------------------------------------------------------
 .gitignore                                |  6 ++++-
 .travis.yml                               |  3 +++
 CMakeLists.txt                            | 32 ++++++++++++++++++++------
 libminifi/CMakeLists.txt                  |  3 +++
 libminifi/src/processors/InvokeHTTP.cpp   |  4 ++--
 libminifi/test/HttpGetIntegrationTest.cpp |  2 +-
 main/CMakeLists.txt                       |  2 +-
 7 files changed, 40 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/35e24a38/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 763c900..846c717 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,12 +8,16 @@ Makefile
 cmake_install.cmake
 install_manifest.txt
 CTestTestfile.cmake
+cmake-build-debug
+
+# Generated files
 build
 bin
 target
 thirdparty/**/*.o
 thirdparty/**/*.a
+docs/generated
 
 # Ignore source files that have been placed in the docker directory during 
build
 docker/minificppsource
-docker/.DS_STORE
\ No newline at end of file
+docker/.DS_STORE

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/35e24a38/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 14c0e09..0fa8aec 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -32,6 +32,7 @@ matrix:
           - doxygen
           - libleveldb-dev
           - openssl
+          - libcurl4-openssl-dev
       before_install:
         # Establish updated toolchain as default
         - sudo unlink /usr/bin/gcc && sudo ln -s /usr/bin/gcc-4.8 /usr/bin/gcc
@@ -47,6 +48,7 @@ matrix:
         - package='cmake'; [[ $(brew ls --versions ${package}) ]] && { brew 
outdated ${package} || brew upgrade ${package}; } || brew install ${package}
         - package='openssl'; [[ $(brew ls --versions ${package}) ]] && { brew 
outdated ${package} || brew upgrade ${package}; } || brew install ${package}
         - package='doxygen'; [[ $(brew ls --versions ${package}) ]] && { brew 
outdated ${package} || brew upgrade ${package}; } || brew install ${package}
+        - package='graphviz'; [[ $(brew ls --versions ${package}) ]] && { brew 
outdated ${package} || brew upgrade ${package}; } || brew install ${package}
     - os: osx
       osx_image: xcode8.3
       # https://docs.travis-ci.com/user/osx-ci-environment/#Homebrew
@@ -58,6 +60,7 @@ matrix:
         - package='cmake'; [[ $(brew ls --versions ${package}) ]] && { brew 
outdated ${package} || brew upgrade ${package}; } || brew install ${package}
         - package='openssl'; [[ $(brew ls --versions ${package}) ]] && { brew 
outdated ${package} || brew upgrade ${package}; } || brew install ${package}
         - package='doxygen'; [[ $(brew ls --versions ${package}) ]] && { brew 
outdated ${package} || brew upgrade ${package}; } || brew install ${package}
+        - package='graphviz'; [[ $(brew ls --versions ${package}) ]] && { brew 
outdated ${package} || brew upgrade ${package}; } || brew install ${package}
 
 script:
   - mkdir ./build && cd ./build && cmake .. && make && make test && make 
linter && make docs

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/35e24a38/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 835c63c..df0ed1e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -81,9 +81,27 @@ endif (LEVELDB_FOUND)
 find_package(UUID REQUIRED)
 file(GLOB SPD_SOURCES "include/spdlog/*")
 
-add_subdirectory(thirdparty/yaml-cpp-yaml-cpp-0.5.3)
-add_subdirectory(thirdparty/jsoncpp)
+
+
+include(ExternalProject)
+
+# Setup Jsoncpp as an external project
+set(JSONCPP_LIB_DIR "${CMAKE_CURRENT_BINARY_DIR}/jsoncpp")
+
+externalproject_add(jsoncpp_project
+        SOURCE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/jsoncpp
+        CMAKE_ARGS
+        "-G${CMAKE_GENERATOR}"
+        "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
+        "-DCMAKE_INSTALL_PREFIX=${JSONCPP_LIB_DIR}"
+        )
+
+set(prefix "lib")
+set(suffix ".a")
+set(JSONCPP_LIB "${JSONCPP_LIB_DIR}/lib/${prefix}jsoncpp${suffix}")
+
 set(CIVETWEB_ENABLE_CXX ON CACHE BOOL "Enable civet C++ library")
+add_subdirectory(thirdparty/yaml-cpp-yaml-cpp-0.5.3)
 add_subdirectory(thirdparty/civetweb-1.9.1)
 add_subdirectory(libminifi)
 add_subdirectory(main)
@@ -137,7 +155,7 @@ enable_testing(test)
     target_include_directories(tests PRIVATE BEFORE "libminifi/include/utils")
     target_include_directories(tests PRIVATE BEFORE 
"libminifi/include/processors")
     target_include_directories(tests PRIVATE BEFORE 
"libminifi/include/provenance")
-    target_link_libraries(tests ${CMAKE_THREAD_LIBS_INIT} ${UUID_LIBRARIES} 
${LEVELDB_LIBRARIES} ${OPENSSL_LIBRARIES} minifi yaml-cpp c-library 
civetweb-cpp jsoncpp_lib_static)
+    target_link_libraries(tests ${CMAKE_THREAD_LIBS_INIT} ${UUID_LIBRARIES} 
${LEVELDB_LIBRARIES} ${OPENSSL_LIBRARIES} minifi yaml-cpp c-library 
civetweb-cpp ${JSON_CPP_LIB})
     if (CURL_FOUND)
         target_include_directories(tests PRIVATE BEFORE ${CURL_INCLUDE_DIRS})
                 target_link_libraries(tests ${CURL_LIBRARIES})
@@ -159,7 +177,7 @@ enable_testing(test)
     target_include_directories(testHttpGet PRIVATE BEFORE 
"libminifi/include/utils")
     target_include_directories(testHttpGet PRIVATE BEFORE 
"libminifi/include/processors")
     target_include_directories(testHttpGet PRIVATE BEFORE 
"libminifi/include/provenance")
-    target_link_libraries(testHttpGet ${CMAKE_THREAD_LIBS_INIT} 
${UUID_LIBRARIES} ${LEVELDB_LIBRARIES} ${OPENSSL_LIBRARIES} minifi yaml-cpp 
c-library civetweb-cpp jsoncpp_lib_static)
+    target_link_libraries(testHttpGet ${CMAKE_THREAD_LIBS_INIT} 
${UUID_LIBRARIES} ${LEVELDB_LIBRARIES} ${OPENSSL_LIBRARIES} minifi yaml-cpp 
c-library civetweb-cpp ${JSON_CPP_LIB})
     if (CURL_FOUND)
         target_include_directories(testHttpGet PRIVATE BEFORE 
${CURL_INCLUDE_DIRS})
                 target_link_libraries(testHttpGet ${CURL_LIBRARIES})
@@ -180,7 +198,7 @@ enable_testing(test)
     target_include_directories(testHttpPost PRIVATE BEFORE 
"libminifi/include/utils")
     target_include_directories(testHttpPost PRIVATE BEFORE 
"libminifi/include/processors")
     target_include_directories(testHttpPost PRIVATE BEFORE 
"libminifi/include/provenance")
-    target_link_libraries(testHttpPost ${CMAKE_THREAD_LIBS_INIT} 
${UUID_LIBRARIES} ${LEVELDB_LIBRARIES} ${OPENSSL_LIBRARIES} minifi yaml-cpp 
c-library civetweb-cpp jsoncpp_lib_static)
+    target_link_libraries(testHttpPost ${CMAKE_THREAD_LIBS_INIT} 
${UUID_LIBRARIES} ${LEVELDB_LIBRARIES} ${OPENSSL_LIBRARIES} minifi yaml-cpp 
c-library civetweb-cpp ${JSON_CPP_LIB})
     if (CURL_FOUND)
         target_include_directories(testHttpPost PRIVATE BEFORE 
${CURL_INCLUDE_DIRS})
        target_link_libraries(testHttpPost ${CURL_LIBRARIES})
@@ -204,7 +222,7 @@ enable_testing(test)
         target_include_directories(testExecuteProcess PRIVATE BEFORE 
${CURL_INCLUDE_DIRS})
        target_link_libraries(testExecuteProcess ${CURL_LIBRARIES})
     endif(CURL_FOUND)
-    target_link_libraries(testExecuteProcess ${CMAKE_THREAD_LIBS_INIT} 
${UUID_LIBRARIES} ${LEVELDB_LIBRARIES} ${OPENSSL_LIBRARIES} minifi yaml-cpp 
c-library civetweb-cpp jsoncpp_lib_static)
+    target_link_libraries(testExecuteProcess ${CMAKE_THREAD_LIBS_INIT} 
${UUID_LIBRARIES} ${LEVELDB_LIBRARIES} ${OPENSSL_LIBRARIES} minifi yaml-cpp 
c-library civetweb-cpp ${JSON_CPP_LIB})
     add_test(NAME ExecuteProcess COMMAND testExecuteProcess)
     
     file(GLOB LIBMINIFI_TEST_SOCKETS "libminifi/test/SocketTests.cpp")
@@ -224,7 +242,7 @@ enable_testing(test)
         target_include_directories(testSockets PRIVATE BEFORE 
${CURL_INCLUDE_DIRS})
        target_link_libraries(testSockets ${CURL_LIBRARIES})
     endif(CURL_FOUND)
-    target_link_libraries(testSockets ${CMAKE_THREAD_LIBS_INIT} 
${UUID_LIBRARIES} ${LEVELDB_LIBRARIES} ${OPENSSL_LIBRARIES} minifi yaml-cpp 
c-library civetweb-cpp jsoncpp_lib_static)
+    target_link_libraries(testSockets ${CMAKE_THREAD_LIBS_INIT} 
${UUID_LIBRARIES} ${LEVELDB_LIBRARIES} ${OPENSSL_LIBRARIES} minifi yaml-cpp 
c-library civetweb-cpp ${JSON_CPP_LIB})
     add_test(NAME TestSockets COMMAND testSockets)
 
 # Create a custom build target called "docker" that will invoke DockerBuild.sh 
and create the NiFi-MiNiFi-CPP Docker image

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/35e24a38/libminifi/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/libminifi/CMakeLists.txt b/libminifi/CMakeLists.txt
index 320fc45..08f7e3c 100644
--- a/libminifi/CMakeLists.txt
+++ b/libminifi/CMakeLists.txt
@@ -69,6 +69,9 @@ file(GLOB SPD_SOURCES "../include/spdlog/*")
 add_library(spdlog STATIC ${SPD_SOURCES})
 add_library(minifi STATIC ${SOURCES})
 
+add_dependencies(minifi jsoncpp_project)
+target_link_libraries(minifi ${JSONCPP_LIB})
+
 find_package(ZLIB REQUIRED)
 include_directories(${ZLIB_INCLUDE_DIRS})
 target_link_libraries (minifi ${ZLIB_LIBRARIES})

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/35e24a38/libminifi/src/processors/InvokeHTTP.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/processors/InvokeHTTP.cpp 
b/libminifi/src/processors/InvokeHTTP.cpp
index 61398b8..17226a8 100644
--- a/libminifi/src/processors/InvokeHTTP.cpp
+++ b/libminifi/src/processors/InvokeHTTP.cpp
@@ -155,8 +155,8 @@ core::Relationship InvokeHTTP::RelFailure(
     "timeout or general exception. It will have new attributes detailing the 
request.");
 
 void InvokeHTTP::set_request_method(CURL *curl, const std::string &method) {
-  std::string my_method;
-  std::transform(method.begin(), method.end(), my_method.begin(), ::toupper);
+  std::string my_method = method;
+  std::transform(my_method.begin(), my_method.end(), my_method.begin(), 
::toupper);
   if (my_method == "POST") {
     curl_easy_setopt(curl, CURLOPT_POST, 1);
   } else if (my_method == "PUT") {

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/35e24a38/libminifi/test/HttpGetIntegrationTest.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/HttpGetIntegrationTest.cpp 
b/libminifi/test/HttpGetIntegrationTest.cpp
index 04e6268..e6720f5 100644
--- a/libminifi/test/HttpGetIntegrationTest.cpp
+++ b/libminifi/test/HttpGetIntegrationTest.cpp
@@ -39,7 +39,7 @@
 std::string test_file_location;
 
 void waitToVerifyProcessor() {
-  std::this_thread::sleep_for(std::chrono::seconds(2));
+  std::this_thread::sleep_for(std::chrono::seconds(10));
 }
 
 int main(int argc, char **argv) {

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/35e24a38/main/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt
index baf4254..a0e43b8 100644
--- a/main/CMakeLists.txt
+++ b/main/CMakeLists.txt
@@ -44,7 +44,7 @@ find_package(OpenSSL REQUIRED)
 include_directories(${OPENSSL_INCLUDE_DIR})
 
 # Link against minifi, yaml-cpp, civetweb-cpp, uuid, openssl, jsoncpp and 
leveldb
-target_link_libraries(minifiexe minifi yaml-cpp c-library civetweb-cpp 
jsoncpp_lib_static ${UUID_LIBRARIES} ${LEVELDB_LIBRARIES} ${OPENSSL_LIBRARIES})
+target_link_libraries(minifiexe minifi yaml-cpp c-library civetweb-cpp 
${JSON_CPP_LIB} ${UUID_LIBRARIES} ${LEVELDB_LIBRARIES} ${OPENSSL_LIBRARIES})
 set_target_properties(minifiexe
         PROPERTIES OUTPUT_NAME minifi)
 

Reply via email to