ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [11/14] ignite git commit: IGNITE-1364: WIP.
Date Thu, 03 Sep 2015 09:28:39 GMT
IGNITE-1364: WIP.


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

Branch: refs/heads/ignite-1364
Commit: 1e18fa324cec2a2d27e11b35e104b4e19672d46c
Parents: 6ac9557
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Thu Sep 3 11:54:32 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Thu Sep 3 11:54:33 2015 +0300

----------------------------------------------------------------------
 .../platform/src/main/cpp/core-test/Makefile.am |   32 +
 .../main/cpp/core-test/config/cache-query.xml   |   83 +
 .../main/cpp/core-test/config/cache-test.xml    |  142 ++
 .../src/main/cpp/core-test/configure.ac         |   45 +
 .../src/main/cpp/core-test/include/Makefile.am  |    5 +
 .../include/gridgain/portable_test_defs.h       |  312 +++
 .../include/gridgain/portable_test_utils.h      |  508 +++++
 .../cpp/core-test/include/teamcity_messages.h   |   55 +
 .../src/main/cpp/core-test/project/README.TXT   |    1 +
 .../main/cpp/core-test/project/vs/README.TXT    |    1 +
 .../cpp/core-test/project/vs/core-test.vcxproj  |  174 ++
 .../project/vs/core-test.vcxproj.filters        |   68 +
 .../main/cpp/core-test/src/cache_query_test.cpp |  644 ++++++
 .../src/main/cpp/core-test/src/cache_test.cpp   |  473 +++++
 .../main/cpp/core-test/src/concurrent_test.cpp  |  178 ++
 .../cpp/core-test/src/grid_factory_test.cpp     |   89 +
 .../cpp/core-test/src/handle_registry_test.cpp  |  168 ++
 .../src/portable_reader_writer_raw_test.cpp     | 1524 ++++++++++++++
 .../src/portable_reader_writer_test.cpp         | 1943 ++++++++++++++++++
 .../cpp/core-test/src/portable_session_test.cpp |  249 +++
 .../cpp/core-test/src/portable_test_defs.cpp    |   57 +
 .../main/cpp/core-test/src/teamcity_boost.cpp   |  159 ++
 .../cpp/core-test/src/teamcity_messages.cpp     |  150 ++
 modules/platform/src/main/cpp/core/Makefile.am  |   49 +
 modules/platform/src/main/cpp/core/configure.ac |   45 +
 .../platform/src/main/cpp/core/gridgain.pc.in   |    9 +
 .../src/main/cpp/core/include/Makefile.am       |   44 +
 .../cpp/core/include/gridgain/cache/cache.h     | 1145 +++++++++++
 .../core/include/gridgain/cache/cache_entry.h   |  110 +
 .../include/gridgain/cache/cache_peek_mode.h    |   63 +
 .../core/include/gridgain/cache/query/query.h   |   19 +
 .../gridgain/cache/query/query_argument.h       |  117 ++
 .../include/gridgain/cache/query/query_cursor.h |  183 ++
 .../include/gridgain/cache/query/query_scan.h   |  143 ++
 .../include/gridgain/cache/query/query_sql.h    |  245 +++
 .../include/gridgain/cache/query/query_text.h   |  151 ++
 .../src/main/cpp/core/include/gridgain/grid.h   |  146 ++
 .../core/include/gridgain/grid_configuration.h  |   84 +
 .../main/cpp/core/include/gridgain/grid_error.h |  255 +++
 .../cpp/core/include/gridgain/grid_factory.h    |  187 ++
 .../src/main/cpp/core/include/gridgain/guid.h   |  104 +
 .../include/gridgain/impl/cache/cache_impl.h    |  410 ++++
 .../gridgain/impl/cache/query/query_impl.h      |  107 +
 .../include/gridgain/impl/grid_environment.h    |  122 ++
 .../cpp/core/include/gridgain/impl/grid_impl.h  |  138 ++
 .../include/gridgain/impl/handle_registry.h     |  194 ++
 .../include/gridgain/impl/interop/interop.h     |   17 +
 .../impl/interop/interop_input_stream.h         |  226 ++
 .../gridgain/impl/interop/interop_memory.h      |  272 +++
 .../impl/interop/interop_output_stream.h        |  226 ++
 .../cpp/core/include/gridgain/impl/operations.h |  444 ++++
 .../gridgain/impl/portable/portable_common.h    |  138 ++
 .../impl/portable/portable_id_resolver.h        |   98 +
 .../impl/portable/portable_metadata_handler.h   |   94 +
 .../impl/portable/portable_metadata_manager.h   |  113 +
 .../impl/portable/portable_metadata_snapshot.h  |  114 +
 .../impl/portable/portable_metadata_updater.h   |   45 +
 .../portable/portable_metadata_updater_impl.h   |   57 +
 .../impl/portable/portable_reader_impl.h        | 1122 ++++++++++
 .../gridgain/impl/portable/portable_utils.h     |  336 +++
 .../impl/portable/portable_writer_impl.h        |  851 ++++++++
 .../core/include/gridgain/portable/portable.h   |   21 +
 .../include/gridgain/portable/portable_consts.h |   98 +
 .../gridgain/portable/portable_containers.h     |  516 +++++
 .../gridgain/portable/portable_raw_reader.h     |  316 +++
 .../gridgain/portable/portable_raw_writer.h     |  292 +++
 .../include/gridgain/portable/portable_reader.h |  347 ++++
 .../include/gridgain/portable/portable_type.h   |  285 +++
 .../include/gridgain/portable/portable_writer.h |  327 +++
 .../main/cpp/core/os/linux/include/Makefile.am  |    3 +
 .../core/os/linux/include/gridgain/impl/utils.h |  147 ++
 .../main/cpp/core/os/linux/src/impl/utils.cpp   |  440 ++++
 .../core/os/win/include/gridgain/impl/utils.h   |  147 ++
 .../src/main/cpp/core/os/win/src/impl/utils.cpp |  453 ++++
 .../src/main/cpp/core/project/README.TXT        |    1 +
 .../src/main/cpp/core/project/vs/README.TXT     |    1 +
 .../src/main/cpp/core/project/vs/core.vcxproj   |  272 +++
 .../cpp/core/project/vs/core.vcxproj.filters    |  246 +++
 .../main/cpp/core/project/vs/core.vcxprojrel    |  272 +++
 modules/platform/src/main/cpp/core/src/grid.cpp |   35 +
 .../src/main/cpp/core/src/grid_error.cpp        |  217 ++
 .../src/main/cpp/core/src/grid_factory.cpp      |  460 +++++
 modules/platform/src/main/cpp/core/src/guid.cpp |   57 +
 .../main/cpp/core/src/impl/cache/cache_impl.cpp |  380 ++++
 .../core/src/impl/cache/query/query_impl.cpp    |  185 ++
 .../main/cpp/core/src/impl/grid_environment.cpp |  158 ++
 .../src/main/cpp/core/src/impl/grid_impl.cpp    |   34 +
 .../main/cpp/core/src/impl/handle_registry.cpp  |  226 ++
 .../src/impl/interop/interop_input_stream.cpp   |  207 ++
 .../core/src/impl/interop/interop_memory.cpp    |  173 ++
 .../src/impl/interop/interop_output_stream.cpp  |  207 ++
 .../impl/portable/portable_metadata_handler.cpp |   70 +
 .../impl/portable/portable_metadata_manager.cpp |  193 ++
 .../portable/portable_metadata_snapshot.cpp     |   62 +
 .../impl/portable/portable_metadata_updater.cpp |   24 +
 .../portable/portable_metadata_updater_impl.cpp |   86 +
 .../src/impl/portable/portable_reader_impl.cpp  |  675 ++++++
 .../core/src/impl/portable/portable_utils.cpp   |  206 ++
 .../src/impl/portable/portable_writer_impl.cpp  |  592 ++++++
 .../core/src/portable/portable_containers.cpp   |   68 +
 .../core/src/portable/portable_raw_reader.cpp   |  128 ++
 .../core/src/portable/portable_raw_writer.cpp   |  139 ++
 .../cpp/core/src/portable/portable_reader.cpp   |  135 ++
 .../cpp/core/src/portable/portable_type.cpp     |   43 +
 .../cpp/core/src/portable/portable_writer.cpp   |  146 ++
 .../platform/src/main/cpp/project/vs/README.TXT |    1 +
 .../src/main/cpp/project/vs/gridgain.sdf        |  Bin 0 -> 141950976 bytes
 .../src/main/cpp/project/vs/gridgain.sln        |   46 +
 .../src/main/cpp/project/vs/gridgain.slnrel     |   33 +
 109 files changed, 24453 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/1e18fa32/modules/platform/src/main/cpp/core-test/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/Makefile.am b/modules/platform/src/main/cpp/core-test/Makefile.am
new file mode 100644
index 0000000..6e3c067
--- /dev/null
+++ b/modules/platform/src/main/cpp/core-test/Makefile.am
@@ -0,0 +1,32 @@
+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 = gridgain-tests
+
+gridgain_tests_SOURCES = src/cache_test.cpp \
+                         src/cache_query_test.cpp \
+                         src/concurrent_test.cpp \
+                         src/grid_factory_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
+
+gridgain_tests_LDFLAGS = -static-libtool-libs -L/usr/local/lib -lgridgain
+
+run-check: check
+	./gridgain-tests -p
+
+clean-local: clean-check
+	$(RM) *.gcno *.gcda
+
+clean-check:
+	$(RM) $(gridgain_tests_OBJECTS)

http://git-wip-us.apache.org/repos/asf/ignite/blob/1e18fa32/modules/platform/src/main/cpp/core-test/config/cache-query.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/config/cache-query.xml b/modules/platform/src/main/cpp/core-test/config/cache-query.xml
new file mode 100644
index 0000000..d3af85a
--- /dev/null
+++ b/modules/platform/src/main/cpp/core-test/config/cache-query.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    Copyright (C) GridGain Systems. All Rights Reserved.
+    _________        _____ __________________        _____
+    __  ____/___________(_)______  /__  ____/______ ____(_)_______
+    _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+    / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+    \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+-->
+
+<!--
+    GridGain 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/1e18fa32/modules/platform/src/main/cpp/core-test/config/cache-test.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/config/cache-test.xml b/modules/platform/src/main/cpp/core-test/config/cache-test.xml
new file mode 100644
index 0000000..59c6142
--- /dev/null
+++ b/modules/platform/src/main/cpp/core-test/config/cache-test.xml
@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    Copyright (C) GridGain Systems. All Rights Reserved.
+    _________        _____ __________________        _____
+    __  ____/___________(_)______  /__  ____/______ ____(_)_______
+    _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+    / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+    \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+-->
+
+<!--
+    GridGain 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="marshaller">
+            <bean class="org.gridgain.grid.marshaller.portable.PortableMarshaller">
+                <property name="typeConfigurations">
+                    <list>
+                        <bean class="org.gridgain.grid.portables.PortableTypeConfiguration">
+                            <property name="className" value="org.gridgain.client.ClientTestPortable"/>
+                        </bean>
+                        <bean class="org.gridgain.grid.portables.PortableTypeConfiguration">
+                            <property name="className" value="org.gridgain.internal.client.model.GridPortablePerson"/>
+                        </bean>
+                        <bean class="org.gridgain.grid.portables.PortableTypeConfiguration">
+                            <property name="className" value="org.gridgain.internal.client.model.GridImplicitPortablePerson"/>
+                        </bean>
+                        <bean class="org.gridgain.grid.portables.PortableTypeConfiguration">
+                            <property name="className" value="GridNoDefPortablePerson"/>
+                        </bean>
+                    </list>
+                </property>
+            </bean>
+        </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/1e18fa32/modules/platform/src/main/cpp/core-test/configure.ac
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/configure.ac b/modules/platform/src/main/cpp/core-test/configure.ac
new file mode 100644
index 0000000..77c3de3
--- /dev/null
+++ b/modules/platform/src/main/cpp/core-test/configure.ac
@@ -0,0 +1,45 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.69])
+AC_INIT([GridGain for C++ Test], [7.4.1], [info@gridgain.com], [gridgain], [www.gridgain.com])
+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/1e18fa32/modules/platform/src/main/cpp/core-test/include/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/include/Makefile.am b/modules/platform/src/main/cpp/core-test/include/Makefile.am
new file mode 100644
index 0000000..eafae0d
--- /dev/null
+++ b/modules/platform/src/main/cpp/core-test/include/Makefile.am
@@ -0,0 +1,5 @@
+ACLOCAL_AMFLAGS = "-Im4"
+
+nobase_include_HEADERS = teamcity_messages.h \
+                         gridgain/portable_test_defs.h \
+                         gridgain/portable_test_utils.h

http://git-wip-us.apache.org/repos/asf/ignite/blob/1e18fa32/modules/platform/src/main/cpp/core-test/include/gridgain/portable_test_defs.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/include/gridgain/portable_test_defs.h b/modules/platform/src/main/cpp/core-test/include/gridgain/portable_test_defs.h
new file mode 100644
index 0000000..6f70103
--- /dev/null
+++ b/modules/platform/src/main/cpp/core-test/include/gridgain/portable_test_defs.h
@@ -0,0 +1,312 @@
+/*
+ *  Copyright (C) GridGain Systems. All Rights Reserved.
+ *  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+#ifndef _GRIDGAIN_PORTABLE_TEST_DEFS
+#define _GRIDGAIN_PORTABLE_TEST_DEFS
+
+#include <stdexcept>
+#include <stdint.h>
+
+#include "gridgain/portable/portable.h"
+
+namespace gridgain_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 gridgain
+{
+    namespace portable
+    {
+        namespace gt = gridgain_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/1e18fa32/modules/platform/src/main/cpp/core-test/include/gridgain/portable_test_utils.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/include/gridgain/portable_test_utils.h b/modules/platform/src/main/cpp/core-test/include/gridgain/portable_test_utils.h
new file mode 100644
index 0000000..d034369
--- /dev/null
+++ b/modules/platform/src/main/cpp/core-test/include/gridgain/portable_test_utils.h
@@ -0,0 +1,508 @@
+/*
+ *  Copyright (C) GridGain Systems. All Rights Reserved.
+ *  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+#ifndef _GRIDGAIN_PORTABLE_TEST_UTILS
+#define _GRIDGAIN_PORTABLE_TEST_UTILS
+
+#include "gridgain/portable/portable.h"
+
+using namespace gridgain;
+using namespace gridgain::portable;
+using namespace gridgain::impl::portable;
+
+namespace gridgain_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/1e18fa32/modules/platform/src/main/cpp/core-test/include/teamcity_messages.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/include/teamcity_messages.h b/modules/platform/src/main/cpp/core-test/include/teamcity_messages.h
new file mode 100644
index 0000000..8cf23d0
--- /dev/null
+++ b/modules/platform/src/main/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/1e18fa32/modules/platform/src/main/cpp/core-test/project/README.TXT
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/project/README.TXT b/modules/platform/src/main/cpp/core-test/project/README.TXT
new file mode 100644
index 0000000..97f4c64
--- /dev/null
+++ b/modules/platform/src/main/cpp/core-test/project/README.TXT
@@ -0,0 +1 @@
+Contains IDE projects artifacts.

http://git-wip-us.apache.org/repos/asf/ignite/blob/1e18fa32/modules/platform/src/main/cpp/core-test/project/vs/README.TXT
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/project/vs/README.TXT b/modules/platform/src/main/cpp/core-test/project/vs/README.TXT
new file mode 100644
index 0000000..f4fb456
--- /dev/null
+++ b/modules/platform/src/main/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/1e18fa32/modules/platform/src/main/cpp/core-test/project/vs/core-test.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/project/vs/core-test.vcxproj b/modules/platform/src/main/cpp/core-test/project/vs/core-test.vcxproj
new file mode 100644
index 0000000..5fcc8b3
--- /dev/null
+++ b/modules/platform/src/main/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\grid_factory_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\gridgain\portable_test_defs.h" />
+    <ClInclude Include="..\..\include\gridgain\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;GG_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;GG_FRIEND;%(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;GG_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;GG_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>
+  <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/1e18fa32/modules/platform/src/main/cpp/core-test/project/vs/core-test.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/project/vs/core-test.vcxproj.filters b/modules/platform/src/main/cpp/core-test/project/vs/core-test.vcxproj.filters
new file mode 100644
index 0000000..0d8a707
--- /dev/null
+++ b/modules/platform/src/main/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\grid_factory_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\gridgain\portable_test_defs.h">
+      <Filter>Code</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\include\gridgain\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/1e18fa32/modules/platform/src/main/cpp/core-test/src/cache_query_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/src/cache_query_test.cpp b/modules/platform/src/main/cpp/core-test/src/cache_query_test.cpp
new file mode 100644
index 0000000..de4a8b2
--- /dev/null
+++ b/modules/platform/src/main/cpp/core-test/src/cache_query_test.cpp
@@ -0,0 +1,644 @@
+/*
+ *  Copyright (C) GridGain Systems. All Rights Reserved.
+ *  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+#ifndef _MSC_VER
+    #define BOOST_TEST_DYN_LINK
+#endif
+
+#include <sstream>
+
+#include <boost/test/unit_test.hpp>
+
+#include "gridgain/impl/utils.h"
+
+#include "gridgain/cache/cache.h"
+#include "gridgain/cache/query/query_cursor.h"
+#include "gridgain/cache/query/query_sql.h"
+#include "gridgain/cache/query/query_text.h"
+#include "gridgain/grid.h"
+#include "gridgain/grid_factory.h"
+
+using namespace boost::unit_test;
+
+using namespace gridgain;
+using namespace gridgain::cache;
+using namespace gridgain::cache::query;
+using namespace gridgain::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 gridgain
+{
+    namespace portable
+    {
+        /**
+         * Portable type definition.
+         */
+        GG_PORTABLE_TYPE_START(QueryPerson)
+            GG_PORTABLE_GET_TYPE_ID_AS_HASH(QueryPerson)
+            GG_PORTABLE_GET_TYPE_NAME_AS_IS(QueryPerson)
+            GG_PORTABLE_GET_FIELD_ID_AS_HASH
+            GG_PORTABLE_GET_HASH_CODE_ZERO(QueryPerson)
+            GG_PORTABLE_IS_NULL_FALSE(QueryPerson)
+            GG_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);
+            }
+
+        GG_PORTABLE_TYPE_END
+    }
+}
+
+/** Node started during the test. */
+Grid grid = Grid();
+
+/** Cache accessor. */
+Cache<int, QueryPerson> GetCache()
+{
+    return grid.GetCache<int, QueryPerson>("cache");
+}
+
+/**
+ * Test setup fixture.
+ */
+struct CacheQueryTestSuiteFixture {
+    /**
+     * Constructor.
+     */
+    CacheQueryTestSuiteFixture()
+    {
+        GridConfiguration cfg;
+
+        GridJvmOption opts[5];
+
+        opts[0] = GridJvmOption("-Xdebug");
+        opts[1] = GridJvmOption("-Xnoagent");
+        opts[2] = GridJvmOption("-Djava.compiler=NONE");
+        opts[3] = GridJvmOption("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
+        opts[4] = GridJvmOption("-XX:+HeapDumpOnOutOfMemoryError");
+
+        cfg.jvmOptsLen = 5;
+        cfg.jvmOpts = opts;
+
+        cfg.jvmInitMem = 1024;
+        cfg.jvmMaxMem = 4096;
+
+        char* cfgPath = getenv("GRIDGAIN_NATIVE_TEST_CPP_CONFIG_PATH");
+
+        std::string cfgPathStr = std::string(cfgPath).append("/").append("cache-query.xml");
+
+        cfg.springCfgPath = const_cast<char*>(cfgPathStr.c_str());
+
+        GridError err;
+
+        Grid grid0 = GridFactory::Start(cfg, &err);
+
+        if (err.GetCode() != GridError::GG_SUCCESS)
+            BOOST_ERROR(err.GetText());
+
+        grid = grid0;
+    }
+
+    /**
+     * Destructor.
+     */
+    ~CacheQueryTestSuiteFixture()
+    {
+        GridFactory::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 (GridError& err)
+    {
+        BOOST_REQUIRE(err.GetCode() == GridError::GG_ERR_GENERIC);
+    }
+}
+
+/**
+ * Ensure that GetNext() fails.
+ *
+ * @param cur Cursor.
+ */
+void CheckGetNextFail(QueryCursor<int, QueryPerson>& cur)
+{
+    try
+    {
+        cur.GetNext();
+
+        BOOST_FAIL("Must fail.");
+    }
+    catch (GridError& err)
+    {
+        BOOST_REQUIRE(err.GetCode() == GridError::GG_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 (GridError& err)
+    {
+        BOOST_REQUIRE(err.GetCode() == GridError::GG_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


Mime
View raw message