Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9E90B18A23 for ; Thu, 26 Nov 2015 16:32:54 +0000 (UTC) Received: (qmail 69898 invoked by uid 500); 26 Nov 2015 16:32:54 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 69861 invoked by uid 500); 26 Nov 2015 16:32:54 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 69852 invoked by uid 99); 26 Nov 2015 16:32:54 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Nov 2015 16:32:54 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 3FA14E0B6B; Thu, 26 Nov 2015 16:32:54 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: agoncharuk@apache.org To: commits@ignite.apache.org Message-Id: <7b35ed7ebece44e0b99484d3e30bcca1@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ignite git commit: Fixing examples. Date: Thu, 26 Nov 2015 16:32:54 +0000 (UTC) Repository: ignite Updated Branches: refs/heads/ignite-1.5 2f2004009 -> df9658bf9 Fixing examples. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/df9658bf Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/df9658bf Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/df9658bf Branch: refs/heads/ignite-1.5 Commit: df9658bf9e77427290e0f548532f5d7dc61c1e18 Parents: 2f20040 Author: Alexey Goncharuk Authored: Thu Nov 26 19:10:39 2015 +0300 Committer: Alexey Goncharuk Committed: Thu Nov 26 19:32:46 2015 +0300 ---------------------------------------------------------------------- .../ComputeFibonacciContinuationExample.java | 15 ++- .../computegrid/ComputeTaskMapExample.java | 6 +- .../computegrid/ComputeTaskSplitExample.java | 4 +- .../examples/messaging/MessagingExample.java | 18 +-- .../examples/misc/springbean/spring-bean.xml | 7 -- .../testsuites/IgniteExamplesSelfTestSuite.java | 4 +- .../portable/GridPortableMarshaller.java | 3 + .../internal/portable/PortableContext.java | 10 +- .../ignite/internal/portable/PortableUtils.java | 7 ++ .../processors/cache/GridCacheEventManager.java | 4 +- .../processors/query/GridQueryProcessor.java | 8 ++ .../sharedfs/SharedFsCheckpointSpi.java | 14 ++- .../session/GridSessionCheckpointSelfTest.java | 16 +++ ...ObjectsCacheDataStructuresSelfTestSuite.java | 33 +++++ ...BinaryObjectsCacheExpiryPolicyTestSuite.java | 34 ++++++ ...gniteBinaryObjectsCacheRestartTestSuite.java | 33 +++++ .../IgniteBinaryObjectsCacheTestSuite3.java | 33 +++++ .../IgniteBinaryObjectsCacheTestSuite4.java | 33 +++++ ...IgniteBinaryObjectsComputeGridTestSuite.java | 33 +++++ .../cache/IgniteCacheNoClassQuerySelfTest.java | 122 +++++++++++++++++++ .../IgniteCacheQuerySelfTestSuite.java | 2 + 21 files changed, 402 insertions(+), 37 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeFibonacciContinuationExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeFibonacciContinuationExample.java b/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeFibonacciContinuationExample.java index 706ec18..6642e9d 100644 --- a/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeFibonacciContinuationExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeFibonacciContinuationExample.java @@ -42,7 +42,9 @@ import org.jetbrains.annotations.Nullable; * performing the distributed recursive calculation of {@code 'Fibonacci'} * numbers on the cluster. Continuations * functionality is exposed via {@link ComputeJobContext#holdcc()} and - * {@link ComputeJobContext#callcc()} method calls in {@link ComputeFibonacciContinuationExample.FibonacciClosure} class. + * {@link ComputeJobContext#callcc()} method calls in + * {@link org.apache.ignite.examples.computegrid.ComputeFibonacciContinuationExample.ContinuationFibonacciClosure} + * class. *

* Remote nodes should always be started with special configuration file which * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-ignite.xml'}. @@ -76,7 +78,8 @@ public final class ComputeFibonacciContinuationExample { long start = System.currentTimeMillis(); - BigInteger fib = ignite.compute(ignite.cluster().forPredicate(nodeFilter)).apply(new FibonacciClosure(nodeFilter), N); + BigInteger fib = ignite.compute(ignite.cluster().forPredicate(nodeFilter)).apply( + new ContinuationFibonacciClosure(nodeFilter), N); long duration = System.currentTimeMillis() - start; @@ -93,7 +96,7 @@ public final class ComputeFibonacciContinuationExample { /** * Closure to execute. */ - private static class FibonacciClosure implements IgniteClosure { + private static class ContinuationFibonacciClosure implements IgniteClosure { /** Future for spawned task. */ private IgniteFuture fut1; @@ -114,7 +117,7 @@ public final class ComputeFibonacciContinuationExample { /** * @param nodeFilter Predicate to filter nodes. */ - FibonacciClosure(IgnitePredicate nodeFilter) { + ContinuationFibonacciClosure(IgnitePredicate nodeFilter) { this.nodeFilter = nodeFilter; } @@ -143,7 +146,7 @@ public final class ComputeFibonacciContinuationExample { // If future is not cached in node-local-map, cache it. if (fut1 == null) { - compute.apply(new FibonacciClosure(nodeFilter), n - 1); + compute.apply(new ContinuationFibonacciClosure(nodeFilter), n - 1); ComputeTaskFuture futVal = compute.future(); @@ -155,7 +158,7 @@ public final class ComputeFibonacciContinuationExample { // If future is not cached in node-local-map, cache it. if (fut2 == null) { - compute.apply(new FibonacciClosure(nodeFilter), n - 2); + compute.apply(new ContinuationFibonacciClosure(nodeFilter), n - 2); ComputeTaskFuture futVal = compute.future(); http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeTaskMapExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeTaskMapExample.java b/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeTaskMapExample.java index 1c880e8..3de5293 100644 --- a/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeTaskMapExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeTaskMapExample.java @@ -59,7 +59,7 @@ public class ComputeTaskMapExample { System.out.println("Compute task map example started."); // Execute task on the cluster and wait for its completion. - int cnt = ignite.compute().execute(CharacterCountTask.class, "Hello Ignite Enabled World!"); + int cnt = ignite.compute().execute(MapExampleCharacterCountTask.class, "Hello Ignite Enabled World!"); System.out.println(); System.out.println(">>> Total number of characters in the phrase is '" + cnt + "'."); @@ -70,7 +70,7 @@ public class ComputeTaskMapExample { /** * Task to count non-white-space characters in a phrase. */ - private static class CharacterCountTask extends ComputeTaskAdapter { + private static class MapExampleCharacterCountTask extends ComputeTaskAdapter { /** * Splits the received string to words, creates a child job for each word, and sends * these jobs to other nodes for processing. Each such job simply prints out the received word. @@ -80,8 +80,6 @@ public class ComputeTaskMapExample { * @return Map of jobs to nodes. */ @Override public Map map(List nodes, String arg) { - String[] words = arg.split(" "); - Map map = new HashMap<>(); Iterator it = nodes.iterator(); http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeTaskSplitExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeTaskSplitExample.java b/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeTaskSplitExample.java index a1358e0..60bce4a 100644 --- a/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeTaskSplitExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeTaskSplitExample.java @@ -56,7 +56,7 @@ public class ComputeTaskSplitExample { System.out.println("Compute task split example started."); // Execute task on the cluster and wait for its completion. - int cnt = ignite.compute().execute(CharacterCountTask.class, "Hello Ignite Enabled World!"); + int cnt = ignite.compute().execute(SplitExampleCharacterCountTask.class, "Hello Ignite Enabled World!"); System.out.println(); System.out.println(">>> Total number of characters in the phrase is '" + cnt + "'."); @@ -67,7 +67,7 @@ public class ComputeTaskSplitExample { /** * Task to count non-white-space characters in a phrase. */ - private static class CharacterCountTask extends ComputeTaskSplitAdapter { + private static class SplitExampleCharacterCountTask extends ComputeTaskSplitAdapter { /** * Splits the received string to words, creates a child job for each word, and sends * these jobs to other nodes for processing. Each such job simply prints out the received word. http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/examples/src/main/java/org/apache/ignite/examples/messaging/MessagingExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/messaging/MessagingExample.java b/examples/src/main/java/org/apache/ignite/examples/messaging/MessagingExample.java index 8f37d59..a810e02 100644 --- a/examples/src/main/java/org/apache/ignite/examples/messaging/MessagingExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/messaging/MessagingExample.java @@ -47,7 +47,7 @@ public final class MessagingExample { private static final int MESSAGES_NUM = 10; /** Message topics. */ - private enum TOPIC { ORDERED, UNORDERED } + private enum EXAMPLE_TOPIC { ORDERED, UNORDERED } /** * Executes example. @@ -79,13 +79,13 @@ public final class MessagingExample { // Send unordered messages to all remote nodes. for (int i = 0; i < MESSAGES_NUM; i++) - ignite.message(rmts).send(TOPIC.UNORDERED, Integer.toString(i)); + ignite.message(rmts).send(EXAMPLE_TOPIC.UNORDERED, Integer.toString(i)); System.out.println(">>> Finished sending unordered messages."); // Send ordered messages to all remote nodes. for (int i = 0; i < MESSAGES_NUM; i++) - ignite.message(rmts).sendOrdered(TOPIC.ORDERED, Integer.toString(i), 0); + ignite.message(rmts).sendOrdered(EXAMPLE_TOPIC.ORDERED, Integer.toString(i), 0); System.out.println(">>> Finished sending ordered messages."); System.out.println(">>> Check output on all nodes for message printouts."); @@ -105,7 +105,7 @@ public final class MessagingExample { */ private static void startListening(IgniteMessaging msg) { // Add ordered message listener. - msg.remoteListen(TOPIC.ORDERED, new IgniteBiPredicate() { + msg.remoteListen(EXAMPLE_TOPIC.ORDERED, new IgniteBiPredicate() { @IgniteInstanceResource private Ignite ignite; @@ -113,7 +113,7 @@ public final class MessagingExample { System.out.println("Received ordered message [msg=" + msg + ", fromNodeId=" + nodeId + ']'); try { - ignite.message(ignite.cluster().forNodeId(nodeId)).send(TOPIC.ORDERED, msg); + ignite.message(ignite.cluster().forNodeId(nodeId)).send(EXAMPLE_TOPIC.ORDERED, msg); } catch (IgniteException e) { e.printStackTrace(); @@ -124,7 +124,7 @@ public final class MessagingExample { }); // Add unordered message listener. - msg.remoteListen(TOPIC.UNORDERED, new IgniteBiPredicate() { + msg.remoteListen(EXAMPLE_TOPIC.UNORDERED, new IgniteBiPredicate() { @IgniteInstanceResource private Ignite ignite; @@ -132,7 +132,7 @@ public final class MessagingExample { System.out.println("Received unordered message [msg=" + msg + ", fromNodeId=" + nodeId + ']'); try { - ignite.message(ignite.cluster().forNodeId(nodeId)).send(TOPIC.UNORDERED, msg); + ignite.message(ignite.cluster().forNodeId(nodeId)).send(EXAMPLE_TOPIC.UNORDERED, msg); } catch (IgniteException e) { e.printStackTrace(); @@ -155,7 +155,7 @@ public final class MessagingExample { final CountDownLatch orderedLatch, final CountDownLatch unorderedLatch ) { - msg.localListen(TOPIC.ORDERED, new IgniteBiPredicate() { + msg.localListen(EXAMPLE_TOPIC.ORDERED, new IgniteBiPredicate() { @Override public boolean apply(UUID nodeId, String msg) { orderedLatch.countDown(); @@ -164,7 +164,7 @@ public final class MessagingExample { } }); - msg.localListen(TOPIC.UNORDERED, new IgniteBiPredicate() { + msg.localListen(EXAMPLE_TOPIC.UNORDERED, new IgniteBiPredicate() { @Override public boolean apply(UUID nodeId, String msg) { unorderedLatch.countDown(); http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/examples/src/main/java/org/apache/ignite/examples/misc/springbean/spring-bean.xml ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/misc/springbean/spring-bean.xml b/examples/src/main/java/org/apache/ignite/examples/misc/springbean/spring-bean.xml index 393b9cf..b9fcb86 100644 --- a/examples/src/main/java/org/apache/ignite/examples/misc/springbean/spring-bean.xml +++ b/examples/src/main/java/org/apache/ignite/examples/misc/springbean/spring-bean.xml @@ -35,13 +35,6 @@ - - - - - - - http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java ---------------------------------------------------------------------- diff --git a/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java b/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java index f68ce95..4412af3 100644 --- a/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java +++ b/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java @@ -59,8 +59,8 @@ public class IgniteExamplesSelfTestSuite extends TestSuite { * @throws Exception If failed. */ public static TestSuite suite() throws Exception { - System.setProperty(IGNITE_OVERRIDE_MCAST_GRP, - GridTestUtils.getNextMulticastGroup(IgniteExamplesSelfTestSuite.class)); +// System.setProperty(IGNITE_OVERRIDE_MCAST_GRP, +// GridTestUtils.getNextMulticastGroup(IgniteExamplesSelfTestSuite.class)); TestSuite suite = new TestSuite("Ignite Examples Test Suite"); http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java index af1ed68..5244da8 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java @@ -173,6 +173,9 @@ public class GridPortableMarshaller { public static final byte CONC_SKIP_LIST_SET = 6; /** */ + public static final byte CONC_LINKED_QUEUE = 7; + + /** */ public static final byte HASH_MAP = 1; /** */ http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java index 765babc..ab96ed1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java @@ -47,6 +47,7 @@ import java.util.TreeMap; import java.util.TreeSet; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentSkipListSet; import java.util.jar.JarEntry; @@ -160,6 +161,7 @@ public class PortableContext implements Externalizable { colTypes.put(LinkedHashSet.class, GridPortableMarshaller.LINKED_HASH_SET); colTypes.put(TreeSet.class, GridPortableMarshaller.TREE_SET); colTypes.put(ConcurrentSkipListSet.class, GridPortableMarshaller.CONC_SKIP_LIST_SET); + colTypes.put(ConcurrentLinkedQueue.class, GridPortableMarshaller.CONC_LINKED_QUEUE); mapTypes.put(HashMap.class, GridPortableMarshaller.HASH_MAP); mapTypes.put(LinkedHashMap.class, GridPortableMarshaller.LINKED_HASH_MAP); @@ -893,8 +895,12 @@ public class PortableContext implements Externalizable { // This is an anonymous class. Don't cut off enclosing class name for it. idx = -1; } - catch (NumberFormatException e) { - return typeName; + catch (NumberFormatException ignore) { + // This is a lambda class. + if (clsName.indexOf("$$Lambda$") > 0) + idx = -1; + else + return typeName; } } http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java index 0c569cf..a83405d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java @@ -17,6 +17,7 @@ package org.apache.ignite.internal.portable; +import java.util.concurrent.ConcurrentLinkedQueue; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.binary.BinaryInvalidTypeException; import org.apache.ignite.binary.BinaryObject; @@ -68,6 +69,7 @@ import static org.apache.ignite.internal.portable.GridPortableMarshaller.CHAR_AR import static org.apache.ignite.internal.portable.GridPortableMarshaller.CLASS; import static org.apache.ignite.internal.portable.GridPortableMarshaller.COL; import static org.apache.ignite.internal.portable.GridPortableMarshaller.CONC_HASH_MAP; +import static org.apache.ignite.internal.portable.GridPortableMarshaller.CONC_LINKED_QUEUE; import static org.apache.ignite.internal.portable.GridPortableMarshaller.CONC_SKIP_LIST_SET; import static org.apache.ignite.internal.portable.GridPortableMarshaller.DATE; import static org.apache.ignite.internal.portable.GridPortableMarshaller.DATE_ARR; @@ -1692,6 +1694,11 @@ public class PortableUtils { break; + case CONC_LINKED_QUEUE: + col = new ConcurrentLinkedQueue<>(); + + break; + case USER_SET: col = U.newHashSet(size); http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEventManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEventManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEventManager.java index 7ff3a99..98579c2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEventManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEventManager.java @@ -376,7 +376,9 @@ public class GridCacheEventManager extends GridCacheManagerAdapter { * @return {@code True} if event is recordable. */ public boolean isRecordable(int type) { - return cctx.userCache() && cctx.gridEvents().isRecordable(type); + GridCacheContext cctx0 = cctx; + + return cctx0 != null && cctx0.userCache() && cctx0.gridEvents().isRecordable(type); } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java index 9009e00..64f2415 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java @@ -222,6 +222,14 @@ public class GridQueryProcessor extends GridProcessorAdapter { desc.keyClass(Object.class); } else { + if (keyCls == null) + throw new IgniteCheckedException("Failed to find key class in the node classpath " + + "(use default marshaller to enable binary objects): " + qryEntity.getKeyType()); + + if (valCls == null) + throw new IgniteCheckedException("Failed to find value class in the node classpath " + + "(use default marshaller to enable binary objects) : " + qryEntity.getValueType()); + desc.valueClass(valCls); desc.keyClass(keyCls); } http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java index eb2b5a9..3a25455 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java @@ -28,12 +28,14 @@ import java.util.Queue; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteLogger; +import org.apache.ignite.internal.portable.BinaryMarshaller; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.internal.util.typedef.internal.SB; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.marshaller.Marshaller; +import org.apache.ignite.marshaller.jdk.JdkMarshaller; import org.apache.ignite.resources.IgniteInstanceResource; import org.apache.ignite.resources.LoggerResource; import org.apache.ignite.spi.IgniteSpiAdapter; @@ -165,6 +167,9 @@ public class SharedFsCheckpointSpi extends IgniteSpiAdapter implements Checkpoin /** Listener. */ private CheckpointListener lsnr; + /** Marshaller. */ + private Marshaller marsh; + /** * Initializes default directory paths. */ @@ -209,6 +214,9 @@ public class SharedFsCheckpointSpi extends IgniteSpiAdapter implements Checkpoin this.gridName = gridName; + marsh = ignite.configuration().getMarshaller() instanceof BinaryMarshaller ? new JdkMarshaller() : + ignite.configuration().getMarshaller(); + folder = getNextSharedPath(); if (folder == null) @@ -307,8 +315,6 @@ public class SharedFsCheckpointSpi extends IgniteSpiAdapter implements Checkpoin if (folder != null) { Map files = new HashMap<>(); - Marshaller marsh = ignite.configuration().getMarshaller(); - // Track expiration for only those files that are made by this node // to avoid file access conflicts. for (File file : getFiles()) { @@ -380,7 +386,7 @@ public class SharedFsCheckpointSpi extends IgniteSpiAdapter implements Checkpoin if (file.exists()) try { - SharedFsCheckpointData data = SharedFsUtils.read(file, ignite.configuration().getMarshaller(), log); + SharedFsCheckpointData data = SharedFsUtils.read(file, marsh, log); return data != null ? data.getExpireTime() == 0 || data.getExpireTime() > U.currentTimeMillis() ? @@ -428,7 +434,7 @@ public class SharedFsCheckpointSpi extends IgniteSpiAdapter implements Checkpoin try { SharedFsUtils.write(file, new SharedFsCheckpointData(state, expireTime, host, key), - ignite.configuration().getMarshaller(), log); + marsh, log); } catch (IOException e) { // Select next shared directory if exists, otherwise throw exception http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/core/src/test/java/org/apache/ignite/session/GridSessionCheckpointSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/session/GridSessionCheckpointSelfTest.java b/modules/core/src/test/java/org/apache/ignite/session/GridSessionCheckpointSelfTest.java index 07e558c..2fd62c1 100644 --- a/modules/core/src/test/java/org/apache/ignite/session/GridSessionCheckpointSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/session/GridSessionCheckpointSelfTest.java @@ -19,6 +19,12 @@ package org.apache.ignite.session; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.internal.portable.BinaryCachingMetadataHandler; +import org.apache.ignite.internal.portable.BinaryMarshaller; +import org.apache.ignite.internal.portable.PortableContext; +import org.apache.ignite.internal.util.IgniteUtils; +import org.apache.ignite.marshaller.Marshaller; +import org.apache.ignite.marshaller.MarshallerContextTestImpl; import org.apache.ignite.spi.checkpoint.cache.CacheCheckpointSpi; import org.apache.ignite.spi.checkpoint.jdbc.JdbcCheckpointSpi; import org.apache.ignite.spi.checkpoint.sharedfs.SharedFsCheckpointSpi; @@ -89,6 +95,16 @@ public class GridSessionCheckpointSelfTest extends GridSessionCheckpointAbstract cfg.setCheckpointSpi(spi); + if (cfg.getMarshaller() instanceof BinaryMarshaller) { + PortableContext ctx = new PortableContext(BinaryCachingMetadataHandler.create(), cfg); + + Marshaller marsh = cfg.getMarshaller(); + + marsh.setContext(new MarshallerContextTestImpl(null)); + + IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setPortableContext", ctx, cfg); + } + GridSessionCheckpointSelfTest.spi = spi; checkCheckpoints(cfg); http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheDataStructuresSelfTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheDataStructuresSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheDataStructuresSelfTestSuite.java new file mode 100644 index 0000000..1a77518 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheDataStructuresSelfTestSuite.java @@ -0,0 +1,33 @@ +/* + * 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. + */ + +package org.apache.ignite.testsuites; + +import junit.framework.TestSuite; +import org.apache.ignite.internal.portable.BinaryMarshaller; +import org.apache.ignite.testframework.config.GridTestProperties; + +/** + * + */ +public class IgniteBinaryObjectsCacheDataStructuresSelfTestSuite { + public static TestSuite suite() throws Exception { + GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName()); + + return IgniteCacheDataStructuresSelfTestSuite.suite(); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheExpiryPolicyTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheExpiryPolicyTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheExpiryPolicyTestSuite.java new file mode 100644 index 0000000..b5bd4de --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheExpiryPolicyTestSuite.java @@ -0,0 +1,34 @@ +/* + * 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. + */ + +package org.apache.ignite.testsuites; + +import junit.framework.TestSuite; +import org.apache.ignite.internal.portable.BinaryMarshaller; +import org.apache.ignite.internal.processors.cache.expiry.IgniteCacheExpiryPolicyTestSuite; +import org.apache.ignite.testframework.config.GridTestProperties; + +/** + * + */ +public class IgniteBinaryObjectsCacheExpiryPolicyTestSuite { + public static TestSuite suite() throws Exception { + GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName()); + + return IgniteCacheExpiryPolicyTestSuite.suite(); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheRestartTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheRestartTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheRestartTestSuite.java new file mode 100644 index 0000000..0ef9446 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheRestartTestSuite.java @@ -0,0 +1,33 @@ +/* + * 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. + */ + +package org.apache.ignite.testsuites; + +import junit.framework.TestSuite; +import org.apache.ignite.internal.portable.BinaryMarshaller; +import org.apache.ignite.testframework.config.GridTestProperties; + +/** + * + */ +public class IgniteBinaryObjectsCacheRestartTestSuite { + public static TestSuite suite() throws Exception { + GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName()); + + return IgniteCacheRestartTestSuite.suite(); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheTestSuite3.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheTestSuite3.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheTestSuite3.java new file mode 100644 index 0000000..736a862 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheTestSuite3.java @@ -0,0 +1,33 @@ +/* + * 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. + */ + +package org.apache.ignite.testsuites; + +import junit.framework.TestSuite; +import org.apache.ignite.internal.portable.BinaryMarshaller; +import org.apache.ignite.testframework.config.GridTestProperties; + +/** + * + */ +public class IgniteBinaryObjectsCacheTestSuite3 { + public static TestSuite suite() throws Exception { + GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName()); + + return IgniteCacheTestSuite3.suite(); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheTestSuite4.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheTestSuite4.java new file mode 100644 index 0000000..4f88e0a --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsCacheTestSuite4.java @@ -0,0 +1,33 @@ +/* + * 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. + */ + +package org.apache.ignite.testsuites; + +import junit.framework.TestSuite; +import org.apache.ignite.internal.portable.BinaryMarshaller; +import org.apache.ignite.testframework.config.GridTestProperties; + +/** + * + */ +public class IgniteBinaryObjectsCacheTestSuite4 { + public static TestSuite suite() throws Exception { + GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName()); + + return IgniteCacheTestSuite4.suite(); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsComputeGridTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsComputeGridTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsComputeGridTestSuite.java new file mode 100644 index 0000000..878f59f --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBinaryObjectsComputeGridTestSuite.java @@ -0,0 +1,33 @@ +/* + * 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. + */ + +package org.apache.ignite.testsuites; + +import junit.framework.TestSuite; +import org.apache.ignite.internal.portable.BinaryMarshaller; +import org.apache.ignite.testframework.config.GridTestProperties; + +/** + * + */ +public class IgniteBinaryObjectsComputeGridTestSuite { + public static TestSuite suite() throws Exception { + GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName()); + + return IgniteComputeGridTestSuite.suite(); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoClassQuerySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoClassQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoClassQuerySelfTest.java new file mode 100644 index 0000000..9429226 --- /dev/null +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoClassQuerySelfTest.java @@ -0,0 +1,122 @@ +/* + * 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. + */ + +package org.apache.ignite.internal.processors.cache; + +import java.util.Arrays; +import java.util.Collections; +import java.util.LinkedHashMap; +import org.apache.ignite.Ignite; +import org.apache.ignite.cache.CacheAtomicityMode; +import org.apache.ignite.cache.QueryEntity; +import org.apache.ignite.cache.QueryIndex; +import org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.configuration.NearCacheConfiguration; +import org.apache.ignite.marshaller.optimized.OptimizedMarshaller; +import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; +import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; +import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; +import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; + +import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; +import static org.apache.ignite.cache.CacheRebalanceMode.SYNC; +import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; + +/** + * + */ +public class IgniteCacheNoClassQuerySelfTest extends GridCommonAbstractTest { + /** */ + private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); + + /** */ + protected Ignite ignite; + + /** + * @return Atomicity mode. + */ + protected CacheAtomicityMode atomicityMode() { + return TRANSACTIONAL; + } + + /** + * @return Distribution. + */ + protected NearCacheConfiguration nearCacheConfiguration() { + return new NearCacheConfiguration(); + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { + IgniteConfiguration c = super.getConfiguration(gridName); + + c.setDiscoverySpi(new TcpDiscoverySpi().setForceServerMode(true).setIpFinder(ipFinder)); + + CacheConfiguration cc = defaultCacheConfiguration(); + + c.setMarshaller(new OptimizedMarshaller()); + + cc.setName("cache"); + + cc.setAtomicityMode(TRANSACTIONAL); + cc.setWriteSynchronizationMode(FULL_SYNC); + cc.setRebalanceMode(SYNC); + + QueryEntity qryEntity = new QueryEntity(); + + qryEntity.setKeyType(Integer.class.getName()); + qryEntity.setValueType("MyClass"); + + LinkedHashMap fields = new LinkedHashMap<>(); + + fields.put("strField", String.class.getName()); + fields.put("intField", Integer.class.getName()); + fields.put("doubleField", Double.class.getName()); + + qryEntity.setFields(fields); + + qryEntity.setFields(fields); + + qryEntity.setIndexes(Arrays.asList( + new QueryIndex("strField"), + new QueryIndex("intField"), + new QueryIndex("doubleField") + )); + + cc.setQueryEntities(Collections.singletonList( + qryEntity + )); + + c.setCacheConfiguration(cc); + + return c; + } + + /** + * @throws Exception If failed. + */ + public void testNoClass() throws Exception { + try { + startGrid(); + } + catch (Exception e) { + assertTrue(e.getMessage().contains("default marshaller")); + } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/df9658bf/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java index 0745cd7..8311414 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java +++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java @@ -33,6 +33,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheReduceQueryMultithre import org.apache.ignite.internal.processors.cache.IgniteCacheCollocatedQuerySelfTest; import org.apache.ignite.internal.processors.cache.IgniteCacheFieldsQueryNoDataSelfTest; import org.apache.ignite.internal.processors.cache.IgniteCacheLargeResultSelfTest; +import org.apache.ignite.internal.processors.cache.IgniteCacheNoClassQuerySelfTest; import org.apache.ignite.internal.processors.cache.IgniteCacheOffheapEvictQueryTest; import org.apache.ignite.internal.processors.cache.IgniteCacheOffheapTieredMultithreadedSelfTest; import org.apache.ignite.internal.processors.cache.IgniteCacheP2pUnmarshallingQueryErrorTest; @@ -204,6 +205,7 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite { //Unmarshallig query test. suite.addTestSuite(IgniteCacheP2pUnmarshallingQueryErrorTest.class); + suite.addTestSuite(IgniteCacheNoClassQuerySelfTest.class); return suite; }