# IGNITE-321 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/99a22e20 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/99a22e20 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/99a22e20 Branch: refs/heads/ignite-51 Commit: 99a22e2038e5160d75507843e2c689739103853c Parents: 13bd631 Author: sevdokimov <sevdoki...@gridgain.com> Authored: Fri Mar 6 15:18:35 2015 +0300 Committer: sevdokimov <sevdoki...@gridgain.com> Committed: Fri Mar 6 15:18:35 2015 +0300 ---------------------------------------------------------------------- .../processors/cache/GridCacheUtils.java | 2 +- .../cache/GridCacheWriteBehindStore.java | 4 ++-- .../ignite/internal/util/IgniteUtils.java | 20 ++++++++++++++++++-- .../IgniteTxStoreExceptionAbstractSelfTest.java | 8 ++++---- .../ignite/testframework/GridTestUtils.java | 2 +- 5 files changed, 26 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/99a22e20/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java index b07c14e..dcdf13e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java @@ -1785,7 +1785,7 @@ public class GridCacheUtils { */ @NotNull public static CacheException convertToCacheException(IgniteCheckedException e) { if (e.hasCause(CacheWriterException.class)) - return new CacheWriterException(e); + return new CacheWriterException(U.convertExceptionLight(e)); if (e instanceof CachePartialUpdateCheckedException) return new CachePartialUpdateException((CachePartialUpdateCheckedException)e); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/99a22e20/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStore.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStore.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStore.java index eb6120a..63a72e3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStore.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStore.java @@ -433,7 +433,7 @@ public class GridCacheWriteBehindStore<K, V> implements CacheStore<K, V>, Lifecy updateCache(entry.getKey(), entry, StoreOperation.PUT); } catch (IgniteInterruptedCheckedException e) { - throw new CacheWriterException(e); + throw new CacheWriterException(U.convertExceptionLight(e)); } } @@ -453,7 +453,7 @@ public class GridCacheWriteBehindStore<K, V> implements CacheStore<K, V>, Lifecy updateCache((K)key, null, StoreOperation.RMV); } catch (IgniteInterruptedCheckedException e) { - throw new CacheWriterException(e); + throw new CacheWriterException(U.convertExceptionLight(e)); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/99a22e20/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java index 79b2171..a4b6617 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java @@ -299,7 +299,7 @@ public abstract class IgniteUtils { exceptionConverters; /** */ - private volatile static IgniteBiTuple<Collection<String>, Collection<String>> cachedLocalAddr; + private static volatile IgniteBiTuple<Collection<String>, Collection<String>> cachedLocalAddr; /** * Initializes enterprise check. @@ -616,6 +616,22 @@ public abstract class IgniteUtils { * @param e Ignite checked exception. * @return Ignite runtime exception. */ + public static Exception convertExceptionLight(IgniteCheckedException e) { + C1<IgniteCheckedException, IgniteException> converter = exceptionConverters.get(e.getClass()); + + if (converter != null) + return converter.apply(e); + + if (e.getCause() instanceof IgniteException) + return (Exception)e.getCause(); + + return e; + } + + /** + * @param e Ignite checked exception. + * @return Ignite runtime exception. + */ public static IgniteException convertException(IgniteCheckedException e) { C1<IgniteCheckedException, IgniteException> converter = exceptionConverters.get(e.getClass()); @@ -8860,7 +8876,7 @@ public abstract class IgniteUtils { public static <T extends R, R> List<R> arrayList(Collection<T> c, @Nullable IgnitePredicate<? super T>... p) { assert c != null; - return IgniteUtils.<T, R>arrayList(c, c.size(), p); + return IgniteUtils.arrayList(c, c.size(), p); } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/99a22e20/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java index b378b97..8a83eae 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java @@ -410,7 +410,7 @@ public abstract class IgniteTxStoreExceptionAbstractSelfTest extends GridCacheAb return null; } - }, TransactionRollbackException.class, null); + }, CacheWriterException.class, null); checkValue(key, putBefore); } @@ -449,7 +449,7 @@ public abstract class IgniteTxStoreExceptionAbstractSelfTest extends GridCacheAb return null; } - }, CacheException.class, null); + }, CacheWriterException.class, null); assertTrue("Unexpected cause: " + e, e.getCause() instanceof TransactionRollbackException); @@ -498,7 +498,7 @@ public abstract class IgniteTxStoreExceptionAbstractSelfTest extends GridCacheAb return null; } - }, TransactionRollbackException.class, null); + }, CacheWriterException.class, null); for (Integer key : m.keySet()) checkValue(key, putBefore); @@ -532,7 +532,7 @@ public abstract class IgniteTxStoreExceptionAbstractSelfTest extends GridCacheAb return null; } - }, TransactionRollbackException.class, null); + }, CacheWriterException.class, null); checkValue(key, putBefore); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/99a22e20/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java index 0449e48..6175a2f 100644 --- a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java @@ -116,7 +116,7 @@ public final class GridTestUtils { * and this message should be equal. * @return Thrown throwable. */ - @Nullable public static Throwable assertThrows(@Nullable IgniteLogger log, Callable<?> call, + public static Throwable assertThrows(@Nullable IgniteLogger log, Callable<?> call, Class<? extends Throwable> cls, @Nullable String msg) { assert call != null; assert cls != null;