ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkuliche...@apache.org
Subject [47/50] [abbrv] ignite git commit: IGNITE-2355 Fixed the test HadoopClientProtocolMultipleServersSelfTest. Close FileSystem after each test to prevent using the one Client delegate for all tests.
Date Wed, 26 Oct 2016 22:55:39 GMT
IGNITE-2355 Fixed the test HadoopClientProtocolMultipleServersSelfTest. Close FileSystem after
each test to prevent using the one Client delegate for all tests.


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

Branch: refs/heads/ignite-4110
Commit: 46e77f912dfd741000c32aae03449df691d522b1
Parents: 442fedc
Author: tledkov-gridgain <tledkov@gridgain.com>
Authored: Tue Oct 18 15:01:03 2016 +0500
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Wed Oct 26 11:12:20 2016 +0300

----------------------------------------------------------------------
 ...opClientProtocolMultipleServersSelfTest.java | 93 ++++++++++++--------
 1 file changed, 55 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/46e77f91/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
index 04747d0..0e51938 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
@@ -24,6 +24,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.concurrent.Callable;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.IntWritable;
 import org.apache.hadoop.io.Text;
@@ -40,7 +41,7 @@ import org.apache.hadoop.mapreduce.TaskAttemptContext;
 import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
 import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
 import org.apache.ignite.IgniteFileSystem;
-import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.hadoop.mapreduce.IgniteHadoopClientProtocolProvider;
 import org.apache.ignite.igfs.IgfsPath;
 import org.apache.ignite.internal.client.GridServerUnreachableException;
@@ -61,6 +62,9 @@ public class HadoopClientProtocolMultipleServersSelfTest extends HadoopAbstractS
     /** Job name. */
     private static final String JOB_NAME = "myJob";
 
+    /** Rest port. */
+    private static int restPort;
+
     /** {@inheritDoc} */
     @Override protected boolean igfsEnabled() {
         return true;
@@ -72,15 +76,6 @@ public class HadoopClientProtocolMultipleServersSelfTest extends HadoopAbstractS
     }
 
     /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        super.beforeTest();
-
-        startGrids(gridCount());
-
-        awaitPartitionMapExchange();
-    }
-
-    /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
         stopAllGrids();
 
@@ -88,10 +83,10 @@ public class HadoopClientProtocolMultipleServersSelfTest extends HadoopAbstractS
     }
 
     /** {@inheritDoc} */
-    @Override protected CacheConfiguration dataCacheConfiguration() {
-        CacheConfiguration cfg = super.dataCacheConfiguration();
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception
{
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
 
-        cfg.setBackups(1);
+        cfg.getConnectorConfiguration().setPort(restPort++);
 
         return cfg;
     }
@@ -149,15 +144,22 @@ public class HadoopClientProtocolMultipleServersSelfTest extends HadoopAbstractS
      */
     @SuppressWarnings("ConstantConditions")
     public void testMultipleAddresses() throws Exception {
-        beforeJob();
+        try {
+            restPort = REST_PORT;
+
+            startGrids(gridCount());
 
-        stopGrid(0);
+            beforeJob();
 
-        U.sleep(5000);
+            U.sleep(5000);
 
-        checkJobSubmit(configMultipleAddrs(gridCount()));
+            checkJobSubmit(configMultipleAddrs(gridCount()));
+        }
+        finally {
+            FileSystem fs = FileSystem.get(configMultipleAddrs(gridCount()));
 
-        startGrid(0);
+            fs.close();
+        }
     }
 
     /**
@@ -165,21 +167,25 @@ public class HadoopClientProtocolMultipleServersSelfTest extends HadoopAbstractS
      */
     @SuppressWarnings({"ConstantConditions", "ThrowableResultOfMethodCallIgnored"})
     public void testSingleAddress() throws Exception {
-        stopGrid(0);
-
-        U.sleep(5000);
-
-        GridTestUtils.assertThrowsAnyCause(log, new Callable<Object>() {
-                @Override public Object call() throws Exception {
-                    checkJobSubmit(configSingleAddress());
-                    return null;
-                }
-            },
-            GridServerUnreachableException.class, "Failed to connect to any of the servers
in list");
-
-        startGrid(0);
+        try {
+            // Don't use REST_PORT to test connection fails if the only this port is configured
+            restPort = REST_PORT + 1;
+
+            startGrids(gridCount());
+
+            GridTestUtils.assertThrowsAnyCause(log, new Callable<Object>() {
+                    @Override public Object call() throws Exception {
+                        checkJobSubmit(configSingleAddress());
+                        return null;
+                    }
+                },
+                GridServerUnreachableException.class, "Failed to connect to any of the servers
in list");
+        }
+        finally {
+            FileSystem fs = FileSystem.get(configSingleAddress());
 
-        awaitPartitionMapExchange();
+            fs.close();
+        }
     }
 
     /**
@@ -187,17 +193,28 @@ public class HadoopClientProtocolMultipleServersSelfTest extends HadoopAbstractS
      */
     @SuppressWarnings("ConstantConditions")
     public void testMixedAddrs() throws Exception {
-        beforeJob();
+        try {
+            restPort = REST_PORT;
+
+            startGrids(gridCount());
 
-        stopGrid(1);
+            beforeJob();
 
-        U.sleep(5000);
+            stopGrid(1);
 
-        checkJobSubmit(configMixed());
+            U.sleep(5000);
 
-        startGrid(1);
+            checkJobSubmit(configMixed());
 
-        awaitPartitionMapExchange();
+            startGrid(1);
+
+            awaitPartitionMapExchange();
+        }
+        finally {
+            FileSystem fs = FileSystem.get(configMixed());
+
+            fs.close();
+        }
     }
 
     /**


Mime
View raw message