Repository: ignite
Updated Branches:
  refs/heads/master 6dc5804af -> a11bcf597


IGNITE-7845 fix checking atomicLong in 
IgniteClientDataStructuresTest#testAtomicLong. - Fixes #3606.

Signed-off-by: Alexey Goncharuk <alexey.goncha...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a11bcf59
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a11bcf59
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a11bcf59

Branch: refs/heads/master
Commit: a11bcf597cfe3a18214a3639daf244b3ba1836c8
Parents: 6dc5804
Author: Anton Kalashnikov <kaa....@yandex.ru>
Authored: Tue Mar 6 17:39:58 2018 +0300
Committer: Alexey Goncharuk <alexey.goncha...@gmail.com>
Committed: Tue Mar 6 17:39:58 2018 +0300

----------------------------------------------------------------------
 .../IgniteClientDataStructuresAbstractTest.java | 40 +++++++++++++++++++-
 1 file changed, 38 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a11bcf59/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteClientDataStructuresAbstractTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteClientDataStructuresAbstractTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteClientDataStructuresAbstractTest.java
index 7f1fe68..51764b5 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteClientDataStructuresAbstractTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteClientDataStructuresAbstractTest.java
@@ -24,6 +24,7 @@ import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteAtomicLong;
 import org.apache.ignite.IgniteAtomicSequence;
 import org.apache.ignite.IgniteCountDownLatch;
+import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteLock;
 import org.apache.ignite.IgniteQueue;
 import org.apache.ignite.IgniteSemaphore;
@@ -162,8 +163,43 @@ public abstract class 
IgniteClientDataStructuresAbstractTest extends GridCommonA
             assertEquals(3L, cntr.get());
         }
 
-        assertNull(creator.atomicLong("long1", 1L, false));
-        assertNull(other.atomicLong("long1", 1L, false));
+        assertAtomicLongClosedCorrect(creator.atomicLong("long1", 1L, false));
+        assertAtomicLongClosedCorrect(other.atomicLong("long1", 1L, false));
+    }
+
+    /**
+     * It is possible 3 variants:
+     * * input value is null, because it already delete.
+     * * input value is not null, but call 'get' method causes 
IllegalStateException because IgniteAtomicLong marked as delete.
+     * * input value is not null, but call 'get' method causes IgniteException
+     * because IgniteAtomicLong have not marked as delete yet but already 
removed from cache.
+     */
+    private void assertAtomicLongClosedCorrect(IgniteAtomicLong atomicLong) {
+        if (atomicLong == null)
+            assertNull(atomicLong);
+        else {
+            try {
+                atomicLong.get();
+
+                fail("Always should be exception because atomicLong was 
closed");
+            }
+            catch (IllegalStateException e) {
+                String expectedMessage = "Sequence was removed from cache";
+
+                assertTrue(
+                    String.format("Exception should start with '%s' but was 
'%s'", expectedMessage, e.getMessage()),
+                    e.getMessage().startsWith(expectedMessage)
+                );
+            }
+            catch (IgniteException e){
+                String expectedMessage = "Failed to find atomic long:";
+
+                assertTrue(
+                    String.format("Exception should start with '%s' but was 
'%s'", expectedMessage, e.getMessage()),
+                    e.getMessage().startsWith(expectedMessage)
+                );
+            }
+        }
     }
 
     /**

Reply via email to