Repository: ignite Updated Branches: refs/heads/ignite-950-new ce235eaca -> 4b73226f3
IGNITE-950-new - Fixing tests. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4b73226f Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4b73226f Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4b73226f Branch: refs/heads/ignite-950-new Commit: 4b73226f338d4474cb912fed33ede70243651f63 Parents: ce235ea Author: Alexey Goncharuk <[email protected]> Authored: Sat Oct 31 18:56:39 2015 +0300 Committer: Alexey Goncharuk <[email protected]> Committed: Sat Oct 31 18:56:39 2015 +0300 ---------------------------------------------------------------------- .../processors/query/GridQueryProcessor.java | 5 +- .../org/apache/ignite/stream/StreamAdapter.java | 3 +- .../GridPortableMarshallerSelfTest.java | 29 +++++----- .../portable/GridPortableWildcardsSelfTest.java | 3 +- .../cache/CacheNearReaderUpdateTest.java | 60 +++++++++++++------- .../DataStreamProcessorPortableSelfTest.java | 28 --------- ...niteCacheP2pUnmarshallingQueryErrorTest.java | 19 +++++-- parent/pom.xml | 3 +- 8 files changed, 79 insertions(+), 71 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/4b73226f/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 2b54e2b..2f18ca3 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 @@ -53,6 +53,7 @@ import org.apache.ignite.cache.query.SqlFieldsQuery; import org.apache.ignite.cache.query.SqlQuery; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.events.CacheQueryExecutedEvent; +import org.apache.ignite.igniteobject.IgniteObject; import org.apache.ignite.internal.GridKernalContext; import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.processors.GridProcessorAdapter; @@ -1837,9 +1838,9 @@ public class GridQueryProcessor extends GridProcessorAdapter { if (isKeyProp0 == 0) { // Key is allowed to be a non-portable object here. // We check key before value consistently with ClassProperty. - if (ctx.cacheObjects().isPortableObject(key) && ctx.cacheObjects().hasField(key, propName)) + if (key instanceof IgniteObject && ((IgniteObject)key).hasField(propName)) isKeyProp = isKeyProp0 = 1; - else if (ctx.cacheObjects().hasField(val, propName)) + else if (val instanceof IgniteObject && ((IgniteObject)val).hasField(propName)) isKeyProp = isKeyProp0 = -1; else { U.warn(log, "Neither key nor value have property " + http://git-wip-us.apache.org/repos/asf/ignite/blob/4b73226f/modules/core/src/main/java/org/apache/ignite/stream/StreamAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/stream/StreamAdapter.java b/modules/core/src/main/java/org/apache/ignite/stream/StreamAdapter.java index e7d224c..48559a9 100644 --- a/modules/core/src/main/java/org/apache/ignite/stream/StreamAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/stream/StreamAdapter.java @@ -33,11 +33,10 @@ import org.apache.ignite.IgniteDataStreamer; * <li>A single tuple extractor, which extracts either no or 1 tuple out of a message. See * see {@link #setTupleExtractor(StreamTupleExtractor)}.</li> * <li>A multiple tuple extractor, which is capable of extracting multiple tuples out of a single message, in the - * form of a {@link Map<K, V>}. See {@link #setMultipleTupleExtractor(StreamMultipleTupleExtractor)}.</li> + * form of a {@link Map}. See {@link #setMultipleTupleExtractor(StreamMultipleTupleExtractor)}.</li> * </ol> */ public abstract class StreamAdapter<T, K, V> { - /** Tuple extractor extracting a single tuple from an event */ private StreamSingleTupleExtractor<T, K, V> singleTupleExtractor; http://git-wip-us.apache.org/repos/asf/ignite/blob/4b73226f/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerSelfTest.java index cd4f19a..1647a25 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerSelfTest.java @@ -37,32 +37,31 @@ import java.util.Map; import java.util.TreeMap; import java.util.TreeSet; import java.util.UUID; -import java.util.concurrent.Callable; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentSkipListSet; import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.internal.portable.builder.IgniteObjectBuilderImpl; -import org.apache.ignite.internal.util.GridUnsafe; -import org.apache.ignite.internal.util.IgniteUtils; -import org.apache.ignite.internal.util.lang.GridMapEntry; -import org.apache.ignite.internal.util.typedef.F; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.marshaller.MarshallerContextTestImpl; -import org.apache.ignite.marshaller.portable.PortableMarshaller; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.igniteobject.IgniteObject; import org.apache.ignite.igniteobject.IgniteObjectBuilder; +import org.apache.ignite.igniteobject.IgniteObjectConfiguration; import org.apache.ignite.igniteobject.IgniteObjectException; import org.apache.ignite.igniteobject.IgniteObjectIdMapper; -import org.apache.ignite.igniteobject.IgniteObjectInvalidClassException; import org.apache.ignite.igniteobject.IgniteObjectMarshalAware; import org.apache.ignite.igniteobject.IgniteObjectMetadata; -import org.apache.ignite.igniteobject.IgniteObject; import org.apache.ignite.igniteobject.IgniteObjectRawReader; import org.apache.ignite.igniteobject.IgniteObjectRawWriter; import org.apache.ignite.igniteobject.IgniteObjectReader; import org.apache.ignite.igniteobject.IgniteObjectSerializer; -import org.apache.ignite.igniteobject.IgniteObjectConfiguration; import org.apache.ignite.igniteobject.IgniteObjectWriter; +import org.apache.ignite.internal.portable.builder.IgniteObjectBuilderImpl; +import org.apache.ignite.internal.util.GridUnsafe; +import org.apache.ignite.internal.util.IgniteUtils; +import org.apache.ignite.internal.util.lang.GridMapEntry; +import org.apache.ignite.internal.util.typedef.F; +import org.apache.ignite.internal.util.typedef.internal.S; +import org.apache.ignite.internal.util.typedef.internal.U; +import org.apache.ignite.marshaller.MarshallerContextTestImpl; +import org.apache.ignite.marshaller.portable.PortableMarshaller; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.jsr166.ConcurrentHashMap8; @@ -2389,7 +2388,9 @@ public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest { * @return Portable context. */ protected PortableContext initPortableContext(PortableMarshaller marsh) throws IgniteCheckedException { - PortableContext ctx = new PortableContext(META_HND, null); + IgniteConfiguration iCfg = new IgniteConfiguration(); + + PortableContext ctx = new PortableContext(META_HND, iCfg); marsh.setContext(new MarshallerContextTestImpl(null)); http://git-wip-us.apache.org/repos/asf/ignite/blob/4b73226f/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableWildcardsSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableWildcardsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableWildcardsSelfTest.java index b8b8189..4629719 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableWildcardsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableWildcardsSelfTest.java @@ -19,6 +19,7 @@ package org.apache.ignite.internal.portable; import java.util.Arrays; import java.util.Map; +import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.marshaller.MarshallerContextTestImpl; import org.apache.ignite.marshaller.portable.PortableMarshaller; @@ -46,7 +47,7 @@ public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest { * @return Portable context. */ private PortableContext portableContext() { - return new PortableContext(META_HND, null); + return new PortableContext(META_HND, new IgniteConfiguration()); } /** http://git-wip-us.apache.org/repos/asf/ignite/blob/4b73226f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNearReaderUpdateTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNearReaderUpdateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNearReaderUpdateTest.java index c2f9fab..3e103ed 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNearReaderUpdateTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNearReaderUpdateTest.java @@ -121,22 +121,46 @@ public class CacheNearReaderUpdateTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ - public void testGetUpdateMultithreaded() throws Exception { - List<CacheConfiguration<Integer, Integer>> cfgs = new ArrayList<>(); + public void testNoBackups() throws Exception { + testGetUpdateMultithreaded(cacheConfiguration(PARTITIONED, FULL_SYNC, 0, false, false)); + } + + /** + * @throws Exception If failed. + */ + public void testOneBackup() throws Exception { + testGetUpdateMultithreaded(cacheConfiguration(PARTITIONED, FULL_SYNC, 1, false, false)); + } - cfgs.add(cacheConfiguration(PARTITIONED, FULL_SYNC, 0, false, false)); - cfgs.add(cacheConfiguration(PARTITIONED, FULL_SYNC, 1, false, false)); - cfgs.add(cacheConfiguration(PARTITIONED, FULL_SYNC, 1, false, true)); - cfgs.add(cacheConfiguration(PARTITIONED, FULL_SYNC, 1, true, false)); + /** + * @throws Exception If failed. + */ + public void testOneBackupNearEnabled() throws Exception { + testGetUpdateMultithreaded(cacheConfiguration(PARTITIONED, FULL_SYNC, 1, false, true)); + } + + /** + * @throws Exception If failed. + */ + public void testOneBackupStoreEnabled() throws Exception { + testGetUpdateMultithreaded(cacheConfiguration(PARTITIONED, FULL_SYNC, 1, true, false)); + } - { - CacheConfiguration<Integer, Integer> ccfg = cacheConfiguration(PARTITIONED, FULL_SYNC, 1, false, false); + /** + * @throws Exception If failed. + */ + public void testOneBackupOffheap() throws Exception { + CacheConfiguration<Integer, Integer> ccfg = cacheConfiguration(PARTITIONED, FULL_SYNC, 1, false, false); - GridTestUtils.setMemoryMode(null, ccfg, GridTestUtils.TestMemoryMode.OFFHEAP_TIERED, 0, 0); + GridTestUtils.setMemoryMode(null, ccfg, GridTestUtils.TestMemoryMode.OFFHEAP_TIERED, 0, 0); - cfgs.add(ccfg); - } + testGetUpdateMultithreaded(ccfg); + } + /** + * @throws Exception If failed. + */ + public void testGetUpdateMultithreaded(CacheConfiguration<Integer, Integer> ccfg) throws Exception { final List<Ignite> putNodes = new ArrayList<>(); for (int i = 0; i < SRVS + CLIENTS - 1; i++) @@ -147,18 +171,16 @@ public class CacheNearReaderUpdateTest extends GridCommonAbstractTest { getNodes.add(ignite(SRVS + CLIENTS - 1)); getNodes.add(ignite(0)); - for (CacheConfiguration<Integer, Integer> ccfg : cfgs) { - logCacheInfo(ccfg); + logCacheInfo(ccfg); - getUpdateMultithreaded(ccfg, putNodes, getNodes, null, null); + getUpdateMultithreaded(ccfg, putNodes, getNodes, null, null); - if (ccfg.getAtomicityMode() == TRANSACTIONAL) { - getUpdateMultithreaded(ccfg, putNodes, getNodes, PESSIMISTIC, REPEATABLE_READ); + if (ccfg.getAtomicityMode() == TRANSACTIONAL) { + getUpdateMultithreaded(ccfg, putNodes, getNodes, PESSIMISTIC, REPEATABLE_READ); - getUpdateMultithreaded(ccfg, putNodes, getNodes, OPTIMISTIC, REPEATABLE_READ); + getUpdateMultithreaded(ccfg, putNodes, getNodes, OPTIMISTIC, REPEATABLE_READ); - getUpdateMultithreaded(ccfg, putNodes, getNodes, OPTIMISTIC, SERIALIZABLE); - } + getUpdateMultithreaded(ccfg, putNodes, getNodes, OPTIMISTIC, SERIALIZABLE); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/4b73226f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/DataStreamProcessorPortableSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/DataStreamProcessorPortableSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/DataStreamProcessorPortableSelfTest.java index ad21a47..68538d9 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/DataStreamProcessorPortableSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/DataStreamProcessorPortableSelfTest.java @@ -17,14 +17,9 @@ package org.apache.ignite.internal.processors.cache.portable.datastreaming; -import java.util.Collection; -import java.util.Map; -import org.apache.ignite.IgniteCache; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.processors.datastreamer.DataStreamProcessorSelfTest; import org.apache.ignite.marshaller.portable.PortableMarshaller; -import org.apache.ignite.igniteobject.IgniteObject; -import org.apache.ignite.stream.StreamReceiver; /** * @@ -40,27 +35,4 @@ public class DataStreamProcessorPortableSelfTest extends DataStreamProcessorSelf return cfg; } - - /** {@inheritDoc} */ - @Override protected StreamReceiver<String, TestObject> getStreamReceiver() { - return new TestDataReceiver(); - } - - /** - * - */ - private static class TestDataReceiver implements StreamReceiver<String, TestObject> { - /** {@inheritDoc} */ - @Override public void receive(IgniteCache<String, TestObject> cache, - Collection<Map.Entry<String, TestObject>> entries) { - for (Map.Entry<String, TestObject> e : entries) { - assertTrue(e.getKey() instanceof String); - assertTrue(e.getValue() instanceof IgniteObject); - - TestObject obj = ((IgniteObject)e.getValue()).deserialize(); - - cache.put(e.getKey(), new TestObject(obj.val + 1)); - } - } - } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/4b73226f/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingQueryErrorTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingQueryErrorTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingQueryErrorTest.java index 07fa2bc..01c2db2 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingQueryErrorTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingQueryErrorTest.java @@ -23,6 +23,8 @@ import javax.cache.CacheException; import org.apache.ignite.cache.query.ScanQuery; import org.apache.ignite.cache.query.SqlQuery; import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.internal.IgniteEx; +import org.apache.ignite.internal.IgniteKernal; import org.apache.ignite.lang.IgniteBiPredicate; /** @@ -51,10 +53,10 @@ public class IgniteCacheP2pUnmarshallingQueryErrorTest extends IgniteCacheP2pUnm try { jcache(0).query(new SqlQuery<TestKey, String>(String.class, "field like '" + key + "'")).getAll(); - fail("p2p marshalling failed, but error response was not sent"); + assertTrue("p2p marshalling failed, but error response was not sent", portableMarshaller()); } catch (CacheException e) { - // No-op + assertFalse("Unexpected exception: " + e, portableMarshaller()); } } @@ -77,10 +79,19 @@ public class IgniteCacheP2pUnmarshallingQueryErrorTest extends IgniteCacheP2pUnm } })).getAll(); - fail("Request unmarshalling failed, but error response was not sent."); + assertTrue("Request unmarshalling failed, but error response was not sent.", portableMarshaller()); } catch (Exception e) { - // No-op. + assertFalse("Unexpected exception: " + e, portableMarshaller()); } } + + /** + * @return {@code True} if portable marshaller is configured. + */ + private boolean portableMarshaller() { + IgniteEx kernal = (IgniteKernal)ignite(0); + + return "PortableMarshaller".equals(kernal.context().config().getMarshaller().getClass().getSimpleName()); + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/4b73226f/parent/pom.xml ---------------------------------------------------------------------- diff --git a/parent/pom.xml b/parent/pom.xml index 06dfd70..d8c2ce0 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -749,7 +749,8 @@ <exclude>**/configure.ac</exclude> <exclude>**/*.pc.in</exclude> <exclude>**/*.sln</exclude> - <exclude>**/*.slnrel</exclude> + <exclude>**/*.snk</exclude> + <exclude>**/*.slnrel</exclude> <exclude>**/*.sln.DotSettings</exclude> <exclude>**/*.FxCop</exclude> <exclude>**/*.csproj</exclude>
