You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2016/03/01 15:46:52 UTC
ignite git commit: Test fixed
Repository: ignite
Updated Branches:
refs/heads/master 9777198aa -> 74fd4008a
Test fixed
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/74fd4008
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/74fd4008
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/74fd4008
Branch: refs/heads/master
Commit: 74fd4008abb1c0e13ffcf0c5e7224b98eb1eee7e
Parents: 9777198
Author: agura <ag...@gridgain.com>
Authored: Tue Mar 1 17:46:35 2016 +0300
Committer: agura <ag...@gridgain.com>
Committed: Tue Mar 1 17:46:35 2016 +0300
----------------------------------------------------------------------
.../GridCacheOnCopyFlagAbstractSelfTest.java | 32 ++++++++++++--------
1 file changed, 19 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/74fd4008/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 {