ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject ignite git commit: IGNITE-7803 Fixed tests.
Date Wed, 07 Mar 2018 11:27:31 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-7803 [created] 389898dda


IGNITE-7803 Fixed tests.


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

Branch: refs/heads/ignite-7803
Commit: 389898dda870ec4fdaaf4ba3b7224bf93b7c09a7
Parents: caba7cc
Author: Alexey Kuznetsov <akuznetsov@apache.org>
Authored: Wed Mar 7 18:27:15 2018 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Wed Mar 7 18:27:15 2018 +0700

----------------------------------------------------------------------
 .../client/impl/ClientCacheFlagsCodecTest.java  |  27 +++--
 .../internal/client/GridClientCacheFlag.java    |   6 ++
 .../impl/connection/GridClientConnection.java   |  12 ++-
 .../handlers/cache/GridCacheCommandHandler.java | 102 ++++++++++---------
 .../cache/GridCacheCommandHandlerSelfTest.java  |   9 +-
 .../http/jetty/GridJettyRestHandler.java        |   4 +-
 6 files changed, 94 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/389898dd/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientCacheFlagsCodecTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientCacheFlagsCodecTest.java
b/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientCacheFlagsCodecTest.java
index 22e9a25..1598ea7 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientCacheFlagsCodecTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/impl/ClientCacheFlagsCodecTest.java
@@ -18,8 +18,8 @@
 package org.apache.ignite.internal.client.impl;
 
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.EnumSet;
+import java.util.Set;
 import junit.framework.TestCase;
 import org.apache.ignite.internal.client.GridClientCacheFlag;
 import org.apache.ignite.internal.client.impl.connection.GridClientConnection;
@@ -37,16 +37,13 @@ public class ClientCacheFlagsCodecTest extends TestCase {
      */
     public void testEncodingDecodingFullness() {
         for (GridClientCacheFlag f : GridClientCacheFlag.values()) {
-            if (f == KEEP_BINARIES)
-                continue;
-
-            int bits = GridClientConnection.encodeCacheFlags(Collections.singleton(f));
+            int bits = GridClientConnection.encodeCacheFlags(EnumSet.of(f));
 
             assertTrue(bits != 0);
 
-            boolean out = GridCacheCommandHandler.parseCacheFlags(bits);
+            Set<GridClientCacheFlag> out = GridCacheCommandHandler.parseCacheFlags(bits);
 
-            assertEquals(out, true);
+            assertTrue(out.contains(f));
         }
     }
 
@@ -54,9 +51,10 @@ public class ClientCacheFlagsCodecTest extends TestCase {
      * Tests that groups of client flags can be correctly converted to corresponding server
flag groups.
      */
     public void testGroupEncodingDecoding() {
-        // all
+        // All
         doTestGroup(GridClientCacheFlag.values());
-        // none
+
+        // None
         doTestGroup();
     }
 
@@ -64,15 +62,14 @@ public class ClientCacheFlagsCodecTest extends TestCase {
      * @param flags Client flags to be encoded, decoded and checked.
      */
     private void doTestGroup(GridClientCacheFlag... flags) {
-        EnumSet<GridClientCacheFlag> flagSet = F.isEmpty(flags) ? EnumSet.noneOf(GridClientCacheFlag.class)
:
-            EnumSet.copyOf(Arrays.asList(flags));
+        EnumSet<GridClientCacheFlag> flagSet = F.isEmpty(flags)
+            ? EnumSet.noneOf(GridClientCacheFlag.class)
+            : EnumSet.copyOf(Arrays.asList(flags));
 
         int bits = GridClientConnection.encodeCacheFlags(flagSet);
 
-        boolean out = GridCacheCommandHandler.parseCacheFlags(bits);
-
-        int length = flagSet.contains(KEEP_BINARIES) ? flagSet.size() - 1 : flagSet.size();
+        Set<GridClientCacheFlag> out = GridCacheCommandHandler.parseCacheFlags(bits);
 
-        assertEquals(length > 0, out);
+        assertTrue(out.containsAll(flagSet));
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/389898dd/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientCacheFlag.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientCacheFlag.java
b/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientCacheFlag.java
index 2e4831e..d131467 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientCacheFlag.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientCacheFlag.java
@@ -49,4 +49,10 @@ public enum GridClientCacheFlag {
     public static GridClientCacheFlag fromOrdinal(int ord) {
         return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
     }
+
+    /** */
+    public static final int SKIP_STORE_MASK = 0b1;
+
+    /** */
+    public static final int KEEP_BINARIES_MASK = 0b10;
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/389898dd/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientConnection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientConnection.java
b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientConnection.java
index 0d7b9e3..ef01609 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientConnection.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientConnection.java
@@ -37,6 +37,11 @@ import org.apache.ignite.internal.client.impl.GridClientFutureCallback;
 import org.apache.ignite.internal.util.typedef.F;
 import org.jetbrains.annotations.Nullable;
 
+import static org.apache.ignite.internal.client.GridClientCacheFlag.KEEP_BINARIES;
+import static org.apache.ignite.internal.client.GridClientCacheFlag.KEEP_BINARIES_MASK;
+import static org.apache.ignite.internal.client.GridClientCacheFlag.SKIP_STORE;
+import static org.apache.ignite.internal.client.GridClientCacheFlag.SKIP_STORE_MASK;
+
 /**
  * Facade for all possible network communications between client and server. Introduced to
hide
  * protocol implementation (TCP, HTTP) from client code.
@@ -114,8 +119,11 @@ public abstract class GridClientConnection {
     public static int encodeCacheFlags(Collection<GridClientCacheFlag> flagSet) {
         int bits = 0;
 
-        if (flagSet.contains(GridClientCacheFlag.SKIP_STORE))
-            bits |= 1;
+        if (flagSet.contains(SKIP_STORE))
+            bits |= SKIP_STORE_MASK;
+
+        if (flagSet.contains(KEEP_BINARIES))
+            bits |= KEEP_BINARIES_MASK;
 
         return bits;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/389898dd/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
index 0a545b4..9b35199 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
@@ -51,6 +51,7 @@ import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.client.GridClientCacheFlag;
 import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
 import org.apache.ignite.internal.processors.cache.CacheConfigurationOverride;
 import org.apache.ignite.internal.processors.cache.CacheInvokeEntry;
@@ -83,6 +84,10 @@ import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 import static org.apache.ignite.cache.CacheMode.REPLICATED;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
 import static org.apache.ignite.internal.GridClosureCallMode.BALANCE;
+import static org.apache.ignite.internal.client.GridClientCacheFlag.KEEP_BINARIES;
+import static org.apache.ignite.internal.client.GridClientCacheFlag.KEEP_BINARIES_MASK;
+import static org.apache.ignite.internal.client.GridClientCacheFlag.SKIP_STORE;
+import static org.apache.ignite.internal.client.GridClientCacheFlag.SKIP_STORE_MASK;
 import static org.apache.ignite.internal.processors.query.QueryUtils.TEMPLATE_PARTITIONED;
 import static org.apache.ignite.internal.processors.query.QueryUtils.TEMPLATE_REPLICATED;
 import static org.apache.ignite.internal.processors.rest.GridRestCommand.ATOMIC_DECREMENT;
@@ -185,16 +190,22 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter
{
      * Retrieves cache flags from corresponding bits.
      *
      * @param cacheFlagsBits Integer representation of cache flags bit set.
-     * @return Skip store flag.
+     * @return Cache flags.
      */
-    public static boolean parseCacheFlags(int cacheFlagsBits) {
-        if (cacheFlagsBits == 0)
-            return false;
+    public static Set<GridClientCacheFlag> parseCacheFlags(int cacheFlagsBits) {
+        boolean skipStore = (cacheFlagsBits & SKIP_STORE_MASK) != 0;
+        boolean keepBinaries = (cacheFlagsBits & KEEP_BINARIES_MASK) != 0;
 
-        if ((cacheFlagsBits & 1) != 0)
-            return true;
+        if (skipStore & keepBinaries)
+            return EnumSet.of(SKIP_STORE, KEEP_BINARIES);
 
-        return false;
+        if (skipStore)
+            return EnumSet.of(SKIP_STORE);
+
+        if (keepBinaries)
+            return EnumSet.of(KEEP_BINARIES);
+
+        return EnumSet.noneOf(GridClientCacheFlag.class);
     }
 
     /**
@@ -377,7 +388,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter
{
 
         final Object key = req0.key();
 
-        final boolean skipStore = parseCacheFlags(req0.cacheFlags());
+        final Set<GridClientCacheFlag> cacheFlags = parseCacheFlags(req0.cacheFlags());
 
         try {
             GridRestCommand cmd = req0.command();
@@ -447,70 +458,70 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter
{
                 }
 
                 case CACHE_CONTAINS_KEYS: {
-                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
skipStore, key,
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
cacheFlags, key,
                         new ContainsKeysCommand(getKeys(req0)));
 
                     break;
                 }
 
                 case CACHE_CONTAINS_KEY: {
-                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
skipStore, key,
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
cacheFlags, key,
                         new ContainsKeyCommand(key));
 
                     break;
                 }
 
                 case CACHE_GET: {
-                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
skipStore, key,
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
cacheFlags, key,
                         new GetCommand(key));
 
                     break;
                 }
 
                 case CACHE_GET_AND_PUT: {
-                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
skipStore, key,
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
cacheFlags, key,
                         new GetAndPutCommand(key, getValue(req0)));
 
                     break;
                 }
 
                 case CACHE_GET_AND_REPLACE: {
-                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
skipStore, key,
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
cacheFlags, key,
                         new GetAndReplaceCommand(key, getValue(req0)));
 
                     break;
                 }
 
                 case CACHE_GET_AND_PUT_IF_ABSENT: {
-                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
skipStore, key,
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
cacheFlags, key,
                         new GetAndPutIfAbsentCommand(key, getValue(req0)));
 
                     break;
                 }
 
                 case CACHE_PUT_IF_ABSENT: {
-                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
skipStore, key,
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
cacheFlags, key,
                         new PutIfAbsentCommand(key, ttl, getValue(req0)));
 
                     break;
                 }
 
                 case CACHE_GET_ALL: {
-                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
skipStore, key,
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
cacheFlags, key,
                         new GetAllCommand(getKeys(req0)));
 
                     break;
                 }
 
                 case CACHE_PUT: {
-                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
skipStore, key, new
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
cacheFlags, key, new
                         PutCommand(key, ttl, getValue(req0)));
 
                     break;
                 }
 
                 case CACHE_ADD: {
-                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
skipStore, key,
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
cacheFlags, key,
                         new AddCommand(key, ttl, getValue(req0)));
 
                     break;
@@ -533,35 +544,35 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter
{
                     // HashMap wrapping for correct serialization
                     map = new HashMap<>(map);
 
-                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
skipStore, key,
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
cacheFlags, key,
                         new PutAllCommand(map));
 
                     break;
                 }
 
                 case CACHE_REMOVE: {
-                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
skipStore, key,
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
cacheFlags, key,
                         new RemoveCommand(key));
 
                     break;
                 }
 
                 case CACHE_REMOVE_VALUE: {
-                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
skipStore, key,
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
cacheFlags, key,
                         new RemoveValueCommand(key, getValue(req0)));
 
                     break;
                 }
 
                 case CACHE_REPLACE_VALUE: {
-                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
skipStore, key,
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
cacheFlags, key,
                         new ReplaceValueCommand(key, getValue(req0), req0.value2()));
 
                     break;
                 }
 
                 case CACHE_GET_AND_REMOVE: {
-                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
skipStore, key,
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
cacheFlags, key,
                         new GetAndRemoveCommand(key));
 
                     break;
@@ -573,7 +584,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter
{
                     // HashSet wrapping for correct serialization
                     Set<Object> keys = map == null ? null : new HashSet<>(map.keySet());
 
-                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
skipStore, key,
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
cacheFlags, key,
                         new RemoveAllCommand(keys));
 
                     break;
@@ -589,7 +600,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter
{
                     GridCompoundFuture compFut = new GridCompoundFuture();
 
                     for (Object cName : cacheNames)
-                        compFut.add(executeCommand(req.destinationId(), req.clientId(), (String)cName,
skipStore, key,
+                        compFut.add(executeCommand(req.destinationId(), req.clientId(), (String)cName,
cacheFlags, key,
                             new RemoveAllCommand(null)));
 
                     compFut.markInitialized();
@@ -623,7 +634,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter
{
                     if (val == null)
                         throw new IgniteCheckedException(GridRestCommandHandlerAdapter.missingParameter("val"));
 
-                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
skipStore, key,
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
cacheFlags, key,
                         new ReplaceCommand(key, ttl, val));
 
                     break;
@@ -633,21 +644,21 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter
{
                     final Object val1 = req0.value();
                     final Object val2 = req0.value2();
 
-                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
skipStore, key,
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
cacheFlags, key,
                         new CasCommand(val2, val1, key));
 
                     break;
                 }
 
                 case CACHE_APPEND: {
-                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
skipStore, key,
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
cacheFlags, key,
                         new AppendCommand(key, req0));
 
                     break;
                 }
 
                 case CACHE_PREPEND: {
-                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
skipStore, key,
+                    fut = executeCommand(req.destinationId(), req.clientId(), cacheName,
cacheFlags, key,
                         new PrependCommand(key, req0));
 
                     break;
@@ -680,12 +691,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter
{
 
             return fut;
         }
-        catch (IgniteException e) {
-            U.error(log, "Failed to execute cache command: " + req, e);
-
-            return new GridFinishedFuture<>(e);
-        }
-        catch (IgniteCheckedException e) {
+        catch (IgniteException | IgniteCheckedException e) {
             U.error(log, "Failed to execute cache command: " + req, e);
 
             return new GridFinishedFuture<>(e);
@@ -741,7 +747,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter
{
      * @param destId Target node Id for the operation. If {@code null} - operation could
be executed anywhere.
      * @param clientId Client ID.
      * @param cacheName Cache name.
-     * @param skipStore Skip store.
+     * @param cacheFlags Cache flags.
      * @param key Key to set affinity mapping in the response.
      * @param op Operation to perform.
      * @return Operation result in future.
@@ -751,7 +757,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter
{
         @Nullable UUID destId,
         UUID clientId,
         final String cacheName,
-        final boolean skipStore,
+        final Set<GridClientCacheFlag> cacheFlags,
         final Object key,
         final CacheProjectionCommand op) throws IgniteCheckedException {
 
@@ -761,8 +767,10 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter
{
         if (locExec) {
             IgniteInternalCache<?, ?> prj = localCache(cacheName)
                 .forSubjectId(clientId)
-                .setSkipStore(skipStore)
-                .keepBinary();
+                .setSkipStore(cacheFlags.contains(SKIP_STORE));
+
+            if (cacheFlags.contains(KEEP_BINARIES))
+                prj = prj.keepBinary();
 
             return op.apply((IgniteInternalCache<Object, Object>)prj, ctx).
                 chain(resultWrapper((IgniteInternalCache<Object, Object>)prj, key));
@@ -773,7 +781,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter
{
             ctx.task().setThreadContext(TC_NO_FAILOVER, true);
 
             return ctx.closure().callAsync(BALANCE,
-                new FlaggedCacheOperationCallable(clientId, cacheName, skipStore, op, key),
+                new FlaggedCacheOperationCallable(clientId, cacheName, cacheFlags, op, key),
                 prj.nodes());
         }
     }
@@ -902,7 +910,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter
{
         /** */
         private final String cacheName;
         /** */
-        private final boolean skipStore;
+        private final Set<GridClientCacheFlag> cacheFlags;
         /** */
         private final CacheProjectionCommand op;
         /** */
@@ -916,19 +924,19 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter
{
         /**
          * @param clientId Client ID.
          * @param cacheName Cache name.
-         * @param skipStore Skip store.
+         * @param cacheFlags Cache flags.
          * @param op Operation.
          * @param key Key.
          */
         private FlaggedCacheOperationCallable(UUID clientId,
             String cacheName,
-            boolean skipStore,
+            Set<GridClientCacheFlag> cacheFlags,
             CacheProjectionCommand op,
             Object key
         ) {
             this.clientId = clientId;
             this.cacheName = cacheName;
-            this.skipStore = skipStore;
+            this.cacheFlags = cacheFlags;
             this.op = op;
             this.key = key;
         }
@@ -937,8 +945,10 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter
{
         @Override public GridRestResponse call() throws Exception {
             IgniteInternalCache<?, ?> prj = cache(g, cacheName)
                 .forSubjectId(clientId)
-                .setSkipStore(skipStore)
-                .keepBinary();
+                .setSkipStore(cacheFlags.contains(SKIP_STORE));
+
+            if (cacheFlags.contains(KEEP_BINARIES))
+                prj = prj.keepBinary();
 
             // Need to apply both operation and response transformation remotely
             // as cache could be inaccessible on local node and

http://git-wip-us.apache.org/repos/asf/ignite/blob/389898dd/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java
index e34992f..c94ebd8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java
@@ -277,10 +277,15 @@ public class GridCacheCommandHandlerSelfTest extends GridCommonAbstractTest
{
 
                             return fut;
                         }
+
                         // Rewriting flagOn result to keep intercepting invocations after
it.
-                        else if ("setSkipStore".equals(mtd.getName()))
+                        if ("setSkipStore".equals(mtd.getName()))
+                            return proxy;
+
+                        if ("forSubjectId".equals(mtd.getName()))
                             return proxy;
-                        else if ("forSubjectId".equals(mtd.getName()))
+
+                        if ("keepBinary".equals(mtd.getName()))
                             return proxy;
 
                         return mtd.invoke(cache, args);

http://git-wip-us.apache.org/repos/asf/ignite/blob/389898dd/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
index 1d80eea..85398cc 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
@@ -67,6 +67,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.jetbrains.annotations.Nullable;
 
+import static org.apache.ignite.internal.client.GridClientCacheFlag.KEEP_BINARIES_MASK;
 import static org.apache.ignite.internal.processors.rest.GridRestCommand.CACHE_CONTAINS_KEYS;
 import static org.apache.ignite.internal.processors.rest.GridRestCommand.CACHE_GET_ALL;
 import static org.apache.ignite.internal.processors.rest.GridRestCommand.CACHE_PUT_ALL;
@@ -625,7 +626,8 @@ public class GridJettyRestHandler extends AbstractHandler {
                 if (val1 != null)
                     restReq0.value(val1);
 
-                restReq0.cacheFlags(intValue("cacheFlags", params, 0));
+                // Cache operations via REST will use binary objects.
+                restReq0.cacheFlags(intValue("cacheFlags", params, KEEP_BINARIES_MASK));
                 restReq0.ttl(longValue("exp", params, null));
 
                 if (cmd == CACHE_GET_ALL || cmd == CACHE_PUT_ALL || cmd == CACHE_REMOVE_ALL
||


Mime
View raw message