You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2018/02/27 08:01:01 UTC

ignite git commit: IGNITE-7819 IgniteServiceConfigVariationsFullApiTest must undeploy services in a finally block

Repository: ignite
Updated Branches:
  refs/heads/master 853cd7a4c -> cb4277e6c


IGNITE-7819 IgniteServiceConfigVariationsFullApiTest must undeploy services in a finally block


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

Branch: refs/heads/master
Commit: cb4277e6cf0f42d0cbc5d11d67662c085ec32cb5
Parents: 853cd7a
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Tue Feb 27 11:00:52 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Tue Feb 27 11:00:52 2018 +0300

----------------------------------------------------------------------
 ...gniteServiceConfigVariationsFullApiTest.java | 58 +++++++++++---------
 1 file changed, 31 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/cb4277e6/modules/core/src/test/java/org/apache/ignite/internal/processors/service/IgniteServiceConfigVariationsFullApiTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/IgniteServiceConfigVariationsFullApiTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/IgniteServiceConfigVariationsFullApiTest.java
index c0f836b..453ddc0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/IgniteServiceConfigVariationsFullApiTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/IgniteServiceConfigVariationsFullApiTest.java
@@ -211,46 +211,50 @@ public class IgniteServiceConfigVariationsFullApiTest extends IgniteConfigVariat
      * @throws Exception If failed.
      */
     protected void testService(TestService svc, boolean sticky, DeployClosure deployC) throws Exception {
+        IgniteServices services;
         IgniteEx ignite = testedGrid();
 
-        IgniteServices services = ignite.services();
+        services = ignite.services();
 
-        Object expected = value(++cntr);
+        try {
+            Object expected = value(++cntr);
 
-        // Put value for testing Service instance serialization.
-        svc.setValue(expected);
+            // Put value for testing Service instance serialization.
+            svc.setValue(expected);
 
-        deployC.run(services, SERVICE_NAME, svc);
+            deployC.run(services, SERVICE_NAME, svc);
 
-        // Expect correct value from local instance.
-        assertEquals(expected, svc.getValue());
+            // Expect correct value from local instance.
+            assertEquals(expected, svc.getValue());
 
-        // Use stickiness to make sure data will be fetched from the same instance.
-        TestService proxy = services.serviceProxy(SERVICE_NAME, TestService.class, sticky);
+            // Use stickiness to make sure data will be fetched from the same instance.
+            TestService proxy = services.serviceProxy(SERVICE_NAME, TestService.class, sticky);
 
-        // Expect that correct value is returned from deployed instance.
-        assertEquals(expected, proxy.getValue());
-
-        expected = value(++cntr);
-
-        // Change value.
-        proxy.setValue(expected);
+            // Expect that correct value is returned from deployed instance.
+            assertEquals(expected, proxy.getValue());
 
-        // Expect correct value after being read back.
-        int r = 1000;
+            expected = value(++cntr);
 
-        while(r-- > 0)
-            assertEquals(expected, proxy.getValue());
+            // Change value.
+            proxy.setValue(expected);
 
-        assertEquals("Expected 1 deployed service", 1, services.serviceDescriptors().size());
+            // Expect correct value after being read back.
+            int r = 1000;
 
-        // Randomize stop method invocation
-        boolean tmp = ThreadLocalRandom.current().nextBoolean();
+            while(r-- > 0)
+                assertEquals(expected, proxy.getValue());
 
-        if (tmp)
-            services.cancelAll();
-        else
-            services.cancel(SERVICE_NAME);
+            assertEquals("Expected 1 deployed service", 1, services.serviceDescriptors().size());
+        }
+        finally {
+            // Randomize stop method invocation
+            boolean tmp = ThreadLocalRandom.current().nextBoolean();
+
+            if (tmp)
+                services.cancelAll();
+            else
+                services.cancel(SERVICE_NAME);
+        }
     }
 
     /**