ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject incubator-ignite git commit: ignite-752: fixed tests
Date Mon, 20 Jul 2015 06:45:17 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-752 c7d3708f1 -> 9dfdce5c5


ignite-752: fixed 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/9dfdce5c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9dfdce5c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9dfdce5c

Branch: refs/heads/ignite-752
Commit: 9dfdce5c5d47c7e71dc720cedce4c6a0aaba4d44
Parents: c7d3708
Author: Denis Magda <dmagda@gridgain.com>
Authored: Mon Jul 20 09:44:53 2015 +0300
Committer: Denis Magda <dmagda@gridgain.com>
Committed: Mon Jul 20 09:44:53 2015 +0300

----------------------------------------------------------------------
 .../spi/IgniteSpiOperationTimeoutException.java |  2 +-
 .../discovery/AbstractDiscoverySelfTest.java    | 25 ++++++++++++++---
 ...TcpDiscoverySpiFailureThresholdSelfTest.java | 28 +++++++++-----------
 3 files changed, 34 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9dfdce5c/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiOperationTimeoutException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiOperationTimeoutException.java
b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiOperationTimeoutException.java
index d3bf44e..5dd0824 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiOperationTimeoutException.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiOperationTimeoutException.java
@@ -25,7 +25,7 @@ import org.apache.ignite.*;
 public class IgniteSpiOperationTimeoutException extends IgniteCheckedException {
     /** */
     private static final long serialVersionUID = 0L;
-    
+
     /**
      * Constructor.
      * @param msg Error message.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9dfdce5c/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
b/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
index 61bb944..96f3d21 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
@@ -43,12 +43,18 @@ import static org.apache.ignite.lang.IgniteProductVersion.*;
 @SuppressWarnings({"JUnitAbstractTestClassNamingConvention"})
 public abstract class AbstractDiscoverySelfTest<T extends IgniteSpi> extends GridSpiAbstractTest<T>
{
     /** */
-    private static final List<DiscoverySpi> spis = new ArrayList<>();
+    private static final String HTTP_ADAPTOR_MBEAN_NAME = "mbeanAdaptor:protocol=HTTP";
+
+    /** */
+    protected static final List<DiscoverySpi> spis = new ArrayList<>();
 
     /** */
     private static final Collection<IgniteTestResources> spiRsrcs = new ArrayList<>();
 
     /** */
+    private static final List<HttpAdaptor> httpAdaptors = new ArrayList<>();
+
+    /** */
     private static long spiStartTime;
 
     /** */
@@ -422,12 +428,14 @@ public abstract class AbstractDiscoverySelfTest<T extends IgniteSpi>
extends Gri
         MBeanServer srv = MBeanServerFactory.createMBeanServer();
 
         adaptor.setPort(Integer.valueOf(GridTestProperties.getProperty("discovery.mbeanserver.selftest.baseport"))
+
-            idx);
+                            idx);
 
-        srv.registerMBean(adaptor, new ObjectName("mbeanAdaptor:protocol=HTTP"));
+        srv.registerMBean(adaptor, new ObjectName(HTTP_ADAPTOR_MBEAN_NAME));
 
         adaptor.start();
 
+        httpAdaptors.add(adaptor);
+
         return srv;
     }
 
@@ -442,12 +450,21 @@ public abstract class AbstractDiscoverySelfTest<T extends IgniteSpi>
extends Gri
             spi.spiStop();
         }
 
-        for (IgniteTestResources rscrs : spiRsrcs)
+        for (IgniteTestResources rscrs : spiRsrcs) {
+            MBeanServer mBeanServer = rscrs.getMBeanServer();
+
+            mBeanServer.unregisterMBean(new ObjectName(HTTP_ADAPTOR_MBEAN_NAME));
+
             rscrs.stopThreads();
+        }
+
+        for (HttpAdaptor adaptor : httpAdaptors)
+            adaptor.stop();
 
         // Clear.
         spis.clear();
         spiRsrcs.clear();
+        httpAdaptors.clear();
 
         spiStartTime = 0;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9dfdce5c/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureThresholdSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureThresholdSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureThresholdSelfTest.java
index fab3628..347ced3 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureThresholdSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureThresholdSelfTest.java
@@ -44,9 +44,6 @@ public class TcpDiscoverySpiFailureThresholdSelfTest extends AbstractDiscoverySe
     private static final long CONN_CHECK_FREQ = 2000;
 
     /** */
-    private static TestTcpDiscoverySpi spis[] = new TestTcpDiscoverySpi[SPI_COUNT];
-
-    /** */
     private TcpDiscoveryIpFinder ipFinder =  new TcpDiscoveryVmIpFinder(true);
 
     /** {@inheritDoc} */
@@ -61,8 +58,6 @@ public class TcpDiscoverySpiFailureThresholdSelfTest extends AbstractDiscoverySe
         spi.setMetricsProvider(createMetricsProvider());
         spi.setIpFinder(ipFinder);
 
-        spis[idx] = spi;
-
         switch (idx) {
             case 0:
                 spi.setConnectionCheckFrequency(CONN_CHECK_FREQ);
@@ -88,6 +83,7 @@ public class TcpDiscoverySpiFailureThresholdSelfTest extends AbstractDiscoverySe
             default:
                 assert false;
         }
+
         return spi;
     }
 
@@ -106,9 +102,9 @@ public class TcpDiscoverySpiFailureThresholdSelfTest extends AbstractDiscoverySe
      * @throws Exception In case of error.
      */
     public void testFailureDetectionThresholdDisabled() throws Exception {
-        for (int i = 2; i < spis.length; i++) {
-            assertFalse(spis[i].failureDetectionThresholdEnabled());
-            assertEquals(0, spis[i].failureDetectionThreshold());
+        for (int i = 2; i < spis.size(); i++) {
+            assertFalse(((TcpDiscoverySpi)spis.get(i)).failureDetectionThresholdEnabled());
+            assertEquals(0, ((TcpDiscoverySpi)spis.get(i)).failureDetectionThreshold());
         }
     }
 
@@ -175,9 +171,9 @@ public class TcpDiscoverySpiFailureThresholdSelfTest extends AbstractDiscoverySe
 
             nextSpi = null;
 
-            for (int i = 1; i < spis.length; i++)
-                if (spis[i].getLocalNode().id().equals(nextNode.id())) {
-                    nextSpi = spis[i];
+            for (int i = 1; i < spis.size(); i++)
+                if (spis.get(i).getLocalNode().id().equals(nextNode.id())) {
+                    nextSpi = (TestTcpDiscoverySpi)spis.get(i);
                     break;
                 }
 
@@ -225,9 +221,9 @@ public class TcpDiscoverySpiFailureThresholdSelfTest extends AbstractDiscoverySe
 
             nextSpi = null;
 
-            for (int i = 1; i < spis.length; i++)
-                if (spis[i].getLocalNode().id().equals(nextNode.id())) {
-                    nextSpi = spis[i];
+            for (int i = 1; i < spis.size(); i++)
+                if (spis.get(i).getLocalNode().id().equals(nextNode.id())) {
+                    nextSpi = (TestTcpDiscoverySpi)spis.get(i);
                     break;
                 }
 
@@ -273,7 +269,7 @@ public class TcpDiscoverySpiFailureThresholdSelfTest extends AbstractDiscoverySe
      * @return SPI.
      */
     private TestTcpDiscoverySpi firstSpi() {
-        return spis[0];
+        return (TestTcpDiscoverySpi)spis.get(0);
     }
 
 
@@ -283,7 +279,7 @@ public class TcpDiscoverySpiFailureThresholdSelfTest extends AbstractDiscoverySe
      * @return SPI.
      */
     private TestTcpDiscoverySpi secondSpi() {
-        return spis[1];
+        return (TestTcpDiscoverySpi)spis.get(1);
     }
     
     /**


Mime
View raw message