IGNITE-1364: Moved CPP module to Ignite.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/58a665aa Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/58a665aa Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/58a665aa Branch: refs/heads/ignite-1093-2 Commit: 58a665aa101ca11f3bfb2177948950052b6afd20 Parents: 94039ec Author: vozerov-gridgain <[email protected]> Authored: Fri Sep 4 12:42:38 2015 +0300 Committer: vozerov-gridgain <[email protected]> Committed: Fri Sep 4 12:42:39 2015 +0300 ---------------------------------------------------------------------- modules/platform/licenses/apache-2.0.txt | 202 ++ .../platform/src/main/cpp/common/configure.ac | 2 +- .../src/main/cpp/common/ignite-common.pc.in | 2 +- .../cpp/common/include/ignite/common/exports.h | 8 +- .../cpp/common/include/ignite/common/java.h | 16 +- .../src/main/cpp/common/src/exports.cpp | 16 +- .../platform/src/main/cpp/common/src/java.cpp | 45 +- .../platform/src/main/cpp/core-test/Makefile.am | 49 + .../main/cpp/core-test/config/cache-query.xml | 91 + .../main/cpp/core-test/config/cache-test.xml | 129 ++ .../src/main/cpp/core-test/configure.ac | 62 + .../src/main/cpp/core-test/include/Makefile.am | 22 + .../include/ignite/portable_test_defs.h | 320 +++ .../include/ignite/portable_test_utils.h | 516 +++++ .../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 | 651 ++++++ .../src/main/cpp/core-test/src/cache_test.cpp | 481 +++++ .../main/cpp/core-test/src/concurrent_test.cpp | 186 ++ .../cpp/core-test/src/handle_registry_test.cpp | 176 ++ .../main/cpp/core-test/src/ignition_test.cpp | 97 + .../src/portable_reader_writer_raw_test.cpp | 1532 ++++++++++++++ .../src/portable_reader_writer_test.cpp | 1951 ++++++++++++++++++ .../cpp/core-test/src/portable_session_test.cpp | 257 +++ .../cpp/core-test/src/portable_test_defs.cpp | 65 + .../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 | 66 + modules/platform/src/main/cpp/core/configure.ac | 62 + modules/platform/src/main/cpp/core/ignite.pc.in | 9 + .../src/main/cpp/core/include/Makefile.am | 61 + .../main/cpp/core/include/ignite/cache/cache.h | 1153 +++++++++++ .../cpp/core/include/ignite/cache/cache_entry.h | 118 ++ .../core/include/ignite/cache/cache_peek_mode.h | 71 + .../cpp/core/include/ignite/cache/query/query.h | 27 + .../include/ignite/cache/query/query_argument.h | 125 ++ .../include/ignite/cache/query/query_cursor.h | 191 ++ .../include/ignite/cache/query/query_scan.h | 151 ++ .../core/include/ignite/cache/query/query_sql.h | 253 +++ .../include/ignite/cache/query/query_text.h | 159 ++ .../src/main/cpp/core/include/ignite/guid.h | 112 + .../src/main/cpp/core/include/ignite/ignite.h | 154 ++ .../core/include/ignite/ignite_configuration.h | 92 + .../main/cpp/core/include/ignite/ignite_error.h | 260 +++ .../src/main/cpp/core/include/ignite/ignition.h | 195 ++ .../core/include/ignite/impl/cache/cache_impl.h | 418 ++++ .../ignite/impl/cache/query/query_impl.h | 115 ++ .../core/include/ignite/impl/handle_registry.h | 202 ++ .../include/ignite/impl/ignite_environment.h | 130 ++ .../cpp/core/include/ignite/impl/ignite_impl.h | 146 ++ .../core/include/ignite/impl/interop/interop.h | 25 + .../ignite/impl/interop/interop_input_stream.h | 234 +++ .../ignite/impl/interop/interop_memory.h | 280 +++ .../ignite/impl/interop/interop_output_stream.h | 234 +++ .../cpp/core/include/ignite/impl/operations.h | 452 ++++ .../ignite/impl/portable/portable_common.h | 146 ++ .../ignite/impl/portable/portable_id_resolver.h | 106 + .../impl/portable/portable_metadata_handler.h | 102 + .../impl/portable/portable_metadata_manager.h | 120 ++ .../impl/portable/portable_metadata_snapshot.h | 122 ++ .../impl/portable/portable_metadata_updater.h | 53 + .../portable/portable_metadata_updater_impl.h | 65 + .../ignite/impl/portable/portable_reader_impl.h | 1130 ++++++++++ .../ignite/impl/portable/portable_utils.h | 344 +++ .../ignite/impl/portable/portable_writer_impl.h | 859 ++++++++ .../cpp/core/include/ignite/portable/portable.h | 29 + .../include/ignite/portable/portable_consts.h | 106 + .../ignite/portable/portable_containers.h | 525 +++++ .../ignite/portable/portable_raw_reader.h | 324 +++ .../ignite/portable/portable_raw_writer.h | 300 +++ .../include/ignite/portable/portable_reader.h | 355 ++++ .../include/ignite/portable/portable_type.h | 293 +++ .../include/ignite/portable/portable_writer.h | 335 +++ .../main/cpp/core/os/linux/include/Makefile.am | 20 + .../core/os/linux/include/ignite/impl/utils.h | 155 ++ .../main/cpp/core/os/linux/src/impl/utils.cpp | 439 ++++ .../cpp/core/os/win/include/ignite/impl/utils.h | 155 ++ .../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/guid.cpp | 65 + .../platform/src/main/cpp/core/src/ignite.cpp | 43 + .../src/main/cpp/core/src/ignite_error.cpp | 222 ++ .../platform/src/main/cpp/core/src/ignition.cpp | 468 +++++ .../main/cpp/core/src/impl/cache/cache_impl.cpp | 388 ++++ .../core/src/impl/cache/query/query_impl.cpp | 193 ++ .../main/cpp/core/src/impl/handle_registry.cpp | 234 +++ .../cpp/core/src/impl/ignite_environment.cpp | 166 ++ .../src/main/cpp/core/src/impl/ignite_impl.cpp | 42 + .../src/impl/interop/interop_input_stream.cpp | 215 ++ .../core/src/impl/interop/interop_memory.cpp | 182 ++ .../src/impl/interop/interop_output_stream.cpp | 215 ++ .../impl/portable/portable_metadata_handler.cpp | 78 + .../impl/portable/portable_metadata_manager.cpp | 201 ++ .../portable/portable_metadata_snapshot.cpp | 70 + .../impl/portable/portable_metadata_updater.cpp | 32 + .../portable/portable_metadata_updater_impl.cpp | 94 + .../src/impl/portable/portable_reader_impl.cpp | 683 ++++++ .../core/src/impl/portable/portable_utils.cpp | 214 ++ .../src/impl/portable/portable_writer_impl.cpp | 600 ++++++ .../core/src/portable/portable_containers.cpp | 76 + .../core/src/portable/portable_raw_reader.cpp | 135 ++ .../core/src/portable/portable_raw_writer.cpp | 147 ++ .../cpp/core/src/portable/portable_reader.cpp | 142 ++ .../cpp/core/src/portable/portable_type.cpp | 51 + .../cpp/core/src/portable/portable_writer.cpp | 154 ++ parent/pom.xml | 10 +- 113 files changed, 25382 insertions(+), 45 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/58a665aa/modules/platform/licenses/apache-2.0.txt ---------------------------------------------------------------------- diff --git a/modules/platform/licenses/apache-2.0.txt b/modules/platform/licenses/apache-2.0.txt new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/modules/platform/licenses/apache-2.0.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. http://git-wip-us.apache.org/repos/asf/ignite/blob/58a665aa/modules/platform/src/main/cpp/common/configure.ac ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/common/configure.ac b/modules/platform/src/main/cpp/common/configure.ac index 7706737..b34d7d8 100644 --- a/modules/platform/src/main/cpp/common/configure.ac +++ b/modules/platform/src/main/cpp/common/configure.ac @@ -19,7 +19,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) -AC_INIT([Ignite JNI bridge for C++], [7.4.1], [[email protected]], [ignite-common], [ignite.apache.org]) +AC_INIT([Apache Ignite JNI bridge for C++], [1.4.0], [[email protected]], [ignite-common], [ignite.apache.org]) AC_CONFIG_SRCDIR(src) AC_CANONICAL_SYSTEM http://git-wip-us.apache.org/repos/asf/ignite/blob/58a665aa/modules/platform/src/main/cpp/common/ignite-common.pc.in ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/common/ignite-common.pc.in b/modules/platform/src/main/cpp/common/ignite-common.pc.in index 3cd3cec..b8c40d2 100644 --- a/modules/platform/src/main/cpp/common/ignite-common.pc.in +++ b/modules/platform/src/main/cpp/common/ignite-common.pc.in @@ -4,6 +4,6 @@ libdir=@libdir@ includedir=@includedir@ Name: ignite-common -Description: Ignite JNI bridge for C++. +Description: Apache Ignite JNI bridge for C++. Version: @PACKAGE_VERSION@ Libs: -L${libdir} -lignite-common http://git-wip-us.apache.org/repos/asf/ignite/blob/58a665aa/modules/platform/src/main/cpp/common/include/ignite/common/exports.h ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/common/include/ignite/common/exports.h b/modules/platform/src/main/cpp/common/include/ignite/common/exports.h index 48e86f0..930fad3 100644 --- a/modules/platform/src/main/cpp/common/include/ignite/common/exports.h +++ b/modules/platform/src/main/cpp/common/include/ignite/common/exports.h @@ -25,10 +25,10 @@ namespace gcj = ignite::common::java; extern "C" { int IGNITE_CALL IgniteReallocate(long long memPtr, int cap); - void* IGNITE_CALL IgniteIgnitionStart(gcj::JniContext* ctx, char* cfgPath, char* gridName, int factoryId, long long dataPtr); - void* IGNITE_CALL IgniteIgnitionInstance(gcj::JniContext* ctx, char* gridName); - long long IGNITE_CALL IgniteIgnitionEnvironmentPointer(gcj::JniContext* ctx, char* gridName); - bool IGNITE_CALL IgniteIgnitionStop(gcj::JniContext* ctx, char* gridName, bool cancel); + void* IGNITE_CALL IgniteIgnitionStart(gcj::JniContext* ctx, char* cfgPath, char* name, int factoryId, long long dataPtr); + void* IGNITE_CALL IgniteIgnitionInstance(gcj::JniContext* ctx, char* name); + long long IGNITE_CALL IgniteIgnitionEnvironmentPointer(gcj::JniContext* ctx, char* name); + bool IGNITE_CALL IgniteIgnitionStop(gcj::JniContext* ctx, char* name, bool cancel); void IGNITE_CALL IgniteIgnitionStopAll(gcj::JniContext* ctx, bool cancel); void IGNITE_CALL IgniteProcessorReleaseStart(gcj::JniContext* ctx, void* obj); http://git-wip-us.apache.org/repos/asf/ignite/blob/58a665aa/modules/platform/src/main/cpp/common/include/ignite/common/java.h ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/common/include/ignite/common/java.h b/modules/platform/src/main/cpp/common/include/ignite/common/java.h index 426ac68..e2d23b2 100644 --- a/modules/platform/src/main/cpp/common/include/ignite/common/java.h +++ b/modules/platform/src/main/cpp/common/include/ignite/common/java.h @@ -449,14 +449,14 @@ namespace ignite static void Detach(); static void Release(jobject obj); - jobject IgnitionStart(char* cfgPath, char* gridName, int factoryId, long long dataPtr); - jobject IgnitionStart(char* cfgPath, char* gridName, int factoryId, long long dataPtr, JniErrorInfo* errInfo); - jobject IgnitionInstance(char* gridName); - jobject IgnitionInstance(char* gridName, JniErrorInfo* errInfo); - long long IgnitionEnvironmentPointer(char* gridName); - long long IgnitionEnvironmentPointer(char* gridName, JniErrorInfo* errInfo); - bool IgnitionStop(char* gridName, bool cancel); - bool IgnitionStop(char* gridName, bool cancel, JniErrorInfo* errInfo); + jobject IgnitionStart(char* cfgPath, char* name, int factoryId, long long dataPtr); + jobject IgnitionStart(char* cfgPath, char* name, int factoryId, long long dataPtr, JniErrorInfo* errInfo); + jobject IgnitionInstance(char* name); + jobject IgnitionInstance(char* name, JniErrorInfo* errInfo); + long long IgnitionEnvironmentPointer(char* name); + long long IgnitionEnvironmentPointer(char* name, JniErrorInfo* errInfo); + bool IgnitionStop(char* name, bool cancel); + bool IgnitionStop(char* name, bool cancel, JniErrorInfo* errInfo); void IgnitionStopAll(bool cancel); void IgnitionStopAll(bool cancel, JniErrorInfo* errInfo); http://git-wip-us.apache.org/repos/asf/ignite/blob/58a665aa/modules/platform/src/main/cpp/common/src/exports.cpp ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/common/src/exports.cpp b/modules/platform/src/main/cpp/common/src/exports.cpp index 10e4801..2ac3340 100644 --- a/modules/platform/src/main/cpp/common/src/exports.cpp +++ b/modules/platform/src/main/cpp/common/src/exports.cpp @@ -26,20 +26,20 @@ extern "C" { return gcj::JniContext::Reallocate(memPtr, cap); } - void* IGNITE_CALL IgniteIgnitionStart(gcj::JniContext* ctx, char* cfgPath, char* gridName, int factoryId, long long dataPtr) { - return ctx->IgnitionStart(cfgPath, gridName, factoryId, dataPtr); + void* IGNITE_CALL IgniteIgnitionStart(gcj::JniContext* ctx, char* cfgPath, char* name, int factoryId, long long dataPtr) { + return ctx->IgnitionStart(cfgPath, name, factoryId, dataPtr); } - void* IGNITE_CALL IgniteIgnitionInstance(gcj::JniContext* ctx, char* gridName) { - return ctx->IgnitionInstance(gridName); + void* IGNITE_CALL IgniteIgnitionInstance(gcj::JniContext* ctx, char* name) { + return ctx->IgnitionInstance(name); } - long long IGNITE_CALL IgniteIgnitionEnvironmentPointer(gcj::JniContext* ctx, char* gridName) { - return ctx->IgnitionEnvironmentPointer(gridName); + long long IGNITE_CALL IgniteIgnitionEnvironmentPointer(gcj::JniContext* ctx, char* name) { + return ctx->IgnitionEnvironmentPointer(name); } - bool IGNITE_CALL IgniteIgnitionStop(gcj::JniContext* ctx, char* gridName, bool cancel) { - return ctx->IgnitionStop(gridName, cancel); + bool IGNITE_CALL IgniteIgnitionStop(gcj::JniContext* ctx, char* name, bool cancel) { + return ctx->IgnitionStop(name, cancel); } void IGNITE_CALL IgniteIgnitionStopAll(gcj::JniContext* ctx, bool cancel) { http://git-wip-us.apache.org/repos/asf/ignite/blob/58a665aa/modules/platform/src/main/cpp/common/src/java.cpp ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/common/src/java.cpp b/modules/platform/src/main/cpp/common/src/java.cpp index 0c6524b..5c5911a 100644 --- a/modules/platform/src/main/cpp/common/src/java.cpp +++ b/modules/platform/src/main/cpp/common/src/java.cpp @@ -919,22 +919,22 @@ namespace ignite } } - jobject JniContext::IgnitionStart(char* cfgPath, char* gridName, int factoryId, long long dataPtr) { - return IgnitionStart(cfgPath, gridName, factoryId, dataPtr, NULL); + jobject JniContext::IgnitionStart(char* cfgPath, char* name, int factoryId, long long dataPtr) { + return IgnitionStart(cfgPath, name, factoryId, dataPtr, NULL); } - jobject JniContext::IgnitionStart(char* cfgPath, char* gridName, int factoryId, long long dataPtr, JniErrorInfo* errInfo) + jobject JniContext::IgnitionStart(char* cfgPath, char* name, int factoryId, long long dataPtr, JniErrorInfo* errInfo) { JNIEnv* env = Attach(); jstring cfgPath0 = env->NewStringUTF(cfgPath); - jstring gridName0 = env->NewStringUTF(gridName); + jstring name0 = env->NewStringUTF(name); jobject interop = env->CallStaticObjectMethod( jvm->GetMembers().c_PlatformIgnition, jvm->GetMembers().m_PlatformIgnition_start, cfgPath0, - gridName0, + name0, factoryId, reinterpret_cast<long long>(&hnds), dataPtr @@ -946,57 +946,57 @@ namespace ignite } - jobject JniContext::IgnitionInstance(char* gridName) + jobject JniContext::IgnitionInstance(char* name) { - return IgnitionInstance(gridName, NULL); + return IgnitionInstance(name, NULL); } - jobject JniContext::IgnitionInstance(char* gridName, JniErrorInfo* errInfo) + jobject JniContext::IgnitionInstance(char* name, JniErrorInfo* errInfo) { JNIEnv* env = Attach(); - jstring gridName0 = env->NewStringUTF(gridName); + jstring name0 = env->NewStringUTF(name); jobject interop = env->CallStaticObjectMethod(jvm->GetMembers().c_PlatformIgnition, - jvm->GetMembers().m_PlatformIgnition_instance, gridName0); + jvm->GetMembers().m_PlatformIgnition_instance, name0); ExceptionCheck(env, errInfo); return LocalToGlobal(env, interop); } - long long JniContext::IgnitionEnvironmentPointer(char* gridName) + long long JniContext::IgnitionEnvironmentPointer(char* name) { - return IgnitionEnvironmentPointer(gridName, NULL); + return IgnitionEnvironmentPointer(name, NULL); } - long long JniContext::IgnitionEnvironmentPointer(char* gridName, JniErrorInfo* errInfo) + long long JniContext::IgnitionEnvironmentPointer(char* name, JniErrorInfo* errInfo) { JNIEnv* env = Attach(); - jstring gridName0 = env->NewStringUTF(gridName); + jstring name0 = env->NewStringUTF(name); long long res = env->CallStaticLongMethod(jvm->GetMembers().c_PlatformIgnition, - jvm->GetMembers().m_PlatformIgnition_environmentPointer, gridName0); + jvm->GetMembers().m_PlatformIgnition_environmentPointer, name0); ExceptionCheck(env, errInfo); return res; } - bool JniContext::IgnitionStop(char* gridName, bool cancel) + bool JniContext::IgnitionStop(char* name, bool cancel) { - return IgnitionStop(gridName, cancel, NULL); + return IgnitionStop(name, cancel, NULL); } - bool JniContext::IgnitionStop(char* gridName, bool cancel, JniErrorInfo* errInfo) + bool JniContext::IgnitionStop(char* name, bool cancel, JniErrorInfo* errInfo) { JNIEnv* env = Attach(); - jstring gridName0 = env->NewStringUTF(gridName); + jstring name0 = env->NewStringUTF(name); - jboolean res = env->CallStaticBooleanMethod(jvm->GetMembers().c_PlatformIgnition, jvm->GetMembers().m_PlatformIgnition_stop, - gridName0, cancel); + jboolean res = env->CallStaticBooleanMethod(jvm->GetMembers().c_PlatformIgnition, + jvm->GetMembers().m_PlatformIgnition_stop, name0, cancel); ExceptionCheck(env, errInfo); @@ -1012,7 +1012,8 @@ namespace ignite { JNIEnv* env = Attach(); - env->CallStaticVoidMethod(jvm->GetMembers().c_PlatformIgnition, jvm->GetMembers().m_PlatformIgnition_stopAll, cancel); + env->CallStaticVoidMethod(jvm->GetMembers().c_PlatformIgnition, + jvm->GetMembers().m_PlatformIgnition_stopAll, cancel); ExceptionCheck(env, errInfo); } http://git-wip-us.apache.org/repos/asf/ignite/blob/58a665aa/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..9ed3111 --- /dev/null +++ b/modules/platform/src/main/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/58a665aa/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..160fe49 --- /dev/null +++ b/modules/platform/src/main/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/58a665aa/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..f239ba9 --- /dev/null +++ b/modules/platform/src/main/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/58a665aa/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..3a1b660 --- /dev/null +++ b/modules/platform/src/main/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.4.0], [[email protected]], [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/58a665aa/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..c43103e --- /dev/null +++ b/modules/platform/src/main/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/58a665aa/modules/platform/src/main/cpp/core-test/include/ignite/portable_test_defs.h ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core-test/include/ignite/portable_test_defs.h b/modules/platform/src/main/cpp/core-test/include/ignite/portable_test_defs.h new file mode 100644 index 0000000..bae0118 --- /dev/null +++ b/modules/platform/src/main/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/58a665aa/modules/platform/src/main/cpp/core-test/include/ignite/portable_test_utils.h ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core-test/include/ignite/portable_test_utils.h b/modules/platform/src/main/cpp/core-test/include/ignite/portable_test_utils.h new file mode 100644 index 0000000..62f99f9 --- /dev/null +++ b/modules/platform/src/main/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/58a665aa/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/58a665aa/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/58a665aa/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
