You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2016/03/17 11:53:27 UTC
[5/5] ignite git commit: IGNITE-2557: Added tests.
IGNITE-2557: Added tests.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/075ab6fb
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/075ab6fb
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/075ab6fb
Branch: refs/heads/ignite-1786
Commit: 075ab6fbd11b3c8e98b6b5945a71b89a9e706e2b
Parents: 9291891
Author: isapego <is...@gridgain.com>
Authored: Thu Mar 17 13:53:16 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Mar 17 13:53:16 2016 +0300
----------------------------------------------------------------------
.../platforms/cpp/binary/include/ignite/date.h | 14 +-
.../platforms/cpp/binary/include/ignite/guid.h | 31 +-
.../cpp/binary/include/ignite/timestamp.h | 14 +-
modules/platforms/cpp/binary/src/date.cpp | 14 +-
modules/platforms/cpp/binary/src/guid.cpp | 2 +-
.../src/impl/binary/binary_reader_impl.cpp | 2 +
modules/platforms/cpp/binary/src/timestamp.cpp | 14 +-
.../cpp/common/include/ignite/common/utils.h | 32 +
.../platforms/cpp/common/os/linux/src/utils.cpp | 21 +
.../platforms/cpp/common/os/win/src/utils.cpp | 21 +
.../cpp/core-test/src/cache_query_test.cpp | 2 +-
modules/platforms/cpp/odbc-test/Makefile.am | 6 +-
.../cpp/odbc-test/config/queries-test.xml | 90 +
.../include/teamcity/teamcity_messages.h | 55 +
.../cpp/odbc-test/include/teamcity_messages.h | 55 -
.../platforms/cpp/odbc-test/include/test_type.h | 130 ++
.../cpp/odbc-test/include/test_utils.h | 57 +
.../cpp/odbc-test/project/vs/odbc-test.vcxproj | 28 +-
.../project/vs/odbc-test.vcxproj.filters | 63 +-
.../src/application_data_buffer_test.cpp | 329 +--
.../cpp/odbc-test/src/configuration_test.cpp | 20 +-
.../cpp/odbc-test/src/queries_test.cpp | 510 ++++
.../odbc-test/src/teamcity/teamcity_boost.cpp | 159 ++
.../src/teamcity/teamcity_messages.cpp | 150 ++
.../cpp/odbc-test/src/teamcity_boost.cpp | 159 --
.../cpp/odbc-test/src/teamcity_messages.cpp | 150 --
.../platforms/cpp/odbc-test/src/test_utils.cpp | 80 +
modules/platforms/cpp/odbc/Makefile.am | 1 +
.../platforms/cpp/odbc/include/ignite/odbc.h | 258 +++
.../ignite/odbc/app/application_data_buffer.h | 7 +
.../cpp/odbc/include/ignite/odbc/decimal.h | 17 +-
.../cpp/odbc/include/ignite/odbc/utility.h | 8 +
.../platforms/cpp/odbc/project/vs/odbc.vcxproj | 2 +
.../cpp/odbc/project/vs/odbc.vcxproj.filters | 6 +
.../odbc/src/app/application_data_buffer.cpp | 76 +-
.../platforms/cpp/odbc/src/app/parameter.cpp | 18 +-
.../cpp/odbc/src/config/configuration.cpp | 6 +
modules/platforms/cpp/odbc/src/connection.cpp | 2 +-
modules/platforms/cpp/odbc/src/decimal.cpp | 42 +-
modules/platforms/cpp/odbc/src/entry_points.cpp | 694 ++++++
modules/platforms/cpp/odbc/src/odbc.cpp | 2193 ++++++++----------
modules/platforms/cpp/odbc/src/utility.cpp | 25 +
42 files changed, 3680 insertions(+), 1883 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/075ab6fb/modules/platforms/cpp/binary/include/ignite/date.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/date.h b/modules/platforms/cpp/binary/include/ignite/date.h
index def073f..31fe5d0 100644
--- a/modules/platforms/cpp/binary/include/ignite/date.h
+++ b/modules/platforms/cpp/binary/include/ignite/date.h
@@ -83,7 +83,7 @@ namespace ignite
* @param val2 Second value.
* @return True if equal.
*/
- friend bool IGNITE_IMPORT_EXPORT operator==(Date& val1, Date& val2);
+ friend bool IGNITE_IMPORT_EXPORT operator==(const Date& val1, const Date& val2);
/**
* Comparison operator override.
@@ -92,7 +92,7 @@ namespace ignite
* @param val2 Second value.
* @return True if not equal.
*/
- friend bool IGNITE_IMPORT_EXPORT operator!=(Date& val1, Date& val2);
+ friend bool IGNITE_IMPORT_EXPORT operator!=(const Date& val1, const Date& val2);
/**
* Comparison operator override.
@@ -101,7 +101,7 @@ namespace ignite
* @param val2 Second value.
* @return True if less.
*/
- friend bool IGNITE_IMPORT_EXPORT operator<(Date& val1, Date& val2);
+ friend bool IGNITE_IMPORT_EXPORT operator<(const Date& val1, const Date& val2);
/**
* Comparison operator override.
@@ -110,7 +110,7 @@ namespace ignite
* @param val2 Second value.
* @return True if less or equal.
*/
- friend bool IGNITE_IMPORT_EXPORT operator<=(Date& val1, Date& val2);
+ friend bool IGNITE_IMPORT_EXPORT operator<=(const Date& val1, const Date& val2);
/**
* Comparison operator override.
@@ -119,7 +119,7 @@ namespace ignite
* @param val2 Second value.
* @return True if gretter.
*/
- friend bool IGNITE_IMPORT_EXPORT operator>(Date& val1, Date& val2);
+ friend bool IGNITE_IMPORT_EXPORT operator>(const Date& val1, const Date& val2);
/**
* Comparison operator override.
@@ -128,11 +128,11 @@ namespace ignite
* @param val2 Second value.
* @return True if gretter or equal.
*/
- friend bool IGNITE_IMPORT_EXPORT operator>=(Date& val1, Date& val2);
+ friend bool IGNITE_IMPORT_EXPORT operator>=(const Date& val1, const Date& val2);
private:
/** Number of milliseconds since 00:00 hours, Jan 1, 1970 UTC. */
int64_t milliseconds;
};
}
-#endif //_IGNITE_DATE
\ No newline at end of file
+#endif //_IGNITE_DATE
http://git-wip-us.apache.org/repos/asf/ignite/blob/075ab6fb/modules/platforms/cpp/binary/include/ignite/guid.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/guid.h b/modules/platforms/cpp/binary/include/ignite/guid.h
index 97ab117..9a045e6 100644
--- a/modules/platforms/cpp/binary/include/ignite/guid.h
+++ b/modules/platforms/cpp/binary/include/ignite/guid.h
@@ -105,7 +105,7 @@ namespace ignite
* @param val2 Second value.
* @return True if equal.
*/
- friend bool IGNITE_IMPORT_EXPORT operator== (Guid& val1, Guid& val2);
+ friend bool IGNITE_IMPORT_EXPORT operator== (const Guid& val1, const Guid& val2);
private:
/** Most significant bits. */
int64_t most;
@@ -138,6 +138,35 @@ namespace ignite
return os;
}
+
+ /**
+ * Input operator.
+ *
+ * @param is Input stream.
+ * @param guid Guid to input.
+ * @return Reference to the first param.
+ */
+ template<typename C>
+ std::basic_istream<C>& operator>>(std::basic_istream<C>& is, Guid& guid)
+ {
+ uint64_t parts[5];
+
+ C delim;
+
+ for (int i = 0; i < 4; ++i)
+ {
+ is >> std::hex >> parts[i] >> delim;
+
+ if (delim != static_cast<C>('-'))
+ return is;
+ }
+
+ is >> std::hex >> parts[4];
+
+ guid = Guid((parts[0] << 32) | (parts[1] << 16) | parts[2], (parts[3] << 48) | parts[4]);
+
+ return is;
+ }
}
#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/075ab6fb/modules/platforms/cpp/binary/include/ignite/timestamp.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/include/ignite/timestamp.h b/modules/platforms/cpp/binary/include/ignite/timestamp.h
index 3f14aec..4528e53 100644
--- a/modules/platforms/cpp/binary/include/ignite/timestamp.h
+++ b/modules/platforms/cpp/binary/include/ignite/timestamp.h
@@ -108,7 +108,7 @@ namespace ignite
* @param val2 Second value.
* @return True if equal.
*/
- friend bool IGNITE_IMPORT_EXPORT operator==(Timestamp& val1, Timestamp& val2);
+ friend bool IGNITE_IMPORT_EXPORT operator==(const Timestamp& val1, const Timestamp& val2);
/**
* Comparison operator override.
@@ -117,7 +117,7 @@ namespace ignite
* @param val2 Second value.
* @return True if not equal.
*/
- friend bool IGNITE_IMPORT_EXPORT operator!=(Timestamp& val1, Timestamp& val2);
+ friend bool IGNITE_IMPORT_EXPORT operator!=(const Timestamp& val1, const Timestamp& val2);
/**
* Comparison operator override.
@@ -126,7 +126,7 @@ namespace ignite
* @param val2 Second value.
* @return True if less.
*/
- friend bool IGNITE_IMPORT_EXPORT operator<(Timestamp& val1, Timestamp& val2);
+ friend bool IGNITE_IMPORT_EXPORT operator<(const Timestamp& val1, const Timestamp& val2);
/**
* Comparison operator override.
@@ -135,7 +135,7 @@ namespace ignite
* @param val2 Second value.
* @return True if less or equal.
*/
- friend bool IGNITE_IMPORT_EXPORT operator<=(Timestamp& val1, Timestamp& val2);
+ friend bool IGNITE_IMPORT_EXPORT operator<=(const Timestamp& val1, const Timestamp& val2);
/**
* Comparison operator override.
@@ -144,7 +144,7 @@ namespace ignite
* @param val2 Second value.
* @return True if gretter.
*/
- friend bool IGNITE_IMPORT_EXPORT operator>(Timestamp& val1, Timestamp& val2);
+ friend bool IGNITE_IMPORT_EXPORT operator>(const Timestamp& val1, const Timestamp& val2);
/**
* Comparison operator override.
@@ -153,7 +153,7 @@ namespace ignite
* @param val2 Second value.
* @return True if gretter or equal.
*/
- friend bool IGNITE_IMPORT_EXPORT operator>=(Timestamp& val1, Timestamp& val2);
+ friend bool IGNITE_IMPORT_EXPORT operator>=(const Timestamp& val1, const Timestamp& val2);
private:
/** Number of seconds since 00:00 hours, Jan 1, 1970 UTC. */
int64_t seconds;
@@ -163,4 +163,4 @@ namespace ignite
};
}
-#endif //_IGNITE_TIMESTAMP
\ No newline at end of file
+#endif //_IGNITE_TIMESTAMP
http://git-wip-us.apache.org/repos/asf/ignite/blob/075ab6fb/modules/platforms/cpp/binary/src/date.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/date.cpp b/modules/platforms/cpp/binary/src/date.cpp
index 56cca6d..2bdcfd5 100644
--- a/modules/platforms/cpp/binary/src/date.cpp
+++ b/modules/platforms/cpp/binary/src/date.cpp
@@ -51,33 +51,33 @@ namespace ignite
return milliseconds / 1000;
}
- bool operator==(Date& val1, Date& val2)
+ bool operator==(const Date& val1, const Date& val2)
{
return val1.milliseconds == val2.milliseconds;
}
- bool operator!=(Date& val1, Date& val2)
+ bool operator!=(const Date& val1, const Date& val2)
{
return val1.milliseconds != val2.milliseconds;
}
- bool operator<(Date& val1, Date& val2)
+ bool operator<(const Date& val1, const Date& val2)
{
return val1.milliseconds < val2.milliseconds;
}
- bool operator<=(Date& val1, Date& val2)
+ bool operator<=(const Date& val1, const Date& val2)
{
return val1.milliseconds <= val2.milliseconds;
}
- bool operator>(Date& val1, Date& val2)
+ bool operator>(const Date& val1, const Date& val2)
{
return val1.milliseconds > val2.milliseconds;
}
- bool operator>=(Date& val1, Date& val2)
+ bool operator>=(const Date& val1, const Date& val2)
{
return val1.milliseconds >= val2.milliseconds;
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/075ab6fb/modules/platforms/cpp/binary/src/guid.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/guid.cpp b/modules/platforms/cpp/binary/src/guid.cpp
index 77997e4..50d6d1d 100644
--- a/modules/platforms/cpp/binary/src/guid.cpp
+++ b/modules/platforms/cpp/binary/src/guid.cpp
@@ -58,7 +58,7 @@ namespace ignite
return static_cast<int32_t>(hilo >> 32) ^ static_cast<int32_t>(hilo);
}
- bool operator==(Guid& val1, Guid& val2)
+ bool operator==(const Guid& val1, const Guid& val2)
{
return val1.least == val2.least && val1.most == val2.most;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/075ab6fb/modules/platforms/cpp/binary/src/impl/binary/binary_reader_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/impl/binary/binary_reader_impl.cpp b/modules/platforms/cpp/binary/src/impl/binary/binary_reader_impl.cpp
index a91f36e..dd915fe 100644
--- a/modules/platforms/cpp/binary/src/impl/binary/binary_reader_impl.cpp
+++ b/modules/platforms/cpp/binary/src/impl/binary/binary_reader_impl.cpp
@@ -744,6 +744,8 @@ namespace ignite
if (typeId == IGNITE_TYPE_DATE)
return BinaryUtils::ReadDate(stream);
+ else if (typeId == IGNITE_TYPE_TIMESTAMP)
+ return Date(BinaryUtils::ReadTimestamp(stream).GetMilliseconds());
else if (typeId == IGNITE_HDR_NULL)
return Date();
else {
http://git-wip-us.apache.org/repos/asf/ignite/blob/075ab6fb/modules/platforms/cpp/binary/src/timestamp.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/binary/src/timestamp.cpp b/modules/platforms/cpp/binary/src/timestamp.cpp
index a56587e..e554950 100644
--- a/modules/platforms/cpp/binary/src/timestamp.cpp
+++ b/modules/platforms/cpp/binary/src/timestamp.cpp
@@ -75,43 +75,43 @@ namespace ignite
return Date(GetMilliseconds());
}
- bool operator==(Timestamp& val1, Timestamp& val2)
+ bool operator==(const Timestamp& val1, const Timestamp& val2)
{
return val1.seconds == val2.seconds &&
val1.fractionNs == val2.fractionNs;
}
- bool operator!=(Timestamp& val1, Timestamp& val2)
+ bool operator!=(const Timestamp& val1, const Timestamp& val2)
{
return val1.seconds != val2.seconds ||
val1.fractionNs != val2.fractionNs;
}
- bool operator<(Timestamp& val1, Timestamp& val2)
+ bool operator<(const Timestamp& val1, const Timestamp& val2)
{
return val1.seconds < val2.seconds ||
(val1.seconds == val2.seconds &&
val1.fractionNs < val2.fractionNs);
}
- bool operator<=(Timestamp& val1, Timestamp& val2)
+ bool operator<=(const Timestamp& val1, const Timestamp& val2)
{
return val1.seconds < val2.seconds ||
(val1.seconds == val2.seconds &&
val1.fractionNs <= val2.fractionNs);
}
- bool operator>(Timestamp& val1, Timestamp& val2)
+ bool operator>(const Timestamp& val1, const Timestamp& val2)
{
return val1.seconds > val2.seconds ||
(val1.seconds == val2.seconds &&
val1.fractionNs > val2.fractionNs);
}
- bool operator>=(Timestamp& val1, Timestamp& val2)
+ bool operator>=(const Timestamp& val1, const Timestamp& val2)
{
return val1.seconds > val2.seconds ||
(val1.seconds == val2.seconds &&
val1.fractionNs >= val2.fractionNs);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/075ab6fb/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 abed714..05f3595 100644
--- a/modules/platforms/cpp/common/include/ignite/common/utils.h
+++ b/modules/platforms/cpp/common/include/ignite/common/utils.h
@@ -17,6 +17,8 @@
#ifndef _IGNITE_COMMON_UTILS
#define _IGNITE_COMMON_UTILS
+#include <stdint.h>
+
#include <cstring>
#include <string>
#include <sstream>
@@ -84,6 +86,36 @@ namespace ignite
}
/**
+ * Get number of leading zeroes in octet.
+ *
+ * @param octet Octet.
+ * @return Number of leading zero-bits.
+ */
+ IGNITE_IMPORT_EXPORT int LeadingZeroesForOctet(int8_t octet);
+
+ /**
+ * Get number of significant bits in octet.
+ *
+ * @param octet Octet.
+ * @return Number of significant bits.
+ */
+ inline int BitLengthForOctet(int8_t octet)
+ {
+ return 8 - LeadingZeroesForOctet(octet);
+ }
+
+ /**
+ * Check if the number is power of two.
+ *
+ * @param num Integer number.
+ * @return True if the number is power of two.
+ */
+ inline bool PowerOfTwo(int num)
+ {
+ return (num & (num - 1)) == 0;
+ }
+
+ /**
* Copy characters.
*
* @param val Value.
http://git-wip-us.apache.org/repos/asf/ignite/blob/075ab6fb/modules/platforms/cpp/common/os/linux/src/utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/os/linux/src/utils.cpp b/modules/platforms/cpp/common/os/linux/src/utils.cpp
index 625844f..5c6df36 100644
--- a/modules/platforms/cpp/common/os/linux/src/utils.cpp
+++ b/modules/platforms/cpp/common/os/linux/src/utils.cpp
@@ -296,6 +296,27 @@ namespace ignite
return res;
}
+ int LeadingZeroesForOctet(int8_t octet) {
+ if (octet == 0)
+ return 8;
+
+ int zeroes = 1;
+
+ if (octet >> 4 == 0) {
+ zeroes += 4;
+ octet <<= 4;
+ }
+
+ if (octet >> 6 == 0) {
+ zeroes += 2;
+ octet <<= 2;
+ }
+
+ zeroes -= octet >> 7;
+
+ return zeroes;
+ }
+
char* CopyChars(const char* val)
{
if (val) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/075ab6fb/modules/platforms/cpp/common/os/win/src/utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/common/os/win/src/utils.cpp b/modules/platforms/cpp/common/os/win/src/utils.cpp
index 493ee9a..2f28645 100644
--- a/modules/platforms/cpp/common/os/win/src/utils.cpp
+++ b/modules/platforms/cpp/common/os/win/src/utils.cpp
@@ -290,6 +290,27 @@ namespace ignite
return res;
}
+ int LeadingZeroesForOctet(int8_t octet) {
+ if (octet == 0)
+ return 8;
+
+ int zeroes = 1;
+
+ if (octet >> 4 == 0) {
+ zeroes += 4;
+ octet <<= 4;
+ }
+
+ if (octet >> 6 == 0) {
+ zeroes += 2;
+ octet <<= 2;
+ }
+
+ zeroes -= octet >> 7;
+
+ return zeroes;
+ }
+
char* CopyChars(const char* val)
{
if (val) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/075ab6fb/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 1630704..a22ddad 100644
--- a/modules/platforms/cpp/core-test/src/cache_query_test.cpp
+++ b/modules/platforms/cpp/core-test/src/cache_query_test.cpp
@@ -1095,4 +1095,4 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryTimestamp)
CheckEmpty(cursor);
}
-BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
+BOOST_AUTO_TEST_SUITE_END()
http://git-wip-us.apache.org/repos/asf/ignite/blob/075ab6fb/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 f8966f0..700ca75 100644
--- a/modules/platforms/cpp/odbc-test/Makefile.am
+++ b/modules/platforms/cpp/odbc-test/Makefile.am
@@ -20,7 +20,7 @@ ACLOCAL_AMFLAGS = "-Im4"
SUBDIRS = .
DIST_SUBDIRS = .
-AM_CPPFLAGS = -I$(srcdir)/include -I$(srcdir)/../odbc/include -DIGNITE_IMPL
+AM_CPPFLAGS = -I$(srcdir)/include -I$(srcdir)/../odbc/include -I$(srcdir)/../common/include -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -DIGNITE_IMPL
AM_CXXFLAGS = -Wall -std=c++0x
noinst_PROGRAMS = ignite-odbc-tests
@@ -34,6 +34,8 @@ ignite_odbc_tests_SOURCES = src/teamcity_boost.cpp \
src/configuration_test.cpp \
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 \
@@ -44,7 +46,7 @@ ignite_odbc_tests_SOURCES = src/teamcity_boost.cpp \
../odbc/src/utility.cpp \
../odbc/src/result_page.cpp
-ignite_odbc_tests_LDFLAGS = -static-libtool-libs -L/usr/local/lib -lignite-binary -ldl
+ignite_odbc_tests_LDFLAGS = -static-libtool-libs -L/usr/local/lib -ldl -lignite-binary -lignite -lodbc
run-check: check
./ignite-odbc-tests -p
http://git-wip-us.apache.org/repos/asf/ignite/blob/075ab6fb/modules/platforms/cpp/odbc-test/config/queries-test.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/config/queries-test.xml b/modules/platforms/cpp/odbc-test/config/queries-test.xml
new file mode 100644
index 0000000..fa87f82
--- /dev/null
+++ b/modules/platforms/cpp/odbc-test/config/queries-test.xml
@@ -0,0 +1,90 @@
+<?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.
+-->
+
+<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">
+ <!-- Set to true to enable distributed class loading for examples, default is false. -->
+ <property name="peerClassLoadingEnabled" value="true"/>
+
+ <property name="cacheConfiguration">
+ <list>
+ <bean class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="name" value="cache"/>
+ <property name="cacheMode" value="PARTITIONED"/>
+ <property name="atomicityMode" value="ATOMIC"/>
+ <property name="writeSynchronizationMode" value="PRIMARY_SYNC"/>
+
+ <!-- Configure type metadata to enable queries. -->
+ <property name="typeMetadata">
+ <list>
+ <bean class="org.apache.ignite.cache.CacheTypeMetadata">
+ <property name="keyType" value="java.lang.Long"/>
+ <property name="valueType" value="TestType"/>
+ <property name="queryFields">
+ <map>
+ <entry key="i8Field" value="java.lang.Byte"/>
+ <entry key="i16Field" value="java.lang.Short"/>
+ <entry key="i32Field" value="java.lang.Integer"/>
+ <entry key="i64Field" value="java.lang.Long"/>
+ <entry key="strField" value="java.lang.String"/>
+ <entry key="floatField" value="java.lang.Float"/>
+ <entry key="doubleField" value="java.lang.Double"/>
+ <entry key="boolField" value="java.lang.Boolean"/>
+ <entry key="guidField" value="java.util.UUID"/>
+ <entry key="dateField" value="java.util.Date"/>
+ <entry key="timestampField" value="java.sql.Timestamp"/>
+ </map>
+ </property>
+ </bean>
+ </list>
+ </property>
+ </bean>
+ </list>
+ </property>
+
+ <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
+ <property name="discoverySpi">
+ <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+ <property name="ipFinder">
+ <!--
+ Ignite provides several options for automatic discovery that can be used
+ instead os static IP based discovery.
+ -->
+ <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
+ <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
+ <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
+ <property name="addresses">
+ <list>
+ <!-- In distributed environment, replace with actual host IP address. -->
+ <value>127.0.0.1:47500..47501</value>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+ </property>
+ </bean>
+</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/075ab6fb/modules/platforms/cpp/odbc-test/include/teamcity/teamcity_messages.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/include/teamcity/teamcity_messages.h b/modules/platforms/cpp/odbc-test/include/teamcity/teamcity_messages.h
new file mode 100644
index 0000000..81a915b
--- /dev/null
+++ b/modules/platforms/cpp/odbc-test/include/teamcity/teamcity_messages.h
@@ -0,0 +1,55 @@
+/* Copyright 2011 JetBrains s.r.o.
+ *
+ * Licensed 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.
+ *
+ * $Revision: 88625 $
+*/
+
+#ifndef H_TEAMCITY_MESSAGES
+#define H_TEAMCITY_MESSAGES
+
+#include <string>
+#include <iostream>
+
+namespace JetBrains {
+
+std::string getFlowIdFromEnvironment();
+bool underTeamcity();
+
+class TeamcityMessages {
+ std::ostream *m_out;
+
+protected:
+ std::string escape(std::string s);
+
+ void openMsg(const std::string &name);
+ void writeProperty(std::string name, std::string value);
+ void closeMsg();
+
+public:
+ TeamcityMessages();
+
+ void setOutput(std::ostream &);
+
+ void suiteStarted(std::string name, std::string flowid = "");
+ void suiteFinished(std::string name, std::string flowid = "");
+
+ void testStarted(std::string name, std::string flowid = "");
+ void testFailed(std::string name, std::string message, std::string details, std::string flowid = "");
+ void testIgnored(std::string name, std::string message, std::string flowid = "");
+ void testFinished(std::string name, int durationMs = -1, std::string flowid = "");
+};
+
+}
+
+#endif /* H_TEAMCITY_MESSAGES */
http://git-wip-us.apache.org/repos/asf/ignite/blob/075ab6fb/modules/platforms/cpp/odbc-test/include/teamcity_messages.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/include/teamcity_messages.h b/modules/platforms/cpp/odbc-test/include/teamcity_messages.h
deleted file mode 100644
index 8cf23d0..0000000
--- a/modules/platforms/cpp/odbc-test/include/teamcity_messages.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Copyright 2011 JetBrains s.r.o.
- *
- * Licensed 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.
- *
- * $Revision: 88625 $
-*/
-
-#ifndef H_TEAMCITY_MESSAGES
-#define H_TEAMCITY_MESSAGES
-
-#include <string>
-#include <iostream>
-
-namespace JetBrains {
-
-std::string getFlowIdFromEnvironment();
-bool underTeamcity();
-
-class TeamcityMessages {
- std::ostream *m_out;
-
-protected:
- std::string escape(std::string s);
-
- void openMsg(const std::string &name);
- void writeProperty(std::string name, std::string value);
- void closeMsg();
-
-public:
- TeamcityMessages();
-
- void setOutput(std::ostream &);
-
- void suiteStarted(std::string name, std::string flowid = "");
- void suiteFinished(std::string name, std::string flowid = "");
-
- void testStarted(std::string name, std::string flowid = "");
- void testFailed(std::string name, std::string message, std::string details, std::string flowid = "");
- void testIgnored(std::string name, std::string message, std::string flowid = "");
- void testFinished(std::string name, int durationMs = -1, std::string flowid = "");
-};
-
-}
-
-#endif /* H_TEAMCITY_MESSAGES */
http://git-wip-us.apache.org/repos/asf/ignite/blob/075ab6fb/modules/platforms/cpp/odbc-test/include/test_type.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/include/test_type.h b/modules/platforms/cpp/odbc-test/include/test_type.h
new file mode 100644
index 0000000..2a4a979
--- /dev/null
+++ b/modules/platforms/cpp/odbc-test/include/test_type.h
@@ -0,0 +1,130 @@
+/*
+ * 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_TYPE
+#define _IGNITE_ODBC_TEST_TEST_TYPE
+
+#include <string>
+
+#include "ignite/ignite.h"
+#include "ignite/ignition.h"
+
+namespace ignite
+{
+ struct TestType
+ {
+ TestType() :
+ i8Field(0),
+ i16Field(0),
+ i32Field(0),
+ i64Field(0),
+ floatField(0.0f),
+ doubleField(0.0),
+ boolField(false),
+ dateField(),
+ timestampField()
+ {
+ // No-op.
+ }
+
+ TestType(int8_t i8Field, int16_t i16Field, int32_t i32Field,
+ int64_t i64Field, const std::string& strField, float floatField,
+ double doubleField, bool boolField, const Guid& guidField,
+ const Date& dateField, const Timestamp& timestampField) :
+ i8Field(i8Field),
+ i16Field(i16Field),
+ i32Field(i32Field),
+ i64Field(i64Field),
+ strField(strField),
+ floatField(floatField),
+ doubleField(doubleField),
+ boolField(boolField),
+ guidField(guidField),
+ dateField(dateField),
+ timestampField(timestampField)
+ {
+ // No-op.
+ }
+
+ int8_t i8Field;
+ int16_t i16Field;
+ int32_t i32Field;
+ int64_t i64Field;
+ std::string strField;
+ float floatField;
+ double doubleField;
+ bool boolField;
+ Guid guidField;
+ Date dateField;
+ Timestamp timestampField;
+ };
+}
+
+namespace ignite
+{
+ namespace binary
+ {
+ IGNITE_BINARY_TYPE_START(ignite::TestType)
+
+ typedef ignite::TestType TestType;
+
+ IGNITE_BINARY_GET_TYPE_ID_AS_HASH(TestType)
+ IGNITE_BINARY_GET_TYPE_NAME_AS_IS(TestType)
+ IGNITE_BINARY_GET_FIELD_ID_AS_HASH
+ IGNITE_BINARY_GET_HASH_CODE_ZERO(TestType)
+ IGNITE_BINARY_IS_NULL_FALSE(TestType)
+ IGNITE_BINARY_GET_NULL_DEFAULT_CTOR(TestType)
+
+ void Write(BinaryWriter& writer, TestType obj)
+ {
+ writer.WriteInt8("i8Field", obj.i8Field);
+ writer.WriteInt16("i16Field", obj.i16Field);
+ writer.WriteInt32("i32Field", obj.i32Field);
+ writer.WriteInt64("i64Field", obj.i64Field);
+ writer.WriteString("strField", obj.strField);
+ writer.WriteFloat("floatField", obj.floatField);
+ writer.WriteDouble("doubleField", obj.doubleField);
+ writer.WriteBool("boolField", obj.boolField);
+ writer.WriteGuid("guidField", obj.guidField);
+ writer.WriteDate("dateField", obj.dateField);
+ writer.WriteTimestamp("timestampField", obj.timestampField);
+ }
+
+ TestType Read(BinaryReader& reader)
+ {
+ int8_t i8Field = reader.ReadInt8("i8Field");
+ int16_t i16Field = reader.ReadInt16("i16Field");
+ int32_t i32Field = reader.ReadInt32("i32Field");
+ int64_t i64Field = reader.ReadInt64("i64Field");
+ std::string strField = reader.ReadString("strField");
+ float floatField = reader.ReadFloat("floatField");
+ double doubleField = reader.ReadDouble("doubleField");
+ bool boolField = reader.ReadBool("boolField");
+ Guid guidField = reader.ReadGuid("guidField");
+ Date dateField = reader.ReadDate("dateField");
+ Timestamp timestampField = reader.ReadTimestamp("timestampField");
+
+ return TestType(i8Field, i16Field, i32Field, i64Field, strField,
+ floatField, doubleField, boolField, guidField, dateField,
+ timestampField);
+ }
+
+ IGNITE_BINARY_TYPE_END
+ }
+};
+
+#endif // _IGNITE_ODBC_TEST_TEST_TYPE
http://git-wip-us.apache.org/repos/asf/ignite/blob/075ab6fb/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
new file mode 100644
index 0000000..602f68f
--- /dev/null
+++ b/modules/platforms/cpp/odbc-test/include/test_utils.h
@@ -0,0 +1,57 @@
+/*
+ * 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/075ab6fb/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 f39e071..ddeabcb 100644
--- a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
+++ b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
@@ -91,8 +91,8 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
- <AdditionalIncludeDirectories>$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\src;$(ProjectDir)\..\..\os\win;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\odbc\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;BOOST_DATE_TIME_NO_LIB;BOOST_REGEX_NO_LIB;IGNITE_IMPL;IGNITE_FRIEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\src;$(ProjectDir)\..\..\os\win;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\odbc\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;BOOST_DATE_TIME_NO_LIB;BOOST_REGEX_NO_LIB;IGNITE_IMPL;IGNITE_FRIEND;IGNITE_TESTS_32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Async</ExceptionHandling>
</ClCompile>
<Link>
@@ -105,7 +105,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
- <AdditionalIncludeDirectories>$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\src;$(ProjectDir)\..\..\os\win;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\odbc\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\src;$(ProjectDir)\..\..\os\win;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\odbc\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;BOOST_DATE_TIME_NO_LIB;BOOST_REGEX_NO_LIB;IGNITE_IMPL;IGNITE_FRIEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Async</ExceptionHandling>
</ClCompile>
@@ -122,8 +122,8 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
- <AdditionalIncludeDirectories>$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\src;$(ProjectDir)\..\..\os\win;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\odbc\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;BOOST_DATE_TIME_NO_LIB;BOOST_REGEX_NO_LIB;IGNITE_IMPL;IGNITE_FRIEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\src;$(ProjectDir)\..\..\os\win;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\odbc\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;BOOST_DATE_TIME_NO_LIB;BOOST_REGEX_NO_LIB;IGNITE_IMPL;IGNITE_FRIEND;IGNITE_TESTS_32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Async</ExceptionHandling>
</ClCompile>
<Link>
@@ -140,7 +140,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
- <AdditionalIncludeDirectories>$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\src;$(ProjectDir)\..\..\os\win;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\odbc\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\src;$(ProjectDir)\..\..\os\win;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\odbc\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;BOOST_DATE_TIME_NO_LIB;BOOST_REGEX_NO_LIB;IGNITE_IMPL;IGNITE_FRIEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Async</ExceptionHandling>
</ClCompile>
@@ -166,14 +166,18 @@
<ClCompile Include="..\..\src\configuration_test.cpp" />
<ClCompile Include="..\..\src\connection_info_test.cpp" />
<ClCompile Include="..\..\src\cursor_test.cpp" />
+ <ClCompile Include="..\..\src\queries_test.cpp" />
<ClCompile Include="..\..\src\parser_test.cpp" />
<ClCompile Include="..\..\src\row_test.cpp" />
- <ClCompile Include="..\..\src\teamcity_boost.cpp" />
- <ClCompile Include="..\..\src\teamcity_messages.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" />
</ItemGroup>
<ItemGroup>
- <ClInclude Include="..\..\include\teamcity_messages.h" />
+ <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">
@@ -182,6 +186,12 @@
<ProjectReference Include="..\..\..\common\project\vs\common.vcxproj">
<Project>{4f7e4917-4612-4b96-9838-025711ade391}</Project>
</ProjectReference>
+ <ProjectReference Include="..\..\..\core\project\vs\core.vcxproj">
+ <Project>{e2dea693-f2ea-43c2-a813-053378f6e4db}</Project>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\config\queries-test.xml" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
http://git-wip-us.apache.org/repos/asf/ignite/blob/075ab6fb/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 3031b1c..d5f22b3 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
@@ -5,11 +5,17 @@
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
- <Filter Include="Code\teamcity">
+ <Filter Include="Externals">
+ <UniqueIdentifier>{cc75fc86-c08d-428a-8ae3-f9979e4588ab}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Code\CacheTypes">
+ <UniqueIdentifier>{43a56b9a-0f5c-4c22-8836-1102252497a4}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Code\TeamCity">
<UniqueIdentifier>{5438a56d-1009-412a-86e3-ceb1112af275}</UniqueIdentifier>
</Filter>
- <Filter Include="External">
- <UniqueIdentifier>{cc75fc86-c08d-428a-8ae3-f9979e4588ab}</UniqueIdentifier>
+ <Filter Include="Configs">
+ <UniqueIdentifier>{fe8a65d3-4f84-4051-ac62-cf4e0f788b43}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
@@ -22,12 +28,6 @@
<ClCompile Include="..\..\src\parser_test.cpp">
<Filter>Code</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\teamcity_boost.cpp">
- <Filter>Code\teamcity</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\teamcity_messages.cpp">
- <Filter>Code\teamcity</Filter>
- </ClCompile>
<ClCompile Include="..\..\src\application_data_buffer_test.cpp">
<Filter>Code</Filter>
</ClCompile>
@@ -44,36 +44,59 @@
<Filter>Code</Filter>
</ClCompile>
<ClCompile Include="..\..\..\odbc\src\app\application_data_buffer.cpp">
- <Filter>External</Filter>
+ <Filter>Externals</Filter>
</ClCompile>
<ClCompile Include="..\..\..\odbc\src\column.cpp">
- <Filter>External</Filter>
+ <Filter>Externals</Filter>
</ClCompile>
<ClCompile Include="..\..\..\odbc\src\config\configuration.cpp">
- <Filter>External</Filter>
+ <Filter>Externals</Filter>
</ClCompile>
<ClCompile Include="..\..\..\odbc\src\config\connection_info.cpp">
- <Filter>External</Filter>
+ <Filter>Externals</Filter>
</ClCompile>
<ClCompile Include="..\..\..\odbc\src\cursor.cpp">
- <Filter>External</Filter>
+ <Filter>Externals</Filter>
</ClCompile>
<ClCompile Include="..\..\..\odbc\src\decimal.cpp">
- <Filter>External</Filter>
+ <Filter>Externals</Filter>
</ClCompile>
<ClCompile Include="..\..\..\odbc\src\result_page.cpp">
- <Filter>External</Filter>
+ <Filter>Externals</Filter>
</ClCompile>
<ClCompile Include="..\..\..\odbc\src\row.cpp">
- <Filter>External</Filter>
+ <Filter>Externals</Filter>
</ClCompile>
<ClCompile Include="..\..\..\odbc\src\utility.cpp">
- <Filter>External</Filter>
+ <Filter>Externals</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\teamcity\teamcity_boost.cpp">
+ <Filter>Code\TeamCity</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\teamcity\teamcity_messages.cpp">
+ <Filter>Code\TeamCity</Filter>
+ </ClCompile>
+ <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\teamcity_messages.h">
- <Filter>Code\teamcity</Filter>
+ <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>
</ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\config\queries-test.xml">
+ <Filter>Configs</Filter>
+ </None>
+ </ItemGroup>
</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/075ab6fb/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 5a840ca..1eac1de 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,6 +28,8 @@
#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;
@@ -35,62 +37,7 @@ using namespace ignite::odbc;
using namespace ignite::odbc::app;
using namespace ignite::odbc::type_traits;
-/**
- * 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.
- */
-Date MakeDate(int year = 1900, int month = 1, int day = 1, int hour = 0,
- int min = 0, int sec = 0)
-{
- 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 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.
- */
-Timestamp MakeTimestamp(int year = 1900, int month = 1, int day = 1,
- int hour = 0, int min = 0, int sec = 0, long ns = 0)
-{
- 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 Timestamp(ct, ns);
-}
+using namespace test_utils;
BOOST_AUTO_TEST_SUITE(ApplicationDataBufferTestSuite)
@@ -103,28 +50,28 @@ BOOST_AUTO_TEST_CASE(TestPutIntToString)
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset);
appBuf.PutInt8(12);
- BOOST_REQUIRE(!strcmp(buffer, "12"));
- BOOST_REQUIRE(reslen == strlen("12"));
+ BOOST_CHECK(!strcmp(buffer, "12"));
+ BOOST_CHECK(reslen == strlen("12"));
appBuf.PutInt8(-12);
- BOOST_REQUIRE(!strcmp(buffer, "-12"));
- BOOST_REQUIRE(reslen == strlen("-12"));
+ BOOST_CHECK(!strcmp(buffer, "-12"));
+ BOOST_CHECK(reslen == strlen("-12"));
appBuf.PutInt16(9876);
- BOOST_REQUIRE(!strcmp(buffer, "9876"));
- BOOST_REQUIRE(reslen == strlen("9876"));
+ BOOST_CHECK(!strcmp(buffer, "9876"));
+ BOOST_CHECK(reslen == strlen("9876"));
appBuf.PutInt16(-9876);
- BOOST_REQUIRE(!strcmp(buffer, "-9876"));
- BOOST_REQUIRE(reslen == strlen("-9876"));
+ BOOST_CHECK(!strcmp(buffer, "-9876"));
+ BOOST_CHECK(reslen == strlen("-9876"));
appBuf.PutInt32(1234567);
- BOOST_REQUIRE(!strcmp(buffer, "1234567"));
- BOOST_REQUIRE(reslen == strlen("1234567"));
+ BOOST_CHECK(!strcmp(buffer, "1234567"));
+ BOOST_CHECK(reslen == strlen("1234567"));
appBuf.PutInt32(-1234567);
- BOOST_REQUIRE(!strcmp(buffer, "-1234567"));
- BOOST_REQUIRE(reslen == strlen("-1234567"));
+ BOOST_CHECK(!strcmp(buffer, "-1234567"));
+ BOOST_CHECK(reslen == strlen("-1234567"));
}
BOOST_AUTO_TEST_CASE(TestPutFloatToString)
@@ -136,20 +83,20 @@ BOOST_AUTO_TEST_CASE(TestPutFloatToString)
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset);
appBuf.PutFloat(12.42f);
- BOOST_REQUIRE(!strcmp(buffer, "12.42"));
- BOOST_REQUIRE(reslen == strlen("12.42"));
+ BOOST_CHECK(!strcmp(buffer, "12.42"));
+ BOOST_CHECK(reslen == strlen("12.42"));
appBuf.PutFloat(-12.42f);
- BOOST_REQUIRE(!strcmp(buffer, "-12.42"));
- BOOST_REQUIRE(reslen == strlen("-12.42"));
+ BOOST_CHECK(!strcmp(buffer, "-12.42"));
+ BOOST_CHECK(reslen == strlen("-12.42"));
appBuf.PutDouble(1000.21);
- BOOST_REQUIRE(!strcmp(buffer, "1000.21"));
- BOOST_REQUIRE(reslen == strlen("1000.21"));
+ BOOST_CHECK(!strcmp(buffer, "1000.21"));
+ BOOST_CHECK(reslen == strlen("1000.21"));
appBuf.PutDouble(-1000.21);
- BOOST_REQUIRE(!strcmp(buffer, "-1000.21"));
- BOOST_REQUIRE(reslen == strlen("-1000.21"));
+ BOOST_CHECK(!strcmp(buffer, "-1000.21"));
+ BOOST_CHECK(reslen == strlen("-1000.21"));
}
BOOST_AUTO_TEST_CASE(TestPutGuidToString)
@@ -164,8 +111,20 @@ BOOST_AUTO_TEST_CASE(TestPutGuidToString)
appBuf.PutGuid(guid);
- BOOST_REQUIRE(!strcmp(buffer, "1da1ef8f-39ff-4d62-8b72-e8e9f3371801"));
- BOOST_REQUIRE(reslen == strlen("1da1ef8f-39ff-4d62-8b72-e8e9f3371801"));
+ BOOST_CHECK(!strcmp(buffer, "1da1ef8f-39ff-4d62-8b72-e8e9f3371801"));
+ BOOST_CHECK(reslen == strlen("1da1ef8f-39ff-4d62-8b72-e8e9f3371801"));
+}
+
+BOOST_AUTO_TEST_CASE(TestGetGuidFromString)
+{
+ char buffer[] = "1da1ef8f-39ff-4d62-8b72-e8e9f3371801";
+ SqlLen reslen;
+
+ ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer) - 1, &reslen, 0);
+
+ ignite::Guid guid = appBuf.GetGuid();
+
+ BOOST_CHECK_EQUAL(guid, Guid(0x1da1ef8f39ff4d62ULL, 0x8b72e8e9f3371801ULL));
}
BOOST_AUTO_TEST_CASE(TestPutBinaryToString)
@@ -180,8 +139,8 @@ BOOST_AUTO_TEST_CASE(TestPutBinaryToString)
appBuf.PutBinaryData(binary, sizeof(binary));
- BOOST_REQUIRE(!strcmp(buffer, "2184f4dc0100fff0"));
- BOOST_REQUIRE(reslen == strlen("2184f4dc0100fff0"));
+ BOOST_CHECK(!strcmp(buffer, "2184f4dc0100fff0"));
+ BOOST_CHECK(reslen == strlen("2184f4dc0100fff0"));
}
BOOST_AUTO_TEST_CASE(TestPutStringToString)
@@ -196,8 +155,8 @@ BOOST_AUTO_TEST_CASE(TestPutStringToString)
appBuf.PutString(testString);
- BOOST_REQUIRE(!strcmp(buffer, testString.c_str()));
- BOOST_REQUIRE(reslen == testString.size());
+ BOOST_CHECK(!strcmp(buffer, testString.c_str()));
+ BOOST_CHECK(reslen == testString.size());
}
BOOST_AUTO_TEST_CASE(TestPutStringToWstring)
@@ -211,7 +170,7 @@ BOOST_AUTO_TEST_CASE(TestPutStringToWstring)
std::string testString("Test string");
appBuf.PutString(testString);
- BOOST_REQUIRE(!wcscmp(buffer, L"Test string"));
+ BOOST_CHECK(!wcscmp(buffer, L"Test string"));
}
BOOST_AUTO_TEST_CASE(TestPutStringToLong)
@@ -223,10 +182,10 @@ BOOST_AUTO_TEST_CASE(TestPutStringToLong)
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_LONG, &numBuf, sizeof(numBuf), &reslen, &offset);
appBuf.PutString("424242424");
- BOOST_REQUIRE(numBuf == 424242424L);
+ BOOST_CHECK(numBuf == 424242424L);
appBuf.PutString("-424242424");
- BOOST_REQUIRE(numBuf == -424242424L);
+ BOOST_CHECK(numBuf == -424242424L);
}
BOOST_AUTO_TEST_CASE(TestPutStringToTiny)
@@ -238,10 +197,10 @@ BOOST_AUTO_TEST_CASE(TestPutStringToTiny)
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_TINYINT, &numBuf, sizeof(numBuf), &reslen, &offset);
appBuf.PutString("12");
- BOOST_REQUIRE(numBuf == 12);
+ BOOST_CHECK(numBuf == 12);
appBuf.PutString("-12");
- BOOST_REQUIRE(numBuf == -12);
+ BOOST_CHECK(numBuf == -12);
}
BOOST_AUTO_TEST_CASE(TestPutStringToFloat)
@@ -253,10 +212,10 @@ BOOST_AUTO_TEST_CASE(TestPutStringToFloat)
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_FLOAT, &numBuf, sizeof(numBuf), &reslen, &offset);
appBuf.PutString("12.21");
- BOOST_REQUIRE_CLOSE_FRACTION(numBuf, 12.21, FLOAT_PRECISION);
+ BOOST_CHECK_CLOSE_FRACTION(numBuf, 12.21, FLOAT_PRECISION);
appBuf.PutString("-12.21");
- BOOST_REQUIRE_CLOSE_FRACTION(numBuf, -12.21, FLOAT_PRECISION);
+ BOOST_CHECK_CLOSE_FRACTION(numBuf, -12.21, FLOAT_PRECISION);
}
BOOST_AUTO_TEST_CASE(TestPutIntToFloat)
@@ -268,22 +227,22 @@ BOOST_AUTO_TEST_CASE(TestPutIntToFloat)
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_FLOAT, &numBuf, sizeof(numBuf), &reslen, &offset);
appBuf.PutInt8(5);
- BOOST_REQUIRE_CLOSE_FRACTION(numBuf, 5.0, FLOAT_PRECISION);
+ BOOST_CHECK_CLOSE_FRACTION(numBuf, 5.0, FLOAT_PRECISION);
appBuf.PutInt8(-5);
- BOOST_REQUIRE_CLOSE_FRACTION(numBuf, -5.0, FLOAT_PRECISION);
+ BOOST_CHECK_CLOSE_FRACTION(numBuf, -5.0, FLOAT_PRECISION);
appBuf.PutInt16(4242);
- BOOST_REQUIRE_CLOSE_FRACTION(numBuf, 4242.0, FLOAT_PRECISION);
+ BOOST_CHECK_CLOSE_FRACTION(numBuf, 4242.0, FLOAT_PRECISION);
appBuf.PutInt16(-4242);
- BOOST_REQUIRE_CLOSE_FRACTION(numBuf, -4242.0, FLOAT_PRECISION);
+ BOOST_CHECK_CLOSE_FRACTION(numBuf, -4242.0, FLOAT_PRECISION);
appBuf.PutInt32(1234567);
- BOOST_REQUIRE_CLOSE_FRACTION(numBuf, 1234567.0, FLOAT_PRECISION);
+ BOOST_CHECK_CLOSE_FRACTION(numBuf, 1234567.0, FLOAT_PRECISION);
appBuf.PutInt32(-1234567);
- BOOST_REQUIRE_CLOSE_FRACTION(numBuf, -1234567.0, FLOAT_PRECISION);
+ BOOST_CHECK_CLOSE_FRACTION(numBuf, -1234567.0, FLOAT_PRECISION);
}
BOOST_AUTO_TEST_CASE(TestPutFloatToShort)
@@ -295,16 +254,16 @@ BOOST_AUTO_TEST_CASE(TestPutFloatToShort)
ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_SHORT, &numBuf, sizeof(numBuf), &reslen, &offset);
appBuf.PutDouble(5.42);
- BOOST_REQUIRE(numBuf == 5);
+ BOOST_CHECK(numBuf == 5);
appBuf.PutDouble(-5.42);
- BOOST_REQUIRE(numBuf == -5.0);
+ BOOST_CHECK(numBuf == -5.0);
appBuf.PutFloat(42.99f);
- BOOST_REQUIRE(numBuf == 42);
+ BOOST_CHECK(numBuf == 42);
appBuf.PutFloat(-42.99f);
- BOOST_REQUIRE(numBuf == -42);
+ BOOST_CHECK(numBuf == -42);
}
BOOST_AUTO_TEST_CASE(TestPutDecimalToDouble)
@@ -316,24 +275,24 @@ BOOST_AUTO_TEST_CASE(TestPutDecimalToDouble)
Decimal decimal;
- BOOST_REQUIRE_CLOSE_FRACTION(static_cast<double>(decimal), 0.0, FLOAT_PRECISION);
+ BOOST_CHECK_CLOSE_FRACTION(static_cast<double>(decimal), 0.0, FLOAT_PRECISION);
appBuf.PutDecimal(decimal);
- BOOST_REQUIRE_CLOSE_FRACTION(numBuf, 0.0, FLOAT_PRECISION);
+ BOOST_CHECK_CLOSE_FRACTION(numBuf, 0.0, FLOAT_PRECISION);
int8_t mag1[] = { 1, 0 };
decimal = Decimal(0, mag1, sizeof(mag1));
appBuf.PutDecimal(decimal);
- BOOST_REQUIRE_CLOSE_FRACTION(numBuf, 256.0, FLOAT_PRECISION);
+ BOOST_CHECK_CLOSE_FRACTION(numBuf, 256.0, FLOAT_PRECISION);
int8_t mag2[] = { 2, 23 };
decimal = Decimal(1 | 0x80000000, mag2, sizeof(mag2));
appBuf.PutDecimal(decimal);
- BOOST_REQUIRE_CLOSE_FRACTION(numBuf, -53.5, FLOAT_PRECISION);
+ BOOST_CHECK_CLOSE_FRACTION(numBuf, -53.5, FLOAT_PRECISION);
}
BOOST_AUTO_TEST_CASE(TestPutDecimalToLong)
@@ -346,21 +305,21 @@ BOOST_AUTO_TEST_CASE(TestPutDecimalToLong)
Decimal decimal;
appBuf.PutDecimal(decimal);
- BOOST_REQUIRE(numBuf == 0);
+ BOOST_CHECK(numBuf == 0);
int8_t mag1[] = { 1, 0 };
decimal = Decimal(0, mag1, sizeof(mag1));
appBuf.PutDecimal(decimal);
- BOOST_REQUIRE(numBuf == 256);
+ BOOST_CHECK(numBuf == 256);
int8_t mag2[] = { 2, 23 };
decimal = Decimal(1 | 0x80000000, mag2, sizeof(mag2));
appBuf.PutDecimal(decimal);
- BOOST_REQUIRE(numBuf == -53);
+ BOOST_CHECK(numBuf == -53);
}
BOOST_AUTO_TEST_CASE(TestPutDecimalToString)
@@ -373,21 +332,72 @@ BOOST_AUTO_TEST_CASE(TestPutDecimalToString)
Decimal decimal;
appBuf.PutDecimal(decimal);
- BOOST_REQUIRE(std::string(strBuf, reslen) == "0");
+ BOOST_CHECK(std::string(strBuf, reslen) == "0");
int8_t mag1[] = { 1, 0 };
decimal = Decimal(0, mag1, sizeof(mag1));
appBuf.PutDecimal(decimal);
- BOOST_REQUIRE(std::string(strBuf, reslen) == "256");
+ BOOST_CHECK(std::string(strBuf, reslen) == "256");
int8_t mag2[] = { 2, 23 };
decimal = Decimal(1 | 0x80000000, mag2, sizeof(mag2));
appBuf.PutDecimal(decimal);
- BOOST_REQUIRE(std::string(strBuf, reslen) == "-53.5");
+ BOOST_CHECK(std::string(strBuf, reslen) == "-53.5");
+}
+
+BOOST_AUTO_TEST_CASE(TestPutDecimalToNumeric)
+{
+ SQL_NUMERIC_STRUCT buf;
+ SqlLen reslen;
+
+ ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_NUMERIC, &buf, sizeof(buf), &reslen, 0);
+
+ Decimal decimal;
+
+ appBuf.PutDecimal(decimal);
+ BOOST_CHECK_EQUAL(1, buf.sign); // Positive
+ BOOST_CHECK_EQUAL(0, buf.scale); // Scale is 0 by default according to specification
+ BOOST_CHECK_EQUAL(20, buf.precision); // Precision is driver specific. We use 20.
+
+ for (int i = 0; i < SQL_MAX_NUMERIC_LEN; ++i)
+ BOOST_CHECK_EQUAL(0, buf.val[i]);
+
+ // Trying to store 123.45 => 12345 => 0x3039 => [0x30, 0x39].
+ uint8_t mag1[] = { 0x30, 0x39 };
+
+ decimal = Decimal(2, reinterpret_cast<int8_t*>(mag1), sizeof(mag1));
+
+ appBuf.PutDecimal(decimal);
+ BOOST_CHECK_EQUAL(1, buf.sign); // Positive
+ BOOST_CHECK_EQUAL(0, buf.scale); // Scale is 0 by default according to specification
+ BOOST_CHECK_EQUAL(20, buf.precision); // Precision is driver specific. We use 20.
+
+ // 123.45 => (scale=0) 123 => 0x7B => [0x7B].
+ BOOST_CHECK_EQUAL(buf.val[0], 0x7B);
+
+ for (int i = 1; i < SQL_MAX_NUMERIC_LEN; ++i)
+ BOOST_CHECK_EQUAL(0, buf.val[i]);
+
+ // Trying to store 12345.678 => 12345678 => 0xBC614E => [0xBC, 0x61, 0x4E].
+ uint8_t mag2[] = { 0xBC, 0x61, 0x4E };
+
+ decimal = Decimal(3 | 0x80000000, reinterpret_cast<int8_t*>(mag2), sizeof(mag2));
+
+ appBuf.PutDecimal(decimal);
+ BOOST_CHECK_EQUAL(2, buf.sign); // Negative
+ BOOST_CHECK_EQUAL(0, buf.scale); // Scale is 0 by default according to specification
+ BOOST_CHECK_EQUAL(20, buf.precision); // Precision is driver specific. We use 20.
+
+ // 12345.678 => (scale=0) 12345 => 0x3039 => [0x39, 0x30].
+ BOOST_CHECK_EQUAL(buf.val[0], 0x39);
+ BOOST_CHECK_EQUAL(buf.val[1], 0x30);
+
+ for (int i = 2; i < SQL_MAX_NUMERIC_LEN; ++i)
+ BOOST_CHECK_EQUAL(0, buf.val[i]);
}
BOOST_AUTO_TEST_CASE(TestPutDateToString)
@@ -513,13 +523,13 @@ BOOST_AUTO_TEST_CASE(TestGetStringFromLong)
std::string res = appBuf.GetString(32);
- BOOST_REQUIRE(res == "42");
+ BOOST_CHECK(res == "42");
numBuf = -77;
res = appBuf.GetString(32);
- BOOST_REQUIRE(res == "-77");
+ BOOST_CHECK(res == "-77");
}
BOOST_AUTO_TEST_CASE(TestGetStringFromDouble)
@@ -532,13 +542,13 @@ BOOST_AUTO_TEST_CASE(TestGetStringFromDouble)
std::string res = appBuf.GetString(32);
- BOOST_REQUIRE(res == "43.36");
+ BOOST_CHECK(res == "43.36");
numBuf = -58.91;
res = appBuf.GetString(32);
- BOOST_REQUIRE(res == "-58.91");
+ BOOST_CHECK(res == "-58.91");
}
BOOST_AUTO_TEST_CASE(TestGetStringFromString)
@@ -551,7 +561,7 @@ BOOST_AUTO_TEST_CASE(TestGetStringFromString)
std::string res = appBuf.GetString(reslen);
- BOOST_REQUIRE(res.compare(buf));
+ BOOST_CHECK(res.compare(buf));
}
BOOST_AUTO_TEST_CASE(TestGetFloatFromUshort)
@@ -564,11 +574,11 @@ BOOST_AUTO_TEST_CASE(TestGetFloatFromUshort)
float resFloat = appBuf.GetFloat();
- BOOST_REQUIRE_CLOSE_FRACTION(resFloat, 7162.0f, FLOAT_PRECISION);
+ BOOST_CHECK_CLOSE_FRACTION(resFloat, 7162.0f, FLOAT_PRECISION);
double resDouble = appBuf.GetDouble();
- BOOST_REQUIRE_CLOSE_FRACTION(resDouble, 7162.0, FLOAT_PRECISION);
+ BOOST_CHECK_CLOSE_FRACTION(resDouble, 7162.0, FLOAT_PRECISION);
}
BOOST_AUTO_TEST_CASE(TestGetFloatFromString)
@@ -581,11 +591,11 @@ BOOST_AUTO_TEST_CASE(TestGetFloatFromString)
float resFloat = appBuf.GetFloat();
- BOOST_REQUIRE_CLOSE_FRACTION(resFloat, 28.562f, FLOAT_PRECISION);
+ BOOST_CHECK_CLOSE_FRACTION(resFloat, 28.562f, FLOAT_PRECISION);
double resDouble = appBuf.GetDouble();
- BOOST_REQUIRE_CLOSE_FRACTION(resDouble, 28.562, FLOAT_PRECISION);
+ BOOST_CHECK_CLOSE_FRACTION(resDouble, 28.562, FLOAT_PRECISION);
}
BOOST_AUTO_TEST_CASE(TestGetFloatFromFloat)
@@ -598,11 +608,11 @@ BOOST_AUTO_TEST_CASE(TestGetFloatFromFloat)
float resFloat = appBuf.GetFloat();
- BOOST_REQUIRE_CLOSE_FRACTION(resFloat, 207.49f, FLOAT_PRECISION);
+ BOOST_CHECK_CLOSE_FRACTION(resFloat, 207.49f, FLOAT_PRECISION);
double resDouble = appBuf.GetDouble();
- BOOST_REQUIRE_CLOSE_FRACTION(resDouble, 207.49, FLOAT_PRECISION);
+ BOOST_CHECK_CLOSE_FRACTION(resDouble, 207.49, FLOAT_PRECISION);
}
BOOST_AUTO_TEST_CASE(TestGetFloatFromDouble)
@@ -615,11 +625,11 @@ BOOST_AUTO_TEST_CASE(TestGetFloatFromDouble)
float resFloat = appBuf.GetFloat();
- BOOST_REQUIRE_CLOSE_FRACTION(resFloat, 893.162f, FLOAT_PRECISION);
+ BOOST_CHECK_CLOSE_FRACTION(resFloat, 893.162f, FLOAT_PRECISION);
double resDouble = appBuf.GetDouble();
- BOOST_REQUIRE_CLOSE_FRACTION(resDouble, 893.162, FLOAT_PRECISION);
+ BOOST_CHECK_CLOSE_FRACTION(resDouble, 893.162, FLOAT_PRECISION);
}
BOOST_AUTO_TEST_CASE(TestGetIntFromString)
@@ -632,19 +642,19 @@ BOOST_AUTO_TEST_CASE(TestGetIntFromString)
int64_t resInt64 = appBuf.GetInt64();
- BOOST_REQUIRE(resInt64 == 39);
+ BOOST_CHECK(resInt64 == 39);
int32_t resInt32 = appBuf.GetInt32();
- BOOST_REQUIRE(resInt32 == 39);
+ BOOST_CHECK(resInt32 == 39);
int16_t resInt16 = appBuf.GetInt16();
- BOOST_REQUIRE(resInt16 == 39);
+ BOOST_CHECK(resInt16 == 39);
int8_t resInt8 = appBuf.GetInt8();
- BOOST_REQUIRE(resInt8 == 39);
+ BOOST_CHECK(resInt8 == 39);
}
BOOST_AUTO_TEST_CASE(TestGetIntFromFloat)
@@ -657,19 +667,19 @@ BOOST_AUTO_TEST_CASE(TestGetIntFromFloat)
int64_t resInt64 = appBuf.GetInt64();
- BOOST_REQUIRE(resInt64 == -107);
+ BOOST_CHECK(resInt64 == -107);
int32_t resInt32 = appBuf.GetInt32();
- BOOST_REQUIRE(resInt32 == -107);
+ BOOST_CHECK(resInt32 == -107);
int16_t resInt16 = appBuf.GetInt16();
- BOOST_REQUIRE(resInt16 == -107);
+ BOOST_CHECK(resInt16 == -107);
int8_t resInt8 = appBuf.GetInt8();
- BOOST_REQUIRE(resInt8 == -107);
+ BOOST_CHECK(resInt8 == -107);
}
BOOST_AUTO_TEST_CASE(TestGetIntFromDouble)
@@ -682,19 +692,19 @@ BOOST_AUTO_TEST_CASE(TestGetIntFromDouble)
int64_t resInt64 = appBuf.GetInt64();
- BOOST_REQUIRE(resInt64 == 42);
+ BOOST_CHECK(resInt64 == 42);
int32_t resInt32 = appBuf.GetInt32();
- BOOST_REQUIRE(resInt32 == 42);
+ BOOST_CHECK(resInt32 == 42);
int16_t resInt16 = appBuf.GetInt16();
- BOOST_REQUIRE(resInt16 == 42);
+ BOOST_CHECK(resInt16 == 42);
int8_t resInt8 = appBuf.GetInt8();
- BOOST_REQUIRE(resInt8 == 42);
+ BOOST_CHECK(resInt8 == 42);
}
BOOST_AUTO_TEST_CASE(TestGetIntFromBigint)
@@ -707,19 +717,19 @@ BOOST_AUTO_TEST_CASE(TestGetIntFromBigint)
int64_t resInt64 = appBuf.GetInt64();
- BOOST_REQUIRE(resInt64 == 19);
+ BOOST_CHECK(resInt64 == 19);
int32_t resInt32 = appBuf.GetInt32();
- BOOST_REQUIRE(resInt32 == 19);
+ BOOST_CHECK(resInt32 == 19);
int16_t resInt16 = appBuf.GetInt16();
- BOOST_REQUIRE(resInt16 == 19);
+ BOOST_CHECK(resInt16 == 19);
int8_t resInt8 = appBuf.GetInt8();
- BOOST_REQUIRE(resInt8 == 19);
+ BOOST_CHECK(resInt8 == 19);
}
BOOST_AUTO_TEST_CASE(TestGetIntWithOffset)
@@ -742,19 +752,19 @@ BOOST_AUTO_TEST_CASE(TestGetIntWithOffset)
int64_t val = appBuf.GetInt64();
- BOOST_REQUIRE(val == 12);
+ BOOST_CHECK(val == 12);
offset += sizeof(TestStruct);
val = appBuf.GetInt64();
- BOOST_REQUIRE(val == 42);
+ BOOST_CHECK(val == 42);
offsetPtr = 0;
val = appBuf.GetInt64();
- BOOST_REQUIRE(val == 12);
+ BOOST_CHECK(val == 12);
}
BOOST_AUTO_TEST_CASE(TestSetStringWithOffset)
@@ -779,9 +789,9 @@ BOOST_AUTO_TEST_CASE(TestSetStringWithOffset)
std::string res(buf[0].val, buf[0].reslen);
- BOOST_REQUIRE(buf[0].reslen == strlen("Hello Ignite!"));
- BOOST_REQUIRE(res == "Hello Ignite!");
- BOOST_REQUIRE(res.size() == strlen("Hello Ignite!"));
+ BOOST_CHECK(buf[0].reslen == strlen("Hello Ignite!"));
+ BOOST_CHECK(res == "Hello Ignite!");
+ BOOST_CHECK(res.size() == strlen("Hello Ignite!"));
offset += sizeof(TestStruct);
@@ -789,15 +799,15 @@ BOOST_AUTO_TEST_CASE(TestSetStringWithOffset)
res.assign(buf[0].val, buf[0].reslen);
- BOOST_REQUIRE(res == "Hello Ignite!");
- BOOST_REQUIRE(res.size() == strlen("Hello Ignite!"));
- BOOST_REQUIRE(buf[0].reslen == strlen("Hello Ignite!"));
+ BOOST_CHECK(res == "Hello Ignite!");
+ BOOST_CHECK(res.size() == strlen("Hello Ignite!"));
+ BOOST_CHECK(buf[0].reslen == strlen("Hello Ignite!"));
res.assign(buf[1].val, buf[1].reslen);
- BOOST_REQUIRE(res == "Hello with offset!");
- BOOST_REQUIRE(res.size() == strlen("Hello with offset!"));
- BOOST_REQUIRE(buf[1].reslen == strlen("Hello with offset!"));
+ BOOST_CHECK(res == "Hello with offset!");
+ BOOST_CHECK(res.size() == strlen("Hello with offset!"));
+ BOOST_CHECK(buf[1].reslen == strlen("Hello with offset!"));
}
BOOST_AUTO_TEST_CASE(TestGetDateFromString)
@@ -814,7 +824,7 @@ BOOST_AUTO_TEST_CASE(TestGetDateFromString)
time_t cTime = utility::DateToCTime(date);
- tm *tmDate = gmtime(&cTime);
+ tm *tmDate = std::gmtime(&cTime);
BOOST_REQUIRE(tmDate != 0);
@@ -828,6 +838,11 @@ BOOST_AUTO_TEST_CASE(TestGetDateFromString)
BOOST_AUTO_TEST_CASE(TestGetTimestampFromString)
{
+ LOG_MSG("Test\n");
+ LOG_MSG("Test\n");
+ LOG_MSG("Test\n");
+ LOG_MSG("Test\n");
+
char buf[] = "2018-11-01 17:45:59";
SqlLen reslen = sizeof(buf);
@@ -840,7 +855,7 @@ BOOST_AUTO_TEST_CASE(TestGetTimestampFromString)
time_t cTime = utility::TimestampToCTime(date);
- tm *tmDate = gmtime(&cTime);
+ tm *tmDate = std::gmtime(&cTime);
BOOST_REQUIRE(tmDate != 0);
@@ -871,7 +886,7 @@ BOOST_AUTO_TEST_CASE(TestGetDateFromDate)
time_t cTime = utility::DateToCTime(date);
- tm *tmDate = gmtime(&cTime);
+ tm *tmDate = std::gmtime(&cTime);
BOOST_REQUIRE(tmDate != 0);
@@ -902,7 +917,7 @@ BOOST_AUTO_TEST_CASE(TestGetTimestampFromDate)
time_t cTime = utility::TimestampToCTime(ts);
- tm *tmDate = gmtime(&cTime);
+ tm *tmDate = std::gmtime(&cTime);
BOOST_REQUIRE(tmDate != 0);
@@ -937,7 +952,7 @@ BOOST_AUTO_TEST_CASE(TestGetTimestampFromTimestamp)
time_t cTime = utility::TimestampToCTime(ts);
- tm *tmDate = gmtime(&cTime);
+ tm *tmDate = std::gmtime(&cTime);
BOOST_REQUIRE(tmDate != 0);
@@ -973,7 +988,7 @@ BOOST_AUTO_TEST_CASE(TestGetDateFromTimestamp)
time_t cTime = utility::DateToCTime(date);
- tm *tmDate = gmtime(&cTime);
+ tm *tmDate = std::gmtime(&cTime);
BOOST_REQUIRE(tmDate != 0);
@@ -985,4 +1000,4 @@ BOOST_AUTO_TEST_CASE(TestGetDateFromTimestamp)
BOOST_CHECK_EQUAL(51, tmDate->tm_sec);
}
-BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
+BOOST_AUTO_TEST_SUITE_END()
http://git-wip-us.apache.org/repos/asf/ignite/blob/075ab6fb/modules/platforms/cpp/odbc-test/src/configuration_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/configuration_test.cpp b/modules/platforms/cpp/odbc-test/src/configuration_test.cpp
index fba46cc..85aa3ff 100644
--- a/modules/platforms/cpp/odbc-test/src/configuration_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/configuration_test.cpp
@@ -103,6 +103,24 @@ BOOST_AUTO_TEST_CASE(TestConnectStringLowercase)
CheckConnectionConfig(cfg);
}
+BOOST_AUTO_TEST_CASE(TestConnectStringZeroTerminated)
+{
+ Configuration cfg;
+
+ std::stringstream constructor;
+
+ constructor << "driver={" << testDriverName << "};"
+ << "server=" << testServerHost << ";"
+ << "port=" << testServerPort << ";"
+ << "cache=" << testCacheName;
+
+ const std::string& connectStr = constructor.str();
+
+ cfg.FillFromConnectString(connectStr.c_str(), connectStr.size() + 1);
+
+ CheckConnectionConfig(cfg);
+}
+
BOOST_AUTO_TEST_CASE(TestConnectStringMixed)
{
Configuration cfg;
@@ -203,4 +221,4 @@ BOOST_AUTO_TEST_CASE(TestDsnStrinWhitespaces)
CheckDsnConfig(cfg);
}
-BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
+BOOST_AUTO_TEST_SUITE_END()