Repository: incubator-ignite Updated Branches: refs/heads/ignite-1 9e7f69625 -> 785bf1065
IGNITE-59 Support lock, lockAll: Fix tests. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/785bf106 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/785bf106 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/785bf106 Branch: refs/heads/ignite-1 Commit: 785bf106568963b2cd52706cb3654f8de76f4e89 Parents: c5fae8e Author: sevdokimov <sevdoki...@gridgain.com> Authored: Fri Jan 16 13:35:34 2015 +0300 Committer: sevdokimov <sevdoki...@gridgain.com> Committed: Fri Jan 16 15:45:41 2015 +0300 ---------------------------------------------------------------------- .../internal/processors/cache/IgniteCacheProxy.java | 10 +++++----- .../processors/cache/GridCacheBasicApiAbstractTest.java | 6 ++++-- .../near/GridCachePartitionedLockSelfTest.java | 5 +++-- .../cache/local/GridCacheLocalLockSelfTest.java | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/785bf106/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java index 055827b..0c98124 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java @@ -273,7 +273,7 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter implements } catch (IgniteCheckedException e) { - throw new CacheException(e); + throw new CacheException(e.getMessage(), e); } } @@ -291,7 +291,7 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter implements throw new InterruptedException(); } catch (IgniteCheckedException e) { - throw new CacheException(e); + throw new CacheException(e.getMessage(), e); } } @@ -300,7 +300,7 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter implements return delegate.lockAll(keys, -1); } catch (IgniteCheckedException e) { - throw new CacheException(e); + throw new CacheException(e.getMessage(), e); } } @@ -315,7 +315,7 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter implements throw new InterruptedException(); } catch (IgniteCheckedException e) { - throw new CacheException(e); + throw new CacheException(e.getMessage(), e); } } @@ -324,7 +324,7 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter implements delegate.unlockAll(keys); } catch (IgniteCheckedException e) { - throw new CacheException(e); + throw new CacheException(e.getMessage(), e); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/785bf106/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheBasicApiAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheBasicApiAbstractTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheBasicApiAbstractTest.java index 2e5d00e..62f64ca 100644 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheBasicApiAbstractTest.java +++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheBasicApiAbstractTest.java @@ -41,6 +41,7 @@ import static org.apache.ignite.events.IgniteEventType.*; /** * Test cases for multi-threaded tests. */ +@SuppressWarnings("LockAcquiredButNotSafelyReleased") public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTest { /** Grid. */ private Ignite ignite; @@ -129,6 +130,8 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe Lock lock = cache.lock(1); + lock.lock(); + assert cache.isLocked(1); assert cache.isLockedByThread(1); @@ -182,7 +185,7 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe assert cache.isLockedByThread(key); try { - assert "1".equals(cache.remove(key)); + assert "1".equals(cache.getAndRemove(key)); } finally { cache.lock(key).unlock(); @@ -432,7 +435,6 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe info("Stop latch wait 3"); - assert cache.containsKey(key); assert cache.isLocked(key); } finally { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/785bf106/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedLockSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedLockSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedLockSelfTest.java index 24d84ea..a0be693 100644 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedLockSelfTest.java +++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedLockSelfTest.java @@ -28,6 +28,7 @@ import org.gridgain.grid.kernal.processors.cache.distributed.*; import org.gridgain.grid.util.typedef.*; import org.gridgain.testframework.*; +import javax.cache.*; import java.util.*; import java.util.concurrent.*; @@ -76,13 +77,13 @@ public class GridCachePartitionedLockSelfTest extends GridCacheLockAbstractTest @Override public Object call() throws Exception { return cache.lock(1).tryLock(Long.MAX_VALUE, TimeUnit.MILLISECONDS); } - }, IgniteCheckedException.class, "Locks are not supported"); + }, CacheException.class, "Locks are not supported"); GridTestUtils.assertThrows(log, new Callable<Object>() { @Override public Object call() throws Exception { return cache.lockAll(Collections.singleton(1)).tryLock(Long.MAX_VALUE, TimeUnit.MILLISECONDS); } - }, IgniteCheckedException.class, "Locks are not supported"); + }, CacheException.class, "Locks are not supported"); final IgniteFuture<Boolean> lockFut1 = g0.cache(null).lockAsync(1, Long.MAX_VALUE); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/785bf106/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/local/GridCacheLocalLockSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/local/GridCacheLocalLockSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/local/GridCacheLocalLockSelfTest.java index 49a83ac..de1da2b 100644 --- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/local/GridCacheLocalLockSelfTest.java +++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/local/GridCacheLocalLockSelfTest.java @@ -293,7 +293,7 @@ public class GridCacheLocalLockSelfTest extends GridCommonAbstractTest { info("Put key-value pair into cache: 1='2'"); - assert "2".equals(cache.remove(1)); + assert "2".equals(cache.getAndRemove(1)); info("Removed key from cache: 1");