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());
