Update to CAPU v0.19.0

CAPU 0.19.0 provides bug fixes and improvements listed here:
https://github.com/bmwcarit/capu/releases

Change-Id: I28ccc1e5549337aa81946db20a6847d9fbbd0a8b

git-svn-id: https://svn.apache.org/repos/asf/etch/trunk@1679585 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/binding-cpp/runtime/CMakeLists.txt b/binding-cpp/runtime/CMakeLists.txt
index 3d063c7..fe2c6ab 100644
--- a/binding-cpp/runtime/CMakeLists.txt
+++ b/binding-cpp/runtime/CMakeLists.txt
@@ -75,8 +75,8 @@
 #install capu headers and library
 INSTALL(DIRECTORY ${LIBCAPU_INCLUDE_DIR}/capu DESTINATION "${ETCH_INSTALL_DIR}/include")
 
-INSTALL(DIRECTORY ${LIBCAPU_LIBRARY_DIR}/ DESTINATION "${ETCH_INSTALL_DIR}/lib/${ETCH_TARGET_PLATFORM}/${CMAKE_BUILD_TYPE}" FILES_MATCHING PATTERN "*capu*" PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ)
+INSTALL(DIRECTORY ${LIBCAPU_LIBRARY_DIR}/ DESTINATION "${ETCH_INSTALL_DIR}/lib/${ETCH_TARGET_PLATFORM}/${CMAKE_BUILD_TYPE}" FILES_MATCHING PATTERN "*Capu*" PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ)
 IF (NOT ${LIBCAPU_BINARY_DIR} STREQUAL "")
-  INSTALL(DIRECTORY ${LIBCAPU_BINARY_DIR} DESTINATION "${ETCH_INSTALL_DIR}/bin/${ETCH_TARGET_PLATFORM}/${CMAKE_BUILD_TYPE}" FILES_MATCHING PATTERN "capuTest*" PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ)
+  INSTALL(DIRECTORY ${LIBCAPU_BINARY_DIR} DESTINATION "${ETCH_INSTALL_DIR}/bin/${ETCH_TARGET_PLATFORM}/${CMAKE_BUILD_TYPE}" FILES_MATCHING PATTERN "CapuTest*" PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ)
 ENDIF()
 
diff --git a/binding-cpp/runtime/FindCapu.cmake b/binding-cpp/runtime/FindCapu.cmake
index 3942395..bc61a45 100644
--- a/binding-cpp/runtime/FindCapu.cmake
+++ b/binding-cpp/runtime/FindCapu.cmake
@@ -28,25 +28,23 @@
 IF ("${CAPU_INCLUDE_DIR}" STREQUAL "" AND "${CAPU_LIBRARY_DIR}" STREQUAL "")
     include(ExternalProject)
 
-    MESSAGE(STATUS "using ${CAPU_INCLUDE_DIR} as CAPU include directory")
-    MESSAGE(STATUS "using ${CAPU_LIBRARY_DIR} as CAPU library directory")
-
     IF ("${LOCAL_CAPU_SOURCE_DIR}" STREQUAL "")
         #download capu from foreign repository
+        MESSAGE("Download capu from github repository")
         SET(CAPU_PROJECT_DIR "${CMAKE_BINARY_DIR}/3rd/capu")
         SET(CAPU_CMAKE_BUILD_DIR "${CAPU_BUILD_DIR}/${TARGET_OS}_${TARGET_ARCH}")
-
+        SET(CAPU_INSTALL_DIR ${CAPU_BUILD_DIR}/deliverable)
         ExternalProject_Add(
-            Capu
-            URL https://github.com/bmwcarit/capu/archive/v0.14.0.zip
+            Capu_external
+            URL https://github.com/bmwcarit/capu/archive/v0.19.0.zip
             SOURCE_DIR "${CAPU_PROJECT_DIR}"
             BINARY_DIR "${CAPU_CMAKE_BUILD_DIR}"
-            INSTALL_DIR "${CAPU_BUILD_DIR}/deliverable"
+            INSTALL_DIR "${CAPU_INSTALL_DIR}"
             UPDATE_COMMAND ""
             CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE:PATH=${CMAKE_TOOLCHAIN_FILE}
-                       -DCMAKE_INSTALL_PREFIX:STRING=${CAPU_BUILD_DIR}/deliverable/${TARGET_OS}_${TARGET_ARCH}/${CMAKE_BUILD_TYPE}
                        -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-                       -DCONFIG_BUILD_UNITTESTS:BOOLEAN=${CONFIG_BUILD_UNITTESTS}
+                       -DCapu_BUILD_TESTS:BOOLEAN=${CONFIG_BUILD_UNITTESTS}
+                       -DCMAKE_INSTALL_PREFIX:PATH=${CAPU_INSTALL_DIR}
                        INSTALL 1
         )
     ELSE()
@@ -54,25 +52,23 @@
         SET(CAPU_CMAKE_BUILD_DIR "${CAPU_BUILD_DIR}/${TARGET_OS}_${TARGET_ARCH}")
 
         ExternalProject_Add(
-            Capu
+            Capu_external
             SOURCE_DIR "${CAPU_PROJECT_DIR}"
             BINARY_DIR "${CAPU_CMAKE_BUILD_DIR}"
             DOWNLOAD_COMMAND ""
             UPDATE_COMMAND ""
-            INSTALL_DIR "${CAPU_BUILD_DIR}/deliverable"
+            INSTALL_DIR "${CAPU_INSTALL_DIR}"
             CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE:PATH=${CMAKE_TOOLCHAIN_FILE}
-                       -DCMAKE_INSTALL_PREFIX:STRING=${CAPU_BUILD_DIR}/deliverable/${TARGET_OS}_${TARGET_ARCH}/${CMAKE_BUILD_TYPE}
                        -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-                       -DCONFIG_BUILD_UNITTESTS:BOOL=${CONFIG_BUILD_UNITTESTS}
+                       -DCapu_BUILD_TESTS:BOOL=${CONFIG_BUILD_UNITTESTS}
+                       -DCMAKE_INSTALL_PREFIX:PATH=${CAPU_INSTALL_DIR}
                        INSTALL 1
         )
     ENDIF()
 
-    SET(CAPU_DELIVERABLE_DIR ${CAPU_BUILD_DIR}/deliverable/${TARGET_OS}_${TARGET_ARCH}/${CMAKE_BUILD_TYPE})
-
-    SET(LIBCAPU_INCLUDE_DIR ${CAPU_DELIVERABLE_DIR}/include)
-    SET(LIBCAPU_LIBRARY_DIR ${CAPU_DELIVERABLE_DIR}/lib)
-    SET(LIBCAPU_BINARY_DIR ${CAPU_DELIVERABLE_DIR}/bin)
+    SET(LIBCAPU_INCLUDE_DIR ${CAPU_INSTALL_DIR}/include)
+    SET(LIBCAPU_LIBRARY_DIR ${CAPU_INSTALL_DIR}/lib)
+    SET(LIBCAPU_BINARY_DIR ${CAPU_INSTALL_DIR}/bin)
 ELSE()
     SET(LIBCAPU_INCLUDE_DIR ${CAPU_INCLUDE_DIR})
     SET(LIBCAPU_LIBRARY_DIR ${CAPU_LIBRARY_DIR})
diff --git a/binding-cpp/runtime/include/common/EtchHashNative.h b/binding-cpp/runtime/include/common/EtchHashNative.h
index 0b18467..716cf5d 100644
--- a/binding-cpp/runtime/include/common/EtchHashNative.h
+++ b/binding-cpp/runtime/include/common/EtchHashNative.h
@@ -27,15 +27,15 @@
 
   template<class T>
   static capu::uint_t Digest(T &key, const capu::uint8_t bitSize) {
-    return capu::CapuDefaultHashFunction::Digest<T>(key, bitSize);
+    return capu::CapuDefaultHashFunction<sizeof(capu::uint_t)*8>::Digest<T>(key, bitSize);
   }
 
   static capu::uint_t Digest(char* key, const capu::uint8_t bitSize) {
-    return capu::CapuDefaultHashFunction::Digest(key, bitSize);
+    return capu::CapuDefaultHashFunction<sizeof(capu::uint_t)*8>::Digest(key, bitSize);
   }
 
   static capu::uint_t Digest(const char* key, const capu::uint8_t bitSize) {
-    return capu::CapuDefaultHashFunction::Digest(key, bitSize);
+    return capu::CapuDefaultHashFunction<sizeof(capu::uint_t)*8>::Digest(key, bitSize);
   }
 
 };
diff --git a/binding-cpp/runtime/include/common/EtchSocket.h b/binding-cpp/runtime/include/common/EtchSocket.h
index b2ab0e4..0801489 100644
--- a/binding-cpp/runtime/include/common/EtchSocket.h
+++ b/binding-cpp/runtime/include/common/EtchSocket.h
@@ -151,7 +151,7 @@
    *         ETCH_SOCKET_ESOCKET if the socket is not created
    *         ETCH_ERROR otherwise
    */
-  status_t getLingerOption(capu::bool_t& isLinger, capu::int32_t& linger);
+  status_t getLingerOption(capu::bool_t& isLinger, capu::uint16_t& linger);
 
   /**
    * Get no delay option
diff --git a/binding-cpp/runtime/src/main/CMakeLists.txt b/binding-cpp/runtime/src/main/CMakeLists.txt
index e956f31..2fb6e43 100644
--- a/binding-cpp/runtime/src/main/CMakeLists.txt
+++ b/binding-cpp/runtime/src/main/CMakeLists.txt
@@ -242,7 +242,7 @@
 
 set_target_properties (etch-cpp PROPERTIES OUTPUT_NAME "etch")
 
-add_dependencies (etch-cpp Capu)
+add_dependencies (etch-cpp Capu_external)
 
 #install etch headers and library
 INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/include DESTINATION "${ETCH_INSTALL_DIR}")
diff --git a/binding-cpp/runtime/src/main/common/EtchObject.cpp b/binding-cpp/runtime/src/main/common/EtchObject.cpp
index 451bc00..128c1e6 100644
--- a/binding-cpp/runtime/src/main/common/EtchObject.cpp
+++ b/binding-cpp/runtime/src/main/common/EtchObject.cpp
@@ -53,7 +53,7 @@
 }

 

 capu::uint32_t EtchObject::getHashCode() const{

-  return capu::CapuDefaultHashFunction::Digest(this);

+  return capu::CapuDefaultHashFunction<sizeof(capu::uint_t)*8>::Digest(this);

 }

 

 capu::bool_t EtchObject::equals(const EtchObject* other) const{

diff --git a/binding-cpp/runtime/src/main/common/EtchObjectType.cpp b/binding-cpp/runtime/src/main/common/EtchObjectType.cpp
index 561ac62..52abf4c 100644
--- a/binding-cpp/runtime/src/main/common/EtchObjectType.cpp
+++ b/binding-cpp/runtime/src/main/common/EtchObjectType.cpp
@@ -76,7 +76,7 @@
 }
 
 capu::uint32_t EtchObjectType::getHashCode() const {
-  return capu::CapuDefaultHashFunction::Digest(this);
+  return capu::CapuDefaultHashFunction<sizeof(capu::uint_t)*8>::Digest(this);
 }
 
 capu::bool_t EtchObjectType::equals(const EtchObjectType* type) const {
diff --git a/binding-cpp/runtime/src/main/common/EtchSocket.cpp b/binding-cpp/runtime/src/main/common/EtchSocket.cpp
index 0c0efb9..81acf35 100644
--- a/binding-cpp/runtime/src/main/common/EtchSocket.cpp
+++ b/binding-cpp/runtime/src/main/common/EtchSocket.cpp
@@ -89,7 +89,7 @@
   return mSocket->getKeepAlive(keepAlive);
 }
 
-status_t EtchSocket::getLingerOption(capu::bool_t& isLinger, capu::int32_t& linger) {
+status_t EtchSocket::getLingerOption(capu::bool_t& isLinger, capu::uint16_t& linger) {
   return mSocket->getLingerOption(isLinger, linger);
 }
 
diff --git a/binding-cpp/runtime/src/test/CMakeLists.txt b/binding-cpp/runtime/src/test/CMakeLists.txt
index fe46677..f977634 100644
--- a/binding-cpp/runtime/src/test/CMakeLists.txt
+++ b/binding-cpp/runtime/src/test/CMakeLists.txt
@@ -105,15 +105,15 @@
 )
 
 IF (TARGET_OS STREQUAL "Linux")
-  target_link_libraries (etch-cpp-test etch-cpp capu pthread rt)
+  target_link_libraries (etch-cpp-test etch-cpp Capu pthread rt)
 ELSEIF(TARGET_OS STREQUAL "Windows")
-  target_link_libraries (etch-cpp-test etch-cpp capu)
+  target_link_libraries (etch-cpp-test etch-cpp Capu)
 ELSEIF(TARGET_OS STREQUAL "QNX")
-  target_link_libraries (etch-cpp-test etch-cpp capu c socket)
+  target_link_libraries (etch-cpp-test etch-cpp Capu c socket)
 ELSEIF(TARGET_OS STREQUAL "MacOSX")
-  target_link_libraries (etch-cpp-test etch-cpp capu)
+  target_link_libraries (etch-cpp-test etch-cpp Capu)
 ELSEIF(TARGET_OS STREQUAL "iPhoneSimulatorOS")
-  target_link_libraries (etch-cpp-test etch-cpp capu)
+  target_link_libraries (etch-cpp-test etch-cpp Capu)
 ENDIF()
 
 IF (TARGET_OS STREQUAL "Windows" AND BUILD_CHECK_MEMORY)
@@ -125,7 +125,7 @@
 ENDIF ()
 
 
-add_dependencies (etch-cpp-test etch-cpp Capu)
+add_dependencies (etch-cpp-test etch-cpp Capu_external)
 
 #install test executables
 INSTALL(TARGETS etch-cpp-test DESTINATION "${ETCH_INSTALL_DIR}/bin/${ETCH_TARGET_PLATFORM}/Release" CONFIGURATIONS Release)
diff --git a/binding-cpp/runtime/src/test/support/EtchRuntimeTest.cpp b/binding-cpp/runtime/src/test/support/EtchRuntimeTest.cpp
index 2dd41c8..d6f854b 100644
--- a/binding-cpp/runtime/src/test/support/EtchRuntimeTest.cpp
+++ b/binding-cpp/runtime/src/test/support/EtchRuntimeTest.cpp
@@ -25,6 +25,8 @@
   virtual ~MockLogAppender() {};
 
   MOCK_METHOD1(log, void(const capu::LogMessage& message));
+  MOCK_METHOD0(getLogLevel, capu::ELogLevel());
+  MOCK_METHOD1(setLogLevel, void(const capu::ELogLevel level));
 
 };
 
diff --git a/examples/helloworld/cpp/CMakeLists.txt b/examples/helloworld/cpp/CMakeLists.txt
index 627a2a8..32b5d81 100644
--- a/examples/helloworld/cpp/CMakeLists.txt
+++ b/examples/helloworld/cpp/CMakeLists.txt
@@ -81,9 +81,9 @@
 
 
 IF (TARGET_OS STREQUAL "Linux")
-  target_link_libraries(etch-cpp-helloworld-server etch capu pthread rt)
+  target_link_libraries(etch-cpp-helloworld-server etch Capu pthread rt)
 ELSEIF(TARGET_OS STREQUAL "Windows")
-  target_link_libraries(etch-cpp-helloworld-server etch capu)
+  target_link_libraries(etch-cpp-helloworld-server etch Capu)
   IF (BUILD_CHECK_MEMORY)
     add_definitions(-DBUILD_CHECK_MEMORY)
     include_directories (${VLD}/include)
@@ -94,7 +94,7 @@
     target_link_libraries (etch-cpp-helloworld-server ${VLD}/lib/Win32/vld.lib)
   ENDIF (BUILD_CHECK_MEMORY)
 ELSEIF(TARGET_OS STREQUAL "QNX")
-  target_link_libraries (etch-cpp-helloworld-server etch capu c socket)
+  target_link_libraries (etch-cpp-helloworld-server etch Capu c socket)
 ENDIF()
 
 set_target_properties(etch-cpp-helloworld-server PROPERTIES OUTPUT_NAME "helloworld-server")
@@ -122,9 +122,9 @@
 )
 
 IF (TARGET_OS STREQUAL "Linux")
-  target_link_libraries(etch-cpp-helloworld-client etch capu pthread rt)
+  target_link_libraries(etch-cpp-helloworld-client etch Capu pthread rt)
 ELSEIF(TARGET_OS STREQUAL "Windows")
-  target_link_libraries(etch-cpp-helloworld-client etch capu )
+  target_link_libraries(etch-cpp-helloworld-client etch Capu )
   IF (BUILD_CHECK_MEMORY)
     add_definitions(-DBUILD_CHECK_MEMORY)
     include_directories (${VLD}/include)
@@ -135,7 +135,7 @@
     target_link_libraries (etch-cpp-helloworld-client ${VLD}/lib/Win32/vld.lib)
   ENDIF (BUILD_CHECK_MEMORY)
 ELSEIF(TARGET_OS STREQUAL "QNX")
-  target_link_libraries (etch-cpp-helloworld-client etch capu c socket)
+  target_link_libraries (etch-cpp-helloworld-client etch Capu c socket)
 ENDIF()
 
 set_target_properties(etch-cpp-helloworld-client PROPERTIES OUTPUT_NAME "helloworld-client")