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 2015/09/22 08:40:11 UTC
[25/28] ignite git commit: IGNITE-1513: Moved CPP.
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core-test/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core-test/Makefile.am b/modules/platform/cpp/core-test/Makefile.am
new file mode 100644
index 0000000..9ed3111
--- /dev/null
+++ b/modules/platform/cpp/core-test/Makefile.am
@@ -0,0 +1,49 @@
+##
+## 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.
+##
+
+ACLOCAL_AMFLAGS = "-Im4"
+
+SUBDIRS = . include
+DIST_SUBDIRS = . include
+
+AM_CPPFLAGS = -I$(srcdir)/include -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -DIGNITE_IMPL
+AM_CXXFLAGS = -Wall -std=c++0x
+
+noinst_PROGRAMS = ignite-tests
+
+ignite_tests_SOURCES = src/cache_test.cpp \
+ src/cache_query_test.cpp \
+ src/concurrent_test.cpp \
+ src/ignition_test.cpp \
+ src/handle_registry_test.cpp \
+ src/portable_test_defs.cpp \
+ src/portable_reader_writer_raw_test.cpp \
+ src/portable_reader_writer_test.cpp \
+ src/portable_session_test.cpp \
+ src/teamcity_messages.cpp \
+ src/teamcity_boost.cpp
+
+ignite_tests_LDFLAGS = -static-libtool-libs -L/usr/local/lib -lignite
+
+run-check: check
+ ./ignite-tests -p
+
+clean-local: clean-check
+ $(RM) *.gcno *.gcda
+
+clean-check:
+ $(RM) $(ignite_tests_OBJECTS)
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core-test/config/cache-query.xml
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core-test/config/cache-query.xml b/modules/platform/cpp/core-test/config/cache-query.xml
new file mode 100644
index 0000000..160fe49
--- /dev/null
+++ b/modules/platform/cpp/core-test/config/cache-query.xml
@@ -0,0 +1,91 @@
+<?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="cache"/>
+ <property name="cacheMode" value="PARTITIONED"/>
+ <property name="atomicityMode" value="TRANSACTIONAL"/>
+ <property name="writeSynchronizationMode" value="FULL_SYNC"/>
+
+ <property name="affinity">
+ <bean class="org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction">
+ <property name="partitions" value="256"/>
+ </bean>
+ </property>
+
+ <property name="typeMetadata">
+ <list>
+ <bean class="org.apache.ignite.cache.CacheTypeMetadata">
+ <property name="valueType" value="QueryPerson"/>
+ <property name="ascendingFields">
+ <map>
+ <entry key="age" value="java.lang.Integer"/>
+ </map>
+ </property>
+ <property name="queryFields">
+ <map>
+ <entry key="name" value="java.lang.String"/>
+ <entry key="age" value="java.lang.Integer"/>
+ </map>
+ </property>
+ <property name="textFields">
+ <list>
+ <value>name</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..47501</value>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+ </property>
+ </bean>
+</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core-test/config/cache-test.xml
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core-test/config/cache-test.xml b/modules/platform/cpp/core-test/config/cache-test.xml
new file mode 100644
index 0000000..f239ba9
--- /dev/null
+++ b/modules/platform/cpp/core-test/config/cache-test.xml
@@ -0,0 +1,129 @@
+<?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="includeEventTypes">
+ <util:constant static-field="org.apache.ignite.events.EventType.EVTS_CACHE"/>
+ </property>
+
+ <property name="cacheConfiguration">
+ <list>
+ <bean parent="cache-template">
+ <property name="name" value="local"/>
+ <property name="cacheMode" value="LOCAL"/>
+ <property name="atomicityMode" value="TRANSACTIONAL"/>
+ </bean>
+
+ <bean parent="cache-template">
+ <property name="name" value="local_atomic"/>
+ <property name="cacheMode" value="LOCAL"/>
+ <property name="atomicityMode" value="ATOMIC"/>
+ </bean>
+
+ <bean parent="cache-template">
+ <property name="name" value="partitioned"/>
+ <property name="cacheMode" value="PARTITIONED"/>
+ <property name="atomicityMode" value="TRANSACTIONAL"/>
+ </bean>
+
+ <bean parent="cache-template">
+ <property name="name" value="partitioned_atomic"/>
+ <property name="cacheMode" value="PARTITIONED"/>
+ <property name="atomicityMode" value="ATOMIC"/>
+ <property name="atomicWriteOrderMode" value="PRIMARY"/>
+ </bean>
+
+ <bean parent="cache-template">
+ <property name="name" value="partitioned_near"/>
+ <property name="cacheMode" value="PARTITIONED"/>
+ <property name="atomicityMode" value="TRANSACTIONAL"/>
+ <property name="nearConfiguration">
+ <bean class="org.apache.ignite.configuration.NearCacheConfiguration" />
+ </property>
+ </bean>
+
+ <bean parent="cache-template">
+ <property name="name" value="partitioned_atomic_near"/>
+ <property name="cacheMode" value="PARTITIONED"/>
+ <property name="atomicityMode" value="ATOMIC"/>
+ <property name="atomicWriteOrderMode" value="PRIMARY"/>
+ <property name="nearConfiguration">
+ <bean class="org.apache.ignite.configuration.NearCacheConfiguration" />
+ </property>
+ </bean>
+
+ <bean parent="cache-template">
+ <property name="name" value="replicated"/>
+ <property name="cacheMode" value="REPLICATED"/>
+ <property name="atomicityMode" value="TRANSACTIONAL"/>
+ </bean>
+
+ <bean parent="cache-template">
+ <property name="name" value="replicated_atomic"/>
+ <property name="cacheMode" value="REPLICATED"/>
+ <property name="atomicityMode" value="ATOMIC"/>
+ <property name="atomicWriteOrderMode" value="PRIMARY"/>
+ </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..47501</value>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+ </property>
+
+ <property name="transactionConfiguration">
+ <bean class="org.apache.ignite.configuration.TransactionConfiguration">
+ <property name="txSerializableEnabled" value="true"/>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="cache-template" abstract="true" class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="rebalanceMode" value="SYNC"/>
+ <property name="writeSynchronizationMode" value="FULL_SYNC"/>
+ <property name="swapEnabled" value="true"/>
+ <property name="backups" value="1"/>
+ <property name="eagerTtl" value="true"/>
+ </bean>
+</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core-test/configure.ac
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core-test/configure.ac b/modules/platform/cpp/core-test/configure.ac
new file mode 100644
index 0000000..b337fba
--- /dev/null
+++ b/modules/platform/cpp/core-test/configure.ac
@@ -0,0 +1,62 @@
+#
+# 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.
+#
+
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.69])
+AC_INIT([Apache Ignite C++ Test], [1.5.0], [dev@ignite.apache.org], [ignite], [ignite.apache.org])
+AC_CONFIG_SRCDIR(src)
+
+AC_CANONICAL_SYSTEM
+AC_CONFIG_MACRO_DIR([m4])
+AC_LANG([C++])
+
+# Initialize automake
+AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
+AC_CONFIG_HEADER(config.h)
+
+AM_PROG_AR
+
+# Checks for programs.
+GXX="-g -O2"
+
+AC_PROG_CXX
+
+# Initialize Libtool
+LT_INIT
+
+# Checks for libraries.
+AC_CHECK_LIB([pthread], [pthread_mutex_lock])
+
+# Checks for header files.
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_INLINE
+AC_TYPE_INT16_T
+AC_TYPE_INT32_T
+AC_TYPE_INT64_T
+AC_TYPE_INT8_T
+AC_TYPE_PID_T
+AC_TYPE_SIZE_T
+
+# Checks for library functions.
+AC_FUNC_ERROR_AT_LINE
+
+AC_CONFIG_FILES(Makefile include/Makefile)
+
+AC_OUTPUT
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core-test/include/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core-test/include/Makefile.am b/modules/platform/cpp/core-test/include/Makefile.am
new file mode 100644
index 0000000..c43103e
--- /dev/null
+++ b/modules/platform/cpp/core-test/include/Makefile.am
@@ -0,0 +1,22 @@
+##
+## 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.
+##
+
+ACLOCAL_AMFLAGS = "-Im4"
+
+nobase_include_HEADERS = teamcity_messages.h \
+ ignite/portable_test_defs.h \
+ ignite/portable_test_utils.h
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core-test/include/ignite/portable_test_defs.h
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core-test/include/ignite/portable_test_defs.h b/modules/platform/cpp/core-test/include/ignite/portable_test_defs.h
new file mode 100644
index 0000000..bae0118
--- /dev/null
+++ b/modules/platform/cpp/core-test/include/ignite/portable_test_defs.h
@@ -0,0 +1,320 @@
+/*
+ * 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_PORTABLE_TEST_DEFS
+#define _IGNITE_PORTABLE_TEST_DEFS
+
+#include <stdexcept>
+#include <stdint.h>
+
+#include "ignite/portable/portable.h"
+
+namespace ignite_test
+{
+ namespace core
+ {
+ namespace portable
+ {
+ class PortableDummy
+ {
+ // No-op.
+ };
+
+ class PortableInner
+ {
+ public:
+ PortableInner();
+
+ PortableInner(int32_t val);
+
+ int32_t GetValue() const;
+ private:
+ int32_t val;
+ };
+
+ class PortableOuter
+ {
+ public:
+ PortableOuter(int32_t valIn, int32_t valOut);
+
+ PortableInner GetInner() const;
+
+ int32_t GetValue() const;
+ private:
+ PortableInner inner;
+ int32_t val;
+ };
+
+ struct PortableFields
+ {
+ int32_t val1;
+ int32_t val2;
+ int32_t rawVal1;
+ int32_t rawVal2;
+
+ PortableFields() : val1(0), val2(0), rawVal1(0), rawVal2(0)
+ {
+ // No-op.
+ }
+
+ PortableFields(int32_t val1, int32_t val2, int32_t rawVal1, int32_t rawVal2) :
+ val1(val1), val2(val2), rawVal1(rawVal1), rawVal2(rawVal2)
+ {
+ // No-op.
+ }
+ };
+ }
+ }
+}
+
+namespace ignite
+{
+ namespace portable
+ {
+ namespace gt = ignite_test::core::portable;
+
+ template<>
+ struct PortableType<gt::PortableDummy>
+ {
+ /** <inheritdoc /> */
+ int32_t GetTypeId()
+ {
+ return GetPortableStringHashCode("PortableDummy");
+ }
+
+ /** <inheritdoc /> */
+ std::string GetTypeName()
+ {
+ return "PortableDummy";
+ }
+
+ /** <inheritdoc /> */
+ int32_t GetFieldId(const char* name)
+ {
+ return GetPortableStringHashCode(name);
+ }
+
+ /** <inheritdoc /> */
+ int32_t GetHashCode(const gt::PortableInner& obj)
+ {
+ return obj.GetValue();
+ }
+
+ /** <inheritdoc /> */
+ bool IsNull(const gt::PortableInner& obj)
+ {
+ return obj.GetValue() == 0;
+ }
+
+ /** <inheritdoc /> */
+ gt::PortableInner GetNull()
+ {
+ return gt::PortableInner(0);
+ }
+
+ /** <inheritdoc /> */
+ void Write(PortableWriter& writer, const gt::PortableDummy& obj)
+ {
+ // No-op.
+ }
+
+ /** <inheritdoc /> */
+ gt::PortableDummy Read(PortableReader& reader)
+ {
+ return gt::PortableDummy();
+ }
+ };
+
+ template<>
+ struct PortableType<gt::PortableInner>
+ {
+ /** <inheritdoc /> */
+ int32_t GetTypeId()
+ {
+ return GetPortableStringHashCode("PortableInner");
+ }
+
+ /** <inheritdoc /> */
+ std::string GetTypeName()
+ {
+ return "PortableInner";
+ }
+
+ /** <inheritdoc /> */
+ int32_t GetFieldId(const char* name)
+ {
+ return GetPortableStringHashCode(name);
+ }
+
+ /** <inheritdoc /> */
+ int32_t GetHashCode(const gt::PortableInner& obj)
+ {
+ return obj.GetValue();
+ }
+
+ /** <inheritdoc /> */
+ bool IsNull(const gt::PortableInner& obj)
+ {
+ return obj.GetValue() == 0;
+ }
+
+ /** <inheritdoc /> */
+ gt::PortableInner GetNull()
+ {
+ return gt::PortableInner(0);
+ }
+
+ /** <inheritdoc /> */
+ void Write(PortableWriter& writer, const gt::PortableInner& obj)
+ {
+ writer.WriteInt32("val", obj.GetValue());
+ }
+
+ /** <inheritdoc /> */
+ gt::PortableInner Read(PortableReader& reader)
+ {
+ int val = reader.ReadInt32("val");
+
+ return gt::PortableInner(val);
+ }
+ };
+
+ template<>
+ struct PortableType<gt::PortableOuter>
+ {
+ /** <inheritdoc /> */
+ int32_t GetTypeId()
+ {
+ return GetPortableStringHashCode("PortableOuter");
+ }
+
+ /** <inheritdoc /> */
+ std::string GetTypeName()
+ {
+ return "PortableOuter";
+ }
+
+ /** <inheritdoc /> */
+ int32_t GetFieldId(const char* name)
+ {
+ return GetPortableStringHashCode(name);
+ }
+
+ /** <inheritdoc /> */
+ int32_t GetHashCode(const gt::PortableOuter& obj)
+ {
+ return obj.GetValue() + obj.GetInner().GetValue();
+ }
+
+ /** <inheritdoc /> */
+ bool IsNull(const gt::PortableOuter& obj)
+ {
+ return obj.GetValue() == 0 && obj.GetInner().GetValue();
+ }
+
+ /** <inheritdoc /> */
+ gt::PortableOuter GetNull()
+ {
+ return gt::PortableOuter(0, 0);
+ }
+
+ /** <inheritdoc /> */
+ void Write(PortableWriter& writer, const gt::PortableOuter& obj)
+ {
+ writer.WriteObject("inner", obj.GetInner());
+ writer.WriteInt32("val", obj.GetValue());
+ }
+
+ /** <inheritdoc /> */
+ gt::PortableOuter Read(PortableReader& reader)
+ {
+ gt::PortableInner inner = reader.ReadObject<gt::PortableInner>("inner");
+ int val = reader.ReadInt32("val");
+
+ return gt::PortableOuter(inner.GetValue(), val);
+ }
+ };
+
+ template<>
+ struct PortableType<gt::PortableFields>
+ {
+ /** <inheritdoc /> */
+ int32_t GetTypeId()
+ {
+ return GetPortableStringHashCode("PortableFields");
+ }
+
+ /** <inheritdoc /> */
+ std::string GetTypeName()
+ {
+ return "PortableFields";
+ }
+
+ /** <inheritdoc /> */
+ int32_t GetFieldId(const char* name)
+ {
+ return GetPortableStringHashCode(name);
+ }
+
+ /** <inheritdoc /> */
+ int32_t GetHashCode(const gt::PortableFields& obj)
+ {
+ return obj.val1 + obj.val2 + obj.rawVal1 + obj.rawVal2;
+ }
+
+ /** <inheritdoc /> */
+ bool IsNull(const gt::PortableFields& obj)
+ {
+ return false;
+ }
+
+ /** <inheritdoc /> */
+ gt::PortableFields GetNull()
+ {
+ throw std::runtime_error("Must not be called.");
+ }
+
+ /** <inheritdoc /> */
+ void Write(PortableWriter& writer, const gt::PortableFields& obj)
+ {
+ writer.WriteInt32("val1", obj.val1);
+ writer.WriteInt32("val2", obj.val2);
+
+ PortableRawWriter rawWriter = writer.RawWriter();
+
+ rawWriter.WriteInt32(obj.rawVal1);
+ rawWriter.WriteInt32(obj.rawVal2);
+ }
+
+ /** <inheritdoc /> */
+ gt::PortableFields Read(PortableReader& reader)
+ {
+ int32_t val1 = reader.ReadInt32("val1");
+ int32_t val2 = reader.ReadInt32("val2");
+
+ PortableRawReader rawReader = reader.RawReader();
+
+ int32_t rawVal1 = rawReader.ReadInt32();
+ int32_t rawVal2 = rawReader.ReadInt32();
+
+ return gt::PortableFields(val1, val2, rawVal1, rawVal2);
+ }
+ };
+ }
+}
+
+#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core-test/include/ignite/portable_test_utils.h
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core-test/include/ignite/portable_test_utils.h b/modules/platform/cpp/core-test/include/ignite/portable_test_utils.h
new file mode 100644
index 0000000..62f99f9
--- /dev/null
+++ b/modules/platform/cpp/core-test/include/ignite/portable_test_utils.h
@@ -0,0 +1,516 @@
+/*
+ * 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_PORTABLE_TEST_UTILS
+#define _IGNITE_PORTABLE_TEST_UTILS
+
+#include "ignite/portable/portable.h"
+
+using namespace ignite;
+using namespace ignite::portable;
+using namespace ignite::impl::portable;
+
+namespace ignite_test
+{
+ namespace core
+ {
+ namespace portable
+ {
+ template<typename T>
+ inline void Write(PortableRawWriter& writer, T val)
+ {
+ throw std::runtime_error("Function is not defined");
+ }
+
+ template<typename T>
+ inline T Read(PortableRawReader& reader)
+ {
+ throw std::runtime_error("Function is not defined");
+ }
+
+ template<>
+ inline void Write(PortableRawWriter& writer, int8_t val)
+ {
+ writer.WriteInt8(val);
+ }
+
+ template<>
+ inline int8_t Read(PortableRawReader& reader)
+ {
+ return reader.ReadInt8();
+ }
+
+ template<>
+ inline void Write(PortableRawWriter& writer, bool val)
+ {
+ writer.WriteBool(val);
+ }
+
+ template<>
+ inline bool Read(PortableRawReader& reader)
+ {
+ return reader.ReadBool();
+ }
+
+ template<>
+ inline void Write(PortableRawWriter& writer, int16_t val)
+ {
+ writer.WriteInt16(val);
+ }
+
+ template<>
+ inline int16_t Read(PortableRawReader& reader)
+ {
+ return reader.ReadInt16();
+ }
+
+ template<>
+ inline void Write(PortableRawWriter& writer, uint16_t val)
+ {
+ writer.WriteUInt16(val);
+ }
+
+ template<>
+ inline uint16_t Read(PortableRawReader& reader)
+ {
+ return reader.ReadUInt16();
+ }
+
+ template<>
+ inline void Write(PortableRawWriter& writer, int32_t val)
+ {
+ writer.WriteInt32(val);
+ }
+
+ template<>
+ inline int32_t Read(PortableRawReader& reader)
+ {
+ return reader.ReadInt32();
+ }
+
+ template<>
+ inline void Write(PortableRawWriter& writer, int64_t val)
+ {
+ writer.WriteInt64(val);
+ }
+
+ template<>
+ inline int64_t Read(PortableRawReader& reader)
+ {
+ return reader.ReadInt64();
+ }
+
+ template<>
+ inline void Write(PortableRawWriter& writer, float val)
+ {
+ writer.WriteFloat(val);
+ }
+
+ template<>
+ inline float Read(PortableRawReader& reader)
+ {
+ return reader.ReadFloat();
+ }
+
+ template<>
+ inline void Write(PortableRawWriter& writer, double val)
+ {
+ writer.WriteDouble(val);
+ }
+
+ template<>
+ inline double Read(PortableRawReader& reader)
+ {
+ return reader.ReadDouble();
+ }
+
+ template<>
+ inline void Write(PortableRawWriter& writer, Guid val)
+ {
+ writer.WriteGuid(val);
+ }
+
+ template<>
+ inline Guid Read(PortableRawReader& reader)
+ {
+ return reader.ReadGuid();
+ }
+
+ template<typename T>
+ inline void WriteArray(PortableRawWriter& writer, T* val, int32_t len)
+ {
+ throw std::runtime_error("Function is not defined");
+ }
+
+ template<typename T>
+ inline int32_t ReadArray(PortableRawReader& reader, T* val, int32_t len)
+ {
+ throw std::runtime_error("Function is not defined");
+ }
+
+ template<>
+ inline void WriteArray(PortableRawWriter& writer, int8_t* val, int32_t len)
+ {
+ writer.WriteInt8Array(val, len);
+ }
+
+ template<>
+ inline int32_t ReadArray(PortableRawReader& reader, int8_t* val, int32_t len)
+ {
+ return reader.ReadInt8Array(val, len);
+ }
+
+ template<>
+ inline void WriteArray(PortableRawWriter& writer, bool* val, int32_t len)
+ {
+ writer.WriteBoolArray(val, len);
+ }
+
+ template<>
+ inline int32_t ReadArray(PortableRawReader& reader, bool* val, int32_t len)
+ {
+ return reader.ReadBoolArray(val, len);
+ }
+
+ template<>
+ inline void WriteArray(PortableRawWriter& writer, int16_t* val, int32_t len)
+ {
+ writer.WriteInt16Array(val, len);
+ }
+
+ template<>
+ inline int32_t ReadArray(PortableRawReader& reader, int16_t* val, int32_t len)
+ {
+ return reader.ReadInt16Array(val, len);
+ }
+
+ template<>
+ inline void WriteArray(PortableRawWriter& writer, uint16_t* val, int32_t len)
+ {
+ writer.WriteUInt16Array(val, len);
+ }
+
+ template<>
+ inline int32_t ReadArray(PortableRawReader& reader, uint16_t* val, int32_t len)
+ {
+ return reader.ReadUInt16Array(val, len);
+ }
+
+ template<>
+ inline void WriteArray(PortableRawWriter& writer, int32_t* val, int32_t len)
+ {
+ writer.WriteInt32Array(val, len);
+ }
+
+ template<>
+ inline int32_t ReadArray(PortableRawReader& reader, int32_t* val, int32_t len)
+ {
+ return reader.ReadInt32Array(val, len);
+ }
+
+ template<>
+ inline void WriteArray(PortableRawWriter& writer, int64_t* val, int32_t len)
+ {
+ writer.WriteInt64Array(val, len);
+ }
+
+ template<>
+ inline int32_t ReadArray(PortableRawReader& reader, int64_t* val, int32_t len)
+ {
+ return reader.ReadInt64Array(val, len);
+ }
+
+ template<>
+ inline void WriteArray(PortableRawWriter& writer, float* val, int32_t len)
+ {
+ writer.WriteFloatArray(val, len);
+ }
+
+ template<>
+ inline int32_t ReadArray(PortableRawReader& reader, float* val, int32_t len)
+ {
+ return reader.ReadFloatArray(val, len);
+ }
+
+ template<>
+ inline void WriteArray(PortableRawWriter& writer, double* val, int32_t len)
+ {
+ writer.WriteDoubleArray(val, len);
+ }
+
+ template<>
+ inline int32_t ReadArray(PortableRawReader& reader, double* val, int32_t len)
+ {
+ return reader.ReadDoubleArray(val, len);
+ }
+
+ template<>
+ inline void WriteArray(PortableRawWriter& writer, Guid* val, int32_t len)
+ {
+ writer.WriteGuidArray(val, len);
+ }
+
+ template<>
+ inline int32_t ReadArray(PortableRawReader& reader, Guid* val, int32_t len)
+ {
+ return reader.ReadGuidArray(val, len);
+ }
+
+ template<typename T>
+ inline void Write(PortableWriter& writer, const char* fieldName, T val)
+ {
+ throw std::runtime_error("Function is not defined");
+ }
+
+ template<typename T>
+ inline T Read(PortableReader& reader, const char* fieldName)
+ {
+ throw std::runtime_error("Function is not defined");
+ }
+
+ template<>
+ inline void Write(PortableWriter& writer, const char* fieldName, int8_t val)
+ {
+ writer.WriteInt8(fieldName, val);
+ }
+
+ template<>
+ inline int8_t Read(PortableReader& reader, const char* fieldName)
+ {
+ return reader.ReadInt8(fieldName);
+ }
+
+ template<>
+ inline void Write(PortableWriter& writer, const char* fieldName, bool val)
+ {
+ writer.WriteBool(fieldName, val);
+ }
+
+ template<>
+ inline bool Read(PortableReader& reader, const char* fieldName)
+ {
+ return reader.ReadBool(fieldName);
+ }
+
+ template<>
+ inline void Write(PortableWriter& writer, const char* fieldName, int16_t val)
+ {
+ writer.WriteInt16(fieldName, val);
+ }
+
+ template<>
+ inline int16_t Read(PortableReader& reader, const char* fieldName)
+ {
+ return reader.ReadInt16(fieldName);
+ }
+
+ template<>
+ inline void Write(PortableWriter& writer, const char* fieldName, uint16_t val)
+ {
+ writer.WriteUInt16(fieldName, val);
+ }
+
+ template<>
+ inline uint16_t Read(PortableReader& reader, const char* fieldName)
+ {
+ return reader.ReadUInt16(fieldName);
+ }
+
+ template<>
+ inline void Write(PortableWriter& writer, const char* fieldName, int32_t val)
+ {
+ writer.WriteInt32(fieldName, val);
+ }
+
+ template<>
+ inline int32_t Read(PortableReader& reader, const char* fieldName)
+ {
+ return reader.ReadInt32(fieldName);
+ }
+
+ template<>
+ inline void Write(PortableWriter& writer, const char* fieldName, int64_t val)
+ {
+ writer.WriteInt64(fieldName, val);
+ }
+
+ template<>
+ inline int64_t Read(PortableReader& reader, const char* fieldName)
+ {
+ return reader.ReadInt64(fieldName);
+ }
+
+ template<>
+ inline void Write(PortableWriter& writer, const char* fieldName, float val)
+ {
+ writer.WriteFloat(fieldName, val);
+ }
+
+ template<>
+ inline float Read(PortableReader& reader, const char* fieldName)
+ {
+ return reader.ReadFloat(fieldName);
+ }
+
+ template<>
+ inline void Write(PortableWriter& writer, const char* fieldName, double val)
+ {
+ writer.WriteDouble(fieldName, val);
+ }
+
+ template<>
+ inline double Read(PortableReader& reader, const char* fieldName)
+ {
+ return reader.ReadDouble(fieldName);
+ }
+
+ template<>
+ inline void Write(PortableWriter& writer, const char* fieldName, Guid val)
+ {
+ writer.WriteGuid(fieldName, val);
+ }
+
+ template<>
+ inline Guid Read(PortableReader& reader, const char* fieldName)
+ {
+ return reader.ReadGuid(fieldName);
+ }
+
+ template<typename T>
+ inline void WriteArray(PortableWriter& writer, const char* fieldName, T* val, int32_t len)
+ {
+ throw std::runtime_error("Function is not defined");
+ }
+
+ template<typename T>
+ inline int32_t ReadArray(PortableReader& reader, const char* fieldName, T* val, int32_t len)
+ {
+ throw std::runtime_error("Function is not defined");
+ }
+
+ template<>
+ inline void WriteArray(PortableWriter& writer, const char* fieldName, int8_t* val, int32_t len)
+ {
+ writer.WriteInt8Array(fieldName, val, len);
+ }
+
+ template<>
+ inline int32_t ReadArray(PortableReader& reader, const char* fieldName, int8_t* val, int32_t len)
+ {
+ return reader.ReadInt8Array(fieldName, val, len);
+ }
+
+ template<>
+ inline void WriteArray(PortableWriter& writer, const char* fieldName, bool* val, int32_t len)
+ {
+ writer.WriteBoolArray(fieldName, val, len);
+ }
+
+ template<>
+ inline int32_t ReadArray(PortableReader& reader, const char* fieldName, bool* val, int32_t len)
+ {
+ return reader.ReadBoolArray(fieldName, val, len);
+ }
+
+ template<>
+ inline void WriteArray(PortableWriter& writer, const char* fieldName, int16_t* val, int32_t len)
+ {
+ writer.WriteInt16Array(fieldName, val, len);
+ }
+
+ template<>
+ inline int32_t ReadArray(PortableReader& reader, const char* fieldName, int16_t* val, int32_t len)
+ {
+ return reader.ReadInt16Array(fieldName, val, len);
+ }
+
+ template<>
+ inline void WriteArray(PortableWriter& writer, const char* fieldName, uint16_t* val, int32_t len)
+ {
+ writer.WriteUInt16Array(fieldName, val, len);
+ }
+
+ template<>
+ inline int32_t ReadArray(PortableReader& reader, const char* fieldName, uint16_t* val, int32_t len)
+ {
+ return reader.ReadUInt16Array(fieldName, val, len);
+ }
+
+ template<>
+ inline void WriteArray(PortableWriter& writer, const char* fieldName, int32_t* val, int32_t len)
+ {
+ writer.WriteInt32Array(fieldName, val, len);
+ }
+
+ template<>
+ inline int32_t ReadArray(PortableReader& reader, const char* fieldName, int32_t* val, int32_t len)
+ {
+ return reader.ReadInt32Array(fieldName, val, len);
+ }
+
+ template<>
+ inline void WriteArray(PortableWriter& writer, const char* fieldName, int64_t* val, int32_t len)
+ {
+ writer.WriteInt64Array(fieldName, val, len);
+ }
+
+ template<>
+ inline int32_t ReadArray(PortableReader& reader, const char* fieldName, int64_t* val, int32_t len)
+ {
+ return reader.ReadInt64Array(fieldName, val, len);
+ }
+
+ template<>
+ inline void WriteArray(PortableWriter& writer, const char* fieldName, float* val, int32_t len)
+ {
+ writer.WriteFloatArray(fieldName, val, len);
+ }
+
+ template<>
+ inline int32_t ReadArray(PortableReader& reader, const char* fieldName, float* val, int32_t len)
+ {
+ return reader.ReadFloatArray(fieldName, val, len);
+ }
+
+ template<>
+ inline void WriteArray(PortableWriter& writer, const char* fieldName, double* val, int32_t len)
+ {
+ writer.WriteDoubleArray(fieldName, val, len);
+ }
+
+ template<>
+ inline int32_t ReadArray(PortableReader& reader, const char* fieldName, double* val, int32_t len)
+ {
+ return reader.ReadDoubleArray(fieldName, val, len);
+ }
+
+ template<>
+ inline void WriteArray(PortableWriter& writer, const char* fieldName, Guid* val, int32_t len)
+ {
+ writer.WriteGuidArray(fieldName, val, len);
+ }
+
+ template<>
+ inline int32_t ReadArray(PortableReader& reader, const char* fieldName, Guid* val, int32_t len)
+ {
+ return reader.ReadGuidArray(fieldName, val, len);
+ }
+ }
+ }
+}
+
+#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core-test/include/teamcity_messages.h
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core-test/include/teamcity_messages.h b/modules/platform/cpp/core-test/include/teamcity_messages.h
new file mode 100644
index 0000000..8cf23d0
--- /dev/null
+++ b/modules/platform/cpp/core-test/include/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/524f5653/modules/platform/cpp/core-test/project/README.TXT
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core-test/project/README.TXT b/modules/platform/cpp/core-test/project/README.TXT
new file mode 100644
index 0000000..97f4c64
--- /dev/null
+++ b/modules/platform/cpp/core-test/project/README.TXT
@@ -0,0 +1 @@
+Contains IDE projects artifacts.
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core-test/project/vs/README.TXT
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core-test/project/vs/README.TXT b/modules/platform/cpp/core-test/project/vs/README.TXT
new file mode 100644
index 0000000..f4fb456
--- /dev/null
+++ b/modules/platform/cpp/core-test/project/vs/README.TXT
@@ -0,0 +1 @@
+Contains Visual Studio project artifacts.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core-test/project/vs/core-test.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core-test/project/vs/core-test.vcxproj b/modules/platform/cpp/core-test/project/vs/core-test.vcxproj
new file mode 100644
index 0000000..ca6ee1a
--- /dev/null
+++ b/modules/platform/cpp/core-test/project/vs/core-test.vcxproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <ItemGroup>
+ <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\cache-query.xml" />
+ <None Include="..\..\config\cache-test.xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\cache_test.cpp" />
+ <ClCompile Include="..\..\src\concurrent_test.cpp" />
+ <ClCompile Include="..\..\src\ignition_test.cpp" />
+ <ClCompile Include="..\..\src\handle_registry_test.cpp" />
+ <ClCompile Include="..\..\src\portable_reader_writer_raw_test.cpp" />
+ <ClCompile Include="..\..\src\portable_reader_writer_test.cpp" />
+ <ClCompile Include="..\..\src\portable_session_test.cpp" />
+ <ClCompile Include="..\..\src\portable_test_defs.cpp" />
+ <ClCompile Include="..\..\src\cache_query_test.cpp" />
+ <ClCompile Include="..\..\src\teamcity_boost.cpp" />
+ <ClCompile Include="..\..\src\teamcity_messages.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\ignite\portable_test_defs.h" />
+ <ClInclude Include="..\..\include\ignite\portable_test_utils.h" />
+ <ClInclude Include="..\..\include\teamcity_messages.h" />
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{133A22DB-FD60-44B9-B5E3-6CBB3EA5ABF0}</ProjectGuid>
+ <RootNamespace>coretest</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v100</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v100</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v100</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v100</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+ <IntDir>$(Platform)\$(Configuration)\</IntDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+ <IntDir>$(Platform)\$(Configuration)\</IntDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\core\os\win\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_DEBUG;IGNITE_IMPL;BOOST_DATE_TIME_NO_LIB;BOOST_REGEX_NO_LIB;_CRT_SECURE_NO_WARNINGS;IGNITE_FRIEND;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>Async</ExceptionHandling>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalDependencies>$(BOOST_HOME)\lib64-msvc-10.0\libboost_unit_test_framework-vc100-mt-gd-1_58.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <SubSystem>Console</SubSystem>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\core\os\win\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_DEBUG;IGNITE_IMPL;BOOST_DATE_TIME_NO_LIB;BOOST_REGEX_NO_LIB;_CRT_SECURE_NO_WARNINGS;IGNITE_FRIEND;IGNITE_TESTS_32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>Async</ExceptionHandling>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalDependencies>$(BOOST_HOME)\lib64-msvc-10.0\libboost_unit_test_framework-vc100-mt-gd-1_58.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\core\os\win\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>NDEBUG;IGNITE_IMPL;BOOST_DATE_TIME_NO_LIB;BOOST_REGEX_NO_LIB;_CRT_SECURE_NO_WARNINGS;IGNITE_FRIEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>Async</ExceptionHandling>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <AdditionalDependencies>$(BOOST_HOME)\lib64-msvc-10.0\libboost_unit_test_framework-vc100-mt-1_58.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\core\os\win\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>NDEBUG;IGNITE_IMPL;BOOST_DATE_TIME_NO_LIB;BOOST_REGEX_NO_LIB;_CRT_SECURE_NO_WARNINGS;IGNITE_FRIEND;IGNITE_TESTS_32%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>Async</ExceptionHandling>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <AdditionalDependencies>$(BOOST_HOME)\lib64-msvc-10.0\libboost_unit_test_framework-vc100-mt-1_58.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core-test/project/vs/core-test.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core-test/project/vs/core-test.vcxproj.filters b/modules/platform/cpp/core-test/project/vs/core-test.vcxproj.filters
new file mode 100644
index 0000000..7e8dd95
--- /dev/null
+++ b/modules/platform/cpp/core-test/project/vs/core-test.vcxproj.filters
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <ClCompile Include="..\..\src\cache_test.cpp">
+ <Filter>Code</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\concurrent_test.cpp">
+ <Filter>Code</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\ignition_test.cpp">
+ <Filter>Code</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\handle_registry_test.cpp">
+ <Filter>Code</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\portable_reader_writer_raw_test.cpp">
+ <Filter>Code</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\portable_reader_writer_test.cpp">
+ <Filter>Code</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\portable_session_test.cpp">
+ <Filter>Code</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\portable_test_defs.cpp">
+ <Filter>Code</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\cache_query_test.cpp">
+ <Filter>Code</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\teamcity_boost.cpp">
+ <Filter>TeamCity</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\teamcity_messages.cpp">
+ <Filter>TeamCity</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\ignite\portable_test_defs.h">
+ <Filter>Code</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\ignite\portable_test_utils.h">
+ <Filter>Code</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\teamcity_messages.h">
+ <Filter>TeamCity</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Filter Include="Code">
+ <UniqueIdentifier>{486c367c-57e9-430a-80f0-39fd5b09bc64}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Configs">
+ <UniqueIdentifier>{a46d9d4c-44eb-40da-b4f6-89cc43b70c12}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="TeamCity">
+ <UniqueIdentifier>{76bceab0-e251-445f-88c3-3f6f8739423b}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\config\cache-test.xml">
+ <Filter>Configs</Filter>
+ </None>
+ <None Include="..\..\config\cache-query.xml">
+ <Filter>Configs</Filter>
+ </None>
+ </ItemGroup>
+</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/524f5653/modules/platform/cpp/core-test/src/cache_query_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/cpp/core-test/src/cache_query_test.cpp b/modules/platform/cpp/core-test/src/cache_query_test.cpp
new file mode 100644
index 0000000..47009f4
--- /dev/null
+++ b/modules/platform/cpp/core-test/src/cache_query_test.cpp
@@ -0,0 +1,656 @@
+/*
+ * 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/impl/utils.h"
+#include "ignite/cache/cache.h"
+#include "ignite/cache/query/query_cursor.h"
+#include "ignite/cache/query/query_sql.h"
+#include "ignite/cache/query/query_text.h"
+#include "ignite/ignite.h"
+#include "ignite/ignition.h"
+
+using namespace boost::unit_test;
+
+using namespace ignite;
+using namespace ignite::cache;
+using namespace ignite::cache::query;
+using namespace ignite::impl::utils;
+
+/**
+ * Person class for query tests.
+ */
+class IGNITE_IMPORT_EXPORT QueryPerson
+{
+public:
+ /**
+ * Constructor.
+ */
+ QueryPerson() : name(NULL), age(0)
+ {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param name Name.
+ * @param age Age.
+ */
+ QueryPerson(std::string name, int age) : name(CopyChars(name.c_str())), age(age)
+ {
+ // No-op.
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @param other Other instance.
+ */
+ QueryPerson(const QueryPerson& other)
+ {
+ name = CopyChars(other.name);
+ age = other.age;
+ }
+
+ /**
+ * Assignment operator.
+ *
+ * @param other Other instance.
+ * @return This instance.
+ */
+ QueryPerson& operator=(const QueryPerson& other)
+ {
+ if (&other != this)
+ {
+ QueryPerson tmp(other);
+
+ char* name0 = name;
+ int age0 = age;
+
+ name = tmp.name;
+ age = tmp.age;
+
+ tmp.name = name0;
+ tmp.age = age0;
+ }
+
+ return *this;
+ }
+
+ /**
+ * Destructor.
+ */
+ ~QueryPerson()
+ {
+ ReleaseChars(name);
+ }
+
+ /**
+ * Get name.
+ *
+ * @return Name.
+ */
+ std::string GetName()
+ {
+ return name ? std::string(name) : std::string();
+ }
+
+ /**
+ * Get age.
+ *
+ * @return Age.
+ */
+ int32_t GetAge()
+ {
+ return age;
+ }
+
+private:
+ /** Name. */
+ char* name;
+
+ /** Age. */
+ int age;
+};
+
+namespace ignite
+{
+ namespace portable
+ {
+ /**
+ * Portable type definition.
+ */
+ IGNITE_PORTABLE_TYPE_START(QueryPerson)
+ IGNITE_PORTABLE_GET_TYPE_ID_AS_HASH(QueryPerson)
+ IGNITE_PORTABLE_GET_TYPE_NAME_AS_IS(QueryPerson)
+ IGNITE_PORTABLE_GET_FIELD_ID_AS_HASH
+ IGNITE_PORTABLE_GET_HASH_CODE_ZERO(QueryPerson)
+ IGNITE_PORTABLE_IS_NULL_FALSE(QueryPerson)
+ IGNITE_PORTABLE_GET_NULL_DEFAULT_CTOR(QueryPerson)
+
+ void Write(PortableWriter& writer, QueryPerson obj)
+ {
+ writer.WriteString("name", obj.GetName());
+ writer.WriteInt32("age", obj.GetAge());
+ }
+
+ QueryPerson Read(PortableReader& reader)
+ {
+ std::string name = reader.ReadString("name");
+ int age = reader.ReadInt32("age");
+
+ return QueryPerson(name, age);
+ }
+
+ IGNITE_PORTABLE_TYPE_END
+ }
+}
+
+/** Node started during the test. */
+Ignite grid = Ignite();
+
+/** Cache accessor. */
+Cache<int, QueryPerson> GetCache()
+{
+ return grid.GetCache<int, QueryPerson>("cache");
+}
+
+/**
+ * Test setup fixture.
+ */
+struct CacheQueryTestSuiteFixture {
+ /**
+ * Constructor.
+ */
+ CacheQueryTestSuiteFixture()
+ {
+ IgniteConfiguration cfg;
+
+ IgniteJvmOption opts[5];
+
+ opts[0] = IgniteJvmOption("-Xdebug");
+ opts[1] = IgniteJvmOption("-Xnoagent");
+ opts[2] = IgniteJvmOption("-Djava.compiler=NONE");
+ opts[3] = IgniteJvmOption("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
+ opts[4] = IgniteJvmOption("-XX:+HeapDumpOnOutOfMemoryError");
+
+ cfg.jvmOptsLen = 5;
+ cfg.jvmOpts = opts;
+
+#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");
+
+ std::string cfgPathStr = std::string(cfgPath).append("/").append("cache-query.xml");
+
+ cfg.springCfgPath = const_cast<char*>(cfgPathStr.c_str());
+
+ IgniteError err;
+
+ Ignite grid0 = Ignition::Start(cfg, &err);
+
+ if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
+ BOOST_ERROR(err.GetText());
+
+ grid = grid0;
+ }
+
+ /**
+ * Destructor.
+ */
+ ~CacheQueryTestSuiteFixture()
+ {
+ Ignition::Stop(grid.GetName(), true);
+ }
+};
+
+/**
+ * Ensure that HasNext() fails.
+ *
+ * @param cur Cursor.
+ */
+void CheckHasNextFail(QueryCursor<int, QueryPerson>& cur)
+{
+ try
+ {
+ cur.HasNext();
+
+ BOOST_FAIL("Must fail.");
+ }
+ catch (IgniteError& err)
+ {
+ BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_GENERIC);
+ }
+}
+
+/**
+ * Ensure that GetNext() fails.
+ *
+ * @param cur Cursor.
+ */
+void CheckGetNextFail(QueryCursor<int, QueryPerson>& cur)
+{
+ try
+ {
+ cur.GetNext();
+
+ BOOST_FAIL("Must fail.");
+ }
+ catch (IgniteError& err)
+ {
+ BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_GENERIC);
+ }
+}
+
+/**
+ * Ensure that GetAll() fails.
+ *
+ * @param cur Cursor.
+ */
+void CheckGetAllFail(QueryCursor<int, QueryPerson>& cur)
+{
+ try
+ {
+ std::vector<CacheEntry<int, QueryPerson>> res;
+
+ cur.GetAll(res);
+
+ BOOST_FAIL("Must fail.");
+ }
+ catch (IgniteError& err)
+ {
+ BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_GENERIC);
+ }
+}
+
+/**
+ * Check empty result through iteration.
+ *
+ * @param cur Cursor.
+ */
+void CheckEmpty(QueryCursor<int, QueryPerson>& cur)
+{
+ BOOST_REQUIRE(!cur.HasNext());
+
+ CheckGetNextFail(cur);
+ CheckGetAllFail(cur);
+}
+
+/**
+ * Check empty result through GetAll().
+ *
+ * @param cur Cursor.
+ */
+void CheckEmptyGetAll(QueryCursor<int, QueryPerson>& cur)
+{
+ std::vector<CacheEntry<int, QueryPerson>> res;
+
+ cur.GetAll(res);
+
+ BOOST_REQUIRE(res.size() == 0);
+
+ CheckHasNextFail(cur);
+ CheckGetNextFail(cur);
+}
+
+/**
+ * Check single result through iteration.
+ *
+ * @param cur Cursor.
+ * @param key1 Key.
+ * @param name1 Name.
+ * @param age1 Age.
+ */
+void CheckSingle(QueryCursor<int, QueryPerson>& cur, int key, std::string name, int age)
+{
+ BOOST_REQUIRE(cur.HasNext());
+
+ CheckGetAllFail(cur);
+
+ CacheEntry<int, QueryPerson> entry = cur.GetNext();
+
+ CheckGetAllFail(cur);
+
+ BOOST_REQUIRE(entry.GetKey() == key);
+ BOOST_REQUIRE(entry.GetValue().GetName().compare(name) == 0);
+ BOOST_REQUIRE(entry.GetValue().GetAge() == age);
+
+ BOOST_REQUIRE(!cur.HasNext());
+
+ CheckGetNextFail(cur);
+ CheckGetAllFail(cur);
+}
+
+/**
+ * Check single result through GetAll().
+ *
+ * @param cur Cursor.
+ * @param key1 Key.
+ * @param name1 Name.
+ * @param age1 Age.
+ */
+void CheckSingleGetAll(QueryCursor<int, QueryPerson>& cur, int key, std::string name, int age)
+{
+ std::vector<CacheEntry<int, QueryPerson>> res;
+
+ cur.GetAll(res);
+
+ CheckHasNextFail(cur);
+ CheckGetNextFail(cur);
+ CheckGetAllFail(cur);
+
+ BOOST_REQUIRE(res.size() == 1);
+
+ BOOST_REQUIRE(res[0].GetKey() == 1);
+ BOOST_REQUIRE(res[0].GetValue().GetName().compare(name) == 0);
+ BOOST_REQUIRE(res[0].GetValue().GetAge() == age);
+
+ CheckHasNextFail(cur);
+ CheckGetNextFail(cur);
+ CheckGetAllFail(cur);
+}
+
+/**
+ * Check multiple results through iteration.
+ *
+ * @param cur Cursor.
+ * @param key1 Key 1.
+ * @param name1 Name 1.
+ * @param age1 Age 1.
+ * @param key2 Key 2.
+ * @param name2 Name 2.
+ * @param age2 Age 2.
+ */
+void CheckMultiple(QueryCursor<int, QueryPerson>& cur, int key1, std::string name1,
+ int age1, int key2, std::string name2, int age2)
+{
+ for (int i = 0; i < 2; i++)
+ {
+ BOOST_REQUIRE(cur.HasNext());
+
+ CheckGetAllFail(cur);
+
+ CacheEntry<int, QueryPerson> entry = cur.GetNext();
+
+ CheckGetAllFail(cur);
+
+ if (entry.GetKey() == key1)
+ {
+ BOOST_REQUIRE(entry.GetValue().GetName().compare(name1) == 0);
+ BOOST_REQUIRE(entry.GetValue().GetAge() == age1);
+ }
+ else if (entry.GetKey() == key2)
+ {
+ BOOST_REQUIRE(entry.GetValue().GetName().compare(name2) == 0);
+ BOOST_REQUIRE(entry.GetValue().GetAge() == age2);
+ }
+ else
+ BOOST_FAIL("Unexpected entry.");
+ }
+
+ BOOST_REQUIRE(!cur.HasNext());
+
+ CheckGetNextFail(cur);
+ CheckGetAllFail(cur);
+}
+
+/**
+ * Check multiple results through GetAll().
+ *
+ * @param cur Cursor.
+ * @param key1 Key 1.
+ * @param name1 Name 1.
+ * @param age1 Age 1.
+ * @param key2 Key 2.
+ * @param name2 Name 2.
+ * @param age2 Age 2.
+ */
+void CheckMultipleGetAll(QueryCursor<int, QueryPerson>& cur, int key1, std::string name1, int age1,
+ int key2, std::string name2, int age2)
+{
+ std::vector<CacheEntry<int, QueryPerson>> res;
+
+ cur.GetAll(res);
+
+ CheckHasNextFail(cur);
+ CheckGetNextFail(cur);
+ CheckGetAllFail(cur);
+
+ BOOST_REQUIRE(res.size() == 2);
+
+ for (int i = 0; i < 2; i++)
+ {
+ CacheEntry<int, QueryPerson> entry = res[i];
+
+ if (entry.GetKey() == key1)
+ {
+ BOOST_REQUIRE(entry.GetValue().GetName().compare(name1) == 0);
+ BOOST_REQUIRE(entry.GetValue().GetAge() == age1);
+ }
+ else if (entry.GetKey() == key2)
+ {
+ BOOST_REQUIRE(entry.GetValue().GetName().compare(name2) == 0);
+ BOOST_REQUIRE(entry.GetValue().GetAge() == age2);
+ }
+ else
+ BOOST_FAIL("Unexpected entry.");
+ }
+}
+
+BOOST_FIXTURE_TEST_SUITE(CacheQueryTestSuite, CacheQueryTestSuiteFixture)
+
+/**
+ * Test SQL query.
+ */
+BOOST_AUTO_TEST_CASE(TestSqlQuery)
+{
+ Cache<int, QueryPerson> cache = GetCache();
+
+ // Test query with no results.
+ SqlQuery qry("QueryPerson", "age < 20");
+
+ QueryCursor<int, QueryPerson> cursor = cache.Query(qry);
+ CheckEmpty(cursor);
+
+ cursor = cache.Query(qry);
+ CheckEmptyGetAll(cursor);
+
+ // Test simple query.
+ cache.Put(1, QueryPerson("A1", 10));
+ cache.Put(2, QueryPerson("A2", 20));
+
+ cursor = cache.Query(qry);
+ CheckSingle(cursor, 1, "A1", 10);
+
+ cursor = cache.Query(qry);
+ CheckSingleGetAll(cursor, 1, "A1", 10);
+
+ // Test simple local query.
+ qry.SetLocal(true);
+
+ cursor = cache.Query(qry);
+ CheckSingle(cursor, 1, "A1", 10);
+
+ cursor = cache.Query(qry);
+ CheckSingleGetAll(cursor, 1, "A1", 10);
+
+ // Test query with arguments.
+ qry.SetSql("age < ? AND name = ?");
+ qry.AddArgument<int>(20);
+ qry.AddArgument<std::string>("A1");
+
+ cursor = cache.Query(qry);
+ CheckSingle(cursor, 1, "A1", 10);
+
+ cursor = cache.Query(qry);
+ CheckSingleGetAll(cursor, 1, "A1", 10);
+
+ // Test query returning multiple entries.
+ qry = SqlQuery("QueryPerson", "age < 30");
+
+ cursor = cache.Query(qry);
+ CheckMultiple(cursor, 1, "A1", 10, 2, "A2", 20);
+
+ cursor = cache.Query(qry);
+ CheckMultipleGetAll(cursor, 1, "A1", 10, 2, "A2", 20);
+}
+
+/**
+ * Test text query.
+ */
+BOOST_AUTO_TEST_CASE(TestTextQuery)
+{
+ Cache<int, QueryPerson> cache = GetCache();
+
+ // Test query with no results.
+ TextQuery qry("QueryPerson", "A1");
+
+ QueryCursor<int, QueryPerson> cursor = cache.Query(qry);
+ CheckEmpty(cursor);
+
+ cursor = cache.Query(qry);
+ CheckEmptyGetAll(cursor);
+
+ // Test simple query.
+ cache.Put(1, QueryPerson("A1", 10));
+ cache.Put(2, QueryPerson("A2", 20));
+
+ cursor = cache.Query(qry);
+ CheckSingle(cursor, 1, "A1", 10);
+
+ cursor = cache.Query(qry);
+ CheckSingleGetAll(cursor, 1, "A1", 10);
+
+ // Test simple local query.
+ qry.SetLocal(true);
+
+ cursor = cache.Query(qry);
+ CheckSingle(cursor, 1, "A1", 10);
+
+ cursor = cache.Query(qry);
+ CheckSingleGetAll(cursor, 1, "A1", 10);
+
+ // Test query returning multiple entries.
+ qry = TextQuery("QueryPerson", "A*");
+
+ cursor = cache.Query(qry);
+ CheckMultiple(cursor, 1, "A1", 10, 2, "A2", 20);
+
+ cursor = cache.Query(qry);
+ CheckMultipleGetAll(cursor, 1, "A1", 10, 2, "A2", 20);
+}
+
+/**
+ * Test scan query.
+ */
+BOOST_AUTO_TEST_CASE(TestScanQuery)
+{
+ // Test simple query.
+ Cache<int, QueryPerson> cache = GetCache();
+
+ // Test query with no results.
+ ScanQuery qry;
+
+ QueryCursor<int, QueryPerson> cursor = cache.Query(qry);
+ CheckEmpty(cursor);
+
+ cursor = cache.Query(qry);
+ CheckEmptyGetAll(cursor);
+
+ // Test simple query.
+ cache.Put(1, QueryPerson("A1", 10));
+
+ cursor = cache.Query(qry);
+ CheckSingle(cursor, 1, "A1", 10);
+
+ cursor = cache.Query(qry);
+ CheckSingleGetAll(cursor, 1, "A1", 10);
+
+ // Test query returning multiple entries.
+ cache.Put(2, QueryPerson("A2", 20));
+
+ cursor = cache.Query(qry);
+ CheckMultiple(cursor, 1, "A1", 10, 2, "A2", 20);
+
+ cursor = cache.Query(qry);
+ CheckMultipleGetAll(cursor, 1, "A1", 10, 2, "A2", 20);
+}
+
+/**
+ * Test scan query over partitions.
+ */
+BOOST_AUTO_TEST_CASE(TestScanQueryPartitioned)
+{
+ // Populate cache with data.
+ Cache<int, QueryPerson> cache = GetCache();
+
+ int32_t partCnt = 256; // Defined in configuration explicitly.
+ int32_t entryCnt = 1000; // Should be greater than partCnt.
+
+ for (int i = 0; i < entryCnt; i++)
+ {
+ std::stringstream stream;
+
+ stream << "A" << i;
+
+ cache.Put(i, QueryPerson(stream.str(), i * 10));
+ }
+
+ // Iterate over all partitions and collect data.
+ std::set<int> keys;
+
+ for (int i = 0; i < partCnt; i++)
+ {
+ ScanQuery qry(i);
+
+ QueryCursor<int, QueryPerson> cur = cache.Query(qry);
+
+ while (cur.HasNext())
+ {
+ CacheEntry<int, QueryPerson> entry = cur.GetNext();
+
+ int key = entry.GetKey();
+
+ keys.insert(key);
+
+ std::stringstream stream;
+ stream << "A" << key;
+ BOOST_REQUIRE(entry.GetValue().GetName().compare(stream.str()) == 0);
+
+ BOOST_REQUIRE(entry.GetValue().GetAge() == key * 10);
+ }
+ }
+
+ // Ensure that all keys were read.
+ BOOST_REQUIRE(keys.size() == entryCnt);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file