Repository: ignite Updated Branches: refs/heads/ignite-1786 f2ff20766 -> a50f7e121
IGNITE-2914: ODBC: Fixed QueriesTestSuite. This closes #586. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a50f7e12 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a50f7e12 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a50f7e12 Branch: refs/heads/ignite-1786 Commit: a50f7e12133285b04f62ce0d95f3b85d9da1bc82 Parents: f2ff207 Author: isapego <[email protected]> Authored: Thu Apr 28 14:08:05 2016 +0300 Committer: vozerov-gridgain <[email protected]> Committed: Thu Apr 28 14:08:05 2016 +0300 ---------------------------------------------------------------------- .../cpp/common/include/ignite/common/utils.h | 50 ++++++------ .../cpp/core-test/src/ignite_error_test.cpp | 2 +- modules/platforms/cpp/jni/os/win/src/utils.cpp | 5 ++ modules/platforms/cpp/jni/src/exports.cpp | 4 +- modules/platforms/cpp/odbc-test/Makefile.am | 1 - .../platforms/cpp/odbc-test/include/Makefile.am | 3 +- .../cpp/odbc-test/include/test_utils.h | 57 -------------- .../cpp/odbc-test/project/vs/odbc-test.vcxproj | 2 - .../project/vs/odbc-test.vcxproj.filters | 6 -- .../src/application_data_buffer_test.cpp | 2 - .../cpp/odbc-test/src/queries_test.cpp | 22 +++--- .../platforms/cpp/odbc-test/src/test_utils.cpp | 80 -------------------- 12 files changed, 43 insertions(+), 191 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/a50f7e12/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 d460876..ff6905d 100644 --- a/modules/platforms/cpp/common/include/ignite/common/utils.h +++ b/modules/platforms/cpp/common/include/ignite/common/utils.h @@ -67,9 +67,9 @@ namespace ignite */ inline std::string LongToString(long val) { - std::stringstream tmp; - tmp << val; - return tmp.str(); + std::stringstream tmp; + tmp << val; + return tmp.str(); } /** @@ -161,7 +161,7 @@ namespace ignite * @param val Value. */ IGNITE_IMPORT_EXPORT void ReleaseChars(char* val); - + /** * Read system environment variable taking thread-safety in count. * @@ -170,7 +170,7 @@ namespace ignite * @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. * @@ -185,26 +185,26 @@ namespace ignite template<typename T> struct IGNITE_IMPORT_EXPORT SafeArray { - /** Target array. */ - T* target; - - /** - * Constructor. - */ - SafeArray(int cap) - { - target = new T[cap]; - } - - /** - * Destructor. - */ - ~SafeArray() - { - delete[] target; - } - - IGNITE_NO_COPY_ASSIGNMENT(SafeArray); + /** Target array. */ + T* target; + + /** + * Constructor. + */ + SafeArray(int cap) + { + target = new T[cap]; + } + + /** + * Destructor. + */ + ~SafeArray() + { + delete[] target; + } + + IGNITE_NO_COPY_ASSIGNMENT(SafeArray); }; } } http://git-wip-us.apache.org/repos/asf/ignite/blob/a50f7e12/modules/platforms/cpp/core-test/src/ignite_error_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/src/ignite_error_test.cpp b/modules/platforms/cpp/core-test/src/ignite_error_test.cpp index c1d34fc..8e379e3 100644 --- a/modules/platforms/cpp/core-test/src/ignite_error_test.cpp +++ b/modules/platforms/cpp/core-test/src/ignite_error_test.cpp @@ -21,7 +21,7 @@ #include <boost/test/unit_test.hpp> -#include "ignite/common/ignite_error.h" +#include "ignite/ignite_error.h" using namespace ignite; using namespace boost::unit_test; http://git-wip-us.apache.org/repos/asf/ignite/blob/a50f7e12/modules/platforms/cpp/jni/os/win/src/utils.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/jni/os/win/src/utils.cpp b/modules/platforms/cpp/jni/os/win/src/utils.cpp index c805d79..0647aa3 100644 --- a/modules/platforms/cpp/jni/os/win/src/utils.cpp +++ b/modules/platforms/cpp/jni/os/win/src/utils.cpp @@ -32,6 +32,11 @@ namespace ignite { namespace jni { + AttachHelper::~AttachHelper() + { + // No-op. + } + void AttachHelper::OnThreadAttach() { // No-op. http://git-wip-us.apache.org/repos/asf/ignite/blob/a50f7e12/modules/platforms/cpp/jni/src/exports.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/jni/src/exports.cpp b/modules/platforms/cpp/jni/src/exports.cpp index 0e84a17..37b2c30 100644 --- a/modules/platforms/cpp/jni/src/exports.cpp +++ b/modules/platforms/cpp/jni/src/exports.cpp @@ -440,8 +440,8 @@ extern "C" { } void* IGNITE_CALL IgniteServicesWithServerKeepPortable(gcj::JniContext* ctx, void* obj) { - return ctx->ServicesWithServerKeepPortable(static_cast<jobject>(obj)); - } + return ctx->ServicesWithServerKeepPortable(static_cast<jobject>(obj)); + } void IGNITE_CALL IgniteServicesCancel(gcj::JniContext* ctx, void* obj, char* name) { ctx->ServicesCancel(static_cast<jobject>(obj), name); http://git-wip-us.apache.org/repos/asf/ignite/blob/a50f7e12/modules/platforms/cpp/odbc-test/Makefile.am ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/Makefile.am b/modules/platforms/cpp/odbc-test/Makefile.am index 3a2182a..45a824b 100644 --- a/modules/platforms/cpp/odbc-test/Makefile.am +++ b/modules/platforms/cpp/odbc-test/Makefile.am @@ -61,7 +61,6 @@ ignite_odbc_tests_SOURCES = \ src/row_test.cpp \ src/utility_test.cpp \ src/queries_test.cpp \ - src/test_utils.cpp \ ../odbc/src/cursor.cpp \ ../odbc/src/config/connection_info.cpp \ ../odbc/src/app/application_data_buffer.cpp \ http://git-wip-us.apache.org/repos/asf/ignite/blob/a50f7e12/modules/platforms/cpp/odbc-test/include/Makefile.am ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/include/Makefile.am b/modules/platforms/cpp/odbc-test/include/Makefile.am index 7b17102..6b2d8b6 100644 --- a/modules/platforms/cpp/odbc-test/include/Makefile.am +++ b/modules/platforms/cpp/odbc-test/include/Makefile.am @@ -19,6 +19,5 @@ ACLOCAL_AMFLAGS =-I m4 noinst_HEADERS = \ teamcity/teamcity_messages.h \ - test_type.h \ - test_utils.h + test_type.h http://git-wip-us.apache.org/repos/asf/ignite/blob/a50f7e12/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 deleted file mode 100644 index 602f68f..0000000 --- a/modules/platforms/cpp/odbc-test/include/test_utils.h +++ /dev/null @@ -1,57 +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. - */ - -#ifndef _IGNITE_ODBC_TEST_TEST_UTILS_H -#define _IGNITE_ODBC_TEST_TEST_UTILS_H - -#include "ignite/date.h" -#include "ignite/timestamp.h" - -namespace test_utils -{ - /** - * Make Date in human understandable way. - * - * @param year Year. - * @param month Month. - * @param day Day. - * @param hour Hour. - * @param min Min. - * @param sec Sec. - * @return Date. - */ - ignite::Date MakeDate(int year = 1900, int month = 1, int day = 1, - int hour = 0, int min = 0, int sec = 0); - - /** - * Make Date in human understandable way. - * - * @param year Year. - * @param month Month. - * @param day Day. - * @param hour Hour. - * @param min Minute. - * @param sec Second. - * @param ns Nanosecond. - * @return Timestamp. - */ - ignite::Timestamp MakeTimestamp(int year = 1900, int month = 1, int day = 1, - int hour = 0, int min = 0, int sec = 0, long ns = 0); -} // namespace test_utils - -#endif // _IGNITE_ODBC_TEST_TEST_UTILS_H - http://git-wip-us.apache.org/repos/asf/ignite/blob/a50f7e12/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj index 7b32bdb..d634cb3 100644 --- a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj +++ b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj @@ -169,7 +169,6 @@ <ClCompile Include="..\..\src\queries_test.cpp" /> <ClCompile Include="..\..\src\parser_test.cpp" /> <ClCompile Include="..\..\src\row_test.cpp" /> - <ClCompile Include="..\..\src\test_utils.cpp" /> <ClCompile Include="..\..\src\teamcity\teamcity_boost.cpp" /> <ClCompile Include="..\..\src\teamcity\teamcity_messages.cpp" /> <ClCompile Include="..\..\src\utility_test.cpp" /> @@ -177,7 +176,6 @@ <ItemGroup> <ClInclude Include="..\..\include\teamcity\teamcity_messages.h" /> <ClInclude Include="..\..\include\test_type.h" /> - <ClInclude Include="..\..\include\test_utils.h" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\..\binary\project\vs\binary.vcxproj"> http://git-wip-us.apache.org/repos/asf/ignite/blob/a50f7e12/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters index d5f22b3..f47d990 100644 --- a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters +++ b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters @@ -79,17 +79,11 @@ <ClCompile Include="..\..\src\queries_test.cpp"> <Filter>Code</Filter> </ClCompile> - <ClCompile Include="..\..\src\test_utils.cpp"> - <Filter>Code</Filter> - </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\include\test_type.h"> <Filter>Code\CacheTypes</Filter> </ClInclude> - <ClInclude Include="..\..\include\test_utils.h"> - <Filter>Code</Filter> - </ClInclude> <ClInclude Include="..\..\include\teamcity\teamcity_messages.h"> <Filter>Code\TeamCity</Filter> </ClInclude> http://git-wip-us.apache.org/repos/asf/ignite/blob/a50f7e12/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 8b128f7..d2ed033 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 @@ -28,8 +28,6 @@ #include <ignite/odbc/app/application_data_buffer.h> #include <ignite/odbc/utility.h> -#include "test_utils.h" - #define FLOAT_PRECISION 0.0000001f using namespace ignite; http://git-wip-us.apache.org/repos/asf/ignite/blob/a50f7e12/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 9a408be..cc3fa8e 100644 --- a/modules/platforms/cpp/odbc-test/src/queries_test.cpp +++ b/modules/platforms/cpp/odbc-test/src/queries_test.cpp @@ -33,11 +33,9 @@ #include "ignite/ignite.h" #include "ignite/ignition.h" +#include "ignite/impl/binary/binary_utils.h" #include "test_type.h" -#include "test_utils.h" - -using namespace test_utils; using namespace ignite; using namespace ignite::cache; @@ -46,6 +44,8 @@ using namespace ignite::common; using namespace boost::unit_test; +using ignite::impl::binary::BinaryUtils; + /** Read buffer size. */ enum { ODBC_BUFFER_SIZE = 1024 }; @@ -105,11 +105,7 @@ struct QueriesTestSuiteFixture grid = Ignition::Start(cfg, &err); if (err.GetCode() != IgniteError::IGNITE_SUCCESS) - { - Ignition::Stop(grid.GetName(), true); - BOOST_FAIL(err.GetText()); - } testCache = grid.GetCache<int64_t, TestType>("cache"); @@ -172,8 +168,8 @@ struct QueriesTestSuiteFixture { SQLRETURN ret; - TestType in1(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), MakeDate(1987, 6, 5), MakeTimestamp(1998, 12, 27, 1, 2, 3, 456)); - TestType in2(8, 7, 6, 5, "4", 3.0f, 2.0, false, Guid(1, 0), MakeDate(1976, 1, 12), MakeTimestamp(1978, 8, 21, 23, 13, 45, 456)); + 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 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)); testCache.Put(1, in1); testCache.Put(2, in2); @@ -321,8 +317,8 @@ BOOST_AUTO_TEST_CASE(TestTwoRowsString) { SQLRETURN ret; - TestType in1(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), MakeDate(1987, 6, 5), MakeTimestamp(1998, 12, 27, 1, 2, 3, 456)); - TestType in2(8, 7, 6, 5, "4", 3.0f, 2.0, false, Guid(1, 0), MakeDate(1976, 1, 12), MakeTimestamp(1978, 8, 21, 23, 13, 45, 999999999)); + 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 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)); testCache.Put(1, in1); testCache.Put(2, in2); @@ -414,7 +410,7 @@ BOOST_AUTO_TEST_CASE(TestOneRowString) { SQLRETURN ret; - TestType in(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), MakeDate(1987, 6, 5), MakeTimestamp(1998, 12, 27, 1, 2, 3, 456)); + 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)); testCache.Put(1, in); @@ -475,7 +471,7 @@ BOOST_AUTO_TEST_CASE(TestOneRowStringLen) { SQLRETURN ret; - TestType in(1, 2, 3, 4, "5", 6.0f, 7.0, true, Guid(8, 9), MakeDate(1987, 6, 5), MakeTimestamp(1998, 12, 27, 1, 2, 3, 456)); + 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)); testCache.Put(1, in); http://git-wip-us.apache.org/repos/asf/ignite/blob/a50f7e12/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 deleted file mode 100644 index 1f7ed82..0000000 --- a/modules/platforms/cpp/odbc-test/src/test_utils.cpp +++ /dev/null @@ -1,80 +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 <ctime> - -#include "test_utils.h" - -namespace test_utils -{ - /** - * Make Date in human understandable way. - * - * @param year Year. - * @param month Month. - * @param day Day. - * @param hour Hour. - * @param min Min. - * @param sec Sec. - * @return Date. - */ - ignite::Date MakeDate(int year, int month, int day, int hour, int min, int sec) - { - tm date; - - 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 ct = mktime(&date) - timezone; - - return ignite::Date(ct * 1000); - } - - /** - * Make Date in human understandable way. - * - * @param year Year. - * @param month Month. - * @param day Day. - * @param hour Hour. - * @param min Minute. - * @param sec Second. - * @param ns Nanosecond. - * @return Timestamp. - */ - ignite::Timestamp MakeTimestamp(int year, int month, int day, int hour, - int min, int sec, long ns) - { - tm date; - - 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 ct = mktime(&date) - timezone; - - return ignite::Timestamp(ct, ns); - } - -} // namespace test_utils
