GridCacheOnCopyFlag tests are fixed for binary object marshaller
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9b096ac5 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9b096ac5 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9b096ac5 Branch: refs/heads/ignite-2801 Commit: 9b096ac50c9e31e11aa07e77527291d73604b44b Parents: a788cd3 Author: agura <[email protected]> Authored: Thu Mar 17 16:33:17 2016 +0300 Committer: agura <[email protected]> Committed: Thu Mar 17 16:34:03 2016 +0300 ---------------------------------------------------------------------- .../GridCacheOnCopyFlagAbstractSelfTest.java | 32 ++++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/9b096ac5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java index 8d8aa02..027f411 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java @@ -25,6 +25,7 @@ import javax.cache.processor.EntryProcessor; import javax.cache.processor.EntryProcessorException; import javax.cache.processor.MutableEntry; import org.apache.ignite.IgniteCache; +import org.apache.ignite.binary.BinaryObject; import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.CacheInterceptor; import org.apache.ignite.cache.CacheInterceptorAdapter; @@ -180,10 +181,7 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCommonAbst ((GridCacheAdapter)((IgniteCacheProxy)cache).delegate()).peekEx(key).peekVisibleValue(); // Check thar internal entry wasn't changed. - if (storeValue(cache)) - assertEquals(i, ((TestValue)U.field(obj, "val")).val()); - else - assertEquals(i, CU.<TestValue>value(obj, ((IgniteCacheProxy)cache).context(), false).val()); + assertEquals(i, getValue(obj, cache)); final TestValue newTestVal = new TestValue(-i); @@ -216,10 +214,7 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCommonAbst obj = ((GridCacheAdapter)((IgniteCacheProxy)cache).delegate()).peekEx(key).peekVisibleValue(); // Check thar internal entry wasn't changed. - if (storeValue(cache)) - assertEquals(-i, ((TestValue)U.field(obj, "val")).val()); - else - assertEquals(-i, CU.<TestValue>value(obj, ((IgniteCacheProxy)cache).context(), false).val()); + assertEquals(-i, getValue(obj, cache)); interceptor.delegate(new CacheInterceptorAdapter<TestKey, TestValue>() { @Override public IgniteBiTuple onBeforeRemove(Cache.Entry<TestKey, TestValue> entry) { @@ -297,11 +292,7 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCommonAbst CacheObject obj = ((GridCacheAdapter)((IgniteCacheProxy)cache).delegate()).peekEx(key).peekVisibleValue(); - if (storeValue(cache)) - assertNotEquals(WRONG_VALUE, ((TestValue)U.field(obj, "val")).val()); - else - assertNotEquals(WRONG_VALUE, - CU.<TestValue>value(obj, ((IgniteCacheProxy)cache).context(), false).val()); + assertNotEquals(WRONG_VALUE, getValue(obj, cache)); } } finally { @@ -556,6 +547,21 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCommonAbst } /** + * @param obj Object. + * @param cache Cache. + */ + private static Object getValue(CacheObject obj, IgniteCache cache) { + if (obj instanceof BinaryObject) + return ((BinaryObject)obj).field("val"); + else { + if (storeValue(cache)) + return ((TestValue)U.field(obj, "val")).val(); + else + return CU.<TestValue>value(obj, ((IgniteCacheProxy)cache).context(), false).val(); + } + } + + /** * */ public static class TestValue implements Serializable {
