ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject ignite git commit: IGNITE-4670: CPP: Added Cache.LoadCache() and Cache.LocalLoadCache() operations. This closes #1547.
Date Fri, 17 Feb 2017 08:55:55 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1.9 45577a91c -> aca315d88


IGNITE-4670: CPP: Added Cache.LoadCache() and Cache.LocalLoadCache() operations. This closes
#1547.


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

Branch: refs/heads/ignite-1.9
Commit: aca315d888b227a36983f44d2874fde66fd11ab9
Parents: 45577a9
Author: isapego <igorsapg@gmail.com>
Authored: Fri Feb 17 11:55:10 2017 +0300
Committer: devozerov <vozerov@gridgain.com>
Committed: Fri Feb 17 11:55:10 2017 +0300

----------------------------------------------------------------------
 modules/platforms/cpp/core-test/Makefile.am     |   1 +
 .../cpp/core-test/config/cache-store.xml        |  71 +++++++++
 .../cpp/core-test/project/vs/core-test.vcxproj  |   5 +
 .../project/vs/core-test.vcxproj.filters        |   9 ++
 .../src/binary_identity_resolver_test.cpp       |   2 +-
 .../src/binary_reader_writer_raw_test.cpp       |   2 +-
 .../core-test/src/binary_reader_writer_test.cpp |   2 +-
 .../cpp/core-test/src/binary_session_test.cpp   |   2 +-
 .../cpp/core-test/src/cache_query_test.cpp      |   2 +-
 .../cpp/core-test/src/cache_store_test.cpp      | 151 +++++++++++++++++++
 .../cpp/core-test/src/continuous_query_test.cpp |   2 +-
 .../cpp/core-test/src/handle_registry_test.cpp  |   2 +-
 .../cpp/core-test/src/ignite_error_test.cpp     |   2 +-
 .../cpp/core-test/src/ignition_test.cpp         |   2 +-
 .../cpp/core-test/src/interop_memory_test.cpp   |   2 +-
 .../cpp/core-test/src/reference_test.cpp        |   2 +-
 .../platforms/cpp/core-test/src/test_utils.cpp  |   7 +
 .../cpp/core-test/src/transactions_test.cpp     |   2 +-
 .../cpp/core/include/ignite/cache/cache.h       |  54 +++++--
 .../cache/query/continuous/continuous_query.h   |   2 +-
 .../core/include/ignite/impl/cache/cache_impl.h |  19 +++
 .../ignite/impl/interop/interop_target.h        |  25 +++
 .../cpp/core/src/impl/cache/cache_impl.cpp      |  48 ++++++
 .../core/src/impl/interop/interop_target.cpp    |  36 +++--
 24 files changed, 412 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/aca315d8/modules/platforms/cpp/core-test/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/Makefile.am b/modules/platforms/cpp/core-test/Makefile.am
index 566a827..a03d2df 100644
--- a/modules/platforms/cpp/core-test/Makefile.am
+++ b/modules/platforms/cpp/core-test/Makefile.am
@@ -57,6 +57,7 @@ ignite_tests_SOURCES = \
 	src/binary_identity_resolver_test.cpp \
     src/cache_test.cpp \
     src/cache_query_test.cpp \
+    src/cache_store_test.cpp \
     src/continuous_query_test.cpp \
     src/concurrent_test.cpp \
     src/ignition_test.cpp \

http://git-wip-us.apache.org/repos/asf/ignite/blob/aca315d8/modules/platforms/cpp/core-test/config/cache-store.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/config/cache-store.xml b/modules/platforms/cpp/core-test/config/cache-store.xml
new file mode 100644
index 0000000..94c7ddd
--- /dev/null
+++ b/modules/platforms/cpp/core-test/config/cache-store.xml
@@ -0,0 +1,71 @@
+<?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="cache1"/>
+                    <property name="cacheMode" value="PARTITIONED"/>
+                    <property name="atomicityMode" value="TRANSACTIONAL"/>
+                    <property name="writeSynchronizationMode" value="FULL_SYNC"/>
+
+                    <property name="cacheStoreFactory">
+                        <bean class="org.apache.ignite.internal.processors.cache.MapCacheStoreStrategy.MapStoreFactory"/>
+                    </property>
+
+                    <property name="writeBehindEnabled" value="false"/>
+
+                    <property name="readThrough" value="false"/>
+                    <property name="writeThrough" value="true"/>
+                </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</value>
+                            </list>
+                        </property>
+                    </bean>
+                </property>
+                <property name="socketTimeout" value="300" />
+            </bean>
+        </property>
+    </bean>
+</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/aca315d8/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj b/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj
index d39746e..1b77c40 100644
--- a/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj
+++ b/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj
@@ -34,13 +34,18 @@
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\config\cache-identity.xml" />
+    <None Include="..\..\config\cache-query-continuous.xml" />
     <None Include="..\..\config\cache-query.xml" />
+    <None Include="..\..\config\cache-store.xml">
+      <SubType>Designer</SubType>
+    </None>
     <None Include="..\..\config\cache-test.xml" />
     <None Include="..\..\config\invalid.xml" />
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\src\binary_object_test.cpp" />
     <ClCompile Include="..\..\src\binary_identity_resolver_test.cpp" />
+    <ClCompile Include="..\..\src\cache_store_test.cpp" />
     <ClCompile Include="..\..\src\cache_test.cpp" />
     <ClCompile Include="..\..\src\concurrent_test.cpp" />
     <ClCompile Include="..\..\src\decimal_test.cpp" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/aca315d8/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj.filters b/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj.filters
index 22048b1..d70b5c2 100644
--- a/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj.filters
+++ b/modules/platforms/cpp/core-test/project/vs/core-test.vcxproj.filters
@@ -73,6 +73,9 @@
     <ClCompile Include="..\..\src\test_utils.cpp">
       <Filter>Code</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\cache_store_test.cpp">
+      <Filter>Code</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\include\teamcity_messages.h">
@@ -124,5 +127,11 @@
     <None Include="..\..\config\cache-identity.xml">
       <Filter>Configs</Filter>
     </None>
+    <None Include="..\..\config\cache-query-continuous.xml">
+      <Filter>Configs</Filter>
+    </None>
+    <None Include="..\..\config\cache-store.xml">
+      <Filter>Configs</Filter>
+    </None>
   </ItemGroup>
 </Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/aca315d8/modules/platforms/cpp/core-test/src/binary_identity_resolver_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/binary_identity_resolver_test.cpp b/modules/platforms/cpp/core-test/src/binary_identity_resolver_test.cpp
index 6cede4e..9a06c3c 100644
--- a/modules/platforms/cpp/core-test/src/binary_identity_resolver_test.cpp
+++ b/modules/platforms/cpp/core-test/src/binary_identity_resolver_test.cpp
@@ -16,7 +16,7 @@
  */
 
 #ifndef _MSC_VER
-    #define BOOST_TEST_DYN_LINK
+#   define BOOST_TEST_DYN_LINK
 #endif
 
 #include <sstream>

http://git-wip-us.apache.org/repos/asf/ignite/blob/aca315d8/modules/platforms/cpp/core-test/src/binary_reader_writer_raw_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/binary_reader_writer_raw_test.cpp b/modules/platforms/cpp/core-test/src/binary_reader_writer_raw_test.cpp
index b6d9eab..bd3868a 100644
--- a/modules/platforms/cpp/core-test/src/binary_reader_writer_raw_test.cpp
+++ b/modules/platforms/cpp/core-test/src/binary_reader_writer_raw_test.cpp
@@ -16,7 +16,7 @@
  */
 
 #ifndef _MSC_VER
-    #define BOOST_TEST_DYN_LINK
+#   define BOOST_TEST_DYN_LINK
 #endif
 
 #include <boost/test/unit_test.hpp>

http://git-wip-us.apache.org/repos/asf/ignite/blob/aca315d8/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp b/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp
index fa36dac..dd5743a 100644
--- a/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp
+++ b/modules/platforms/cpp/core-test/src/binary_reader_writer_test.cpp
@@ -16,7 +16,7 @@
  */
 
 #ifndef _MSC_VER
-    #define BOOST_TEST_DYN_LINK
+#   define BOOST_TEST_DYN_LINK
 #endif
 
 #include <boost/test/unit_test.hpp>

http://git-wip-us.apache.org/repos/asf/ignite/blob/aca315d8/modules/platforms/cpp/core-test/src/binary_session_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/binary_session_test.cpp b/modules/platforms/cpp/core-test/src/binary_session_test.cpp
index d178921..0b9b34d 100644
--- a/modules/platforms/cpp/core-test/src/binary_session_test.cpp
+++ b/modules/platforms/cpp/core-test/src/binary_session_test.cpp
@@ -16,7 +16,7 @@
  */
 
 #ifndef _MSC_VER
-    #define BOOST_TEST_DYN_LINK
+#   define BOOST_TEST_DYN_LINK
 #endif
 
 #include <boost/test/unit_test.hpp>

http://git-wip-us.apache.org/repos/asf/ignite/blob/aca315d8/modules/platforms/cpp/core-test/src/cache_query_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/cache_query_test.cpp b/modules/platforms/cpp/core-test/src/cache_query_test.cpp
index b61e289..28eb3fd 100644
--- a/modules/platforms/cpp/core-test/src/cache_query_test.cpp
+++ b/modules/platforms/cpp/core-test/src/cache_query_test.cpp
@@ -16,7 +16,7 @@
  */
 
 #ifndef _MSC_VER
-    #define BOOST_TEST_DYN_LINK
+#   define BOOST_TEST_DYN_LINK
 #endif
 
 #include <sstream>

http://git-wip-us.apache.org/repos/asf/ignite/blob/aca315d8/modules/platforms/cpp/core-test/src/cache_store_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/cache_store_test.cpp b/modules/platforms/cpp/core-test/src/cache_store_test.cpp
new file mode 100644
index 0000000..f1b4630
--- /dev/null
+++ b/modules/platforms/cpp/core-test/src/cache_store_test.cpp
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _MSC_VER
+#   define BOOST_TEST_DYN_LINK
+#endif
+
+#include <boost/test/unit_test.hpp>
+
+#include "ignite/common/utils.h"
+
+#include "ignite/ignite.h"
+#include "ignite/ignition.h"
+#include "ignite/test_utils.h"
+
+using namespace ignite;
+using namespace boost::unit_test;
+
+/*
+ * Test setup fixture.
+ */
+struct CacheStoreTestSuiteFixture
+{
+    /* Nodes started during the test. */
+    Ignite node1;
+
+    /*
+     * Constructor.
+     */
+    CacheStoreTestSuiteFixture() : 
+        node1(ignite_test::StartNode("cache-store.xml", "node1"))
+    {
+        // No-op.
+    }
+
+    /*
+     * Destructor.
+     */
+    ~CacheStoreTestSuiteFixture()
+    {
+        GetCache().RemoveAll();
+
+        Ignition::StopAll(true);
+    }
+
+    /**
+     * Cache accessor.
+     */
+    cache::Cache<int64_t, std::string> GetCache()
+    {
+        return node1.GetOrCreateCache<int64_t, std::string>("cache1");
+    }
+};
+
+void FillStore(cache::Cache<int64_t, std::string>& cache, int64_t n)
+{
+    for (int64_t i = 0; i < n; ++i)
+        cache.Put(i, common::LexicalCast<std::string>(i));
+
+    cache.Clear();
+}
+
+BOOST_FIXTURE_TEST_SUITE(CacheStoreTestSuite, CacheStoreTestSuiteFixture)
+
+BOOST_AUTO_TEST_CASE(LoadCacheSingleNodeNoPredicate)
+{
+    const int64_t entriesNum = 100;
+
+    cache::Cache<int64_t, std::string> cache = GetCache();
+
+    BOOST_CHECK(cache.IsEmpty());
+
+    FillStore(cache, entriesNum);
+
+    BOOST_CHECK(cache.IsEmpty());
+
+    cache.LoadCache();
+
+    BOOST_CHECK(!cache.IsEmpty());
+
+    BOOST_CHECK_EQUAL(cache.Size(cache::IGNITE_PEEK_MODE_PRIMARY), entriesNum);
+
+    std::string val42 = cache.Get(42);
+
+    BOOST_CHECK_EQUAL(val42, "42");
+}
+
+BOOST_AUTO_TEST_CASE(LoadCacheSeveralNodesNoPredicate)
+{
+    BOOST_CHECKPOINT("Starting additional node");
+    Ignite node2 = ignite_test::StartNode("cache-store.xml", "node2");
+
+    const int64_t entriesNum = 100;
+
+    cache::Cache<int64_t, std::string> cache = GetCache();
+
+    BOOST_CHECK(cache.IsEmpty());
+
+    FillStore(cache, entriesNum);
+
+    BOOST_CHECK(cache.IsEmpty());
+
+    cache.LoadCache();
+
+    BOOST_CHECK(!cache.IsEmpty());
+
+    BOOST_CHECK_EQUAL(cache.Size(cache::IGNITE_PEEK_MODE_PRIMARY), entriesNum);
+
+    std::string val42 = cache.Get(42);
+
+    BOOST_CHECK_EQUAL(val42, "42");
+}
+
+BOOST_AUTO_TEST_CASE(LocalLoadCacheSingleNodeNoPredicate)
+{
+    const int64_t entriesNum = 100;
+
+    cache::Cache<int64_t, std::string> cache = GetCache();
+
+    BOOST_CHECK(cache.IsEmpty());
+
+    FillStore(cache, entriesNum);
+
+    BOOST_CHECK(cache.IsEmpty());
+
+    cache.LocalLoadCache();
+
+    BOOST_CHECK(!cache.IsEmpty());
+
+    BOOST_CHECK_EQUAL(cache.Size(cache::IGNITE_PEEK_MODE_PRIMARY), entriesNum);
+
+    std::string val42 = cache.Get(42);
+
+    BOOST_CHECK_EQUAL(val42, "42");
+}
+
+BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/aca315d8/modules/platforms/cpp/core-test/src/continuous_query_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/continuous_query_test.cpp b/modules/platforms/cpp/core-test/src/continuous_query_test.cpp
index 6ce38de..1be21c1 100644
--- a/modules/platforms/cpp/core-test/src/continuous_query_test.cpp
+++ b/modules/platforms/cpp/core-test/src/continuous_query_test.cpp
@@ -16,7 +16,7 @@
  */
 
 #ifndef _MSC_VER
-    #define BOOST_TEST_DYN_LINK
+#   define BOOST_TEST_DYN_LINK
 #endif
 
 #include <deque>

http://git-wip-us.apache.org/repos/asf/ignite/blob/aca315d8/modules/platforms/cpp/core-test/src/handle_registry_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/handle_registry_test.cpp b/modules/platforms/cpp/core-test/src/handle_registry_test.cpp
index 0956d9b..db75e0b 100644
--- a/modules/platforms/cpp/core-test/src/handle_registry_test.cpp
+++ b/modules/platforms/cpp/core-test/src/handle_registry_test.cpp
@@ -16,7 +16,7 @@
  */
 
 #ifndef _MSC_VER
-    #define BOOST_TEST_DYN_LINK
+#   define BOOST_TEST_DYN_LINK
 #endif
 
 #include <boost/test/unit_test.hpp>

http://git-wip-us.apache.org/repos/asf/ignite/blob/aca315d8/modules/platforms/cpp/core-test/src/ignite_error_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/ignite_error_test.cpp b/modules/platforms/cpp/core-test/src/ignite_error_test.cpp
index 8e379e3..69ad8cf 100644
--- a/modules/platforms/cpp/core-test/src/ignite_error_test.cpp
+++ b/modules/platforms/cpp/core-test/src/ignite_error_test.cpp
@@ -16,7 +16,7 @@
  */
 
 #ifndef _MSC_VER
-    #define BOOST_TEST_DYN_LINK
+#   define BOOST_TEST_DYN_LINK
 #endif
 
 #include <boost/test/unit_test.hpp>

http://git-wip-us.apache.org/repos/asf/ignite/blob/aca315d8/modules/platforms/cpp/core-test/src/ignition_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/ignition_test.cpp b/modules/platforms/cpp/core-test/src/ignition_test.cpp
index 17f78ae..52a51d0 100644
--- a/modules/platforms/cpp/core-test/src/ignition_test.cpp
+++ b/modules/platforms/cpp/core-test/src/ignition_test.cpp
@@ -16,7 +16,7 @@
  */
 
 #ifndef _MSC_VER
-    #define BOOST_TEST_DYN_LINK
+#   define BOOST_TEST_DYN_LINK
 #endif
 
 #include <boost/test/unit_test.hpp>

http://git-wip-us.apache.org/repos/asf/ignite/blob/aca315d8/modules/platforms/cpp/core-test/src/interop_memory_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/interop_memory_test.cpp b/modules/platforms/cpp/core-test/src/interop_memory_test.cpp
index 1c782b5..9bd3ef1 100644
--- a/modules/platforms/cpp/core-test/src/interop_memory_test.cpp
+++ b/modules/platforms/cpp/core-test/src/interop_memory_test.cpp
@@ -16,7 +16,7 @@
  */
 
 #ifndef _MSC_VER
-    #define BOOST_TEST_DYN_LINK
+#   define BOOST_TEST_DYN_LINK
 #endif
 
 #include <boost/test/unit_test.hpp>

http://git-wip-us.apache.org/repos/asf/ignite/blob/aca315d8/modules/platforms/cpp/core-test/src/reference_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/reference_test.cpp b/modules/platforms/cpp/core-test/src/reference_test.cpp
index b240e2e..a5ac559 100644
--- a/modules/platforms/cpp/core-test/src/reference_test.cpp
+++ b/modules/platforms/cpp/core-test/src/reference_test.cpp
@@ -16,7 +16,7 @@
  */
 
 #ifndef _MSC_VER
-    #define BOOST_TEST_DYN_LINK
+#   define BOOST_TEST_DYN_LINK
 #endif
 
 #include <memory>

http://git-wip-us.apache.org/repos/asf/ignite/blob/aca315d8/modules/platforms/cpp/core-test/src/test_utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/test_utils.cpp b/modules/platforms/cpp/core-test/src/test_utils.cpp
index 1378487..b706511 100644
--- a/modules/platforms/cpp/core-test/src/test_utils.cpp
+++ b/modules/platforms/cpp/core-test/src/test_utils.cpp
@@ -37,6 +37,13 @@ namespace ignite_test
         cfg.jvmOpts.push_back("-DIGNITE_CONSOLE_APPENDER=false");
         cfg.jvmOpts.push_back("-DIGNITE_UPDATE_NOTIFIER=false");
 
+        bool homeFound;
+        std::string home = jni::ResolveIgniteHome(0, &homeFound);
+
+        assert(homeFound);
+
+        cfg.jvmClassPath = jni::CreateIgniteClasspath(0, &home, true);
+
 #ifdef IGNITE_TESTS_32
         cfg.jvmInitMem = 256;
         cfg.jvmMaxMem = 768;

http://git-wip-us.apache.org/repos/asf/ignite/blob/aca315d8/modules/platforms/cpp/core-test/src/transactions_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/transactions_test.cpp b/modules/platforms/cpp/core-test/src/transactions_test.cpp
index 98856d6..3bf1ac6 100644
--- a/modules/platforms/cpp/core-test/src/transactions_test.cpp
+++ b/modules/platforms/cpp/core-test/src/transactions_test.cpp
@@ -16,7 +16,7 @@
  */
 
 #ifndef _MSC_VER
-    #define BOOST_TEST_DYN_LINK
+#   define BOOST_TEST_DYN_LINK
 #endif
 
 #include <boost/test/unit_test.hpp>

http://git-wip-us.apache.org/repos/asf/ignite/blob/aca315d8/modules/platforms/cpp/core/include/ignite/cache/cache.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/cache/cache.h b/modules/platforms/cpp/core/include/ignite/cache/cache.h
index 54c0f96..f179830 100644
--- a/modules/platforms/cpp/core/include/ignite/cache/cache.h
+++ b/modules/platforms/cpp/core/include/ignite/cache/cache.h
@@ -30,17 +30,17 @@
 #include <ignite/common/concurrent.h>
 #include <ignite/ignite_error.h>
 
-#include "ignite/cache/cache_peek_mode.h"
-#include "ignite/cache/query/query_cursor.h"
-#include "ignite/cache/query/query_fields_cursor.h"
-#include "ignite/cache/query/query_scan.h"
-#include "ignite/cache/query/query_sql.h"
-#include "ignite/cache/query/query_text.h"
-#include "ignite/cache/query/query_sql_fields.h"
-#include "ignite/cache/query/continuous/continuous_query_handle.h"
-#include "ignite/cache/query/continuous/continuous_query.h"
-#include "ignite/impl/cache/cache_impl.h"
-#include "ignite/impl/operations.h"
+#include <ignite/cache/cache_peek_mode.h>
+#include <ignite/cache/query/query_cursor.h>
+#include <ignite/cache/query/query_fields_cursor.h>
+#include <ignite/cache/query/query_scan.h>
+#include <ignite/cache/query/query_sql.h>
+#include <ignite/cache/query/query_text.h>
+#include <ignite/cache/query/query_sql_fields.h>
+#include <ignite/cache/query/continuous/continuous_query_handle.h>
+#include <ignite/cache/query/continuous/continuous_query.h>
+#include <ignite/impl/cache/cache_impl.h>
+#include <ignite/impl/operations.h>
 
 namespace ignite
 {
@@ -57,6 +57,9 @@ namespace ignite
          * of this class instance will only create another reference to the same
          * underlying object. Underlying object released automatically once all
          * the instances are destructed.
+         *
+         * @tparam K Cache key type.
+         * @tparam V Cache value type.
          */
         template<typename K, typename V>
         class IGNITE_IMPORT_EXPORT Cache
@@ -1456,6 +1459,35 @@ namespace ignite
                 return impl.IsValid();
             }
 
+            /**
+             * Executes LocalLoadCache on all cache nodes.
+             */
+            void LoadCache()
+            {
+                IgniteError err;
+
+                impl.Get()->LoadCache(err);
+
+                IgniteError::ThrowIfNeeded(err);
+            }
+
+            /**
+             * Loads state from the underlying persistent storage.
+             *
+             * This method is not transactional and may end up loading a stale value into
+             * cache if another thread has updated the value immediately after it has been
+             * loaded. It is mostly useful when pre-loading the cache from underlying
+             * data store before start, or for read-only caches.
+             */
+            void LocalLoadCache()
+            {
+                IgniteError err;
+
+                impl.Get()->LocalLoadCache(err);
+
+                IgniteError::ThrowIfNeeded(err);
+            }
+
         private:
             /** Implementation delegate. */
             common::concurrent::SharedPointer<impl::cache::CacheImpl> impl;

http://git-wip-us.apache.org/repos/asf/ignite/blob/aca315d8/modules/platforms/cpp/core/include/ignite/cache/query/continuous/continuous_query.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/cache/query/continuous/continuous_query.h
b/modules/platforms/cpp/core/include/ignite/cache/query/continuous/continuous_query.h
index 781ce2e..82bb125 100644
--- a/modules/platforms/cpp/core/include/ignite/cache/query/continuous/continuous_query.h
+++ b/modules/platforms/cpp/core/include/ignite/cache/query/continuous/continuous_query.h
@@ -198,7 +198,7 @@ namespace ignite
                     /**
                      * Set cache entry event listener.
                      *
-                     * @param val Cache entry event listener. Invoked on the
+                     * @param lsnr Cache entry event listener. Invoked on the
                      *     node where continuous query execution has been
                      *     started.
                      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/aca315d8/modules/platforms/cpp/core/include/ignite/impl/cache/cache_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/cache/cache_impl.h b/modules/platforms/cpp/core/include/ignite/impl/cache/cache_impl.h
index 535e3ec..18c3410 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/cache/cache_impl.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/cache/cache_impl.h
@@ -360,6 +360,25 @@ namespace ignite
                     const common::concurrent::SharedPointer<query::continuous::ContinuousQueryImplBase>
qry,
                     const ignite::cache::query::ScanQuery& initialQry, IgniteError&
err);
 
+                /**
+                 * Executes LocalLoadCache on all cache nodes.
+                 *
+                 * @param err Error.
+                 */
+                void LoadCache(IgniteError& err);
+
+                /**
+                 * Loads state from the underlying persistent storage.
+                 *
+                 * This method is not transactional and may end up loading a stale value
into
+                 * cache if another thread has updated the value immediately after it has
been
+                 * loaded. It is mostly useful when pre-loading the cache from underlying
+                 * data store before start, or for read-only caches.
+                 *
+                 * @param err Error.
+                 */
+                void LocalLoadCache(IgniteError& err);
+
             private:
                 IGNITE_NO_COPY_ASSIGNMENT(CacheImpl)
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/aca315d8/modules/platforms/cpp/core/include/ignite/impl/interop/interop_target.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/interop/interop_target.h b/modules/platforms/cpp/core/include/ignite/impl/interop/interop_target.h
index 432d2ac..f959f95 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/interop/interop_target.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/interop/interop_target.h
@@ -34,6 +34,21 @@ namespace ignite
             {
             public:
                 /**
+                 * Operation result.
+                 */
+                enum OperationResult
+                {
+                    /** Null. */
+                    ResultNull = 0,
+
+                    /** Success. */
+                    ResultSuccess = 1,
+
+                    /** Error. */
+                    ResultError = -1
+                };
+
+                /**
                  * Constructor used to create new instance.
                  *
                  * @param env Environment.
@@ -98,6 +113,16 @@ namespace ignite
                 void OutInOpX(int32_t opType, InputOperation& inOp, OutputOperation&
outOp, IgniteError* err);
 
                 /**
+                 * In stream out long operation.
+                 *
+                 * @param opType Type of operation.
+                 * @param outInMem Input and output memory.
+                 * @param err Error.
+                 * @return Operation result.
+                 */
+                OperationResult InStreamOutLong(int32_t opType, InteropMemory& outInMem,
IgniteError* err);
+
+                /**
                 * Internal out-in operation.
                 *
                 * @param opType Operation type.

http://git-wip-us.apache.org/repos/asf/ignite/blob/aca315d8/modules/platforms/cpp/core/src/impl/cache/cache_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/cache/cache_impl.cpp b/modules/platforms/cpp/core/src/impl/cache/cache_impl.cpp
index 5d09e46..f439f76 100644
--- a/modules/platforms/cpp/core/src/impl/cache/cache_impl.cpp
+++ b/modules/platforms/cpp/core/src/impl/cache/cache_impl.cpp
@@ -70,9 +70,15 @@ namespace ignite
             /** Operation: GetAndReplace. */
             const int32_t OP_GET_AND_REPLACE = 10;
 
+            /** Operation: LoadCache */
+            const int32_t OP_LOAD_CACHE = 15;
+
             /** Operation: LocalEvict. */
             const int32_t OP_LOCAL_EVICT = 16;
 
+            /** Operation: LocalLoadCache */
+            const int32_t OP_LOC_LOAD_CACHE = 17;
+
             /** Operation: LocalClear. */
             const int32_t OP_LOCAL_CLEAR = 20;
 
@@ -325,6 +331,48 @@ namespace ignite
                 return QueryContinuous(qry, initialQry, OP_QRY_SCAN, OP_QRY_CONTINUOUS, err);
             }
 
+            void CacheImpl::LoadCache(IgniteError& err)
+            {
+                JniErrorInfo jniErr;
+
+                SharedPointer<InteropMemory> mem = GetEnvironment().AllocateMemory();
+                InteropOutputStream out(mem.Get());
+                BinaryWriterImpl writer(&out, GetEnvironment().GetTypeManager());
+
+                // Predicate. Always null for now.
+                writer.WriteNull();
+
+                // Arguments. No arguments supported for now.
+                writer.WriteInt32(0);
+
+                out.Synchronize();
+
+                InStreamOutLong(OP_LOAD_CACHE, *mem.Get(), &err);
+
+                IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, &err);
+            }
+
+            void CacheImpl::LocalLoadCache(IgniteError & err)
+            {
+                JniErrorInfo jniErr;
+
+                SharedPointer<InteropMemory> mem = GetEnvironment().AllocateMemory();
+                InteropOutputStream out(mem.Get());
+                BinaryWriterImpl writer(&out, GetEnvironment().GetTypeManager());
+
+                // Predicate. Always null for now.
+                writer.WriteNull();
+
+                // Arguments. No arguments supported for now.
+                writer.WriteInt32(0);
+
+                out.Synchronize();
+
+                InStreamOutLong(OP_LOC_LOAD_CACHE, *mem.Get(), &err);
+
+                IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, &err);
+            }
+
             struct DummyQry { void Write(BinaryRawWriter&) const { }};
 
             ContinuousQueryHandleImpl* CacheImpl::QueryContinuous(const SharedPointer<ContinuousQueryImplBase>
qry,

http://git-wip-us.apache.org/repos/asf/ignite/blob/aca315d8/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp b/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp
index 4992ccb..32be8bc 100644
--- a/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp
+++ b/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp
@@ -31,21 +31,6 @@ namespace ignite
     {
         namespace interop
         {
-            /**
-             * Operation result.
-             */
-            enum OperationResult
-            {
-                /** Null. */
-                ResultNull = 0,
-
-                /** Object. */
-                ResultObject = 1,
-
-                /** Error. */
-                ResultError = -1
-            };
-
             InteropTarget::InteropTarget(SharedPointer<IgniteEnvironment> env, jobject
javaRef) :
                 env(env), javaRef(javaRef)
             {
@@ -178,7 +163,7 @@ namespace ignite
 
                     IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
 
-                    if (jniErr.code == IGNITE_JNI_ERR_SUCCESS && res == ResultObject)
+                    if (jniErr.code == IGNITE_JNI_ERR_SUCCESS && res == ResultSuccess)
                         ReadFrom(outInMem.Get(), outOp);
                     else if (res == ResultNull)
                         outOp.SetNull();
@@ -187,6 +172,25 @@ namespace ignite
                 }
             }
 
+            InteropTarget::OperationResult InteropTarget::InStreamOutLong(int32_t opType,
+                InteropMemory& outInMem, IgniteError* err)
+            {
+                JniErrorInfo jniErr;
+
+                int64_t outInPtr = outInMem.PointerLong();
+
+                if (outInPtr)
+                {
+                    int64_t res = env.Get()->Context()->TargetInStreamOutLong(javaRef,
opType, outInPtr, &jniErr);
+
+                    IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+
+                    return static_cast<OperationResult>(res);
+                }
+
+                return ResultError;
+            }
+
             int64_t InteropTarget::OutInOpLong(int32_t opType, int64_t val, IgniteError*
err)
             {
                 JniErrorInfo jniErr;


Mime
View raw message