MINIFI-188: Incorporate CATCH and example tests
to run type make; make test

This closes #46.

Signed-off-by: Aldrin Piri <[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/95fa21ee
Tree: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/tree/95fa21ee
Diff: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/diff/95fa21ee

Branch: refs/heads/master
Commit: 95fa21ee84913829ef2fbe400f51af06653bc6e6
Parents: 0b02224
Author: Marc Parisi <[email protected]>
Authored: Fri Feb 3 09:43:25 2017 -0500
Committer: Aldrin Piri <[email protected]>
Committed: Mon Feb 6 19:30:41 2017 -0500

----------------------------------------------------------------------
 .travis.yml                                |     2 +-
 CMakeLists.txt                             |    17 +-
 LICENSE                                    |    28 +-
 cmake/FindLeveldb.cmake                    |     4 +-
 libminifi/CMakeLists.txt                   |     2 +-
 libminifi/cmake/FindLeveldb.cmake          |    50 +
 libminifi/cmake/FindUUID.cmake             |    37 +
 libminifi/include/ProcessContext.h         |    15 +
 libminifi/include/Processor.h              |     2 +
 libminifi/src/Processor.cpp                |    24 +
 libminifi/test/TestBase.h                  |    25 +
 libminifi/test/unit/ProcessorTests.h       |   100 +
 libminifi/test/unit/ProvenanceTestHelper.h |    67 +
 libminifi/test/unit/ProvenanceTests.h      |    36 +
 libminifi/test/unit/Tests.cpp              |    23 +
 thirdparty/catch/catch.hpp                 | 10663 ++++++++++++++++++++++
 16 files changed, 11089 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/95fa21ee/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 5f5234e..38cfca1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,7 +22,7 @@ script:
   # Establish updated toolchain as default
   - sudo unlink /usr/bin/gcc && sudo ln -s /usr/bin/gcc-4.8 /usr/bin/gcc
   - sudo unlink /usr/bin/g++ && sudo ln -s /usr/bin/g++-4.8 /usr/bin/g++
-  - mkdir ./build && cd ./build && cmake .. && make
+  - mkdir ./build && cd ./build && cmake .. && make && make test
 
 addons:
   apt:

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/95fa21ee/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9d80e57..c8857fb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,12 +18,12 @@
 #
 
 cmake_minimum_required(VERSION 2.6)
-
 project(nifi-minifi-cpp)
 set(PROJECT_NAME "nifi-minifi-cpp")
 set(PROJECT_VERSION_MAJOR 0)
 set(PROJECT_VERSION_MINOR 2)
 set(PROJECT_VERSION_PATCH 0)
+option(test "Build all tests." ON)
 
 #### Establish Project Configuration ####
 # Enable usage of the VERSION specifier
@@ -52,6 +52,11 @@ find_package(Threads REQUIRED)
 # Provide custom modules for the project
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
 
+find_package(UUID REQUIRED)
+
+file(GLOB SPD_SOURCES "include/spdlog/*")
+
+
 add_subdirectory(thirdparty/yaml-cpp-yaml-cpp-0.5.3)
 add_subdirectory(libminifi)
 add_subdirectory(main)
@@ -88,3 +93,13 @@ set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
 set(CPACK_COMPONENTS_ALL bin)
 
 include(CPack)
+
+enable_testing(test) 
+    file(GLOB LIBMINIFI_TEST_SOURCES "libminifi/test/unit/*.cpp")
+    add_executable(tests ${LIBMINIFI_TEST_SOURCES} ${SPD_SOURCES})
+    target_include_directories(tests PRIVATE BEFORE "thirdparty/catch")
+    target_include_directories(tests PRIVATE BEFORE 
"thirdparty/yaml-cpp-yaml-cpp-0.5.3/include")
+    target_include_directories(tests PRIVATE BEFORE "include")
+    target_include_directories(tests PRIVATE BEFORE "libminifi/include/")
+    target_link_libraries(tests ${CMAKE_THREAD_LIBS_INIT} ${UUID_LIBRARIES} 
minifi yaml-cpp)
+    add_test(NAME LibMinifiTests COMMAND tests)

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/95fa21ee/LICENSE
----------------------------------------------------------------------
diff --git a/LICENSE b/LICENSE
index b60ecf1..d72606a 100644
--- a/LICENSE
+++ b/LICENSE
@@ -415,4 +415,30 @@ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
SOFTWARE, EVEN IF
 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 The views and conclusions contained in the software and documentation are 
those of the authors and
-should not be interpreted as representing official policies, either expressed 
or implied, of Dmitry Vyukov.
\ No newline at end of file
+should not be interpreted as representing official policies, either expressed 
or implied, of Dmitry Vyukov.
+
+This product bundles 'Catch' which is available under a Boost Software License.
+
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/95fa21ee/cmake/FindLeveldb.cmake
----------------------------------------------------------------------
diff --git a/cmake/FindLeveldb.cmake b/cmake/FindLeveldb.cmake
index 73ac693..a6d94c0 100644
--- a/cmake/FindLeveldb.cmake
+++ b/cmake/FindLeveldb.cmake
@@ -8,7 +8,7 @@
 #
 #   http://www.apache.org/licenses/LICENSE-2.0
 #
-# Unless qrequired by applicable law or agreed to in writing,
+# Unless required by applicable law or agreed to in writing,
 # software distributed under the License is distributed on an
 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 # KIND, either express or implied.  See the License for the
@@ -47,4 +47,4 @@ if (LEVELDB_FOUND)
     set(LEVELDB_DEFINITIONS )
 endif()
 
-mark_as_advanced(LEVELDB_ROOT_DIR LEVELDB_INCLUDE_DIR LEVELDB_LIBRARY)
\ No newline at end of file
+mark_as_advanced(LEVELDB_ROOT_DIR LEVELDB_INCLUDE_DIR LEVELDB_LIBRARY)

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/95fa21ee/libminifi/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/libminifi/CMakeLists.txt b/libminifi/CMakeLists.txt
index f1e79e4..8cb3cd9 100644
--- a/libminifi/CMakeLists.txt
+++ b/libminifi/CMakeLists.txt
@@ -9,7 +9,7 @@
 #
 #   http://www.apache.org/licenses/LICENSE-2.0
 #
-# Unless qrequired by applicable law or agreed to in writing,
+# Unless required by applicable law or agreed to in writing,
 # software distributed under the License is distributed on an
 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 # KIND, either express or implied.  See the License for the

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/95fa21ee/libminifi/cmake/FindLeveldb.cmake
----------------------------------------------------------------------
diff --git a/libminifi/cmake/FindLeveldb.cmake 
b/libminifi/cmake/FindLeveldb.cmake
new file mode 100644
index 0000000..32adafa
--- /dev/null
+++ b/libminifi/cmake/FindLeveldb.cmake
@@ -0,0 +1,50 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+# Find module for Leveldb library and includes
+#  LEVELDB_FOUND - if system found LEVELDB library
+#  LEVELDB_INCLUDE_DIRS - The LEVELDB include directories
+#  LEVELDB_LIBRARIES - The libraries needed to use LEVELDB
+#  LEVELDB_DEFINITIONS - Compiler switches required for using LEVELDB
+
+# For OS X do not attempt to use the OS X application frameworks or bundles.
+set (CMAKE_FIND_FRAMEWORK NEVER)
+set (CMAKE_FIND_APPBUNDLE NEVER)
+
+find_path(LEVELDB_INCLUDE_DIR
+    NAMES leveldb/db.h
+    PATHS /usr/local/include /usr/include
+    DOC "LevelDB include header"
+)
+
+find_library(LEVELDB_LIBRARY 
+    NAMES libleveldb.dylib libleveldb.so
+    PATHS /usr/local/lib /usr/lib/x86_64-linux-gnu
+    DOC "LevelDB library"
+)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LEVELDB DEFAULT_MSG LEVELDB_INCLUDE_DIR 
LEVELDB_LIBRARY)
+
+if (LEVELDB_FOUND)
+    set(LEVELDB_LIBRARIES ${LEVELDB_LIBRARY} )
+    set(LEVELDB_INCLUDE_DIRS ${LEVELDB_INCLUDE_DIR} )
+    set(LEVELDB_DEFINITIONS )
+endif()
+
+mark_as_advanced(LEVELDB_ROOT_DIR LEVELDB_INCLUDE_DIR LEVELDB_LIBRARY)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/95fa21ee/libminifi/cmake/FindUUID.cmake
----------------------------------------------------------------------
diff --git a/libminifi/cmake/FindUUID.cmake b/libminifi/cmake/FindUUID.cmake
new file mode 100644
index 0000000..2402d08
--- /dev/null
+++ b/libminifi/cmake/FindUUID.cmake
@@ -0,0 +1,37 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+find_path(UUID_INCLUDE_DIR
+       NAMES uuid/uuid.h
+       HINTS ${UUID_DIR}/include
+                       $ENV{UUID_DIR}/include
+       PATHS /usr/include
+          /usr/local/include )
+
+find_library(UUID_LIBRARY NAMES uuid
+             PATHS /usr/lib /usr/local/lib /usr/local/lib64 
/lib/i386-linux-gnu /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu)
+
+set(UUID_INCLUDE_DIRS ${UUID_INCLUDE_DIR})
+set(UUID_LIBRARIES ${UUID_LIBRARY})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(UUID  DEFAULT_MSG
+                                  UUID_LIBRARY UUID_INCLUDE_DIR)
+
+
+mark_as_advanced(UUID_INCLUDE_DIRS UUID_LIBRARIES)

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/95fa21ee/libminifi/include/ProcessContext.h
----------------------------------------------------------------------
diff --git a/libminifi/include/ProcessContext.h 
b/libminifi/include/ProcessContext.h
index 2a88b93..8d0bdd1 100644
--- a/libminifi/include/ProcessContext.h
+++ b/libminifi/include/ProcessContext.h
@@ -54,6 +54,21 @@ public:
                else
                        return false;
        }
+       //! Sets the property value using the property's string name
+       bool setProperty(std::string name, std::string value)
+       {
+               if (_processor)
+                       return _processor->setProperty(name, value);
+               else
+                       return false;
+       }
+       //! Sets the property value using the Property object
+       bool setProperty(Property prop, std::string value) {
+               if (_processor)
+                       return _processor->setProperty(prop, value);
+               else
+                       return false;
+       }
        //! Whether the relationship is supported
        bool isSupportedRelationship(Relationship relationship) {
                if (_processor)

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/95fa21ee/libminifi/include/Processor.h
----------------------------------------------------------------------
diff --git a/libminifi/include/Processor.h b/libminifi/include/Processor.h
index eb3ef9f..35bf040 100644
--- a/libminifi/include/Processor.h
+++ b/libminifi/include/Processor.h
@@ -126,6 +126,8 @@ public:
        bool getProperty(std::string name, std::string &value);
        //! Set the supported property value by name wile the process is not 
running
        bool setProperty(std::string name, std::string value);
+       //! Set the supported property value by using the property itself.
+       bool setProperty(Property prop, std::string value);
        //! Whether the relationship is supported
        bool isSupportedRelationship(Relationship relationship);
        //! Set the auto terminated relationships while the process is not 
running

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/95fa21ee/libminifi/src/Processor.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/Processor.cpp b/libminifi/src/Processor.cpp
index 8da253a..6a11893 100644
--- a/libminifi/src/Processor.cpp
+++ b/libminifi/src/Processor.cpp
@@ -226,6 +226,30 @@ bool Processor::setProperty(std::string name, std::string 
value)
        }
 }
 
+bool Processor::setProperty(Property prop, std::string value) {
+
+       std::lock_guard<std::mutex> lock(_mtx);
+       auto it = _properties.find(
+                       prop.getName());
+
+       if (it != _properties.end()) {
+               Property item = it->second;
+               item.setValue(value);
+               _properties[item.getName()] = item;
+               _logger->log_info("Processor %s property name %s value %s",
+                               _name.c_str(), item.getName().c_str(), 
value.c_str());
+               return true;
+       } else {
+               Property newProp(prop);
+               newProp.setValue(value);
+               _properties.insert(
+                               std::pair<std::string, 
Property>(prop.getName(), newProp));
+               return true;
+
+               return false;
+       }
+}
+
 std::set<Connection *> Processor::getOutGoingConnections(std::string 
relationship)
 {
        std::set<Connection *> empty;

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/95fa21ee/libminifi/test/TestBase.h
----------------------------------------------------------------------
diff --git a/libminifi/test/TestBase.h b/libminifi/test/TestBase.h
new file mode 100644
index 0000000..a0950e1
--- /dev/null
+++ b/libminifi/test/TestBase.h
@@ -0,0 +1,25 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef LIBMINIFI_TEST_TESTBASE_H_
+#define LIBMINIFI_TEST_TESTBASE_H_
+
+#include "catch.hpp"
+
+
+#endif /* LIBMINIFI_TEST_TESTBASE_H_ */

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/95fa21ee/libminifi/test/unit/ProcessorTests.h
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/ProcessorTests.h 
b/libminifi/test/unit/ProcessorTests.h
new file mode 100644
index 0000000..0cb6f65
--- /dev/null
+++ b/libminifi/test/unit/ProcessorTests.h
@@ -0,0 +1,100 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <cstdlib>
+#include <uuid/uuid.h>
+#include <fstream>
+#include "../TestBase.h"
+#include "GetFile.h"
+
+
+TEST_CASE("Test Creation of GetFile", "[getfileCreate]"){
+       GetFile processor("processorname");
+       REQUIRE( processor.getName() == "processorname");
+}
+
+
+TEST_CASE("Test Find file", "[getfileCreate2]"){
+
+
+       GetFile processor("getfileCreate2");
+
+       char format[] ="/tmp/gt.XXXXXX";
+       char *dir = mkdtemp(format);
+
+
+       Connection connection("emptyConnection");
+       connection.setRelationship(Relationship("success","description"));
+
+       // link the connections so that we can test results at the end for this
+
+       connection.setSourceProcessor(&processor);
+
+       uuid_t processoruuid;
+       uuid_parse(processor.getUUIDStr().c_str(),processoruuid);
+
+       connection.setSourceProcessorUUID(processoruuid);
+
+       processor.addConnection(&connection);
+       REQUIRE( dir != NULL );
+
+       ProcessContext context(&processor);
+       context.setProperty(GetFile::Directory,dir);
+       ProcessSession session(&context);
+
+
+       REQUIRE( processor.getName() == "getfileCreate2");
+
+       FlowFileRecord *record;
+       processor.setScheduledState(ScheduledState::RUNNING);
+       processor.onTrigger(&context,&session);
+
+       ProvenanceReporter *reporter = session.getProvenanceReporter();
+       std::set<ProvenanceEventRecord *> records = reporter->getEvents();
+
+    record = session.get();
+       REQUIRE( record== 0 );
+       REQUIRE( records.size() == 0 );
+
+       std::fstream file;
+       std::stringstream ss;
+       ss << dir << "/" << "tstFile";
+       file.open(ss.str(),std::ios::out);
+       file << "tempFile";
+       file.close();
+
+       processor.incrementActiveTasks();
+       processor.setScheduledState(ScheduledState::RUNNING);
+       processor.onTrigger(&context,&session);
+       unlink(ss.str().c_str());
+       rmdir(dir);
+
+       reporter = session.getProvenanceReporter();
+
+       records = reporter->getEvents();
+
+       for(ProvenanceEventRecord *provEventRecord : records)
+       {
+
+               REQUIRE (provEventRecord->getComponentType() == 
processor.getName());
+       }
+
+
+
+
+}
+

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/95fa21ee/libminifi/test/unit/ProvenanceTestHelper.h
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/ProvenanceTestHelper.h 
b/libminifi/test/unit/ProvenanceTestHelper.h
new file mode 100644
index 0000000..2516ed9
--- /dev/null
+++ b/libminifi/test/unit/ProvenanceTestHelper.h
@@ -0,0 +1,67 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef LIBMINIFI_TEST_UNIT_PROVENANCETESTHELPER_H_
+#define LIBMINIFI_TEST_UNIT_PROVENANCETESTHELPER_H_
+
+#include "Provenance.h"
+
+class ProvenanceTestRepository : public ProvenanceRepository
+{
+public:
+               //! initialize
+               bool initialize()
+               {
+                       return true;
+               }
+
+               //! Destructor
+               virtual ~ProvenanceTestRepository() {
+
+               }
+
+               bool Put(std::string key, uint8_t *buf, int bufLen)
+               {
+                       
repositoryResults.insert(std::pair<std::string,std::string>(key,std::string((const
 char*)buf,bufLen)));
+                       return true;
+               }
+               //! Delete
+               bool Delete(std::string key)
+               {
+                       repositoryResults.erase(key);
+                       return true;
+               }
+               //! Get
+               bool Get(std::string key, std::string &value)
+               {
+                       auto result = repositoryResults.find(key);
+                       if (result != repositoryResults.end())
+                       {
+                               value = result->second;
+                               return true;
+                       }
+                       else
+                       {
+                               return false;
+                       }
+               }
+protected:
+               std::map<std::string,std::string> repositoryResults;
+};
+
+
+#endif /* LIBMINIFI_TEST_UNIT_PROVENANCETESTHELPER_H_ */

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/95fa21ee/libminifi/test/unit/ProvenanceTests.h
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/ProvenanceTests.h 
b/libminifi/test/unit/ProvenanceTests.h
new file mode 100644
index 0000000..63608df
--- /dev/null
+++ b/libminifi/test/unit/ProvenanceTests.h
@@ -0,0 +1,36 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "../TestBase.h"
+
+#include "ProvenanceTestHelper.h"
+#include "Provenance.h"
+#include "FlowFileRecord.h"
+
+
+TEST_CASE("Test Provenance record creation", "[TestProvenanceEventRecord]"){
+
+       ProvenanceEventRecord 
record1(ProvenanceEventRecord::ProvenanceEventType::CREATE,"blah","blahblah");
+
+
+       REQUIRE( record1.getAttributes().size() == 0);
+       REQUIRE( record1.getAlternateIdentifierUri().length() == 0);
+
+}
+
+

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/95fa21ee/libminifi/test/unit/Tests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/Tests.cpp b/libminifi/test/unit/Tests.cpp
new file mode 100644
index 0000000..9150ed8
--- /dev/null
+++ b/libminifi/test/unit/Tests.cpp
@@ -0,0 +1,23 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define CATCH_CONFIG_MAIN  // This tells Catch to provide a main() - only do 
this in one cpp file
+
+
+#include "ProvenanceTests.h"
+#include "ProcessorTests.h"

Reply via email to