You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2017/02/01 15:05:02 UTC

[1/4] ignite git commit: IGNITE-4046: Added DML support to CPP platform. This closes #1432.

Repository: ignite
Updated Branches:
  refs/heads/master 4908210aa -> e92d44f68


http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/odbc-test/src/sql_types_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_types_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_types_test.cpp
index bba806c..4c0f892 100644
--- a/modules/platforms/cpp/odbc-test/src/sql_types_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/sql_types_test.cpp
@@ -25,6 +25,7 @@
 #include "test_utils.h"
 
 using namespace ignite;
+using namespace ignite_test;
 
 using namespace boost::unit_test;
 
@@ -192,7 +193,7 @@ BOOST_AUTO_TEST_CASE(TestTimestampSelect)
 {
     TestType in1;
     in1.i32Field = 1;
-    in1.timestampField = impl::binary::BinaryUtils::MakeTimestampGmt(2017, 1, 13, 19, 54, 01, 987654321);
+    in1.timestampField = common::MakeTimestampGmt(2017, 1, 13, 19, 54, 01, 987654321);
 
     testCache.Put(1, in1);
 
@@ -230,7 +231,7 @@ BOOST_AUTO_TEST_CASE(TestTimestampInsert)
     data.fraction = 987654321;
 
     using ignite::impl::binary::BinaryUtils;
-    Timestamp expected = BinaryUtils::MakeTimestampGmt(data.year, data.month, data.day, data.hour,
+    Timestamp expected = common::MakeTimestampGmt(data.year, data.month, data.day, data.hour,
         data.minute, data.second, data.fraction);
 
     SQLLEN lenInd = sizeof(data);
@@ -259,7 +260,7 @@ BOOST_AUTO_TEST_CASE(TestTimeSelect)
 
     TestType in1;
     in1.i32Field = 1;
-    in1.timestampField = impl::binary::BinaryUtils::MakeTimestampGmt(2017, 1, 13, ts.hour, ts.minute, ts.second);
+    in1.timestampField = common::MakeTimestampGmt(2017, 1, 13, ts.hour, ts.minute, ts.second);
 
     testCache.Put(1, in1);
 
@@ -293,8 +294,7 @@ BOOST_AUTO_TEST_CASE(TestTimeInsertToTimestamp)
     data.second = 1;
 
     using ignite::impl::binary::BinaryUtils;
-    Timestamp expected = BinaryUtils::MakeTimestampGmt(1970, 1, 1, data.hour,
-        data.minute, data.second, 0);
+    Timestamp expected = common::MakeTimestampGmt(1970, 1, 1, data.hour, data.minute, data.second, 0);
 
     SQLLEN lenInd = sizeof(data);
     ret = SQLBindParameter(stmt, 2, SQL_PARAM_INPUT, SQL_C_TIME, SQL_TIMESTAMP, sizeof(data), 0, &data, sizeof(data), &lenInd);

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/odbc-test/src/test_utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/test_utils.cpp b/modules/platforms/cpp/odbc-test/src/test_utils.cpp
index 48f409b..89d50ef 100644
--- a/modules/platforms/cpp/odbc-test/src/test_utils.cpp
+++ b/modules/platforms/cpp/odbc-test/src/test_utils.cpp
@@ -15,11 +15,12 @@
  * limitations under the License.
  */
 
+#include <cassert>
+
 #include "test_utils.h"
 
-namespace ignite
+namespace ignite_test
 {
-
     std::string GetOdbcErrorMessage(SQLSMALLINT handleType, SQLHANDLE handle)
     {
         SQLCHAR sqlstate[7] = {};
@@ -33,4 +34,59 @@ namespace ignite
         return std::string(reinterpret_cast<char*>(sqlstate)) + ": " +
             std::string(reinterpret_cast<char*>(message), reallen);
     }
+
+    void InitConfig(ignite::IgniteConfiguration& cfg, const char* cfgFile)
+    {
+        using namespace ignite;
+
+        assert(cfgFile != 0);
+
+        cfg.jvmOpts.push_back("-Xdebug");
+        cfg.jvmOpts.push_back("-Xnoagent");
+        cfg.jvmOpts.push_back("-Djava.compiler=NONE");
+        cfg.jvmOpts.push_back("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
+        cfg.jvmOpts.push_back("-XX:+HeapDumpOnOutOfMemoryError");
+        cfg.jvmOpts.push_back("-Duser.timezone=GMT");
+        cfg.jvmOpts.push_back("-DIGNITE_QUIET=false");
+        cfg.jvmOpts.push_back("-DIGNITE_CONSOLE_APPENDER=false");
+        cfg.jvmOpts.push_back("-DIGNITE_UPDATE_NOTIFIER=false");
+
+#ifdef IGNITE_TESTS_32
+        cfg.jvmInitMem = 256;
+        cfg.jvmMaxMem = 768;
+#else
+        cfg.jvmInitMem = 1024;
+        cfg.jvmMaxMem = 4096;
+#endif
+
+        char* cfgPath = getenv("IGNITE_NATIVE_TEST_ODBC_CONFIG_PATH");
+
+        assert(cfgPath != 0);
+
+        cfg.springCfgPath = std::string(cfgPath).append("/").append(cfgFile);
+    }
+
+    ignite::Ignite StartNode(const char* cfgFile)
+    {
+        using namespace ignite;
+
+        IgniteConfiguration cfg;
+
+        InitConfig(cfg, cfgFile);
+
+        return Ignition::Start(cfg);
+    }
+
+    ignite::Ignite StartNode(const char* cfgFile, const char* name)
+    {
+        using namespace ignite;
+
+        assert(name != 0);
+
+        IgniteConfiguration cfg;
+
+        InitConfig(cfg, cfgFile);
+
+        return Ignition::Start(cfg, name);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp b/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp
index 85979c8..026cd60 100644
--- a/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp
+++ b/modules/platforms/cpp/odbc/src/app/application_data_buffer.cpp
@@ -672,7 +672,7 @@ namespace ignite
 
                 tm tmTime;
 
-                BinaryUtils::DateToCTm(value, tmTime);
+                common::DateToCTm(value, tmTime);
 
                 SqlLen* resLenPtr = GetResLen();
                 void* dataPtr = GetData();
@@ -806,7 +806,7 @@ namespace ignite
 
                 tm tmTime;
 
-                BinaryUtils::TimestampToCTm(value, tmTime);
+                common::TimestampToCTm(value, tmTime);
 
                 SqlLen* resLenPtr = GetResLen();
                 void* dataPtr = GetData();
@@ -1306,7 +1306,7 @@ namespace ignite
                         break;
                 }
 
-                return BinaryUtils::CTmToDate(tmTime);
+                return common::CTmToDate(tmTime);
             }
 
             Timestamp ApplicationDataBuffer::GetTimestamp() const
@@ -1382,7 +1382,7 @@ namespace ignite
                         break;
                 }
 
-                return BinaryUtils::CTmToTimestamp(tmTime, nanos);
+                return common::CTmToTimestamp(tmTime, nanos);
             }
 
             void ApplicationDataBuffer::GetDecimal(common::Decimal& val) const


[2/4] ignite git commit: IGNITE-4046: Added DML support to CPP platform. This closes #1432.

Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/core-test/config/cache-identity.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/config/cache-identity.xml b/modules/platforms/cpp/core-test/config/cache-identity.xml
new file mode 100644
index 0000000..ace9f6a
--- /dev/null
+++ b/modules/platforms/cpp/core-test/config/cache-identity.xml
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    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.
+-->
+
+<!--
+    Ignite Spring configuration file to startup grid cache.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd
+        http://www.springframework.org/schema/util
+        http://www.springframework.org/schema/util/spring-util.xsd">
+    <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+        <property name="localHost" value="127.0.0.1"/>
+        <property name="connectorConfiguration"><null/></property>
+
+        <property name="cacheConfiguration">
+            <list>
+                <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                    <property name="name" value="cache1"/>
+                    <property name="cacheMode" value="PARTITIONED"/>
+                    <property name="atomicityMode" value="TRANSACTIONAL"/>
+                    <property name="writeSynchronizationMode" value="FULL_SYNC"/>
+
+                    <!-- Configure type metadata to enable queries. -->
+                    <property name="queryEntities">
+                        <list>
+                            <bean class="org.apache.ignite.cache.QueryEntity">
+                                <property name="keyType" value="CompositeKey"/>
+                                <property name="valueType" value="java.lang.Integer"/>
+
+                                <property name="fields">
+                                    <map>
+                                        <entry key="str" value="java.lang.String"/>
+                                        <entry key="ts" value="java.sql.Timestamp"/>
+                                        <entry key="guid" value="java.util.UUID"/>
+                                    </map>
+                                </property>
+
+                                <property name="keyFields">
+                                    <list>
+                                        <value>str</value>
+                                        <value>ts</value>
+                                        <value>guid</value>
+                                    </list>
+                                </property>
+                            </bean>
+                        </list>
+                    </property>
+                </bean>
+
+                <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                    <property name="name" value="cache2"/>
+                    <property name="cacheMode" value="PARTITIONED"/>
+                    <property name="atomicityMode" value="TRANSACTIONAL"/>
+                    <property name="writeSynchronizationMode" value="FULL_SYNC"/>
+
+                    <!-- Configure type metadata to enable queries. -->
+                    <property name="queryEntities">
+                        <list>
+                            <bean class="org.apache.ignite.cache.QueryEntity">
+                                <property name="keyType" value="CompositeKeySimple"/>
+                                <property name="valueType" value="java.lang.Integer"/>
+
+                                <property name="fields">
+                                    <map>
+                                        <entry key="str" value="java.lang.String"/>
+                                        <entry key="ts" value="java.sql.Timestamp"/>
+                                        <entry key="i64" value="java.lang.Long"/>
+                                    </map>
+                                </property>
+
+                                <property name="keyFields">
+                                    <list>
+                                        <value>str</value>
+                                        <value>ts</value>
+                                        <value>i64</value>
+                                    </list>
+                                </property>
+                            </bean>
+                        </list>
+                    </property>
+                </bean>
+            </list>
+        </property>
+
+        <property name="discoverySpi">
+            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+                <property name="ipFinder">
+                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
+                        <property name="addresses">
+                            <list>
+                                <!-- In distributed environment, replace with actual host IP address. -->
+                                <value>127.0.0.1:47500</value>
+                            </list>
+                        </property>
+                    </bean>
+                </property>
+                <property name="socketTimeout" value="300" />
+            </bean>
+        </property>
+    </bean>
+</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/core-test/config/cache-query.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/config/cache-query.xml b/modules/platforms/cpp/core-test/config/cache-query.xml
index dead2b1..bb18f7c 100644
--- a/modules/platforms/cpp/core-test/config/cache-query.xml
+++ b/modules/platforms/cpp/core-test/config/cache-query.xml
@@ -69,16 +69,6 @@
                                     </list>
                                 </property>
                             </bean>
-
-                            <bean class="org.apache.ignite.cache.CacheTypeMetadata">
-                                <property name="valueType" value="QueryRelation"/>
-                                <property name="queryFields">
-                                    <map>
-                                        <entry key="personId" value="java.lang.Integer"/>
-                                        <entry key="someVal" value="java.lang.Integer"/>
-                                    </map>
-                                </property>
-                            </bean>
                         </list>
                     </property>
                 </bean>

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/core-test/include/ignite/test_utils.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/include/ignite/test_utils.h b/modules/platforms/cpp/core-test/include/ignite/test_utils.h
new file mode 100644
index 0000000..2336626
--- /dev/null
+++ b/modules/platforms/cpp/core-test/include/ignite/test_utils.h
@@ -0,0 +1,63 @@
+/*
+ * 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 _IGNITE_CORE_TEST_TEST_UTILS
+#define _IGNITE_CORE_TEST_TEST_UTILS
+
+#include "ignite/ignition.h"
+
+namespace ignite_test
+{
+    /**
+     * Initialize configuration for a node.
+     *
+     * Inits Ignite node configuration from specified config file.
+     * Config file is searched in path specified by IGNITE_NATIVE_TEST_CPP_CONFIG_PATH
+     * environmental variable.
+     *
+     * @param cfg Ignite config.
+     * @param cfgFile Ignite node config file name without path.
+     */
+    void InitConfig(ignite::IgniteConfiguration& cfg, const char* cfgFile);
+
+    /**
+     * Start Ignite node.
+     *
+     * Starts new Ignite node from specified config file.
+     * Config file is searched in path specified by IGNITE_NATIVE_TEST_CPP_CONFIG_PATH
+     * environmental variable.
+     *
+     * @param cfgFile Ignite node config file name without path.
+     * @return New node.
+     */
+    ignite::Ignite StartNode(const char* cfgFile);
+
+    /**
+     * Start Ignite node.
+     *
+     * Starts new Ignite node with the specified name and from specified config file.
+     * Config file is searched in path specified by IGNITE_NATIVE_TEST_CPP_CONFIG_PATH
+     * environmental variable.
+     *
+     * @param cfgFile Ignite node config file name without path.
+     * @param name Node name.
+     * @return New node.
+     */
+    ignite::Ignite StartNode(const char* cfgFile, const char* name);
+}
+
+#endif // _IGNITE_CORE_TEST_TEST_UTILS
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj b/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj
index 634ede2..d39746e 100644
--- a/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj
+++ b/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj
@@ -33,12 +33,14 @@
     </ProjectReference>
   </ItemGroup>
   <ItemGroup>
+    <None Include="..\..\config\cache-identity.xml" />
     <None Include="..\..\config\cache-query.xml" />
     <None Include="..\..\config\cache-test.xml" />
     <None Include="..\..\config\invalid.xml" />
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\src\binary_object_test.cpp" />
+    <ClCompile Include="..\..\src\binary_identity_resolver_test.cpp" />
     <ClCompile Include="..\..\src\cache_test.cpp" />
     <ClCompile Include="..\..\src\concurrent_test.cpp" />
     <ClCompile Include="..\..\src\decimal_test.cpp" />
@@ -59,6 +61,7 @@
     <ClCompile Include="..\..\src\reference_test.cpp" />
     <ClCompile Include="..\..\src\teamcity_boost.cpp" />
     <ClCompile Include="..\..\src\teamcity_messages.cpp" />
+    <ClCompile Include="..\..\src\test_utils.cpp" />
     <ClCompile Include="..\..\src\transactions_test.cpp" />
   </ItemGroup>
   <ItemGroup>
@@ -66,6 +69,7 @@
     <ClInclude Include="..\..\include\ignite\binary_test_utils.h" />
     <ClInclude Include="..\..\include\ignite\complex_type.h" />
     <ClInclude Include="..\..\include\ignite\test_type.h" />
+    <ClInclude Include="..\..\include\ignite\test_utils.h" />
     <ClInclude Include="..\..\include\teamcity_messages.h" />
   </ItemGroup>
   <PropertyGroup Label="Globals">

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj.filters b/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj.filters
index 906a9d4..22048b1 100644
--- a/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj.filters
+++ b/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj.filters
@@ -67,6 +67,12 @@
     <ClCompile Include="..\..\src\binary_object_test.cpp">
       <Filter>Code</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\binary_identity_resolver_test.cpp">
+      <Filter>Code</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\test_utils.cpp">
+      <Filter>Code</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\include\teamcity_messages.h">
@@ -84,6 +90,9 @@
     <ClInclude Include="..\..\include\ignite\binary_test_defs.h">
       <Filter>Code</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\include\ignite\test_utils.h">
+      <Filter>Code</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <Filter Include="Code">
@@ -98,6 +107,9 @@
     <Filter Include="Code\Types">
       <UniqueIdentifier>{fb43524e-3694-44ee-b153-770cd9cf6c7a}</UniqueIdentifier>
     </Filter>
+    <Filter Include="Code\Types">
+      <UniqueIdentifier>{fb43524e-3694-44ee-b153-770cd9cf6c7a}</UniqueIdentifier>
+    </Filter>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\config\cache-test.xml">
@@ -109,5 +121,8 @@
     <None Include="..\..\config\invalid.xml">
       <Filter>Configs</Filter>
     </None>
+    <None Include="..\..\config\cache-identity.xml">
+      <Filter>Configs</Filter>
+    </None>
   </ItemGroup>
 </Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/core-test/src/binary_identity_resolver_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/binary_identity_resolver_test.cpp b/modules/platforms/cpp/core-test/src/binary_identity_resolver_test.cpp
new file mode 100644
index 0000000..6cede4e
--- /dev/null
+++ b/modules/platforms/cpp/core-test/src/binary_identity_resolver_test.cpp
@@ -0,0 +1,522 @@
+/*
+ * 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 _MSC_VER
+    #define BOOST_TEST_DYN_LINK
+#endif
+
+#include <sstream>
+
+#include <boost/test/unit_test.hpp>
+
+#include <ignite/common/utils.h>
+
+#include "ignite/cache/cache.h"
+#include "ignite/cache/query/query_cursor.h"
+#include "ignite/cache/query/query_sql_fields.h"
+#include "ignite/ignite.h"
+#include "ignite/ignition.h"
+#include "ignite/binary/binary_array_identity_resolver.h"
+
+#include "ignite/test_utils.h"
+
+
+using namespace boost::unit_test;
+
+using namespace ignite;
+using namespace ignite::cache;
+using namespace ignite::cache::query;
+using namespace ignite::common;
+using namespace ignite::binary;
+using namespace ignite::impl::interop;
+using namespace ignite::impl::binary;
+
+/**
+ * Composite key class.
+ */
+struct CompositeKey
+{
+    /**
+     * Default constructor.
+     */
+    CompositeKey() :
+        str(),
+        ts(),
+        guid()
+    {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param str String part.
+     * @param ts Timestamp part.
+     * @param guid Guid part.
+     */
+    CompositeKey(const std::string& str, const Timestamp& ts, const Guid& guid) :
+        str(str),
+        ts(ts),
+        guid(guid)
+    {
+        // No-op.
+    }
+
+    /** String part. */
+    std::string str;
+
+    /** Timestamp. */
+    Timestamp ts;
+
+    /** Guid. */
+    Guid guid;
+};
+
+/**
+ * Simple composite key class.
+ */
+struct CompositeKeySimple
+{
+    /**
+     * Default constructor.
+     */
+    CompositeKeySimple() :
+        str(),
+        ts(),
+        i64(0)
+    {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param str String part.
+     * @param ts Timestamp part.
+     * @param i64 Integer part.
+     */
+    CompositeKeySimple(const std::string& str, const Timestamp& ts, int64_t i64) :
+        str(str),
+        ts(ts),
+        i64(i64)
+    {
+        // No-op.
+    }
+
+    /** String part. */
+    std::string str;
+
+    /** Timestamp. */
+    Timestamp ts;
+
+    /** Integer 64-bit. */
+    int64_t i64;
+};
+
+struct TestUserClassBase
+{
+    int32_t field;
+};
+
+struct DefaultHashing : TestUserClassBase {};
+struct GetHashDefined : TestUserClassBase {};
+struct ResolverDefined : TestUserClassBase {};
+struct BothDefined : TestUserClassBase {};
+
+struct CustomIdResolver : binary::BinaryIdentityResolver
+{
+    int32_t GetHashCode(const BinaryObject& obj)
+    {
+        int32_t field;
+        try
+        {
+            ResolverDefined res = obj.Deserialize<ResolverDefined>();
+
+            field =  res.field;
+        }
+        catch (const IgniteError&)
+        {
+            BothDefined res = obj.Deserialize<BothDefined>();
+
+            field = res.field;
+        }
+
+        return field * 42;
+    }
+};
+
+namespace ignite
+{
+    namespace binary
+    {
+        template<>
+        struct BinaryType<DefaultHashing>
+        {
+            IGNITE_BINARY_GET_TYPE_ID_AS_HASH(DefaultHashing)
+            IGNITE_BINARY_GET_TYPE_NAME_AS_IS(DefaultHashing)
+            IGNITE_BINARY_GET_FIELD_ID_AS_HASH
+            IGNITE_BINARY_IS_NULL_FALSE(DefaultHashing)
+            IGNITE_BINARY_GET_NULL_DEFAULT_CTOR(DefaultHashing)
+
+            void Write(BinaryWriter& writer, const DefaultHashing& obj)
+            {
+                writer.WriteInt32("field", obj.field);
+            }
+
+            DefaultHashing Read(BinaryReader& reader)
+            {
+                DefaultHashing val;
+
+                val.field = reader.ReadInt32("field");
+
+                return val;
+            }
+        };
+
+        template<>
+        struct BinaryType<GetHashDefined>
+        {
+            IGNITE_BINARY_GET_TYPE_ID_AS_HASH(GetHashDefined)
+            IGNITE_BINARY_GET_TYPE_NAME_AS_IS(GetHashDefined)
+            IGNITE_BINARY_GET_FIELD_ID_AS_HASH
+            IGNITE_BINARY_IS_NULL_FALSE(GetHashDefined)
+            IGNITE_BINARY_GET_NULL_DEFAULT_CTOR(GetHashDefined)
+
+            int32_t GetHashCode(const GetHashDefined& obj)
+            {
+                return obj.field * 10;
+            }
+
+            void Write(BinaryWriter& writer, const GetHashDefined& obj)
+            {
+                writer.WriteInt32("field", obj.field);
+            }
+
+            GetHashDefined Read(BinaryReader& reader)
+            {
+                GetHashDefined val;
+
+                val.field = reader.ReadInt32("field");
+
+                return val;
+            }
+        };
+
+        template<>
+        struct BinaryType<ResolverDefined>
+        {
+            IGNITE_BINARY_GET_TYPE_ID_AS_HASH(ResolverDefined)
+            IGNITE_BINARY_GET_TYPE_NAME_AS_IS(ResolverDefined)
+            IGNITE_BINARY_GET_FIELD_ID_AS_HASH
+            IGNITE_BINARY_IS_NULL_FALSE(ResolverDefined)
+            IGNITE_BINARY_GET_NULL_DEFAULT_CTOR(ResolverDefined)
+
+            ignite::Reference<ignite::binary::BinaryIdentityResolver> GetIdentityResolver()
+            {
+                return ignite::MakeReferenceFromCopy(CustomIdResolver());
+            }
+
+            void Write(BinaryWriter& writer, const ResolverDefined& obj)
+            {
+                writer.WriteInt32("field", obj.field);
+            }
+
+            ResolverDefined Read(BinaryReader& reader)
+            {
+                ResolverDefined val;
+
+                val.field = reader.ReadInt32("field");
+
+                return val;
+            }
+        };
+
+        template<>
+        struct BinaryType<BothDefined>
+        {
+            IGNITE_BINARY_GET_TYPE_ID_AS_HASH(BothDefined)
+            IGNITE_BINARY_GET_TYPE_NAME_AS_IS(BothDefined)
+            IGNITE_BINARY_GET_FIELD_ID_AS_HASH
+            IGNITE_BINARY_IS_NULL_FALSE(BothDefined)
+            IGNITE_BINARY_GET_NULL_DEFAULT_CTOR(BothDefined)
+
+            int32_t GetHashCode(const GetHashDefined& obj)
+            {
+                return obj.field * 10;
+            }
+
+            ignite::Reference<ignite::binary::BinaryIdentityResolver> GetIdentityResolver()
+            {
+                return ignite::MakeReferenceFromCopy(CustomIdResolver());
+            }
+
+            void Write(BinaryWriter& writer, const BothDefined& obj)
+            {
+                writer.WriteInt32("field", obj.field);
+            }
+
+            BothDefined Read(BinaryReader& reader)
+            {
+                BothDefined val;
+
+                val.field = reader.ReadInt32("field");
+
+                return val;
+            }
+        };
+
+
+        /**
+         * Binary type definition for CompositeKey.
+         */
+        template<>
+        struct BinaryType<CompositeKey>
+        {
+            IGNITE_BINARY_GET_TYPE_ID_AS_HASH(CompositeKey)
+            IGNITE_BINARY_GET_TYPE_NAME_AS_IS(CompositeKey)
+            IGNITE_BINARY_GET_FIELD_ID_AS_HASH
+            IGNITE_BINARY_IS_NULL_FALSE(CompositeKey)
+            IGNITE_BINARY_GET_NULL_DEFAULT_CTOR(CompositeKey)
+
+            void Write(BinaryWriter& writer, const CompositeKey& obj)
+            {
+                writer.WriteString("str", obj.str);
+                writer.WriteTimestamp("ts", obj.ts);
+                writer.WriteGuid("guid", obj.guid);
+            }
+
+            CompositeKey Read(BinaryReader& reader)
+            {
+                CompositeKey val;
+
+                val.str = reader.ReadString("str");
+                val.ts = reader.ReadTimestamp("ts");
+                val.guid = reader.ReadGuid("guid");
+
+                return val;
+            }
+        };
+
+        /**
+         * Binary type definition for CompositeKey.
+         */
+        template<>
+        struct BinaryType<CompositeKeySimple>
+        {
+            IGNITE_BINARY_GET_TYPE_ID_AS_HASH(CompositeKeySimple)
+            IGNITE_BINARY_GET_TYPE_NAME_AS_IS(CompositeKeySimple)
+            IGNITE_BINARY_GET_FIELD_ID_AS_HASH
+            IGNITE_BINARY_IS_NULL_FALSE(CompositeKeySimple)
+            IGNITE_BINARY_GET_NULL_DEFAULT_CTOR(CompositeKeySimple)
+
+            void Write(BinaryWriter& writer, const CompositeKeySimple& obj)
+            {
+                writer.WriteString("str", obj.str);
+                writer.WriteTimestamp("ts", obj.ts);
+                writer.WriteInt64("i64", obj.i64);
+            }
+
+            CompositeKeySimple Read(BinaryReader& reader)
+            {
+                CompositeKeySimple val;
+
+                val.str = reader.ReadString("str");
+                val.ts = reader.ReadTimestamp("ts");
+                val.i64 = reader.ReadInt64("i64");
+
+                return val;
+            }
+        };
+    }
+}
+
+/**
+ * Test setup fixture.
+ */
+struct BinaryIdentityResolverTestSuiteFixture
+{
+    /**
+     * Constructor.
+     */
+    BinaryIdentityResolverTestSuiteFixture()
+    {
+        // No-op.
+    }
+
+    /**
+     * Destructor.
+     */
+    ~BinaryIdentityResolverTestSuiteFixture()
+    {
+        Ignition::StopAll(true);
+    }
+};
+
+template<typename T>
+void FillMem(InteropMemory& mem, const T& value)
+{
+    InteropOutputStream stream(&mem);
+    BinaryWriterImpl writer(&stream, 0);
+
+    writer.WriteObject<T>(value);
+
+    stream.Synchronize();
+}
+
+template<typename R, typename T>
+int32_t CalculateHashCode(const T& value)
+{
+    InteropUnpooledMemory mem(1024);
+
+    FillMem<T>(mem, value);
+
+    BinaryObject obj(mem, 0);
+
+    R resolver;
+
+    return resolver.GetHashCode(obj);
+}
+
+template<typename T>
+int32_t RetrieveHashCode(const T& value)
+{
+    InteropUnpooledMemory mem(1024);
+
+    FillMem<T>(mem, value);
+
+    BinaryObjectImpl obj(mem, 0);
+
+    return obj.GetHashCode();
+}
+
+BOOST_FIXTURE_TEST_SUITE(BinaryIdentityResolverTestSuite, BinaryIdentityResolverTestSuiteFixture)
+
+BOOST_AUTO_TEST_CASE(GetDataHashCode)
+{
+    int8_t data1[] = { 0 };
+    int8_t data2[] = { 0, 0, 0, 0 };
+    int8_t data3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+    int8_t data4[] = { 1 };
+    int8_t data5[] = { -1 };
+    int8_t data6[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+    int8_t data7[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
+    uint8_t data8[] = { 0xFF };
+    uint8_t data9[] = { 0xFF, 0xFF, 0xFF, 0xFF };
+
+    BOOST_CHECK_EQUAL(BinaryUtils::GetDataHashCode(data1, sizeof(data1)), 0x0000001F);
+    BOOST_CHECK_EQUAL(BinaryUtils::GetDataHashCode(data2, sizeof(data2)), 0x000e1781);
+    BOOST_CHECK_EQUAL(BinaryUtils::GetDataHashCode(data3, sizeof(data3)), 0x94E4B2C1);
+    BOOST_CHECK_EQUAL(BinaryUtils::GetDataHashCode(data4, sizeof(data4)), 0x00000020);
+    BOOST_CHECK_EQUAL(BinaryUtils::GetDataHashCode(data5, sizeof(data5)), 0x0000001E);
+    BOOST_CHECK_EQUAL(BinaryUtils::GetDataHashCode(data6, sizeof(data6)), 0x9EBADAC6);
+    BOOST_CHECK_EQUAL(BinaryUtils::GetDataHashCode(data7, sizeof(data7)), 0xC5D38B5C);
+    BOOST_CHECK_EQUAL(BinaryUtils::GetDataHashCode(data8, sizeof(data8)), 0x0000001E);
+    BOOST_CHECK_EQUAL(BinaryUtils::GetDataHashCode(data9, sizeof(data9)), 0x000D9F41);
+}
+
+BOOST_AUTO_TEST_CASE(ArrayIdentityResolver)
+{
+    using namespace binary;
+
+    CompositeKey key1("Some test garbage, one-two-three...",
+        Timestamp(109917, 130347199), Guid(0xACC064DF54EE9670, 0x065CF938F56E5E3B));
+
+    CompositeKeySimple key2("!!!!!!!!!!!!!!!!", Timestamp(324140, 334685375), 89563963);
+
+    BOOST_CHECK_EQUAL(CalculateHashCode<BinaryArrayIdentityResolver>(key1), 0xC298792B);
+    BOOST_CHECK_EQUAL(CalculateHashCode<BinaryArrayIdentityResolver>(key2), 0x53207175);
+}
+
+BOOST_AUTO_TEST_CASE(IdentityEquilityWithGuid)
+{
+    Ignite grid = ignite_test::StartNode("cache-identity.xml");
+
+    CompositeKey key("Key String", Timestamp(123851, 562304134), Guid(0x4A950C6206FE4502, 0xAC06145097E56F02));
+    int32_t value = 12321;
+
+    Cache<CompositeKey, int32_t> cache = grid.GetOrCreateCache<CompositeKey, int32_t>("cache1");
+
+    SqlFieldsQuery qry("INSERT INTO Integer (str, ts, guid, _val) VALUES (?, ?, ?, ?)");
+
+    qry.AddArgument(key.str);
+    qry.AddArgument(key.ts);
+    qry.AddArgument(key.guid);
+    qry.AddArgument(value);
+
+    cache.Query(qry);
+
+    int32_t realValue = cache.Get(key);
+
+    BOOST_CHECK_EQUAL(value, realValue);
+}
+
+BOOST_AUTO_TEST_CASE(IdentityEquilityWithoutGuid)
+{
+    Ignite grid = ignite_test::StartNode("cache-identity.xml");
+
+    CompositeKeySimple key("Lorem ipsum", Timestamp(112460, 163002155), 1337);
+    int32_t value = 42;
+
+    Cache<CompositeKeySimple, int32_t> cache = grid.GetOrCreateCache<CompositeKeySimple, int32_t>("cache2");
+
+    SqlFieldsQuery qry("INSERT INTO Integer (str, ts, i64, _val) VALUES (?, ?, ?, ?)");
+
+    qry.AddArgument(key.str);
+    qry.AddArgument(key.ts);
+    qry.AddArgument(key.i64);
+    qry.AddArgument(value);
+
+    cache.Query(qry);
+
+    int32_t realValue = cache.Get(key);
+
+    BOOST_CHECK_EQUAL(value, realValue);
+}
+
+BOOST_AUTO_TEST_CASE(TestDefaultHashing)
+{
+    DefaultHashing val;
+    val.field = 1337;
+
+    BOOST_CHECK_EQUAL(RetrieveHashCode(val), 0x01F91B0E);
+}
+
+BOOST_AUTO_TEST_CASE(TestGetHashDefined)
+{
+    GetHashDefined val;
+    val.field = 1337;
+
+    BOOST_CHECK_EQUAL(RetrieveHashCode(val), val.field * 10);
+}
+
+BOOST_AUTO_TEST_CASE(TestResolverDefined)
+{
+    ResolverDefined val;
+    val.field = 1337;
+
+    BOOST_CHECK_EQUAL(RetrieveHashCode(val), val.field * 42);
+}
+
+BOOST_AUTO_TEST_CASE(TestBothDefined)
+{
+    BothDefined val;
+    val.field = 1337;
+
+    BOOST_CHECK_EQUAL(RetrieveHashCode(val), val.field * 42);
+}
+
+BOOST_AUTO_TEST_SUITE_END()

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/core-test/src/binary_object_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/binary_object_test.cpp b/modules/platforms/cpp/core-test/src/binary_object_test.cpp
index 0ae7136..0a8f948 100644
--- a/modules/platforms/cpp/core-test/src/binary_object_test.cpp
+++ b/modules/platforms/cpp/core-test/src/binary_object_test.cpp
@@ -205,17 +205,17 @@ BOOST_AUTO_TEST_CASE(PrimitiveGuid)
 BOOST_AUTO_TEST_CASE(PrimitiveDate)
 {
     CheckSimpleNP<Date>(Date(0));
-    CheckSimpleNP<Date>(BinaryUtils::MakeDateGmt(1998, 12, 3, 18, 32, 01));
-    CheckSimpleNP<Date>(BinaryUtils::MakeDateGmt(2017, 1, 18, 20, 50, 41));
-    CheckSimpleNP<Date>(BinaryUtils::MakeDateLocal(1998, 12, 3, 18, 32, 01));
+    CheckSimpleNP<Date>(common::MakeDateGmt(1998, 12, 3, 18, 32, 01));
+    CheckSimpleNP<Date>(common::MakeDateGmt(2017, 1, 18, 20, 50, 41));
+    CheckSimpleNP<Date>(common::MakeDateLocal(1998, 12, 3, 18, 32, 01));
 }
 
 BOOST_AUTO_TEST_CASE(PrimitiveTimestamp)
 {
     CheckSimpleNP<Timestamp>(Timestamp(0));
-    CheckSimpleNP<Timestamp>(BinaryUtils::MakeTimestampGmt(1998, 12, 3, 18, 32, 01, 593846589));
-    CheckSimpleNP<Timestamp>(BinaryUtils::MakeTimestampGmt(2017, 1, 18, 20, 50, 41, 920700532));
-    CheckSimpleNP<Timestamp>(BinaryUtils::MakeTimestampLocal(1998, 12, 3, 18, 32, 01, 2385));
+    CheckSimpleNP<Timestamp>(common::MakeTimestampGmt(1998, 12, 3, 18, 32, 01, 593846589));
+    CheckSimpleNP<Timestamp>(common::MakeTimestampGmt(2017, 1, 18, 20, 50, 41, 920700532));
+    CheckSimpleNP<Timestamp>(common::MakeTimestampLocal(1998, 12, 3, 18, 32, 01, 2385));
 }
 
 #endif //CHECK_BINARY_OBJECT_WITH_PRIMITIVES
@@ -224,8 +224,8 @@ BOOST_AUTO_TEST_CASE(UserTestType)
 {
     CheckSimpleNP(TestType());
     CheckSimpleNP(TestType(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9),
-        BinaryUtils::MakeDateGmt(1987, 6, 5),
-        BinaryUtils::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456)));
+        common::MakeDateGmt(1987, 6, 5),
+        common::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456)));
 }
 
 BOOST_AUTO_TEST_CASE(UserComplexType)
@@ -269,8 +269,8 @@ BOOST_AUTO_TEST_CASE(UserTestTypeGetData)
 {
     CheckData(TestType());
     CheckData(TestType(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9),
-        BinaryUtils::MakeDateGmt(1987, 6, 5),
-        BinaryUtils::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456)));
+        common::MakeDateGmt(1987, 6, 5),
+        common::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456)));
 }
 
 BOOST_AUTO_TEST_CASE(UserBinaryFieldsGetData)

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/core-test/src/binary_session_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/binary_session_test.cpp b/modules/platforms/cpp/core-test/src/binary_session_test.cpp
index 19bfaac..d178921 100644
--- a/modules/platforms/cpp/core-test/src/binary_session_test.cpp
+++ b/modules/platforms/cpp/core-test/src/binary_session_test.cpp
@@ -170,7 +170,9 @@ BOOST_AUTO_TEST_CASE(TestTimestamp)
     BinaryReaderImpl reader(&in);
     Timestamp readVal = reader.ReadTopObject<Timestamp>();
 
-    BOOST_REQUIRE(readVal == writeVal);
+    BOOST_CHECK(readVal == writeVal);
+    BOOST_CHECK_EQUAL(readVal.GetMilliseconds(), writeVal.GetMilliseconds());
+    BOOST_CHECK_EQUAL(readVal.GetSecondFraction(), writeVal.GetSecondFraction());
 }
 
 BOOST_AUTO_TEST_CASE(TestString)

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/core-test/src/cache_query_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/cache_query_test.cpp b/modules/platforms/cpp/core-test/src/cache_query_test.cpp
index b5bb170..b61e289 100644
--- a/modules/platforms/cpp/core-test/src/cache_query_test.cpp
+++ b/modules/platforms/cpp/core-test/src/cache_query_test.cpp
@@ -32,6 +32,7 @@
 #include "ignite/cache/query/query_sql_fields.h"
 #include "ignite/ignite.h"
 #include "ignite/ignition.h"
+#include "ignite/test_utils.h"
 
 using namespace boost::unit_test;
 
@@ -194,8 +195,8 @@ public:
     /**
      * Constructor.
      *
-     * @param name Name.
-     * @param age Age.
+     * @param personId Id.
+     * @param someVal Int value.
      */
     QueryRelation(int32_t personId, int32_t someVal) :
         personId(personId),
@@ -294,7 +295,6 @@ namespace ignite
     }
 }
 
-
 /**
  * Count number of records returned by cursor.
  *
@@ -591,36 +591,7 @@ struct CacheQueryTestSuiteFixture
 {
     Ignite StartNode(const char* name)
     {
-        IgniteConfiguration cfg;
-
-        cfg.jvmOpts.push_back("-Xdebug");
-        cfg.jvmOpts.push_back("-Xnoagent");
-        cfg.jvmOpts.push_back("-Djava.compiler=NONE");
-        cfg.jvmOpts.push_back("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
-        cfg.jvmOpts.push_back("-XX:+HeapDumpOnOutOfMemoryError");
-
-#ifdef IGNITE_TESTS_32
-        cfg.jvmInitMem = 256;
-        cfg.jvmMaxMem = 768;
-#else
-        cfg.jvmInitMem = 1024;
-        cfg.jvmMaxMem = 4096;
-#endif
-
-        const char* cfgPath = getenv("IGNITE_NATIVE_TEST_CPP_CONFIG_PATH");
-
-        BOOST_CHECK(cfgPath != 0);
-
-        cfg.springCfgPath.assign(cfgPath).append("/cache-query.xml");
-
-        IgniteError err;
-
-        Ignite grid0 = Ignition::Start(cfg, name, &err);
-
-        if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
-            BOOST_ERROR(err.GetText());
-
-        return grid0;
+        return ignite_test::StartNode("cache-query.xml", name);
     }
 
     void CheckFieldsQueryPages(int32_t pageSize, int32_t pagesNum, int32_t additionalNum)
@@ -644,8 +615,8 @@ struct CacheQueryTestSuiteFixture
 
             stream << "A" << i;
 
-            cache.Put(i, QueryPerson(stream.str(), i * 10, BinaryUtils::MakeDateLocal(1970 + i),
-                BinaryUtils::MakeTimestampLocal(2016, 1, 1, i / 60, i % 60)));
+            cache.Put(i, QueryPerson(stream.str(), i * 10, MakeDateGmt(1970 + i),
+                MakeTimestampGmt(2016, 1, 1, i / 60, i % 60)));
         }
 
         cursor = cache.Query(qry);
@@ -738,11 +709,11 @@ BOOST_AUTO_TEST_CASE(TestSqlQuery)
     CheckEmptyGetAll(cursor);
 
     // Test simple query.
-    cache.Put(1, QueryPerson("A1", 10, BinaryUtils::MakeDateLocal(1990, 03, 18),
-        BinaryUtils::MakeTimestampLocal(2016, 02, 10, 17, 39, 34, 579304685)));
+    cache.Put(1, QueryPerson("A1", 10, MakeDateGmt(1990, 03, 18),
+        MakeTimestampGmt(2016, 02, 10, 17, 39, 34, 579304685)));
 
-    cache.Put(2, QueryPerson("A2", 20, BinaryUtils::MakeDateLocal(1989, 10, 26),
-        BinaryUtils::MakeTimestampLocal(2016, 02, 10, 17, 39, 35, 678403201)));
+    cache.Put(2, QueryPerson("A2", 20, MakeDateGmt(1989, 10, 26),
+        MakeTimestampGmt(2016, 02, 10, 17, 39, 35, 678403201)));
     
     cursor = cache.Query(qry);
     CheckSingle(cursor, 1, "A1", 10);
@@ -815,8 +786,8 @@ BOOST_AUTO_TEST_CASE(TestSqlQueryDistributedJoins)
 
         stream << "A" << i;
 
-        cache1.Put(i, QueryPerson(stream.str(), i * 10, BinaryUtils::MakeDateLocal(1970 + i),
-            BinaryUtils::MakeTimestampLocal(2016, 1, 1, i / 60, i % 60)));
+        cache1.Put(i, QueryPerson(stream.str(), i * 10, MakeDateGmt(1970 + i),
+            MakeTimestampGmt(2016, 1, 1, i / 60, i % 60)));
 
         cache2.Put(i + 1, QueryRelation(i, i * 10));
     }
@@ -861,11 +832,11 @@ BOOST_AUTO_TEST_CASE(TestTextQuery)
     CheckEmptyGetAll(cursor);
 
     // Test simple query.
-    cache.Put(1, QueryPerson("A1", 10, BinaryUtils::MakeDateLocal(1990, 03, 18),
-        BinaryUtils::MakeTimestampLocal(2016, 02, 10, 17, 39, 34, 579304685)));
+    cache.Put(1, QueryPerson("A1", 10, MakeDateGmt(1990, 03, 18),
+        MakeTimestampGmt(2016, 02, 10, 17, 39, 34, 579304685)));
 
-    cache.Put(2, QueryPerson("A2", 20, BinaryUtils::MakeDateLocal(1989, 10, 26),
-        BinaryUtils::MakeTimestampLocal(2016, 02, 10, 17, 39, 35, 678403201)));
+    cache.Put(2, QueryPerson("A2", 20, MakeDateGmt(1989, 10, 26),
+        MakeTimestampGmt(2016, 02, 10, 17, 39, 35, 678403201)));
 
     cursor = cache.Query(qry);
     CheckSingle(cursor, 1, "A1", 10);
@@ -910,8 +881,8 @@ BOOST_AUTO_TEST_CASE(TestScanQuery)
     CheckEmptyGetAll(cursor);
 
     // Test simple query.
-    cache.Put(1, QueryPerson("A1", 10, BinaryUtils::MakeDateLocal(1990, 03, 18),
-        BinaryUtils::MakeTimestampLocal(2016, 02, 10, 17, 39, 34, 579304685)));
+    cache.Put(1, QueryPerson("A1", 10, MakeDateGmt(1990, 03, 18),
+        MakeTimestampGmt(2016, 02, 10, 17, 39, 34, 579304685)));
 
     cursor = cache.Query(qry);
     CheckSingle(cursor, 1, "A1", 10);
@@ -920,8 +891,8 @@ BOOST_AUTO_TEST_CASE(TestScanQuery)
     CheckSingleGetAll(cursor, 1, "A1", 10);
 
     // Test query returning multiple entries.
-    cache.Put(2, QueryPerson("A2", 20, BinaryUtils::MakeDateLocal(1989, 10, 26),
-        BinaryUtils::MakeTimestampLocal(2016, 02, 10, 17, 39, 35, 678403201)));
+    cache.Put(2, QueryPerson("A2", 20, MakeDateGmt(1989, 10, 26),
+        MakeTimestampGmt(2016, 02, 10, 17, 39, 35, 678403201)));
 
     cursor = cache.Query(qry);
     CheckMultiple(cursor, 1, "A1", 10, 2, "A2", 20);
@@ -947,8 +918,8 @@ BOOST_AUTO_TEST_CASE(TestScanQueryPartitioned)
 
         stream << "A" << i;
 
-        cache.Put(i, QueryPerson(stream.str(), i * 10, BinaryUtils::MakeDateLocal(1970 + i),
-            BinaryUtils::MakeTimestampLocal(2016, 1, 1, i / 60, i % 60)));
+        cache.Put(i, QueryPerson(stream.str(), i * 10, MakeDateGmt(1970 + i),
+            MakeTimestampGmt(2016, 1, 1, i / 60, i % 60)));
     }
 
     // Iterate over all partitions and collect data.
@@ -994,11 +965,11 @@ BOOST_AUTO_TEST_CASE(TestSqlFieldsQueryBasic)
     CheckEmpty(cursor);
 
     // Test simple query.
-    cache.Put(1, QueryPerson("A1", 10, BinaryUtils::MakeDateLocal(1990, 03, 18),
-        BinaryUtils::MakeTimestampLocal(2016, 02, 10, 17, 39, 34, 579304685)));
+    cache.Put(1, QueryPerson("A1", 10, MakeDateGmt(1990, 03, 18),
+        MakeTimestampGmt(2016, 02, 10, 17, 39, 34, 579304685)));
 
-    cache.Put(2, QueryPerson("A2", 20, BinaryUtils::MakeDateLocal(1989, 10, 26),
-        BinaryUtils::MakeTimestampLocal(2016, 02, 10, 17, 39, 35, 678403201)));
+    cache.Put(2, QueryPerson("A2", 20, MakeDateGmt(1989, 10, 26),
+        MakeTimestampGmt(2016, 02, 10, 17, 39, 35, 678403201)));
 
     cursor = cache.Query(qry);
     CheckSingle(cursor, 1, "A1", 10);
@@ -1062,8 +1033,8 @@ BOOST_AUTO_TEST_CASE(TestSqlFieldsQueryDistributedJoins)
 
         stream << "A" << i;
 
-        cache1.Put(i, QueryPerson(stream.str(), i * 10, BinaryUtils::MakeDateLocal(1970 + i),
-            BinaryUtils::MakeTimestampLocal(2016, 1, 1, i / 60, i % 60)));
+        cache1.Put(i, QueryPerson(stream.str(), i * 10, MakeDateGmt(1970 + i),
+            MakeTimestampGmt(2016, 1, 1, i / 60, i % 60)));
 
         cache2.Put(i + 1, QueryRelation(i, i * 10));
     }
@@ -1108,8 +1079,8 @@ BOOST_AUTO_TEST_CASE(TestFieldsQuerySingle)
     CheckEmpty(cursor);
     
     // Test simple query.
-    cache.Put(1, QueryPerson("A1", 10, BinaryUtils::MakeDateLocal(1990, 03, 18),
-        BinaryUtils::MakeTimestampLocal(2016, 02, 10, 17, 39, 34, 579304685)));
+    cache.Put(1, QueryPerson("A1", 10, MakeDateGmt(1990, 03, 18),
+        MakeTimestampGmt(2016, 02, 10, 17, 39, 34, 579304685)));
 
     cursor = cache.Query(qry);
 
@@ -1154,8 +1125,8 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryExceptions)
     CheckEmpty(cursor);
 
     // Test simple query.
-    cache.Put(1, QueryPerson("A1", 10, BinaryUtils::MakeDateLocal(1990, 03, 18),
-        BinaryUtils::MakeTimestampLocal(2016, 02, 10, 17, 39, 34, 579304685)));
+    cache.Put(1, QueryPerson("A1", 10, MakeDateGmt(1990, 03, 18),
+        MakeTimestampGmt(2016, 02, 10, 17, 39, 34, 579304685)));
 
     cursor = cache.Query(qry);
 
@@ -1200,11 +1171,11 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryTwo)
     CheckEmpty(cursor);
 
     // Test simple query.
-    cache.Put(1, QueryPerson("A1", 10, BinaryUtils::MakeDateLocal(1990, 03, 18),
-        BinaryUtils::MakeTimestampLocal(2016, 02, 10, 17, 39, 34, 579304685)));
+    cache.Put(1, QueryPerson("A1", 10, MakeDateGmt(1990, 03, 18),
+        MakeTimestampGmt(2016, 02, 10, 17, 39, 34, 579304685)));
 
-    cache.Put(2, QueryPerson("A2", 20, BinaryUtils::MakeDateLocal(1989, 10, 26),
-        BinaryUtils::MakeTimestampLocal(2016, 02, 10, 17, 39, 35, 678403201)));
+    cache.Put(2, QueryPerson("A2", 20, MakeDateGmt(1989, 10, 26),
+        MakeTimestampGmt(2016, 02, 10, 17, 39, 35, 678403201)));
 
     cursor = cache.Query(qry);
 
@@ -1273,8 +1244,8 @@ BOOST_AUTO_TEST_CASE(TestFieldsQuerySeveral)
 
         stream << "A" << i;
 
-        QueryPerson val(stream.str(), i * 10, BinaryUtils::MakeDateLocal(1980 + i, 1, 1),
-            BinaryUtils::MakeTimestampLocal(2016, 1, 1, i / 60, i % 60));
+        QueryPerson val(stream.str(), i * 10, MakeDateGmt(1980 + i, 1, 1),
+            MakeTimestampGmt(2016, 1, 1, i / 60, i % 60));
 
         cache.Put(i, val);
     }
@@ -1339,8 +1310,8 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryDateLess)
 
         stream << "A" << i;
 
-        QueryPerson val(stream.str(), i * 10, BinaryUtils::MakeDateLocal(1980 + i, 1, 1),
-            BinaryUtils::MakeTimestampLocal(2016, 1, 1, i / 60, i % 60));
+        QueryPerson val(stream.str(), i * 10, MakeDateGmt(1980 + i, 1, 1),
+            MakeTimestampGmt(2016, 1, 1, i / 60, i % 60));
 
         cache.Put(i, val);
     }
@@ -1364,9 +1335,9 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryDateLess)
         Date birthday = row.GetNext<Date>(error);
         BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS);
 
-        BOOST_CHECK(birthday == BinaryUtils::MakeDateLocal(1980 + resultSetSize, 1, 1));
+        BOOST_CHECK(birthday == MakeDateGmt(1980 + resultSetSize, 1, 1));
 
-        BOOST_CHECK(birthday < BinaryUtils::MakeDateLocal(1990, 1, 1));
+        BOOST_CHECK(birthday < MakeDateGmt(1990, 1, 1));
 
         BOOST_REQUIRE(!row.HasNext());
 
@@ -1400,8 +1371,8 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryDateMore)
 
         stream << "A" << i;
 
-        QueryPerson val(stream.str(), i * 10, BinaryUtils::MakeDateLocal(1980 + i, 1, 1),
-            BinaryUtils::MakeTimestampLocal(2016, 1, 1, i / 60, i % 60));
+        QueryPerson val(stream.str(), i * 10, MakeDateGmt(1980 + i, 1, 1),
+            MakeTimestampGmt(2016, 1, 1, i / 60, i % 60));
 
         cache.Put(i, val);
     }
@@ -1425,9 +1396,9 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryDateMore)
         Date birthday = row.GetNext<Date>(error);
         BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS);
 
-        BOOST_CHECK(birthday == BinaryUtils::MakeDateLocal(2071 + resultSetSize, 1, 1));
+        BOOST_CHECK(birthday == MakeDateGmt(2071 + resultSetSize, 1, 1));
 
-        BOOST_CHECK(birthday > BinaryUtils::MakeDateLocal(2070, 1, 1));
+        BOOST_CHECK(birthday > MakeDateGmt(2070, 1, 1));
 
         BOOST_REQUIRE(!row.HasNext());
 
@@ -1461,8 +1432,8 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryDateEqual)
 
         stream << "A" << i;
 
-        QueryPerson val(stream.str(), i * 10, BinaryUtils::MakeDateLocal(1980 + i, 1, 1),
-            BinaryUtils::MakeTimestampLocal(2016, 1, 1, i / 60, i % 60));
+        QueryPerson val(stream.str(), i * 10, MakeDateGmt(1980 + i, 1, 1),
+            MakeTimestampGmt(2016, 1, 1, i / 60, i % 60));
 
         cache.Put(i, val);
     }
@@ -1484,7 +1455,7 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryDateEqual)
     Date birthday = row.GetNext<Date>(error);
     BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS);
 
-    BOOST_CHECK(birthday == BinaryUtils::MakeDateLocal(2032, 1, 1));
+    BOOST_CHECK(birthday == MakeDateGmt(2032, 1, 1));
 
     BOOST_REQUIRE(!row.HasNext());
 
@@ -1513,8 +1484,8 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryTimestampLess)
 
         stream << "A" << i;
 
-        QueryPerson val(stream.str(), i * 10, BinaryUtils::MakeDateLocal(1980 + i, 1, 1),
-            BinaryUtils::MakeTimestampLocal(2016, 1, 1, i / 60, i % 60));
+        QueryPerson val(stream.str(), i * 10, MakeDateGmt(1980 + i, 1, 1),
+            MakeTimestampGmt(2016, 1, 1, i / 60, i % 60));
 
         cache.Put(i, val);
     }
@@ -1538,9 +1509,9 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryTimestampLess)
         Timestamp recordCreated = row.GetNext<Timestamp>(error);
         BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS);
 
-        BOOST_CHECK(recordCreated == BinaryUtils::MakeTimestampLocal(2016, 1, 1, 0, resultSetSize % 60, 0));
+        BOOST_CHECK(recordCreated == MakeTimestampGmt(2016, 1, 1, 0, resultSetSize % 60, 0));
 
-        BOOST_CHECK(recordCreated < BinaryUtils::MakeTimestampLocal(2016, 1, 1, 1, 0, 0));
+        BOOST_CHECK(recordCreated < MakeTimestampGmt(2016, 1, 1, 1, 0, 0));
 
         BOOST_REQUIRE(!row.HasNext());
 
@@ -1574,8 +1545,8 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryTimestampMore)
 
         stream << "A" << i;
 
-        QueryPerson val(stream.str(), i * 10, BinaryUtils::MakeDateLocal(1980 + i, 1, 1),
-            BinaryUtils::MakeTimestampLocal(2016, 1, 1, i / 60, i % 60));
+        QueryPerson val(stream.str(), i * 10, MakeDateGmt(1980 + i, 1, 1),
+            MakeTimestampGmt(2016, 1, 1, i / 60, i % 60));
 
         cache.Put(i, val);
     }
@@ -1601,9 +1572,9 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryTimestampMore)
 
         int32_t minutes = resultSetSize + 31;
 
-        BOOST_CHECK(recordCreated == BinaryUtils::MakeTimestampLocal(2016, 1, 1, 15 + minutes / 60, minutes % 60, 0));
+        BOOST_CHECK(recordCreated == MakeTimestampGmt(2016, 1, 1, 15 + minutes / 60, minutes % 60, 0));
 
-        BOOST_CHECK(recordCreated > BinaryUtils::MakeTimestampLocal(2016, 1, 1, 15, 30, 0));
+        BOOST_CHECK(recordCreated > MakeTimestampGmt(2016, 1, 1, 15, 30, 0));
 
         BOOST_REQUIRE(!row.HasNext());
 
@@ -1637,8 +1608,8 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryTimestampEqual)
 
         stream << "A" << i;
 
-        QueryPerson val(stream.str(), i * 10, BinaryUtils::MakeDateLocal(1980 + i, 1, 1),
-            BinaryUtils::MakeTimestampLocal(2016, 1, 1, i / 60, i % 60));
+        QueryPerson val(stream.str(), i * 10, MakeDateGmt(1980 + i, 1, 1),
+            MakeTimestampGmt(2016, 1, 1, i / 60, i % 60));
 
         cache.Put(i, val);
     }
@@ -1660,7 +1631,7 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryTimestampEqual)
     Timestamp recordCreated = row.GetNext<Timestamp>(error);
     BOOST_REQUIRE(error.GetCode() == IgniteError::IGNITE_SUCCESS);
 
-    BOOST_CHECK(recordCreated == BinaryUtils::MakeTimestampLocal(2016, 1, 1, 9, 18, 0));
+    BOOST_CHECK(recordCreated == MakeTimestampGmt(2016, 1, 1, 9, 18, 0));
 
     BOOST_REQUIRE(!row.HasNext());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/core-test/src/cache_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/cache_test.cpp b/modules/platforms/cpp/core-test/src/cache_test.cpp
index 1df70df..1aa7277 100644
--- a/modules/platforms/cpp/core-test/src/cache_test.cpp
+++ b/modules/platforms/cpp/core-test/src/cache_test.cpp
@@ -24,6 +24,7 @@
 #include "ignite/cache/cache_peek_mode.h"
 #include "ignite/ignite.h"
 #include "ignite/ignition.h"
+#include "ignite/test_utils.h"
 
 using namespace ignite;
 using namespace boost::unit_test;
@@ -65,7 +66,7 @@ namespace ignite
         IGNITE_BINARY_GET_HASH_CODE_ZERO(Person)
         IGNITE_BINARY_IS_NULL_FALSE(Person)
         IGNITE_BINARY_GET_NULL_DEFAULT_CTOR(Person)
-            
+
         void Write(BinaryWriter& writer, Person obj)
         {
             writer.WriteString("name", obj.name);
@@ -93,44 +94,8 @@ struct CacheTestSuiteFixture {
      */
     CacheTestSuiteFixture()
     {
-        IgniteConfiguration cfg;
-
-        cfg.jvmOpts.push_back("-Xdebug");
-        cfg.jvmOpts.push_back("-Xnoagent");
-        cfg.jvmOpts.push_back("-Djava.compiler=NONE");
-        cfg.jvmOpts.push_back("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
-        cfg.jvmOpts.push_back("-XX:+HeapDumpOnOutOfMemoryError");
-
-#ifdef IGNITE_TESTS_32
-        cfg.jvmInitMem = 256;
-        cfg.jvmMaxMem = 768;
-#else
-        cfg.jvmInitMem = 1024;
-        cfg.jvmMaxMem = 4096;
-#endif
-
-        char* cfgPath = getenv("IGNITE_NATIVE_TEST_CPP_CONFIG_PATH");
-
-        cfg.springCfgPath = std::string(cfgPath).append("/").append("cache-test.xml");
-        
-        for (int i = 0; i < 2; i++) 
-        {
-            std::stringstream stream;
-
-            stream << "grid-" << i;
-
-            IgniteError err;
-
-            Ignite grid = Ignition::Start(cfg, stream.str().c_str(), &err);
-                
-            if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
-                BOOST_FAIL(err.GetText());
-
-            if (i == 0)
-                grid0 = grid;
-            else
-                grid1 = grid;
-        }
+        grid0 = ignite_test::StartNode("cache-test.xml", "grid-0");
+        grid1 = ignite_test::StartNode("cache-test.xml", "grid-1");
     }
 
     /*

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/core-test/src/continuous_query_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/continuous_query_test.cpp b/modules/platforms/cpp/core-test/src/continuous_query_test.cpp
index e9d7e8a..6ce38de 100644
--- a/modules/platforms/cpp/core-test/src/continuous_query_test.cpp
+++ b/modules/platforms/cpp/core-test/src/continuous_query_test.cpp
@@ -28,6 +28,7 @@
 
 #include "ignite/ignition.h"
 #include "ignite/cache/cache.h"
+#include "ignite/test_utils.h"
 
 using namespace ignite;
 using namespace ignite::cache;
@@ -241,38 +242,10 @@ struct ContinuousQueryTestSuiteFixture
     Cache<int, TestEntry> cache;
 
     /*
-     * Get configuration for nodes.
-     */
-    IgniteConfiguration GetConfiguration()
-    {
-        IgniteConfiguration cfg;
-
-        cfg.jvmOpts.push_back("-Xdebug");
-        cfg.jvmOpts.push_back("-Xnoagent");
-        cfg.jvmOpts.push_back("-Djava.compiler=NONE");
-        cfg.jvmOpts.push_back("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
-        cfg.jvmOpts.push_back("-XX:+HeapDumpOnOutOfMemoryError");
-
-#ifdef IGNITE_TESTS_32
-        cfg.jvmInitMem = 256;
-        cfg.jvmMaxMem = 768;
-#else
-        cfg.jvmInitMem = 1024;
-        cfg.jvmMaxMem = 4096;
-#endif
-
-        char* cfgPath = getenv("IGNITE_NATIVE_TEST_CPP_CONFIG_PATH");
-
-        cfg.springCfgPath = std::string(cfgPath).append("/").append("cache-query-continuous.xml");
-
-        return cfg;
-    }
-
-    /*
      * Constructor.
      */
     ContinuousQueryTestSuiteFixture() :
-        grid(Ignition::Start(GetConfiguration(), "node-01")),
+        grid(ignite_test::StartNode("cache-query-continuous.xml", "node-01")),
         cache(grid.GetCache<int, TestEntry>("transactional_no_backup"))
     {
         // No-op.

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/core-test/src/ignition_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/ignition_test.cpp b/modules/platforms/cpp/core-test/src/ignition_test.cpp
index 7d1284a..17f78ae 100644
--- a/modules/platforms/cpp/core-test/src/ignition_test.cpp
+++ b/modules/platforms/cpp/core-test/src/ignition_test.cpp
@@ -23,6 +23,7 @@
 
 #include "ignite/ignite.h"
 #include "ignite/ignition.h"
+#include "ignite/test_utils.h"
 
 using namespace ignite;
 using namespace boost::unit_test;
@@ -33,23 +34,7 @@ BOOST_AUTO_TEST_CASE(TestIgnition)
 {
     IgniteConfiguration cfg;
 
-    cfg.jvmOpts.push_back("-Xdebug");
-    cfg.jvmOpts.push_back("-Xnoagent");
-    cfg.jvmOpts.push_back("-Djava.compiler=NONE");
-    cfg.jvmOpts.push_back("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
-    cfg.jvmOpts.push_back("-XX:+HeapDumpOnOutOfMemoryError");
-
-#ifdef IGNITE_TESTS_32
-        cfg.jvmInitMem = 256;
-        cfg.jvmMaxMem = 768;
-#else
-        cfg.jvmInitMem = 1024;
-        cfg.jvmMaxMem = 4096;
-#endif
-
-    char* cfgPath = getenv("IGNITE_NATIVE_TEST_CPP_CONFIG_PATH");
-
-    cfg.springCfgPath = std::string(cfgPath).append("/").append("cache-test.xml");
+    ignite_test::InitConfig(cfg, "cache-test.xml");
 
     IgniteError err;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/core-test/src/interop_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/interop_test.cpp b/modules/platforms/cpp/core-test/src/interop_test.cpp
index f29ecc8..b76d030 100644
--- a/modules/platforms/cpp/core-test/src/interop_test.cpp
+++ b/modules/platforms/cpp/core-test/src/interop_test.cpp
@@ -22,43 +22,19 @@
 #include <boost/test/unit_test.hpp>
 
 #include "ignite/ignition.h"
+#include "ignite/test_utils.h"
 
 using namespace ignite;
 using namespace cache;
 using namespace boost::unit_test;
 
-void InitConfig(IgniteConfiguration& cfg, const char* config)
-{
-    cfg.jvmOpts.push_back("-Xdebug");
-    cfg.jvmOpts.push_back("-Xnoagent");
-    cfg.jvmOpts.push_back("-Djava.compiler=NONE");
-    cfg.jvmOpts.push_back("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
-    cfg.jvmOpts.push_back("-XX:+HeapDumpOnOutOfMemoryError");
-
-#ifdef IGNITE_TESTS_32
-    cfg.jvmInitMem = 256;
-    cfg.jvmMaxMem = 768;
-#else
-    cfg.jvmInitMem = 1024;
-    cfg.jvmMaxMem = 4096;
-#endif
-
-    char* cfgPath = getenv("IGNITE_NATIVE_TEST_CPP_CONFIG_PATH");
-
-    cfg.springCfgPath = std::string(cfgPath).append("/").append(config);
-}
-
 BOOST_AUTO_TEST_SUITE(InteropTestSuite)
 
 #ifdef ENABLE_STRING_SERIALIZATION_VER_2_TESTS
 
 BOOST_AUTO_TEST_CASE(StringUtfInvalidSequence)
 {
-    IgniteConfiguration cfg;
-
-    InitConfig(cfg);
-
-    Ignite ignite = Ignition::Start(cfg);
+    Ignite ignite = ignite_test::StartNode("cache-test.xml");
 
     Cache<std::string, std::string> cache = ignite.CreateCache<std::string, std::string>("Test");
 
@@ -85,13 +61,9 @@ BOOST_AUTO_TEST_CASE(StringUtfInvalidSequence)
 
 BOOST_AUTO_TEST_CASE(StringUtfInvalidCodePoint)
 {
-    IgniteConfiguration cfg;
-
-    InitConfig(cfg);
-
     putenv("IGNITE_BINARY_MARSHALLER_USE_STRING_SERIALIZATION_VER_2=true");
 
-    Ignite ignite = Ignition::Start(cfg);
+    Ignite ignite = ignite_test::StartNode("cache-test.xml");
 
     Cache<std::string, std::string> cache = ignite.CreateCache<std::string, std::string>("Test");
 
@@ -117,11 +89,7 @@ BOOST_AUTO_TEST_CASE(StringUtfInvalidCodePoint)
 
 BOOST_AUTO_TEST_CASE(StringUtfValid4ByteCodePoint)
 {
-    IgniteConfiguration cfg;
-
-    InitConfig(cfg, "cache-test.xml");
-
-    Ignite ignite = Ignition::Start(cfg);
+    Ignite ignite = ignite_test::StartNode("cache-test.xml");
 
     Cache<std::string, std::string> cache = ignite.CreateCache<std::string, std::string>("Test");
 
@@ -149,7 +117,7 @@ BOOST_AUTO_TEST_CASE(GracefulDeathOnInvalidConfig)
 {
     IgniteConfiguration cfg;
 
-    InitConfig(cfg, "invalid.xml");
+    ignite_test::InitConfig(cfg, "invalid.xml");
 
     BOOST_CHECK_THROW(Ignition::Start(cfg), IgniteError);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/core-test/src/test_utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/test_utils.cpp b/modules/platforms/cpp/core-test/src/test_utils.cpp
new file mode 100644
index 0000000..1378487
--- /dev/null
+++ b/modules/platforms/cpp/core-test/src/test_utils.cpp
@@ -0,0 +1,79 @@
+/*
+ * 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 <cassert>
+
+#include "ignite/test_utils.h"
+
+namespace ignite_test
+{
+    void InitConfig(ignite::IgniteConfiguration& cfg, const char* cfgFile)
+    {
+        using namespace ignite;
+
+        assert(cfgFile != 0);
+
+        cfg.jvmOpts.push_back("-Xdebug");
+        cfg.jvmOpts.push_back("-Xnoagent");
+        cfg.jvmOpts.push_back("-Djava.compiler=NONE");
+        cfg.jvmOpts.push_back("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
+        cfg.jvmOpts.push_back("-XX:+HeapDumpOnOutOfMemoryError");
+        cfg.jvmOpts.push_back("-Duser.timezone=GMT");
+        cfg.jvmOpts.push_back("-DIGNITE_QUIET=false");
+        cfg.jvmOpts.push_back("-DIGNITE_CONSOLE_APPENDER=false");
+        cfg.jvmOpts.push_back("-DIGNITE_UPDATE_NOTIFIER=false");
+
+#ifdef IGNITE_TESTS_32
+        cfg.jvmInitMem = 256;
+        cfg.jvmMaxMem = 768;
+#else
+        cfg.jvmInitMem = 1024;
+        cfg.jvmMaxMem = 4096;
+#endif
+
+        char* cfgPath = getenv("IGNITE_NATIVE_TEST_CPP_CONFIG_PATH");
+
+        assert(cfgPath != 0);
+
+        cfg.springCfgPath = std::string(cfgPath).append("/").append(cfgFile);
+    }
+
+    ignite::Ignite StartNode(const char* cfgFile)
+    {
+        using namespace ignite;
+
+        IgniteConfiguration cfg;
+
+        InitConfig(cfg, cfgFile);
+
+        return Ignition::Start(cfg);
+    }
+
+    ignite::Ignite StartNode(const char* cfgFile, const char* name)
+    {
+        using namespace ignite;
+
+        assert(name != 0);
+
+        IgniteConfiguration cfg;
+
+        InitConfig(cfg, cfgFile);
+
+        return Ignition::Start(cfg, name);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/core-test/src/transactions_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/transactions_test.cpp b/modules/platforms/cpp/core-test/src/transactions_test.cpp
index c194423..98856d6 100644
--- a/modules/platforms/cpp/core-test/src/transactions_test.cpp
+++ b/modules/platforms/cpp/core-test/src/transactions_test.cpp
@@ -22,6 +22,7 @@
 #include <boost/test/unit_test.hpp>
 
 #include "ignite/ignition.h"
+#include "ignite/test_utils.h"
 
 using namespace ignite;
 using namespace ignite::transactions;
@@ -39,27 +40,7 @@ struct TransactionsTestSuiteFixture {
      */
     TransactionsTestSuiteFixture()
     {
-        IgniteConfiguration cfg;
-
-        cfg.jvmOpts.push_back("-Xdebug");
-        cfg.jvmOpts.push_back("-Xnoagent");
-        cfg.jvmOpts.push_back("-Djava.compiler=NONE");
-        cfg.jvmOpts.push_back("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
-        cfg.jvmOpts.push_back("-XX:+HeapDumpOnOutOfMemoryError");
-
-#ifdef IGNITE_TESTS_32
-        cfg.jvmInitMem = 256;
-        cfg.jvmMaxMem = 768;
-#else
-        cfg.jvmInitMem = 1024;
-        cfg.jvmMaxMem = 4096;
-#endif
-
-        char* cfgPath = getenv("IGNITE_NATIVE_TEST_CPP_CONFIG_PATH");
-
-        cfg.springCfgPath = std::string(cfgPath).append("/").append("cache-test.xml");
-
-        grid = Ignition::Start(cfg, "txTest");
+        grid = ignite_test::StartNode("cache-test.xml", "txTest");
     }
 
     /*

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/core/src/impl/ignite_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/ignite_impl.cpp b/modules/platforms/cpp/core/src/impl/ignite_impl.cpp
index 0a10791..fdc1008 100644
--- a/modules/platforms/cpp/core/src/impl/ignite_impl.cpp
+++ b/modules/platforms/cpp/core/src/impl/ignite_impl.cpp
@@ -52,9 +52,9 @@ namespace ignite
 
         IgniteImpl::SP_TransactionsImpl IgniteImpl::InternalGetTransactions(IgniteError &err)
         {
-            IgniteImpl::SP_TransactionsImpl res;
+            SP_TransactionsImpl res;
 
-            ignite::jni::java::JniErrorInfo jniErr;
+            JniErrorInfo jniErr;
 
             jobject txJavaRef = env.Get()->Context()->ProcessorTransactions(javaRef, &jniErr);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/odbc-test/include/test_utils.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/include/test_utils.h b/modules/platforms/cpp/odbc-test/include/test_utils.h
index e239f45..6a58e54 100644
--- a/modules/platforms/cpp/odbc-test/include/test_utils.h
+++ b/modules/platforms/cpp/odbc-test/include/test_utils.h
@@ -27,15 +27,17 @@
 
 #include <string>
 
-#define ODBC_FAIL_ON_ERROR(ret, type, handle)           \
-    if (!SQL_SUCCEEDED(ret))                            \
-    {                                                   \
-        Ignition::StopAll(true);                        \
-        BOOST_FAIL(GetOdbcErrorMessage(type, handle));  \
+#include "ignite/ignition.h"
+
+#define ODBC_FAIL_ON_ERROR(ret, type, handle)                       \
+    if (!SQL_SUCCEEDED(ret))                                        \
+    {                                                               \
+        Ignition::StopAll(true);                                    \
+        BOOST_FAIL(ignite_test::GetOdbcErrorMessage(type, handle)); \
     }
 
 
-namespace ignite
+namespace ignite_test
 {
     /** Read buffer size. */
     enum { ODBC_BUFFER_SIZE = 1024 };
@@ -48,6 +50,43 @@ namespace ignite
      * @return Error message.
      */
     std::string GetOdbcErrorMessage(SQLSMALLINT handleType, SQLHANDLE handle);
+
+    /**
+     * Initialize configuration for a node.
+     *
+     * Inits Ignite node configuration from specified config file.
+     * Config file is searched in path specified by IGNITE_NATIVE_TEST_CPP_CONFIG_PATH
+     * environmental variable.
+     *
+     * @param cfg Ignite config.
+     * @param cfgFile Ignite node config file name without path.
+     */
+    void InitConfig(ignite::IgniteConfiguration& cfg, const char* cfgFile);
+
+    /**
+     * Start Ignite node.
+     *
+     * Starts new Ignite node from specified config file.
+     * Config file is searched in path specified by IGNITE_NATIVE_TEST_CPP_CONFIG_PATH
+     * environmental variable.
+     *
+     * @param cfgFile Ignite node config file name without path.
+     * @return New node.
+     */
+    ignite::Ignite StartNode(const char* cfgFile);
+
+    /**
+     * Start Ignite node.
+     *
+     * Starts new Ignite node with the specified name and from specified config file.
+     * Config file is searched in path specified by IGNITE_NATIVE_TEST_CPP_CONFIG_PATH
+     * environmental variable.
+     *
+     * @param cfgFile Ignite node config file name without path.
+     * @param name Node name.
+     * @return New node.
+     */
+    ignite::Ignite StartNode(const char* cfgFile, const char* name);
 }
 
 #endif // _IGNITE_ODBC_TEST_TEST_UTILS
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp b/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp
index 5247129..343cdc6 100644
--- a/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp
@@ -42,6 +42,7 @@ using namespace ignite;
 using namespace ignite::cache;
 using namespace ignite::cache::query;
 using namespace ignite::common;
+using namespace ignite_test;
 
 using namespace boost::unit_test;
 
@@ -111,39 +112,9 @@ struct ApiRobustnessTestSuiteFixture
         SQLFreeHandle(SQL_HANDLE_ENV, env);
     }
 
-    static Ignite StartNode(const char* name, const char* config)
-    {
-        IgniteConfiguration cfg;
-
-        cfg.jvmOpts.push_back("-Xdebug");
-        cfg.jvmOpts.push_back("-Xnoagent");
-        cfg.jvmOpts.push_back("-Djava.compiler=NONE");
-        cfg.jvmOpts.push_back("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
-        cfg.jvmOpts.push_back("-XX:+HeapDumpOnOutOfMemoryError");
-        cfg.jvmOpts.push_back("-Duser.timezone=GMT");
-
-#ifdef IGNITE_TESTS_32
-        cfg.jvmInitMem = 256;
-        cfg.jvmMaxMem = 768;
-#else
-        cfg.jvmInitMem = 1024;
-        cfg.jvmMaxMem = 4096;
-#endif
-
-        char* cfgPath = getenv("IGNITE_NATIVE_TEST_ODBC_CONFIG_PATH");
-
-        BOOST_REQUIRE(cfgPath != 0);
-
-        cfg.springCfgPath.assign(cfgPath).append("/").append(config);
-
-        IgniteError err;
-
-        return Ignition::Start(cfg, name);
-    }
-
     static Ignite StartAdditionalNode(const char* name)
     {
-        return StartNode(name, "queries-test-noodbc.xml");
+        return StartNode("queries-test-noodbc.xml", name);
     }
 
     /**
@@ -155,7 +126,7 @@ struct ApiRobustnessTestSuiteFixture
         dbc(NULL),
         stmt(NULL)
     {
-        grid = StartNode("NodeMain", "queries-test.xml");
+        grid = StartNode("queries-test.xml", "NodeMain");
 
         testCache = grid.GetCache<int64_t, TestType>("cache");
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/odbc-test/src/application_data_buffer_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/application_data_buffer_test.cpp b/modules/platforms/cpp/odbc-test/src/application_data_buffer_test.cpp
index fe50295..82521be 100644
--- a/modules/platforms/cpp/odbc-test/src/application_data_buffer_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/application_data_buffer_test.cpp
@@ -406,7 +406,7 @@ BOOST_AUTO_TEST_CASE(TestPutDateToString)
 
     ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &strBuf, sizeof(strBuf), &reslen, 0);
 
-    Date date = BinaryUtils::MakeDateGmt(1999, 2, 22);
+    Date date = common::MakeDateGmt(1999, 2, 22);
 
     appBuf.PutDate(date);
 
@@ -420,7 +420,7 @@ BOOST_AUTO_TEST_CASE(TestPutTimestampToString)
 
     ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &strBuf, sizeof(strBuf), &reslen, 0);
 
-    Timestamp date = BinaryUtils::MakeTimestampGmt(2018, 11, 1, 17, 45, 59);
+    Timestamp date = common::MakeTimestampGmt(2018, 11, 1, 17, 45, 59);
 
     appBuf.PutTimestamp(date);
 
@@ -437,7 +437,7 @@ BOOST_AUTO_TEST_CASE(TestPutDateToDate)
 
     ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TDATE, &buf, sizeof(buf), &reslen, &offsetPtr);
 
-    Date date = BinaryUtils::MakeDateGmt(1984, 5, 27);
+    Date date = common::MakeDateGmt(1984, 5, 27);
 
     appBuf.PutDate(date);
 
@@ -456,7 +456,7 @@ BOOST_AUTO_TEST_CASE(TestPutTimestampToDate)
 
     ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TDATE, &buf, sizeof(buf), &reslen, &offsetPtr);
 
-    Timestamp ts = BinaryUtils::MakeTimestampGmt(2004, 8, 14, 6, 34, 51, 573948623);
+    Timestamp ts = common::MakeTimestampGmt(2004, 8, 14, 6, 34, 51, 573948623);
 
     appBuf.PutTimestamp(ts);
 
@@ -475,7 +475,7 @@ BOOST_AUTO_TEST_CASE(TestPutTimestampToTimestamp)
 
     ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr);
 
-    Timestamp ts = BinaryUtils::MakeTimestampGmt(2004, 8, 14, 6, 34, 51, 573948623);
+    Timestamp ts = common::MakeTimestampGmt(2004, 8, 14, 6, 34, 51, 573948623);
 
     appBuf.PutTimestamp(ts);
 
@@ -499,7 +499,7 @@ BOOST_AUTO_TEST_CASE(TestPutDateToTimestamp)
 
     ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_TTIMESTAMP, &buf, sizeof(buf), &reslen, &offsetPtr);
 
-    Date date = BinaryUtils::MakeDateGmt(1984, 5, 27);
+    Date date = common::MakeDateGmt(1984, 5, 27);
 
     appBuf.PutDate(date);
 
@@ -823,7 +823,7 @@ BOOST_AUTO_TEST_CASE(TestGetDateFromString)
 
     tm tmDate;
 
-    bool success = BinaryUtils::DateToCTm(date, tmDate);
+    bool success = common::DateToCTm(date, tmDate);
 
     BOOST_REQUIRE(success);
 
@@ -849,7 +849,7 @@ BOOST_AUTO_TEST_CASE(TestGetTimestampFromString)
 
     tm tmDate;
 
-    bool success = BinaryUtils::TimestampToCTm(date, tmDate);
+    bool success = common::TimestampToCTm(date, tmDate);
 
     BOOST_REQUIRE(success);
 
@@ -880,7 +880,7 @@ BOOST_AUTO_TEST_CASE(TestGetDateFromDate)
 
     tm tmDate;
 
-    bool success = BinaryUtils::DateToCTm(date, tmDate);
+    bool success = common::DateToCTm(date, tmDate);
 
     BOOST_REQUIRE(success);
 
@@ -911,7 +911,7 @@ BOOST_AUTO_TEST_CASE(TestGetTimestampFromDate)
 
     tm tmDate;
 
-    bool success = BinaryUtils::TimestampToCTm(ts, tmDate);
+    bool success = common::TimestampToCTm(ts, tmDate);
 
     BOOST_REQUIRE(success);
 
@@ -946,7 +946,7 @@ BOOST_AUTO_TEST_CASE(TestGetTimestampFromTimestamp)
 
     tm tmDate;
 
-    bool success = BinaryUtils::TimestampToCTm(ts, tmDate);
+    bool success = common::TimestampToCTm(ts, tmDate);
 
     BOOST_REQUIRE(success);
 
@@ -982,7 +982,7 @@ BOOST_AUTO_TEST_CASE(TestGetDateFromTimestamp)
 
     tm tmDate;
 
-    bool success = BinaryUtils::DateToCTm(date, tmDate);
+    bool success = common::DateToCTm(date, tmDate);
 
     BOOST_REQUIRE(success);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/odbc-test/src/queries_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/queries_test.cpp b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
index a304229..422648e 100644
--- a/modules/platforms/cpp/odbc-test/src/queries_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
@@ -44,6 +44,7 @@ using namespace ignite;
 using namespace ignite::cache;
 using namespace ignite::cache::query;
 using namespace ignite::common;
+using namespace ignite_test;
 
 using namespace boost::unit_test;
 
@@ -113,39 +114,9 @@ struct QueriesTestSuiteFixture
         SQLFreeHandle(SQL_HANDLE_ENV, env);
     }
 
-    static Ignite StartNode(const char* name, const char* config)
-    {
-        IgniteConfiguration cfg;
-
-        cfg.jvmOpts.push_back("-Xdebug");
-        cfg.jvmOpts.push_back("-Xnoagent");
-        cfg.jvmOpts.push_back("-Djava.compiler=NONE");
-        cfg.jvmOpts.push_back("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
-        cfg.jvmOpts.push_back("-XX:+HeapDumpOnOutOfMemoryError");
-        cfg.jvmOpts.push_back("-Duser.timezone=GMT");
-
-#ifdef IGNITE_TESTS_32
-        cfg.jvmInitMem = 256;
-        cfg.jvmMaxMem = 768;
-#else
-        cfg.jvmInitMem = 1024;
-        cfg.jvmMaxMem = 4096;
-#endif
-
-        char* cfgPath = getenv("IGNITE_NATIVE_TEST_ODBC_CONFIG_PATH");
-
-        BOOST_REQUIRE(cfgPath != 0);
-
-        cfg.springCfgPath.assign(cfgPath).append("/").append(config);
-
-        IgniteError err;
-
-        return Ignition::Start(cfg, name);
-    }
-
     static Ignite StartAdditionalNode(const char* name)
     {
-        return StartNode(name, "queries-test-noodbc.xml");
+        return StartNode("queries-test-noodbc.xml", name);
     }
 
     /**
@@ -158,7 +129,7 @@ struct QueriesTestSuiteFixture
         dbc(NULL),
         stmt(NULL)
     {
-        grid = StartNode("NodeMain", "queries-test.xml");
+        grid = StartNode("queries-test.xml", "NodeMain");
 
         cache1 = grid.GetCache<int64_t, TestType>("cache");
         cache2 = grid.GetCache<int64_t, ComplexType>("cache2");
@@ -181,11 +152,11 @@ struct QueriesTestSuiteFixture
 
         SQLRETURN ret;
 
-        TestType in1(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), BinaryUtils::MakeDateGmt(1987, 6, 5),
-            BinaryUtils::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
+        TestType in1(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), common::MakeDateGmt(1987, 6, 5),
+            common::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
 
-        TestType in2(8, 7, 6, 5, "4", 3.0f, 2.0, false, Guid(1, 0), BinaryUtils::MakeDateGmt(1976, 1, 12),
-            BinaryUtils::MakeTimestampGmt(1978, 8, 21, 23, 13, 45, 456));
+        TestType in2(8, 7, 6, 5, "4", 3.0f, 2.0, false, Guid(1, 0), common::MakeDateGmt(1976, 1, 12),
+            common::MakeTimestampGmt(1978, 8, 21, 23, 13, 45, 456));
 
         cache1.Put(1, in1);
         cache1.Put(2, in2);
@@ -448,11 +419,11 @@ BOOST_AUTO_TEST_CASE(TestTwoRowsString)
 
     SQLRETURN ret;
 
-    TestType in1(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), BinaryUtils::MakeDateGmt(1987, 6, 5),
-        BinaryUtils::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
+    TestType in1(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), common::MakeDateGmt(1987, 6, 5),
+        common::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
 
-    TestType in2(8, 7, 6, 5, "4", 3.0f, 2.0, false, Guid(1, 0), BinaryUtils::MakeDateGmt(1976, 1, 12),
-        BinaryUtils::MakeTimestampGmt(1978, 8, 21, 23, 13, 45, 999999999));
+    TestType in2(8, 7, 6, 5, "4", 3.0f, 2.0, false, Guid(1, 0), common::MakeDateGmt(1976, 1, 12),
+        common::MakeTimestampGmt(1978, 8, 21, 23, 13, 45, 999999999));
 
     cache1.Put(1, in1);
     cache1.Put(2, in2);
@@ -548,8 +519,8 @@ BOOST_AUTO_TEST_CASE(TestOneRowString)
 
     SQLRETURN ret;
 
-    TestType in(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), BinaryUtils::MakeDateGmt(1987, 6, 5),
-        BinaryUtils::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
+    TestType in(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), common::MakeDateGmt(1987, 6, 5),
+        common::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
 
     cache1.Put(1, in);
 
@@ -614,8 +585,8 @@ BOOST_AUTO_TEST_CASE(TestOneRowStringLen)
 
     SQLRETURN ret;
 
-    TestType in(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), BinaryUtils::MakeDateGmt(1987, 6, 5),
-        BinaryUtils::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
+    TestType in(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), common::MakeDateGmt(1987, 6, 5),
+        common::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
 
     cache1.Put(1, in);
 
@@ -722,11 +693,11 @@ BOOST_AUTO_TEST_CASE(TestDataAtExecution)
 
     SQLRETURN ret;
 
-    TestType in1(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), BinaryUtils::MakeDateGmt(1987, 6, 5),
-        BinaryUtils::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
+    TestType in1(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), common::MakeDateGmt(1987, 6, 5),
+        common::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
 
-    TestType in2(8, 7, 6, 5, "4", 3.0f, 2.0, false, Guid(1, 0), BinaryUtils::MakeDateGmt(1976, 1, 12),
-        BinaryUtils::MakeTimestampGmt(1978, 8, 21, 23, 13, 45, 999999999));
+    TestType in2(8, 7, 6, 5, "4", 3.0f, 2.0, false, Guid(1, 0), common::MakeDateGmt(1976, 1, 12),
+        common::MakeTimestampGmt(1978, 8, 21, 23, 13, 45, 999999999));
 
     cache1.Put(1, in1);
     cache1.Put(2, in2);
@@ -845,8 +816,8 @@ BOOST_AUTO_TEST_CASE(TestNullFields)
 
     SQLRETURN ret;
 
-    TestType in(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), BinaryUtils::MakeDateGmt(1987, 6, 5),
-        BinaryUtils::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
+    TestType in(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), common::MakeDateGmt(1987, 6, 5),
+        common::MakeTimestampGmt(1998, 12, 27, 1, 2, 3, 456));
 
     TestType inNull;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/odbc-test/src/sql_aggregate_functions_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_aggregate_functions_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_aggregate_functions_test.cpp
index de1f5f8..fd55d99 100644
--- a/modules/platforms/cpp/odbc-test/src/sql_aggregate_functions_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/sql_aggregate_functions_test.cpp
@@ -47,6 +47,7 @@ using namespace ignite;
 using namespace ignite::cache;
 using namespace ignite::cache::query;
 using namespace ignite::common;
+using namespace ignite_test;
 
 using namespace boost::unit_test;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/odbc-test/src/sql_date_time_functions_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_date_time_functions_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_date_time_functions_test.cpp
index f89cc3d..157a011 100644
--- a/modules/platforms/cpp/odbc-test/src/sql_date_time_functions_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/sql_date_time_functions_test.cpp
@@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE(TestDayname)
 {
     TestType in;
 
-    in.dateField = impl::binary::BinaryUtils::MakeDateGmt(2016, 8, 29);
+    in.dateField = common::MakeDateGmt(2016, 8, 29);
 
     testCache.Put(1, in);
 
@@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE(TestDayofmonth)
 {
     TestType in;
 
-    in.dateField = impl::binary::BinaryUtils::MakeDateGmt(2016, 8, 29);
+    in.dateField = common::MakeDateGmt(2016, 8, 29);
 
     testCache.Put(1, in);
 
@@ -81,7 +81,7 @@ BOOST_AUTO_TEST_CASE(TestDayofweek)
 {
     TestType in;
 
-    in.dateField = impl::binary::BinaryUtils::MakeDateGmt(2016, 8, 29);
+    in.dateField = common::MakeDateGmt(2016, 8, 29);
 
     testCache.Put(1, in);
 
@@ -93,7 +93,7 @@ BOOST_AUTO_TEST_CASE(TestDayofyear)
 {
     TestType in;
 
-    in.dateField = impl::binary::BinaryUtils::MakeDateGmt(2016, 8, 29);
+    in.dateField = common::MakeDateGmt(2016, 8, 29);
 
     testCache.Put(1, in);
 
@@ -105,7 +105,7 @@ BOOST_AUTO_TEST_CASE(TestExtract)
 {
     TestType in;
 
-    in.timestampField = impl::binary::BinaryUtils::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
+    in.timestampField = common::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
 
     testCache.Put(1, in);
 
@@ -121,7 +121,7 @@ BOOST_AUTO_TEST_CASE(TestHour)
 {
     TestType in;
 
-    in.timestampField = impl::binary::BinaryUtils::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
+    in.timestampField = common::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
 
     testCache.Put(1, in);
 
@@ -132,7 +132,7 @@ BOOST_AUTO_TEST_CASE(TestMinute)
 {
     TestType in;
 
-    in.timestampField = impl::binary::BinaryUtils::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
+    in.timestampField = common::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
 
     testCache.Put(1, in);
 
@@ -143,7 +143,7 @@ BOOST_AUTO_TEST_CASE(TestMonth)
 {
     TestType in;
 
-    in.timestampField = impl::binary::BinaryUtils::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
+    in.timestampField = common::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
 
     testCache.Put(1, in);
 
@@ -154,7 +154,7 @@ BOOST_AUTO_TEST_CASE(TestMonthname)
 {
     TestType in;
 
-    in.timestampField = impl::binary::BinaryUtils::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
+    in.timestampField = common::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
 
     testCache.Put(1, in);
 
@@ -170,7 +170,7 @@ BOOST_AUTO_TEST_CASE(TestQuarter)
 {
     TestType in;
 
-    in.timestampField = impl::binary::BinaryUtils::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
+    in.timestampField = common::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
 
     testCache.Put(1, in);
 
@@ -181,7 +181,7 @@ BOOST_AUTO_TEST_CASE(TestSecond)
 {
     TestType in;
 
-    in.timestampField = impl::binary::BinaryUtils::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
+    in.timestampField = common::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
 
     testCache.Put(1, in);
 
@@ -192,7 +192,7 @@ BOOST_AUTO_TEST_CASE(TestWeek)
 {
     TestType in;
 
-    in.timestampField = impl::binary::BinaryUtils::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
+    in.timestampField = common::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
 
     testCache.Put(1, in);
 
@@ -203,7 +203,7 @@ BOOST_AUTO_TEST_CASE(TestYear)
 {
     TestType in;
 
-    in.timestampField = impl::binary::BinaryUtils::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
+    in.timestampField = common::MakeTimestampGmt(2016, 2, 24, 13, 45, 23, 580695103);
 
     testCache.Put(1, in);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/odbc-test/src/sql_esc_convert_function_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_esc_convert_function_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_esc_convert_function_test.cpp
index d9a14a9..5dc2b58 100644
--- a/modules/platforms/cpp/odbc-test/src/sql_esc_convert_function_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/sql_esc_convert_function_test.cpp
@@ -137,7 +137,7 @@ BOOST_AUTO_TEST_CASE(TestEscConvertFunctionGuid)
 BOOST_AUTO_TEST_CASE(TestEscConvertFunctionDate)
 {
     using ignite::impl::binary::BinaryUtils;
-    Date date = BinaryUtils::MakeDateGmt(1983, 3, 14);
+    Date date = common::MakeDateGmt(1983, 3, 14);
     CheckSingleResult<Date>("SELECT {fn CONVERT('1983-03-14', SQL_DATE)}", date);
 }
 
@@ -153,7 +153,7 @@ BOOST_AUTO_TEST_CASE(TestEscConvertFunctionTime)
 BOOST_AUTO_TEST_CASE(TestEscConvertFunctionTimestamp)
 {
     using ignite::impl::binary::BinaryUtils;
-    Timestamp ts = BinaryUtils::MakeTimestampGmt(1983, 3, 14, 13, 20, 15, 999999999);
+    Timestamp ts = common::MakeTimestampGmt(1983, 3, 14, 13, 20, 15, 999999999);
     CheckSingleResult<Timestamp>("SELECT {fn CONVERT('1983-03-14 13:20:15.999999999', SQL_TIMESTAMP)}", ts);
 }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/odbc-test/src/sql_numeric_functions_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_numeric_functions_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_numeric_functions_test.cpp
index e16d8c1..723f784 100644
--- a/modules/platforms/cpp/odbc-test/src/sql_numeric_functions_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/sql_numeric_functions_test.cpp
@@ -47,6 +47,7 @@ using namespace ignite;
 using namespace ignite::cache;
 using namespace ignite::cache::query;
 using namespace ignite::common;
+using namespace ignite_test;
 
 using namespace boost::unit_test;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/odbc-test/src/sql_outer_join_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_outer_join_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_outer_join_test.cpp
index 56f5219..21fc568 100644
--- a/modules/platforms/cpp/odbc-test/src/sql_outer_join_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/sql_outer_join_test.cpp
@@ -25,6 +25,7 @@
 #include "test_utils.h"
 
 using namespace ignite;
+using namespace ignite_test;
 
 using namespace boost::unit_test;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/odbc-test/src/sql_string_functions_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_string_functions_test.cpp b/modules/platforms/cpp/odbc-test/src/sql_string_functions_test.cpp
index c85f80c..389f2f4 100644
--- a/modules/platforms/cpp/odbc-test/src/sql_string_functions_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/sql_string_functions_test.cpp
@@ -43,6 +43,7 @@ using namespace ignite;
 using namespace ignite::cache;
 using namespace ignite::cache::query;
 using namespace ignite::common;
+using namespace ignite_test;
 
 using namespace boost::unit_test;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp b/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp
index 1ecd26a..400e9a9 100644
--- a/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp
+++ b/modules/platforms/cpp/odbc-test/src/sql_test_suite_fixture.cpp
@@ -19,6 +19,8 @@
 
 #include "test_utils.h"
 
+using namespace ignite_test;
+
 namespace ignite
 {
     SqlTestSuiteFixture::SqlTestSuiteFixture():
@@ -27,35 +29,7 @@ namespace ignite
         dbc(NULL),
         stmt(NULL)
     {
-        IgniteConfiguration cfg;
-
-        cfg.jvmOpts.push_back("-Xdebug");
-        cfg.jvmOpts.push_back("-Xnoagent");
-        cfg.jvmOpts.push_back("-Djava.compiler=NONE");
-        cfg.jvmOpts.push_back("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
-        cfg.jvmOpts.push_back("-XX:+HeapDumpOnOutOfMemoryError");
-        cfg.jvmOpts.push_back("-Duser.timezone=GMT");
-
-#ifdef IGNITE_TESTS_32
-        cfg.jvmInitMem = 256;
-        cfg.jvmMaxMem = 768;
-#else
-        cfg.jvmInitMem = 1024;
-        cfg.jvmMaxMem = 4096;
-#endif
-
-        char* cfgPath = getenv("IGNITE_NATIVE_TEST_ODBC_CONFIG_PATH");
-
-        BOOST_REQUIRE(cfgPath != 0);
-
-        cfg.springCfgPath.assign(cfgPath).append("/queries-test.xml");
-
-        IgniteError err;
-
-        grid = Ignition::Start(cfg, &err);
-
-        if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
-            BOOST_FAIL(err.GetText()) ;
+        grid = StartNode("queries-test.xml");
 
         testCache = grid.GetCache<int64_t, TestType>("cache");
 
@@ -84,7 +58,7 @@ namespace ignite
 
         if (!SQL_SUCCEEDED(ret))
         {
-            Ignition::Stop(grid.GetName(), true);
+            Ignition::StopAll(true);
 
             BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_DBC, dbc));
         }
@@ -107,7 +81,7 @@ namespace ignite
         SQLFreeHandle(SQL_HANDLE_DBC, dbc);
         SQLFreeHandle(SQL_HANDLE_ENV, env);
 
-        ignite::Ignition::Stop(grid.GetName(), true);
+        ignite::Ignition::StopAll(true);
     }
 
     void SqlTestSuiteFixture::CheckSingleResult0(const char* request,
@@ -321,7 +295,7 @@ namespace ignite
         CheckSingleResult0(request, SQL_C_DATE, &res, 0, 0);
 
         using ignite::impl::binary::BinaryUtils;
-        Date actual = BinaryUtils::MakeDateGmt(res.year, res.month, res.day);
+        Date actual = common::MakeDateGmt(res.year, res.month, res.day);
         BOOST_REQUIRE_EQUAL(actual.GetSeconds(), expected.GetSeconds());
     }
 
@@ -345,7 +319,7 @@ namespace ignite
         CheckSingleResult0(request, SQL_C_TIMESTAMP, &res, 0, 0);
 
         using ignite::impl::binary::BinaryUtils;
-        Timestamp actual = BinaryUtils::MakeTimestampGmt(res.year, res.month, res.day, res.hour, res.minute, res.second, res.fraction);
+        Timestamp actual = common::MakeTimestampGmt(res.year, res.month, res.day, res.hour, res.minute, res.second, res.fraction);
 
         BOOST_REQUIRE_EQUAL(actual.GetSeconds(), expected.GetSeconds());
         BOOST_REQUIRE_EQUAL(actual.GetSecondFraction(), expected.GetSecondFraction());


[3/4] ignite git commit: IGNITE-4046: Added DML support to CPP platform. This closes #1432.

Posted by vo...@apache.org.
IGNITE-4046: Added DML support to CPP platform. This closes #1432.


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

Branch: refs/heads/master
Commit: b0bc6f0cb1bdcc3038f48ec0eb34f9a01044ded0
Parents: 529a545
Author: isapego <ig...@gmail.com>
Authored: Wed Feb 1 18:04:20 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Feb 1 18:04:20 2017 +0300

----------------------------------------------------------------------
 modules/platforms/cpp/binary/Makefile.am        |   1 +
 .../platforms/cpp/binary/include/Makefile.am    |   3 +
 .../binary/binary_array_identity_resolver.h     |  64 +++
 .../ignite/binary/binary_identity_resolver.h    |  61 +++
 .../include/ignite/binary/binary_object.h       |   5 +-
 .../binary/include/ignite/binary/binary_type.h  |  16 -
 .../ignite/impl/binary/binary_object_impl.h     |   9 +-
 .../ignite/impl/binary/binary_type_impl.h       | 149 ++++++
 .../ignite/impl/binary/binary_type_snapshot.h   |  18 +-
 .../include/ignite/impl/binary/binary_utils.h   | 175 +------
 .../ignite/impl/binary/binary_writer_impl.h     |  11 +-
 .../ignite/impl/interop/interop_output_stream.h |  10 +-
 .../cpp/binary/project/vs/binary.vcxproj        |   4 +
 .../binary/project/vs/binary.vcxproj.filters    |  12 +
 .../binary/binary_array_identity_resolver.cpp   |  42 ++
 .../cpp/binary/src/binary/binary_type.cpp       |   4 +-
 .../src/impl/binary/binary_object_impl.cpp      |  10 +-
 .../src/impl/binary/binary_type_manager.cpp     |  12 +-
 .../cpp/binary/src/impl/binary/binary_utils.cpp |  80 +--
 .../src/impl/binary/binary_writer_impl.cpp      |   2 -
 .../src/impl/interop/interop_output_stream.cpp  |   5 +
 modules/platforms/cpp/common/Makefile.am        |   5 +-
 .../platforms/cpp/common/include/Makefile.am    |   1 +
 .../include/ignite/common/platform_utils.h      |  79 +++
 .../cpp/common/include/ignite/common/utils.h    | 251 +++++++--
 .../os/linux/src/common/platform_utils.cpp      |  81 +++
 .../cpp/common/os/linux/src/common/utils.cpp    | 148 ------
 .../common/os/win/src/common/platform_utils.cpp |  88 ++++
 .../cpp/common/os/win/src/common/utils.cpp      | 154 ------
 .../cpp/common/project/vs/common.vcxproj        |   4 +-
 .../common/project/vs/common.vcxproj.filters    |  12 +-
 .../platforms/cpp/common/src/common/utils.cpp   | 153 ++++++
 modules/platforms/cpp/core-test/Makefile.am     |   4 +-
 .../cpp/core-test/config/cache-identity.xml     | 121 +++++
 .../cpp/core-test/config/cache-query.xml        |  10 -
 .../cpp/core-test/include/ignite/test_utils.h   |  63 +++
 .../cpp/core-test/project/vs/core-test.vcxproj  |   4 +
 .../project/vs/core-test.vcxproj.filters        |  15 +
 .../src/binary_identity_resolver_test.cpp       | 522 +++++++++++++++++++
 .../cpp/core-test/src/binary_object_test.cpp    |  20 +-
 .../cpp/core-test/src/binary_session_test.cpp   |   4 +-
 .../cpp/core-test/src/cache_query_test.cpp      | 149 +++---
 .../platforms/cpp/core-test/src/cache_test.cpp  |  43 +-
 .../cpp/core-test/src/continuous_query_test.cpp |  31 +-
 .../cpp/core-test/src/ignition_test.cpp         |  19 +-
 .../cpp/core-test/src/interop_test.cpp          |  42 +-
 .../platforms/cpp/core-test/src/test_utils.cpp  |  79 +++
 .../cpp/core-test/src/transactions_test.cpp     |  23 +-
 .../platforms/cpp/core/src/impl/ignite_impl.cpp |   4 +-
 .../cpp/odbc-test/include/test_utils.h          |  51 +-
 .../cpp/odbc-test/src/api_robustness_test.cpp   |  35 +-
 .../src/application_data_buffer_test.cpp        |  24 +-
 .../cpp/odbc-test/src/queries_test.cpp          |  71 +--
 .../src/sql_aggregate_functions_test.cpp        |   1 +
 .../src/sql_date_time_functions_test.cpp        |  26 +-
 .../src/sql_esc_convert_function_test.cpp       |   4 +-
 .../src/sql_numeric_functions_test.cpp          |   1 +
 .../cpp/odbc-test/src/sql_outer_join_test.cpp   |   1 +
 .../odbc-test/src/sql_string_functions_test.cpp |   1 +
 .../odbc-test/src/sql_test_suite_fixture.cpp    |  40 +-
 .../cpp/odbc-test/src/sql_types_test.cpp        |  10 +-
 .../platforms/cpp/odbc-test/src/test_utils.cpp  |  60 ++-
 .../odbc/src/app/application_data_buffer.cpp    |   8 +-
 63 files changed, 2100 insertions(+), 1055 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/Makefile.am b/modules/platforms/cpp/binary/Makefile.am
index cee87cd..c13a1bb 100644
--- a/modules/platforms/cpp/binary/Makefile.am
+++ b/modules/platforms/cpp/binary/Makefile.am
@@ -52,6 +52,7 @@ libignite_binary_la_SOURCES = \
     src/binary/binary_reader.cpp \
     src/binary/binary_type.cpp \
     src/binary/binary_raw_reader.cpp \
+    src/binary/binary_array_identity_resolver.cpp \
     src/impl/binary/binary_type_manager.cpp \
     src/impl/binary/binary_utils.cpp \
     src/impl/binary/binary_reader_impl.cpp \

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/include/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/Makefile.am b/modules/platforms/cpp/binary/include/Makefile.am
index 2795cbc..a25a753 100644
--- a/modules/platforms/cpp/binary/include/Makefile.am
+++ b/modules/platforms/cpp/binary/include/Makefile.am
@@ -27,6 +27,8 @@ nobase_include_HEADERS = \
     ignite/binary/binary_consts.h \
     ignite/binary/binary_type.h \
     ignite/binary/binary_object.h \
+    ignite/binary/binary_identity_resolver.h \
+    ignite/binary/binary_array_identity_resolver.h \
     ignite/impl/binary/binary_type_handler.h \
     ignite/impl/binary/binary_id_resolver.h \
     ignite/impl/binary/binary_type_manager.h \
@@ -39,6 +41,7 @@ nobase_include_HEADERS = \
     ignite/impl/binary/binary_utils.h \
     ignite/impl/binary/binary_object_header.h \
     ignite/impl/binary/binary_object_impl.h \
+    ignite/impl/binary/binary_type_impl.h \
     ignite/impl/interop/interop_memory.h \
     ignite/impl/interop/interop.h \
     ignite/impl/interop/interop_stream_position_guard.h \

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/include/ignite/binary/binary_array_identity_resolver.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_array_identity_resolver.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_array_identity_resolver.h
new file mode 100644
index 0000000..70c5ed4
--- /dev/null
+++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_array_identity_resolver.h
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+
+/**
+ * @file
+ * Declares ignite::binary::BinaryArrayIdentityResolver class template.
+ */
+
+#ifndef _IGNITE_BINARY_BINARY_ARRAY_IDENTITY_RESOLVER
+#define _IGNITE_BINARY_BINARY_ARRAY_IDENTITY_RESOLVER
+
+#include <stdint.h>
+
+#include <ignite/common/common.h>
+#include <ignite/binary/binary_identity_resolver.h>
+
+namespace ignite
+{
+    namespace binary
+    {
+        class BinaryObject;
+
+        /**
+         * Binary array identity resolver.
+         */
+        class IGNITE_IMPORT_EXPORT BinaryArrayIdentityResolver : public BinaryIdentityResolver
+        {
+        public:
+            /**
+             * Default constructor.
+             */
+            BinaryArrayIdentityResolver();
+
+            /**
+             * Destructor.
+             */
+            virtual ~BinaryArrayIdentityResolver();
+
+            /**
+             * Get binary object hash code.
+             *
+             * @param obj Binary object.
+             * @return Hash code.
+             */
+            virtual int32_t GetHashCode(const BinaryObject& obj);
+        };
+    }
+}
+
+#endif //_IGNITE_BINARY_BINARY_ARRAY_IDENTITY_RESOLVER

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/include/ignite/binary/binary_identity_resolver.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_identity_resolver.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_identity_resolver.h
new file mode 100644
index 0000000..ce10012
--- /dev/null
+++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_identity_resolver.h
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+/**
+ * @file
+ * Declares ignite::binary::BinaryIdentityResolver class.
+ */
+
+#ifndef _IGNITE_BINARY_BINARY_IDENTITY_RESOLVER
+#define _IGNITE_BINARY_BINARY_IDENTITY_RESOLVER
+
+#include <stdint.h>
+
+#include <ignite/common/common.h>
+
+#include <ignite/binary/binary_object.h>
+
+namespace ignite
+{
+    namespace binary
+    {
+        /**
+         * Binary identity resolver.
+         */
+        class IGNITE_IMPORT_EXPORT BinaryIdentityResolver
+        {
+        public:
+            /**
+             * Destructor.
+             */
+            virtual ~BinaryIdentityResolver()
+            {
+                // No-op.
+            }
+
+            /**
+             * Get binary object hash code.
+             *
+             * @param obj Binary object.
+             * @return Hash code.
+             */
+            virtual int32_t GetHashCode(const BinaryObject& obj) = 0;
+        };
+    }
+}
+
+#endif //_IGNITE_BINARY_BINARY_IDENTITY_RESOLVER

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/include/ignite/binary/binary_object.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_object.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_object.h
index 41907d0..08b503e 100644
--- a/modules/platforms/cpp/binary/include/ignite/binary/binary_object.h
+++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_object.h
@@ -25,14 +25,14 @@
 
 #include <stdint.h>
 
-#include <ignite/impl/interop/interop.h>
-#include <ignite/impl/binary/binary_reader_impl.h>
 #include <ignite/impl/binary/binary_object_impl.h>
 
 namespace ignite
 {
     namespace binary
     {
+        class BinaryArrayIdentityResolver;
+
         /**
          * Binary object.
          *
@@ -41,6 +41,7 @@ namespace ignite
          */
         class IGNITE_IMPORT_EXPORT BinaryObject : private impl::binary::BinaryObjectImpl
         {
+            friend class BinaryArrayIdentityResolver;
         public:
             /// @cond INTERNAL
             /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/include/ignite/binary/binary_type.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/binary/binary_type.h b/modules/platforms/cpp/binary/include/ignite/binary/binary_type.h
index 978a928..1c37f6d 100644
--- a/modules/platforms/cpp/binary/include/ignite/binary/binary_type.h
+++ b/modules/platforms/cpp/binary/include/ignite/binary/binary_type.h
@@ -189,17 +189,6 @@ namespace ignite
             }
 
             /**
-             * Get binary object hash code.
-             *
-             * @param obj Binary object.
-             * @return Hash code.
-             */
-            int32_t GetHashCode(const T& obj)
-            {
-                return 0;
-            }
-
-            /**
              * Write binary object.
              *
              * @param writer Writer.
@@ -275,11 +264,6 @@ namespace ignite
                 return typ.GetFieldId(name);
             }
 
-            int32_t GetHashCode(T* const& obj)
-            {
-                return typ.GetHashCode(*obj);
-            }
-
             void Write(BinaryWriter& writer, T* const& obj)
             {
                 typ.Write(writer, *obj);

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_object_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_object_impl.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_object_impl.h
index 288ba26..efe1f49 100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_object_impl.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_object_impl.h
@@ -72,7 +72,6 @@ namespace ignite
 
                 /**
                  * Get object data.
-                 * @throw IgniteError if the object is not in a valid state.
                  *
                  * @return Pointer to object data.
                  */
@@ -86,6 +85,14 @@ namespace ignite
                  */
                 int32_t GetLength() const;
 
+                /**
+                 * Get object hash code.
+                 * @throw IgniteError if the object is not in a valid state.
+                 *
+                 * @return Object hash code.
+                 */
+                int32_t GetHashCode() const;
+
             private:
                 IGNITE_NO_COPY_ASSIGNMENT(BinaryObjectImpl)
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_impl.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_impl.h
new file mode 100644
index 0000000..d0cbb86
--- /dev/null
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_impl.h
@@ -0,0 +1,149 @@
+/*
+ * 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 _IGNITE_IMPL_BINARY_BINARY_TYPE_IMP
+#define _IGNITE_IMPL_BINARY_BINARY_TYPE_IMP
+
+#include <stdint.h>
+
+#include <ignite/common/utils.h>
+
+#include <ignite/binary/binary_type.h>
+#include <ignite/binary/binary_object.h>
+#include <ignite/binary/binary_array_identity_resolver.h>
+
+#include <ignite/reference.h>
+
+/**
+ * Some SFINAE magic to check existence of the specified method with the
+ * specified signature in the BinaryType<T> class.
+ *
+ * This macro declares checker for the method.
+ */
+#define IGNITE_DECLARE_BINARY_TYPE_METHOD_CHECKER(method, sign)                         \
+    template<typename T>                                                                \
+    class IsDeclaredBinaryType##method                                                  \
+    {                                                                                   \
+        typedef char one;                                                               \
+        typedef char two[2];                                                            \
+                                                                                        \
+        template<class U, U> struct test;                                               \
+                                                                                        \
+        template<typename C> static one& helper(test<sign, &C::method>*);               \
+        template<typename C> static two& helper(...);                                   \
+                                                                                        \
+    public:                                                                             \
+        const static bool value =                                                       \
+            (sizeof(helper< ignite::binary::BinaryType<T> >(0)) == sizeof(one));        \
+    }
+
+namespace ignite
+{
+    namespace impl
+    {
+        namespace binary
+        {
+            IGNITE_DECLARE_BINARY_TYPE_METHOD_CHECKER(GetHashCode, int32_t(ignite::binary::BinaryType<T>::*)(const T&));
+            IGNITE_DECLARE_BINARY_TYPE_METHOD_CHECKER(GetIdentityResolver,
+                ignite::Reference<ignite::binary::BinaryIdentityResolver>(ignite::binary::BinaryType<T>::*)());
+
+            /**
+             * This type is used to get hash code for binary types which have not
+             * GetHashCode nor GetIdentityResolver methods defined.
+             */
+            template<typename T>
+            struct HashCodeGetterDefault
+            {
+                static int32_t Get(const T&, const ignite::binary::BinaryObject& obj)
+                {
+                    ignite::binary::BinaryArrayIdentityResolver arrayResolver;
+
+                    return arrayResolver.GetHashCode(obj);
+                }
+            };
+
+            /**
+             * This type is used to get hash code for binary types which have not
+             * GetIdentityResolver method defined but have GetHashCode.
+             */
+            template<typename T>
+            struct HashCodeGetterHashCode
+            {
+                static int32_t Get(const T& obj, const ignite::binary::BinaryObject&)
+                {
+                    ignite::binary::BinaryType<T> bt;
+
+                    return bt.GetHashCode(obj);
+                }
+            };
+
+            /**
+             * This type is used to get hash code for binary types which have
+             * GetIdentityResolver method defined.
+             */
+            template<typename T>
+            struct HashCodeGetterResolver
+            {
+                static int32_t Get(const T&, const ignite::binary::BinaryObject& obj)
+                {
+                    ignite::binary::BinaryType<T> bt;
+                    ignite::Reference<ignite::binary::BinaryIdentityResolver> resolver = bt.GetIdentityResolver();
+
+                    return resolver.Get().GetHashCode(obj);
+                }
+            };
+
+            /**
+             * Get hash code for the specified object.
+             * Determines the best method to use based on user-defined methods.
+             *
+             * @param obj Object reference.
+             * @param binObj Binary representation reference.
+             * @return Hash code for the object.
+             */
+            template<typename T>
+            int32_t GetHashCode(const T& obj, const ignite::binary::BinaryObject& binObj)
+            {
+                using namespace common;
+
+                typedef typename Conditional<
+                    // Checking if the BinaryType<T>::GetIdentityResolver declared
+                    IsDeclaredBinaryTypeGetIdentityResolver<T>::value,
+
+                    // True case. Using user-provided resolver.
+                    HashCodeGetterResolver<T>,
+
+                    // False case. Adding condition.
+                    typename Conditional<
+                        // Checking if the BinaryType<T>::GetHashCode declared
+                        IsDeclaredBinaryTypeGetHashCode<T>::value,
+
+                        // True case - using BinaryType<T>::GetHashCode().
+                        HashCodeGetterHashCode<T>,
+
+                        // False case. Using default getter.
+                        HashCodeGetterDefault<T> 
+                    >::type
+                >::type HashCodeGetter;
+
+                return HashCodeGetter::Get(obj, binObj);
+            }
+        }
+    }
+}
+
+#endif //_IGNITE_IMPL_BINARY_BINARY_TYPE_IMP

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_snapshot.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_snapshot.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_snapshot.h
index 4a8b41f..f1959fc 100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_snapshot.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_snapshot.h
@@ -27,13 +27,13 @@
 #include <ignite/common/concurrent.h>
 
 namespace ignite
-{    
+{
     namespace impl
     {
         namespace binary
         {
             /**
-             * Type snapshot. 
+             * Type snapshot.
              */
             class BinaryTypeSnapshot
             {
@@ -48,7 +48,7 @@ namespace ignite
                  */
                 BinaryTypeSnapshot(std::string typeName, int32_t typeId, std::set<int32_t>* fieldIds, 
                     std::map<std::string, int32_t>* fields);
-                
+
                 /**
                  * Destructor.
                  */
@@ -65,7 +65,7 @@ namespace ignite
                 /**
                  * Get type name.
                  *
-                 * @param Type name.
+                 * @return Type name.
                  */
                 std::string GetTypeName();
 
@@ -79,14 +79,14 @@ namespace ignite
                 /**
                  * Whether snapshot contains any fields.
                  *
-                 * @param True if fields exist.
+                 * @return True if fields exist.
                  */
                 bool HasFields();
 
                 /** 
                  * Get field IDs.
                  *
-                 * @param Field IDs.
+                 * @return Field IDs.
                  */
                 std::set<int32_t>* GetFieldIds();
 
@@ -99,8 +99,8 @@ namespace ignite
 
             private:
                 /** Type name. */
-                std::string typeName;                   
-                
+                std::string typeName;
+
                 /** Type ID. */
                 int32_t typeId;
 
@@ -116,7 +116,7 @@ namespace ignite
             typedef BinaryTypeSnapshot Snap;
             typedef ignite::common::concurrent::SharedPointer<Snap> SPSnap;
         }
-    }    
+    }
 }
 
 #endif //_IGNITE_IMPL_BINARY_BINARY_TYPE_SNAPSHOT
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_utils.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_utils.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_utils.h
index 9599fce..b541483 100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_utils.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_utils.h
@@ -48,6 +48,15 @@ namespace ignite
             {
             public:
                 /**
+                 * Get data hash code.
+                 *
+                 * @param data Data pointer.
+                 * @param size Data size in bytes.
+                 * @return Hash code.
+                 */
+                static int32_t GetDataHashCode(const void* data, size_t size);
+
+                /**
                  * Utility method to read signed 8-bit integer from stream.
                  *
                  * @param stream Stream.
@@ -437,172 +446,6 @@ namespace ignite
                 static void WriteString(interop::InteropOutputStream* stream, const char* val, const int32_t len);
 
                 /**
-                 * Convert Date type to standard C type time_t.
-                 *
-                 * @param date Date type value.
-                 * @return Corresponding value of time_t.
-                 */
-                static inline time_t DateToCTime(const Date& date)
-                {
-                    return static_cast<time_t>(date.GetSeconds());
-                }
-
-                /**
-                 * Convert Timestamp type to standard C type time_t.
-                 *
-                 * @param ts Timestamp type value.
-                 * @return Corresponding value of time_t.
-                 */
-                static inline time_t TimestampToCTime(const Timestamp& ts)
-                {
-                    return static_cast<time_t>(ts.GetSeconds());
-                }
-
-                /**
-                 * Convert Date type to standard C type time_t.
-                 *
-                 * @param date Date type value.
-                 * @param ctime Corresponding value of struct tm.
-                 * @return True on success.
-                 */
-                static inline bool DateToCTm(const Date& date, tm& ctime)
-                {
-                    time_t tmt = DateToCTime(date);
-
-                    return common::IgniteGmTime(tmt, ctime);
-                }
-
-                /**
-                 * Convert Timestamp type to standard C type struct tm.
-                 *
-                 * @param ts Timestamp type value.
-                 * @param ctime Corresponding value of struct tm.
-                 * @return True on success.
-                 */
-                static inline bool TimestampToCTm(const Timestamp& ts, tm& ctime)
-                {
-                    time_t tmt = TimestampToCTime(ts);
-
-                    return common::IgniteGmTime(tmt, ctime);
-                }
-
-                /**
-                 * Convert standard C type time_t to Date struct tm.
-                 *
-                 * @param ctime Standard C type time_t.
-                 * @return Corresponding value of Date.
-                 */
-                static inline Date CTimeToDate(time_t ctime)
-                {
-                    return Date(ctime * 1000);
-                }
-
-                /**
-                 * Convert standard C type time_t to Timestamp type.
-                 *
-                 * @param ctime Standard C type time_t.
-                 * @param ns Nanoseconds second fraction.
-                 * @return Corresponding value of Timestamp.
-                 */
-                static inline Timestamp CTimeToTimestamp(time_t ctime, int32_t ns)
-                {
-                    return Timestamp(ctime, ns);
-                }
-
-                /**
-                 * Convert standard C type struct tm to Date type.
-                 *
-                 * @param ctime Standard C type struct tm.
-                 * @return Corresponding value of Date.
-                 */
-                static inline Date CTmToDate(const tm& ctime)
-                {
-                    time_t time = common::IgniteTimeGm(ctime);
-
-                    return CTimeToDate(time);
-                }
-
-                /**
-                 * Convert standard C type struct tm to Timestamp type.
-                 *
-                 * @param ctime Standard C type struct tm.
-                 * @param ns Nanoseconds second fraction.
-                 * @return Corresponding value of Timestamp.
-                 */
-                static inline Timestamp CTmToTimestamp(const tm& ctime, int32_t ns)
-                {
-                    time_t time = common::IgniteTimeGm(ctime);
-
-                    return CTimeToTimestamp(time, ns);
-                }
-
-                /**
-                 * Make Date in human understandable way.
-                 *
-                 * Created Date uses GMT timezone.
-                 *
-                 * @param year Year.
-                 * @param month Month.
-                 * @param day Day.
-                 * @param hour Hour.
-                 * @param min Min.
-                 * @param sec Sec.
-                 * @return Date.
-                 */
-                static Date MakeDateGmt(int year = 1900, int month = 1,
-                    int day = 1, int hour = 0, int min = 0, int sec = 0);
-
-                /**
-                 * Make Date in human understandable way.
-                 *
-                 * Created Date uses local timezone.
-                 *
-                 * @param year Year.
-                 * @param month Month.
-                 * @param day Day.
-                 * @param hour Hour.
-                 * @param min Min.
-                 * @param sec Sec.
-                 * @return Date.
-                 */
-                static Date MakeDateLocal(int year = 1900, int month = 1,
-                    int day = 1, int hour = 0, int min = 0, int sec = 0);
-
-                /**
-                 * Make Date in human understandable way.
-                 *
-                 * Created Timestamp uses GMT timezone.
-                 *
-                 * @param year Year.
-                 * @param month Month.
-                 * @param day Day.
-                 * @param hour Hour.
-                 * @param min Minute.
-                 * @param sec Second.
-                 * @param ns Nanosecond.
-                 * @return Timestamp.
-                 */
-                static Timestamp MakeTimestampGmt(int year = 1900, int month = 1,
-                    int day = 1, int hour = 0, int min = 0, int sec = 0, long ns = 0);
-
-                /**
-                 * Make Date in human understandable way.
-                 *
-                 * Created Timestamp uses Local timezone.
-                 *
-                 * @param year Year.
-                 * @param month Month.
-                 * @param day Day.
-                 * @param hour Hour.
-                 * @param min Minute.
-                 * @param sec Second.
-                 * @param ns Nanosecond.
-                 * @return Timestamp.
-                 */
-                static Timestamp MakeTimestampLocal(int year = 1900, int month = 1,
-                    int day = 1, int hour = 0, int min = 0, int sec = 0, long ns = 0);
-
-                /**
                  * Get default value for the type.
                  *
                  * @return Null value for non primitive types and zeroes for primitives.

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_writer_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_writer_impl.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_writer_impl.h
index 6ee088d..fc38837 100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_writer_impl.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_writer_impl.h
@@ -31,6 +31,7 @@
 #include "ignite/impl/binary/binary_type_manager.h"
 #include "ignite/impl/binary/binary_utils.h"
 #include "ignite/impl/binary/binary_schema.h"
+#include "ignite/impl/binary/binary_type_impl.h"
 #include "ignite/binary/binary_consts.h"
 #include "ignite/binary/binary_type.h"
 #include "ignite/guid.h"
@@ -669,15 +670,21 @@ namespace ignite
                         stream->WriteInt8(IGNITE_PROTO_VER);
                         stream->WriteInt16(IGNITE_BINARY_FLAG_USER_TYPE);
                         stream->WriteInt32(idRslvr.GetTypeId());
-                        stream->WriteInt32(type.GetHashCode(obj));
 
-                        // Reserve space for the Object Lenght, Schema ID and Schema or Raw Offsett.
+                        int32_t hashPos = stream->Reserve(4);
+
+                        // Reserve space for the Object Lenght, Schema ID and Schema or Raw Offset.
                         stream->Reserve(12);
 
                         type.Write(writer, obj);
 
                         writerImpl.PostWrite();
 
+                        stream->Synchronize();
+
+                        ignite::binary::BinaryObject binObj(*stream->GetMemory(), pos);
+                        stream->WriteInt32(hashPos, impl::binary::GetHashCode<T>(obj, binObj));
+
                         if (metaMgr)
                             metaMgr->SubmitHandler(type.GetTypeName(), idRslvr.GetTypeId(), metaHnd.Get());
                     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/include/ignite/impl/interop/interop_output_stream.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/impl/interop/interop_output_stream.h b/modules/platforms/cpp/binary/include/ignite/impl/interop/interop_output_stream.h
index c5bb884..9df3b1f 100644
--- a/modules/platforms/cpp/binary/include/ignite/impl/interop/interop_output_stream.h
+++ b/modules/platforms/cpp/binary/include/ignite/impl/interop/interop_output_stream.h
@@ -205,6 +205,14 @@ namespace ignite
                  * Synchronize data with underlying memory.
                  */
                 void Synchronize();
+
+                /**
+                 * Get underlying memory.
+                 *
+                 * @return Underlying memory.
+                 */
+                InteropMemory* GetMemory();
+
             private:
                 /** Memory. */
                 InteropMemory* mem; 
@@ -237,7 +245,7 @@ namespace ignite
                 /**
                  * Copy data to the stream shifting it along the way.
                  *
-                 * @param ptr Pointer to data.
+                 * @param src Pointer to data.
                  * @param off Offset.
                  * @param len Length.
                  */

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/project/vs/binary.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/project/vs/binary.vcxproj b/modules/platforms/cpp/binary/project/vs/binary.vcxproj
index 887eb96..6c1c433 100644
--- a/modules/platforms/cpp/binary/project/vs/binary.vcxproj
+++ b/modules/platforms/cpp/binary/project/vs/binary.vcxproj
@@ -181,6 +181,8 @@
     <ClInclude Include="..\..\include\ignite\binary\binary_consts.h" />
     <ClInclude Include="..\..\include\ignite\binary\binary_containers.h" />
     <ClInclude Include="..\..\include\ignite\binary\binary_object.h" />
+    <ClInclude Include="..\..\include\ignite\binary\binary_identity_resolver.h" />
+    <ClInclude Include="..\..\include\ignite\binary\binary_array_identity_resolver.h" />
     <ClInclude Include="..\..\include\ignite\binary\binary_raw_reader.h" />
     <ClInclude Include="..\..\include\ignite\binary\binary_raw_writer.h" />
     <ClInclude Include="..\..\include\ignite\binary\binary_reader.h" />
@@ -193,6 +195,7 @@
     <ClInclude Include="..\..\include\ignite\impl\binary\binary_reader_impl.h" />
     <ClInclude Include="..\..\include\ignite\impl\binary\binary_schema.h" />
     <ClInclude Include="..\..\include\ignite\impl\binary\binary_type_handler.h" />
+    <ClInclude Include="..\..\include\ignite\impl\binary\binary_type_impl.h" />
     <ClInclude Include="..\..\include\ignite\impl\binary\binary_type_manager.h" />
     <ClInclude Include="..\..\include\ignite\impl\binary\binary_type_snapshot.h" />
     <ClInclude Include="..\..\include\ignite\impl\binary\binary_type_updater.h" />
@@ -205,6 +208,7 @@
     <ClInclude Include="..\..\include\ignite\impl\interop\interop_stream_position_guard.h" />
   </ItemGroup>
   <ItemGroup>
+    <ClCompile Include="..\..\src\binary\binary_array_identity_resolver.cpp" />
     <ClCompile Include="..\..\src\binary\binary_containers.cpp" />
     <ClCompile Include="..\..\src\binary\binary_raw_reader.cpp" />
     <ClCompile Include="..\..\src\binary\binary_raw_writer.cpp" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/project/vs/binary.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/project/vs/binary.vcxproj.filters b/modules/platforms/cpp/binary/project/vs/binary.vcxproj.filters
index a1a83ef..c649c4d 100644
--- a/modules/platforms/cpp/binary/project/vs/binary.vcxproj.filters
+++ b/modules/platforms/cpp/binary/project/vs/binary.vcxproj.filters
@@ -97,6 +97,15 @@
     <ClInclude Include="..\..\include\ignite\impl\binary\binary_object_impl.h">
       <Filter>Code\impl\binary</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\include\ignite\binary\binary_array_identity_resolver.h">
+      <Filter>Code\binary</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\ignite\binary\binary_identity_resolver.h">
+      <Filter>Code\binary</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\ignite\impl\binary\binary_type_impl.h">
+      <Filter>Code\impl\binary</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\src\binary\binary_containers.cpp">
@@ -156,5 +165,8 @@
     <ClCompile Include="..\..\src\impl\binary\binary_object_impl.cpp">
       <Filter>Code\impl\binary</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\binary\binary_array_identity_resolver.cpp">
+      <Filter>Code\binary</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/src/binary/binary_array_identity_resolver.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/binary/binary_array_identity_resolver.cpp b/modules/platforms/cpp/binary/src/binary/binary_array_identity_resolver.cpp
new file mode 100644
index 0000000..1d4e384
--- /dev/null
+++ b/modules/platforms/cpp/binary/src/binary/binary_array_identity_resolver.cpp
@@ -0,0 +1,42 @@
+/*
+ * 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 <ignite/binary/binary_object.h>
+#include <ignite/impl/binary/binary_utils.h>
+
+#include <ignite/binary/binary_array_identity_resolver.h>
+
+namespace ignite
+{
+    namespace binary
+    {
+        BinaryArrayIdentityResolver::BinaryArrayIdentityResolver()
+        {
+            // No-op.
+        }
+
+        BinaryArrayIdentityResolver::~BinaryArrayIdentityResolver()
+        {
+            // No-op.
+        }
+
+        int32_t BinaryArrayIdentityResolver::GetHashCode(const BinaryObject& obj)
+        {
+            return impl::binary::BinaryUtils::GetDataHashCode(obj.GetData(), obj.GetLength());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/src/binary/binary_type.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/binary/binary_type.cpp b/modules/platforms/cpp/binary/src/binary/binary_type.cpp
index 19d906d..0ea5a92 100644
--- a/modules/platforms/cpp/binary/src/binary/binary_type.cpp
+++ b/modules/platforms/cpp/binary/src/binary/binary_type.cpp
@@ -44,8 +44,8 @@ namespace ignite
 
                 return hash;
             }
-            else
-                return 0;
+
+            return 0;
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/src/impl/binary/binary_object_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/impl/binary/binary_object_impl.cpp b/modules/platforms/cpp/binary/src/impl/binary/binary_object_impl.cpp
index 652d54d..8167f8b 100644
--- a/modules/platforms/cpp/binary/src/impl/binary/binary_object_impl.cpp
+++ b/modules/platforms/cpp/binary/src/impl/binary/binary_object_impl.cpp
@@ -35,9 +35,6 @@ namespace ignite
 
             const int8_t* BinaryObjectImpl::GetData() const
             {
-                // Creating header here to validate object header layout.
-                BinaryObjectHeader header = BinaryObjectHeader::FromMemory(mem, start);
-
                 return mem.Data() + start + BinaryObjectHeader::SIZE;
             }
 
@@ -47,6 +44,13 @@ namespace ignite
 
                 return header.GetDataLength();
             }
+
+            int32_t BinaryObjectImpl::GetHashCode() const
+            {
+                BinaryObjectHeader header = BinaryObjectHeader::FromMemory(mem, start);
+
+                return header.GetHashCode();
+            }
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/src/impl/binary/binary_type_manager.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/impl/binary/binary_type_manager.cpp b/modules/platforms/cpp/binary/src/impl/binary/binary_type_manager.cpp
index 8b5dfc1..a6692d1 100644
--- a/modules/platforms/cpp/binary/src/impl/binary/binary_type_manager.cpp
+++ b/modules/platforms/cpp/binary/src/impl/binary/binary_type_manager.cpp
@@ -46,9 +46,7 @@ namespace ignite
 
             SharedPointer<BinaryTypeHandler> BinaryTypeManager::GetHandler(int32_t typeId)
             {
-                SharedPointer<std::map<int32_t, SPSnap> > snapshots0 = snapshots;
-
-                SPSnap snapshot = (*snapshots0.Get())[typeId];
+                SPSnap snapshot = (*snapshots.Get())[typeId];
 
                 return SharedPointer<BinaryTypeHandler>(new BinaryTypeHandler(snapshot));
             }
@@ -108,12 +106,12 @@ namespace ignite
             bool BinaryTypeManager::ProcessPendingUpdates(BinaryTypeUpdater* updater, IgniteError* err)
             {
                 bool success = true; // Optimistically assume that all will be fine.
-                
-                cs->Enter();
+
+                CsLockGuard guard(*cs);
 
                 for (std::vector<SPSnap>::iterator it = pending->begin(); it != pending->end(); ++it)
                 {
-                    Snap* pendingSnap = (*it).Get();
+                    Snap* pendingSnap = it->Get();
 
                     if (updater->Update(pendingSnap, err))
                     {
@@ -174,8 +172,6 @@ namespace ignite
                     ver = pendingVer;
                 }
 
-                cs->Leave();
-
                 return success;
             }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/src/impl/binary/binary_utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/impl/binary/binary_utils.cpp b/modules/platforms/cpp/binary/src/impl/binary/binary_utils.cpp
index bffd038..5fe8d83 100644
--- a/modules/platforms/cpp/binary/src/impl/binary/binary_utils.cpp
+++ b/modules/platforms/cpp/binary/src/impl/binary/binary_utils.cpp
@@ -82,6 +82,22 @@ namespace ignite
     {
         namespace binary
         {
+            int32_t BinaryUtils::GetDataHashCode(const void * data, size_t size)
+            {
+                if (data)
+                {
+                    int32_t hash = 1;
+                    const int8_t* bytes = static_cast<const int8_t*>(data);
+
+                    for (int i = 0; i < size; ++i)
+                        hash = 31 * hash + bytes[i];
+
+                    return hash;
+                }
+
+                return 0;
+            }
+
             int8_t BinaryUtils::ReadInt8(InteropInputStream* stream)
             {
                 return stream->ReadInt8();
@@ -317,70 +333,6 @@ namespace ignite
                 stream->WriteInt32(len);
                 stream->WriteInt8Array(reinterpret_cast<const int8_t*>(val), len);
             }
-
-            Date BinaryUtils::MakeDateGmt(int year, int month, int day, int hour,
-                int min, int sec)
-            {
-                tm date = { 0 };
-
-                date.tm_year = year - 1900;
-                date.tm_mon = month - 1;
-                date.tm_mday = day;
-                date.tm_hour = hour;
-                date.tm_min = min;
-                date.tm_sec = sec;
-
-                return CTmToDate(date);
-            }
-
-            Date BinaryUtils::MakeDateLocal(int year, int month, int day, int hour,
-                int min, int sec)
-            {
-                tm date = { 0 };
-
-                date.tm_year = year - 1900;
-                date.tm_mon = month - 1;
-                date.tm_mday = day;
-                date.tm_hour = hour;
-                date.tm_min = min;
-                date.tm_sec = sec;
-
-                time_t localTime = common::IgniteTimeLocal(date);
-
-                return CTimeToDate(localTime);
-            }
-
-            Timestamp BinaryUtils::MakeTimestampGmt(int year, int month, int day,
-                int hour, int min, int sec, long ns)
-            {
-                tm date = { 0 };
-
-                date.tm_year = year - 1900;
-                date.tm_mon = month - 1;
-                date.tm_mday = day;
-                date.tm_hour = hour;
-                date.tm_min = min;
-                date.tm_sec = sec;
-
-                return CTmToTimestamp(date, ns);
-            }
-
-            Timestamp BinaryUtils::MakeTimestampLocal(int year, int month, int day,
-                int hour, int min, int sec, long ns)
-            {
-                tm date = { 0 };
-
-                date.tm_year = year - 1900;
-                date.tm_mon = month - 1;
-                date.tm_mday = day;
-                date.tm_hour = hour;
-                date.tm_min = min;
-                date.tm_sec = sec;
-
-                time_t localTime = common::IgniteTimeLocal(date);
-
-                return CTimeToTimestamp(localTime, ns);
-            }
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/src/impl/binary/binary_writer_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/impl/binary/binary_writer_impl.cpp b/modules/platforms/cpp/binary/src/impl/binary/binary_writer_impl.cpp
index 20fb74d..b8f95b3 100644
--- a/modules/platforms/cpp/binary/src/impl/binary/binary_writer_impl.cpp
+++ b/modules/platforms/cpp/binary/src/impl/binary/binary_writer_impl.cpp
@@ -709,8 +709,6 @@ namespace ignite
             {
                 int32_t lenWithoutSchema = stream->Position() - start;
 
-                int32_t nonRawLen = rawPos == -1 ? lenWithoutSchema : rawPos - start;
-
                 uint16_t flags = IGNITE_BINARY_FLAG_USER_TYPE;
 
                 if (rawPos > 0)

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/binary/src/impl/interop/interop_output_stream.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/impl/interop/interop_output_stream.cpp b/modules/platforms/cpp/binary/src/impl/interop/interop_output_stream.cpp
index 374f634..ab58f1e 100644
--- a/modules/platforms/cpp/binary/src/impl/interop/interop_output_stream.cpp
+++ b/modules/platforms/cpp/binary/src/impl/interop/interop_output_stream.cpp
@@ -204,6 +204,11 @@ namespace ignite
                 mem->Length(pos);
             }
 
+            InteropMemory* InteropOutputStream::GetMemory()
+            {
+                return mem;
+            }
+
             void InteropOutputStream::EnsureCapacity(int32_t reqCap) {
                 if (reqCap > cap) {
                     int newCap = cap << 1;

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/common/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/Makefile.am b/modules/platforms/cpp/common/Makefile.am
index 9c27a57..8c79c3e 100644
--- a/modules/platforms/cpp/common/Makefile.am
+++ b/modules/platforms/cpp/common/Makefile.am
@@ -43,16 +43,17 @@ libignite_common_la_LDFLAGS = \
 
 libignite_common_la_SOURCES = \
     os/linux/src/common/concurrent_os.cpp \
-    os/linux/src/common/utils.cpp \
+    os/linux/src/common/platform_utils.cpp \
     src/common/big_integer.cpp \
     src/common/concurrent.cpp \
     src/common/decimal.cpp \
     src/common/bits.cpp \
+    src/common/utils.cpp \
     src/date.cpp \
     src/ignite_error.cpp \
     src/guid.cpp \
     src/timestamp.cpp
-	
+
 clean-local:
 	$(RM) *.gcno *.gcda
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/common/include/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/Makefile.am b/modules/platforms/cpp/common/include/Makefile.am
index a5073f6..7f7ab83 100644
--- a/modules/platforms/cpp/common/include/Makefile.am
+++ b/modules/platforms/cpp/common/include/Makefile.am
@@ -27,6 +27,7 @@ nobase_include_HEADERS = \
 	ignite/common/dynamic_size_array.h \
 	ignite/common/fixed_size_array.h \
 	ignite/common/utils.h \
+	ignite/common/platform_utils.h \
 	ignite/date.h \
 	ignite/guid.h \
 	ignite/ignite_error.h \

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/common/include/ignite/common/platform_utils.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/ignite/common/platform_utils.h b/modules/platforms/cpp/common/include/ignite/common/platform_utils.h
new file mode 100644
index 0000000..273a5e0
--- /dev/null
+++ b/modules/platforms/cpp/common/include/ignite/common/platform_utils.h
@@ -0,0 +1,79 @@
+/*
+ * 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 _IGNITE_COMMON_PLATFORM_UTILS
+#define _IGNITE_COMMON_PLATFORM_UTILS
+
+#include <ignite/common/common.h>
+
+namespace ignite
+{
+    namespace common
+    {
+        /**
+         * Convert struct tm to time_t (UTC).
+         *
+         * @param time Standard C type struct tm value.
+         * @return Standard C type time_t value.
+         */
+        IGNITE_IMPORT_EXPORT time_t IgniteTimeGm(const tm& time);
+
+        /**
+         * Convert struct tm to time_t (Local time).
+         *
+         * @param time Standard C type struct tm value.
+         * @return Standard C type time_t value.
+         */
+        IGNITE_IMPORT_EXPORT time_t IgniteTimeLocal(const tm& time);
+
+        /**
+         * Convert time_t to struct tm (UTC).
+         *
+         * @param in Standard C type time_t value.
+         * @param out Standard C type struct tm value.
+         * @return True on success.
+         */
+        IGNITE_IMPORT_EXPORT bool IgniteGmTime(time_t in, tm& out);
+
+        /**
+         * Convert time_t to struct tm (Local time).
+         *
+         * @param in Standard C type time_t value.
+         * @param out Standard C type struct tm value.
+         * @return True on success.
+         */
+        IGNITE_IMPORT_EXPORT bool IgniteLocalTime(time_t in, tm& out);
+
+        /**
+         * Read system environment variable taking thread-safety in count.
+         *
+         * @param name Environment variable name.
+         * @param found Whether environment variable with such name was found.
+         * @return Environment variable value.
+         */
+        IGNITE_IMPORT_EXPORT std::string GetEnv(const std::string& name, bool& found);
+
+        /**
+         * Ensure that file on the given path exists in the system.
+         *
+         * @param path Path.
+         * @return True if file exists, false otherwise.
+         */
+        IGNITE_IMPORT_EXPORT bool FileExists(const std::string& path);
+    }
+}
+
+#endif //_IGNITE_COMMON_PLATFORM_UTILS
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/common/include/ignite/common/utils.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/include/ignite/common/utils.h b/modules/platforms/cpp/common/include/ignite/common/utils.h
index 6ac3c17..bf1f39b 100644
--- a/modules/platforms/cpp/common/include/ignite/common/utils.h
+++ b/modules/platforms/cpp/common/include/ignite/common/utils.h
@@ -25,6 +25,10 @@
 #include <algorithm>
 
 #include <ignite/common/common.h>
+#include <ignite/common/platform_utils.h>
+
+#include <ignite/date.h>
+#include <ignite/timestamp.h>
 
 #ifdef IGNITE_FRIEND
 #   define IGNITE_FRIEND_EXPORT IGNITE_EXPORT
@@ -91,40 +95,6 @@ namespace ignite
         }
 
         /**
-         * Convert struct tm to time_t (UTC).
-         *
-         * @param time Standard C type struct tm value.
-         * @return Standard C type time_t value.
-         */
-        IGNITE_IMPORT_EXPORT time_t IgniteTimeGm(const tm& time);
-
-        /**
-         * Convert struct tm to time_t (Local time).
-         *
-         * @param time Standard C type struct tm value.
-         * @return Standard C type time_t value.
-         */
-        IGNITE_IMPORT_EXPORT time_t IgniteTimeLocal(const tm& time);
-
-        /**
-         * Convert time_t to struct tm (UTC).
-         *
-         * @param in Standard C type time_t value.
-         * @param out Standard C type struct tm value.
-         * @return True on success.
-         */
-        IGNITE_IMPORT_EXPORT bool IgniteGmTime(time_t in, tm& out);
-
-        /**
-         * Convert time_t to struct tm (Local time).
-         *
-         * @param in Standard C type time_t value.
-         * @param out Standard C type struct tm value.
-         * @return True on success.
-         */
-        IGNITE_IMPORT_EXPORT bool IgniteLocalTime(time_t in, tm& out);
-
-        /**
          * Copy characters.
          *
          * @param val Value.
@@ -140,23 +110,6 @@ namespace ignite
         IGNITE_IMPORT_EXPORT void ReleaseChars(char* val);
 
         /**
-         * Read system environment variable taking thread-safety in count.
-         *
-         * @param name Environment variable name.
-         * @param found Whether environment variable with such name was found.
-         * @return Environment variable value.
-         */
-        IGNITE_IMPORT_EXPORT std::string GetEnv(const std::string& name, bool& found);
-
-        /**
-         * Ensure that file on the given path exists in the system.
-         *
-         * @param path Path.
-         * @return True if file exists, false otherwise.
-         */
-        IGNITE_IMPORT_EXPORT bool FileExists(const std::string& path);
-
-        /**
          * Casts value of one type to another type, using stringstream.
          *
          * @param val Input value.
@@ -206,12 +159,198 @@ namespace ignite
         }
 
         /**
-        * Converts 32-bit integer to big endian format
-        *
-        * @param value Input value
-        * @return Resulting value
-        */
+         * Converts 32-bit integer to big endian format
+         *
+         * @param value Input value
+         * @return Resulting value
+         */
         IGNITE_IMPORT_EXPORT uint32_t ToBigEndian(uint32_t value);
+
+        /**
+         * Convert Date type to standard C type time_t.
+         *
+         * @param date Date type value.
+         * @return Corresponding value of time_t.
+         */
+        inline time_t DateToCTime(const Date& date)
+        {
+            return static_cast<time_t>(date.GetSeconds());
+        }
+
+        /**
+         * Convert Timestamp type to standard C type time_t.
+         *
+         * @param ts Timestamp type value.
+         * @return Corresponding value of time_t.
+         */
+        inline time_t TimestampToCTime(const Timestamp& ts)
+        {
+            return static_cast<time_t>(ts.GetSeconds());
+        }
+
+        /**
+         * Convert Date type to standard C type time_t.
+         *
+         * @param date Date type value.
+         * @param ctime Corresponding value of struct tm.
+         * @return True on success.
+         */
+        inline bool DateToCTm(const Date& date, tm& ctime)
+        {
+            time_t tmt = DateToCTime(date);
+
+            return common::IgniteGmTime(tmt, ctime);
+        }
+
+        /**
+         * Convert Timestamp type to standard C type struct tm.
+         *
+         * @param ts Timestamp type value.
+         * @param ctime Corresponding value of struct tm.
+         * @return True on success.
+         */
+        inline bool TimestampToCTm(const Timestamp& ts, tm& ctime)
+        {
+            time_t tmt = TimestampToCTime(ts);
+
+            return common::IgniteGmTime(tmt, ctime);
+        }
+
+        /**
+         * Convert standard C type time_t to Date struct tm.
+         *
+         * @param ctime Standard C type time_t.
+         * @return Corresponding value of Date.
+         */
+        inline Date CTimeToDate(time_t ctime)
+        {
+            return Date(ctime * 1000);
+        }
+
+        /**
+         * Convert standard C type time_t to Timestamp type.
+         *
+         * @param ctime Standard C type time_t.
+         * @param ns Nanoseconds second fraction.
+         * @return Corresponding value of Timestamp.
+         */
+        inline Timestamp CTimeToTimestamp(time_t ctime, int32_t ns)
+        {
+            return Timestamp(ctime, ns);
+        }
+
+        /**
+         * Convert standard C type struct tm to Date type.
+         *
+         * @param ctime Standard C type struct tm.
+         * @return Corresponding value of Date.
+         */
+        inline Date CTmToDate(const tm& ctime)
+        {
+            time_t time = common::IgniteTimeGm(ctime);
+
+            return CTimeToDate(time);
+        }
+
+        /**
+         * Convert standard C type struct tm to Timestamp type.
+         *
+         * @param ctime Standard C type struct tm.
+         * @param ns Nanoseconds second fraction.
+         * @return Corresponding value of Timestamp.
+         */
+        inline Timestamp CTmToTimestamp(const tm& ctime, int32_t ns)
+        {
+            time_t time = common::IgniteTimeGm(ctime);
+
+            return CTimeToTimestamp(time, ns);
+        }
+
+        /**
+         * Make Date in human understandable way.
+         *
+         * Created Date uses GMT timezone.
+         *
+         * @param year Year.
+         * @param month Month.
+         * @param day Day.
+         * @param hour Hour.
+         * @param min Min.
+         * @param sec Sec.
+         * @return Date.
+         */
+        Date MakeDateGmt(int year = 1900, int month = 1,
+            int day = 1, int hour = 0, int min = 0, int sec = 0);
+
+        /**
+         * Make Date in human understandable way.
+         *
+         * Created Date uses local timezone.
+         *
+         * @param year Year.
+         * @param month Month.
+         * @param day Day.
+         * @param hour Hour.
+         * @param min Min.
+         * @param sec Sec.
+         * @return Date.
+         */
+        Date MakeDateLocal(int year = 1900, int month = 1,
+            int day = 1, int hour = 0, int min = 0, int sec = 0);
+
+        /**
+         * Make Date in human understandable way.
+         *
+         * Created Timestamp uses GMT timezone.
+         *
+         * @param year Year.
+         * @param month Month.
+         * @param day Day.
+         * @param hour Hour.
+         * @param min Minute.
+         * @param sec Second.
+         * @param ns Nanosecond.
+         * @return Timestamp.
+         */
+        Timestamp MakeTimestampGmt(int year = 1900, int month = 1,
+            int day = 1, int hour = 0, int min = 0, int sec = 0, long ns = 0);
+
+        /**
+         * Make Date in human understandable way.
+         *
+         * Created Timestamp uses Local timezone.
+         *
+         * @param year Year.
+         * @param month Month.
+         * @param day Day.
+         * @param hour Hour.
+         * @param min Minute.
+         * @param sec Second.
+         * @param ns Nanosecond.
+         * @return Timestamp.
+         */
+        Timestamp MakeTimestampLocal(int year = 1900, int month = 1,
+            int day = 1, int hour = 0, int min = 0, int sec = 0, long ns = 0);
+
+        /**
+         * Meta-programming class.
+         * Defines T1 as ::type if the condition is true, otherwise
+         * defines T2 as ::type.
+         */
+        template<bool, typename T1, typename T2>
+        struct Conditional
+        {
+            typedef T1 type;
+        };
+
+        /**
+         * Specialization for the false case.
+         */
+        template<typename T1, typename T2>
+        struct Conditional<false, T1, T2>
+        {
+            typedef T2 type;
+        };
     }
 }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/common/os/linux/src/common/platform_utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/os/linux/src/common/platform_utils.cpp b/modules/platforms/cpp/common/os/linux/src/common/platform_utils.cpp
new file mode 100644
index 0000000..a3e1d17
--- /dev/null
+++ b/modules/platforms/cpp/common/os/linux/src/common/platform_utils.cpp
@@ -0,0 +1,81 @@
+/*
+ * 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 <time.h>
+
+#include <sys/stat.h>
+#include <dirent.h>
+#include <dlfcn.h>
+
+#include <ignite/common/utils.h>
+
+namespace ignite
+{
+    namespace common
+    {
+        time_t IgniteTimeGm(const tm& time)
+        {
+            tm tmc = time;
+
+            return timegm(&tmc);
+        }
+
+        time_t IgniteTimeLocal(const tm& time)
+        {
+            tm tmc = time;
+
+            return mktime(&tmc);
+        }
+
+        bool IgniteGmTime(time_t in, tm& out)
+        {
+            return gmtime_r(&in, &out) != NULL;
+        }
+
+        bool IgniteLocalTime(time_t in, tm& out)
+        {
+            return localtime_r(&in, &out) == 0;
+        }
+
+        std::string GetEnv(const std::string& name, bool& found)
+        {
+            char* val = std::getenv(name.c_str());
+
+            if (val)
+            {
+                found = true;
+
+                return std::string(val);
+            }
+            else
+            {
+                found = false;
+
+                return std::string();
+            }
+        }
+
+        bool FileExists(const std::string& path)
+        {
+            struct stat s;
+
+            int res = stat(path.c_str(), &s);
+
+            return res != -1;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/common/os/linux/src/common/utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/os/linux/src/common/utils.cpp b/modules/platforms/cpp/common/os/linux/src/common/utils.cpp
deleted file mode 100644
index 0fa9231..0000000
--- a/modules/platforms/cpp/common/os/linux/src/common/utils.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * 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 <time.h>
-
-#include <sys/stat.h>
-#include <dirent.h>
-#include <dlfcn.h>
-
-#include <ignite/common/utils.h>
-
-namespace ignite
-{
-    namespace common
-    {
-        /**
-         * Check if string ends with the given ending.
-         *
-         * @param str String to check.
-         * @param ending Ending.
-         * @return Result.
-         */
-        inline bool StringEndsWith(const std::string& str, const std::string& ending)
-        {
-            if (str.length() > ending.length())
-                return str.compare(str.length() - ending.length(), ending.length(), ending) == 0;
-
-            return false;
-        }
-
-        time_t IgniteTimeGm(const tm& time)
-        {
-            tm tmc = time;
-
-            return timegm(&tmc);
-        }
-
-        time_t IgniteTimeLocal(const tm& time)
-        {
-            tm tmc = time;
-
-            return mktime(&tmc);
-        }
-
-        bool IgniteGmTime(time_t in, tm& out)
-        {
-            return gmtime_r(&in, &out) != NULL;
-        }
-
-        bool IgniteLocalTime(time_t in, tm& out)
-        {
-            return localtime_r(&in, &out) == 0;
-        }
-
-        int LeadingZeroesForOctet(int8_t octet) {
-            if (octet == 0)
-                return 8;
-
-            int zeroes = 1;
-
-            if (octet >> 4 == 0) {
-                zeroes += 4;
-                octet <<= 4;
-            }
-
-            if (octet >> 6 == 0) {
-                zeroes += 2;
-                octet <<= 2;
-            }
-
-            zeroes -= octet >> 7;
-
-            return zeroes;
-        }
-
-        char* CopyChars(const char* val)
-        {
-            if (val) {
-                size_t len = strlen(val);
-                char* dest = new char[len + 1];
-                strcpy(dest, val);
-                *(dest + len) = 0;
-                return dest;
-            }
-            else
-                return NULL;
-        }
-
-        void ReleaseChars(char* val)
-        {
-            if (val)
-                delete[] val;
-        }
-
-        std::string GetEnv(const std::string& name, bool& found)
-        {
-            char* val = std::getenv(name.c_str());
-
-            if (val)
-            {
-                found = true;
-
-                return std::string(val);
-            }
-            else
-            {
-                found = false;
-
-                return std::string();
-            }
-        }
-
-        bool FileExists(const std::string& path)
-        {
-            struct stat s;
-
-            int res = stat(path.c_str(), &s);
-
-            return res != -1;
-        }
-
-        uint32_t ToBigEndian(uint32_t value)
-        {
-            // The answer is 42
-            static const int num = 42;
-            static const bool isLittleEndian = (*reinterpret_cast<const char*>(&num) == num);
-
-            if (isLittleEndian)
-                return ((value & 0xFF) << 24) | (((value >> 8) & 0xFF) << 16) | (((value >> 16) & 0xFF) << 8) | ((value >> 24) & 0xFF);
-
-            return value;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/common/os/win/src/common/platform_utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/os/win/src/common/platform_utils.cpp b/modules/platforms/cpp/common/os/win/src/common/platform_utils.cpp
new file mode 100644
index 0000000..16fd6ec
--- /dev/null
+++ b/modules/platforms/cpp/common/os/win/src/common/platform_utils.cpp
@@ -0,0 +1,88 @@
+/*
+ * 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 <time.h>
+
+#include <windows.h>
+
+#include <ignite/common/platform_utils.h>
+
+namespace ignite
+{
+    namespace common
+    {
+        time_t IgniteTimeGm(const tm& time)
+        {
+            tm tmc = time;
+
+            return _mkgmtime(&tmc);
+        }
+
+        time_t IgniteTimeLocal(const tm& time)
+        {
+            tm tmc = time;
+
+            return mktime(&tmc);
+        }
+
+        bool IgniteGmTime(time_t in, tm& out)
+        {
+            return gmtime_s(&out, &in) == 0;
+        }
+
+        bool IgniteLocalTime(time_t in, tm& out)
+        {
+            return localtime_s(&out, &in) == 0;
+        }
+
+        std::string GetEnv(const std::string& name, bool& found)
+        {
+            char res0[32767];
+
+            DWORD envRes = GetEnvironmentVariableA(name.c_str(), res0, 32767);
+
+            if (envRes != 0)
+            {
+                found = true;
+
+                return std::string(res0);
+            }
+            else
+            {
+                found = false;
+
+                return std::string();
+            }
+        }
+
+        bool FileExists(const std::string& path)
+        {
+            WIN32_FIND_DATAA findres;
+
+            HANDLE hnd = FindFirstFileA(path.c_str(), &findres);
+
+            if (hnd == INVALID_HANDLE_VALUE)
+                return false;
+            else
+            {
+                FindClose(hnd);
+
+                return true;
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/common/os/win/src/common/utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/os/win/src/common/utils.cpp b/modules/platforms/cpp/common/os/win/src/common/utils.cpp
deleted file mode 100644
index c6afce2..0000000
--- a/modules/platforms/cpp/common/os/win/src/common/utils.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * 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 <time.h>
-
-#include <windows.h>
-
-#include <ignite/common/utils.h>
-
-namespace ignite
-{
-    namespace common
-    {
-        /**
-         * Check if string ends with the given ending.
-         *
-         * @param str String to check.
-         * @param ending Ending.
-         * @return Result.
-         */
-        inline bool StringEndsWith(const std::string& str, const std::string& ending)
-        {
-            if (str.length() > ending.length())
-                return str.compare(str.length() - ending.length(), ending.length(), ending) == 0;
-
-            return false;
-        }
-
-        void StripSurroundingWhitespaces(std::string& str)
-        {
-            std::string::size_type newBegin = 0;
-            while (newBegin < str.size() && ::isspace(str[newBegin]))
-                ++newBegin;
-
-            if (newBegin == str.size())
-            {
-                str.clear();
-
-                return;
-            }
-
-            std::string::size_type newEnd = str.size() - 1;
-            while (::isspace(str[newEnd]))
-                --newEnd;
-
-            str.assign(str, newBegin, (newEnd - newBegin) + 1);
-        }
-
-        time_t IgniteTimeGm(const tm& time)
-        {
-            tm tmc = time;
-
-            return _mkgmtime(&tmc);
-        }
-
-        time_t IgniteTimeLocal(const tm& time)
-        {
-            tm tmc = time;
-
-            return mktime(&tmc);
-        }
-
-        bool IgniteGmTime(time_t in, tm& out)
-        {
-            return gmtime_s(&out, &in) == 0;
-        }
-
-        bool IgniteLocalTime(time_t in, tm& out)
-        {
-            return localtime_s(&out, &in) == 0;
-        }
-
-        char* CopyChars(const char* val)
-        {
-            if (val) {
-                size_t len = strlen(val);
-                char* dest = new char[len + 1];
-                strcpy(dest, val);
-                *(dest + len) = 0;
-                return dest;
-            }
-            else
-                return NULL;
-        }
-
-        void ReleaseChars(char* val)
-        {
-            if (val)
-                delete[] val;
-        }
-
-        std::string GetEnv(const std::string& name, bool& found)
-        {
-            char res0[32767];
-
-            DWORD envRes = GetEnvironmentVariableA(name.c_str(), res0, 32767);
-
-            if (envRes != 0)
-            {
-                found = true;
-
-                return std::string(res0);
-            }
-            else
-            {
-                found = false;
-
-                return std::string();
-            }
-        }
-
-        bool FileExists(const std::string& path)
-        {
-            WIN32_FIND_DATAA findres;
-
-            HANDLE hnd = FindFirstFileA(path.c_str(), &findres);
-
-            if (hnd == INVALID_HANDLE_VALUE)
-                return false;
-            else
-            {
-                FindClose(hnd);
-
-                return true;
-            }
-        }
-
-        uint32_t ToBigEndian(uint32_t value)
-        {
-            // The answer is 42
-            static const int num = 42;
-            static const bool isLittleEndian = (*reinterpret_cast<const char*>(&num) == num);
-
-            if (isLittleEndian)
-                return ((value & 0xFF) << 24) | (((value >> 8) & 0xFF) << 16) | (((value >> 16) & 0xFF) << 8) | ((value >> 24) & 0xFF);
-
-            return value;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/common/project/vs/common.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/project/vs/common.vcxproj b/modules/platforms/cpp/common/project/vs/common.vcxproj
index b4431f8..7a57ac0 100644
--- a/modules/platforms/cpp/common/project/vs/common.vcxproj
+++ b/modules/platforms/cpp/common/project/vs/common.vcxproj
@@ -172,6 +172,7 @@
     <ClInclude Include="..\..\include\ignite\common\dynamic_size_array.h" />
     <ClInclude Include="..\..\include\ignite\common\fixed_size_array.h" />
     <ClInclude Include="..\..\include\ignite\common\bits.h" />
+    <ClInclude Include="..\..\include\ignite\common\platform_utils.h" />
     <ClInclude Include="..\..\include\ignite\common\reference_impl.h" />
     <ClInclude Include="..\..\include\ignite\common\utils.h" />
     <ClInclude Include="..\..\include\ignite\date.h" />
@@ -185,11 +186,12 @@
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\os\win\src\common\concurrent_os.cpp" />
-    <ClCompile Include="..\..\os\win\src\common\utils.cpp" />
+    <ClCompile Include="..\..\os\win\src\common\platform_utils.cpp" />
     <ClCompile Include="..\..\src\common\big_integer.cpp" />
     <ClCompile Include="..\..\src\common\bits.cpp" />
     <ClCompile Include="..\..\src\common\concurrent.cpp" />
     <ClCompile Include="..\..\src\common\decimal.cpp" />
+    <ClCompile Include="..\..\src\common\utils.cpp" />
     <ClCompile Include="..\..\src\date.cpp" />
     <ClCompile Include="..\..\src\guid.cpp" />
     <ClCompile Include="..\..\src\ignite_error.cpp" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/common/project/vs/common.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/project/vs/common.vcxproj.filters b/modules/platforms/cpp/common/project/vs/common.vcxproj.filters
index d99722b..f08471e 100644
--- a/modules/platforms/cpp/common/project/vs/common.vcxproj.filters
+++ b/modules/platforms/cpp/common/project/vs/common.vcxproj.filters
@@ -64,6 +64,9 @@
     <ClInclude Include="..\..\include\ignite\reference.h">
       <Filter>Code</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\include\ignite\common\platform_utils.h">
+      <Filter>Code\common</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\src\date.cpp">
@@ -78,9 +81,6 @@
     <ClCompile Include="..\..\os\win\src\common\concurrent_os.cpp">
       <Filter>Code\common</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\os\win\src\common\utils.cpp">
-      <Filter>Code\common</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\src\common\concurrent.cpp">
       <Filter>Code\common</Filter>
     </ClCompile>
@@ -96,5 +96,11 @@
     <ClCompile Include="..\..\src\common\bits.cpp">
       <Filter>Code\common</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\os\win\src\common\platform_utils.cpp">
+      <Filter>Code\common</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\common\utils.cpp">
+      <Filter>Code\common</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/common/src/common/utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/src/common/utils.cpp b/modules/platforms/cpp/common/src/common/utils.cpp
new file mode 100644
index 0000000..27d2473
--- /dev/null
+++ b/modules/platforms/cpp/common/src/common/utils.cpp
@@ -0,0 +1,153 @@
+/*
+ * 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 <ignite/common/utils.h>
+
+namespace ignite
+{
+    namespace common
+    {
+        /**
+         * Check if string ends with the given ending.
+         *
+         * @param str String to check.
+         * @param ending Ending.
+         * @return Result.
+         */
+        inline bool StringEndsWith(const std::string& str, const std::string& ending)
+        {
+            if (str.length() > ending.length())
+                return str.compare(str.length() - ending.length(), ending.length(), ending) == 0;
+
+            return false;
+        }
+
+        void StripSurroundingWhitespaces(std::string& str)
+        {
+            std::string::size_type newBegin = 0;
+            while (newBegin < str.size() && ::isspace(str[newBegin]))
+                ++newBegin;
+
+            if (newBegin == str.size())
+            {
+                str.clear();
+
+                return;
+            }
+
+            std::string::size_type newEnd = str.size() - 1;
+            while (::isspace(str[newEnd]))
+                --newEnd;
+
+            str.assign(str, newBegin, (newEnd - newBegin) + 1);
+        }
+
+        char* CopyChars(const char* val)
+        {
+            if (val) {
+                size_t len = strlen(val);
+                char* dest = new char[len + 1];
+                strcpy(dest, val);
+                *(dest + len) = 0;
+                return dest;
+            }
+
+            return NULL;
+        }
+
+        void ReleaseChars(char* val)
+        {
+            delete[] val;
+        }
+
+        uint32_t ToBigEndian(uint32_t value)
+        {
+            // The answer is 42
+            static const int num = 42;
+            static const bool isLittleEndian = (*reinterpret_cast<const char*>(&num) == num);
+
+            if (isLittleEndian)
+                return ((value & 0xFF) << 24) | (((value >> 8) & 0xFF) << 16) | (((value >> 16) & 0xFF) << 8) | ((value >> 24) & 0xFF);
+
+            return value;
+        }
+
+        Date MakeDateGmt(int year, int month, int day, int hour,
+            int min, int sec)
+        {
+            tm date = { 0 };
+
+            date.tm_year = year - 1900;
+            date.tm_mon = month - 1;
+            date.tm_mday = day;
+            date.tm_hour = hour;
+            date.tm_min = min;
+            date.tm_sec = sec;
+
+            return CTmToDate(date);
+        }
+
+        Date MakeDateLocal(int year, int month, int day, int hour,
+            int min, int sec)
+        {
+            tm date = { 0 };
+
+            date.tm_year = year - 1900;
+            date.tm_mon = month - 1;
+            date.tm_mday = day;
+            date.tm_hour = hour;
+            date.tm_min = min;
+            date.tm_sec = sec;
+
+            time_t localTime = common::IgniteTimeLocal(date);
+
+            return CTimeToDate(localTime);
+        }
+
+        Timestamp MakeTimestampGmt(int year, int month, int day,
+            int hour, int min, int sec, long ns)
+        {
+            tm date = { 0 };
+
+            date.tm_year = year - 1900;
+            date.tm_mon = month - 1;
+            date.tm_mday = day;
+            date.tm_hour = hour;
+            date.tm_min = min;
+            date.tm_sec = sec;
+
+            return CTmToTimestamp(date, ns);
+        }
+
+        Timestamp MakeTimestampLocal(int year, int month, int day,
+            int hour, int min, int sec, long ns)
+        {
+            tm date = { 0 };
+
+            date.tm_year = year - 1900;
+            date.tm_mon = month - 1;
+            date.tm_mday = day;
+            date.tm_hour = hour;
+            date.tm_min = min;
+            date.tm_sec = sec;
+
+            time_t localTime = common::IgniteTimeLocal(date);
+
+            return CTimeToTimestamp(localTime, ns);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0bc6f0c/modules/platforms/cpp/core-test/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/Makefile.am b/modules/platforms/cpp/core-test/Makefile.am
index 4af2850..566a827 100644
--- a/modules/platforms/cpp/core-test/Makefile.am
+++ b/modules/platforms/cpp/core-test/Makefile.am
@@ -54,6 +54,7 @@ ignite_tests_LDFLAGS = \
 ignite_tests_SOURCES = \
     src/reference_test.cpp \
     src/bits_test.cpp \
+	src/binary_identity_resolver_test.cpp \
     src/cache_test.cpp \
     src/cache_query_test.cpp \
     src/continuous_query_test.cpp \
@@ -73,7 +74,8 @@ ignite_tests_SOURCES = \
     src/fixed_size_array_test.cpp \
     src/transactions_test.cpp \
     src/teamcity_messages.cpp \
-    src/teamcity_boost.cpp
+    src/teamcity_boost.cpp \
+	src/test_utils.cpp
 
 run-check: check
 	./ignite-tests -p


[4/4] ignite git commit: Merge remote-tracking branch 'origin/master'

Posted by vo...@apache.org.
Merge remote-tracking branch 'origin/master'


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

Branch: refs/heads/master
Commit: e92d44f68329797a9f7377da6ceb8885aabc90b8
Parents: b0bc6f0 4908210
Author: devozerov <vo...@gridgain.com>
Authored: Wed Feb 1 18:04:50 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Feb 1 18:04:50 2017 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheAdapter.java      | 10 ++--
 .../cache/GridCacheAffinityManager.java         | 60 ++++++++------------
 .../processors/cache/GridCacheContext.java      | 17 ------
 .../cache/GridCacheEvictionManager.java         |  6 +-
 .../processors/cache/GridCacheUtils.java        | 20 -------
 .../cache/affinity/GridCacheAffinityImpl.java   | 16 +++---
 .../CacheDataStructuresManager.java             |  2 +-
 .../distributed/dht/GridDhtCacheAdapter.java    |  2 +-
 .../distributed/dht/GridDhtCacheEntry.java      |  2 +-
 .../distributed/dht/GridDhtLocalPartition.java  |  4 +-
 .../dht/GridDhtPartitionTopologyImpl.java       |  4 +-
 .../cache/distributed/dht/GridDhtTxRemote.java  |  2 +-
 .../dht/GridPartitionedGetFuture.java           |  2 +-
 .../dht/GridPartitionedSingleGetFuture.java     |  2 +-
 .../dht/atomic/GridDhtAtomicCache.java          | 13 +++--
 .../GridNearAtomicSingleUpdateFuture.java       |  2 +-
 .../dht/atomic/GridNearAtomicUpdateFuture.java  |  4 +-
 .../dht/colocated/GridDhtColocatedCache.java    |  6 +-
 .../colocated/GridDhtColocatedLockFuture.java   |  4 +-
 .../dht/preloader/GridDhtPartitionDemander.java |  8 +--
 .../dht/preloader/GridDhtPartitionSupplier.java | 12 ++--
 .../dht/preloader/GridDhtPreloader.java         |  4 +-
 .../distributed/near/GridNearAtomicCache.java   |  2 +-
 .../distributed/near/GridNearCacheEntry.java    |  6 +-
 .../distributed/near/GridNearGetFuture.java     |  4 +-
 .../distributed/near/GridNearLockFuture.java    |  2 +-
 ...arOptimisticSerializableTxPrepareFuture.java |  2 +-
 .../near/GridNearOptimisticTxPrepareFuture.java |  2 +-
 .../GridNearPessimisticTxPrepareFuture.java     |  2 +-
 .../near/GridNearTransactionalCache.java        |  6 +-
 .../near/GridNearTxFinishFuture.java            |  2 +-
 .../cache/query/GridCacheQueryManager.java      |  9 +--
 .../continuous/CacheContinuousQueryHandler.java |  2 +-
 .../continuous/CacheContinuousQueryManager.java |  2 +-
 .../cache/transactions/IgniteTxAdapter.java     |  4 +-
 .../transactions/IgniteTxLocalAdapter.java      |  4 +-
 .../cache/transactions/TxDeadlockDetection.java |  2 +-
 .../datastreamer/DataStreamerImpl.java          |  2 +-
 .../datastructures/GridCacheSetImpl.java        |  2 +-
 .../datastructures/GridSetQueryPredicate.java   |  2 +-
 .../processors/job/GridJobProcessor.java        |  2 +-
 .../cache/CacheAffinityCallSelfTest.java        |  4 +-
 .../cache/GridCacheAbstractFullApiSelfTest.java |  6 +-
 .../IgniteCacheConfigVariationsFullApiTest.java |  6 +-
 .../cache/IgniteCachePeekModesAbstractTest.java |  8 +--
 ...actQueueFailoverDataConsistencySelfTest.java |  2 +-
 ...niteCacheClientNodeChangingTopologyTest.java |  8 +--
 .../TxOptimisticDeadlockDetectionTest.java      |  2 +-
 .../TxPessimisticDeadlockDetectionTest.java     |  2 +-
 .../processors/query/h2/IgniteH2Indexing.java   |  2 +-
 .../query/h2/opt/GridH2IndexBase.java           |  2 +-
 .../Cache/CacheAbstractTransactionalTest.cs     |  8 ++-
 .../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs  |  9 ++-
 53 files changed, 140 insertions(+), 180 deletions(-)
----------------------------------------------------------------------