You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ta...@apache.org on 2015/08/20 18:29:14 UTC

qpid-jms git commit: NO-JIRA Add checks for Host name resolution for some tests that depend on it not working. Fixes some failing tests on CI boxes where the bad addresses resolve unexpectedly.

Repository: qpid-jms
Updated Branches:
  refs/heads/master 250d2ba48 -> 8b8f361bd


NO-JIRA Add checks for Host name resolution for some tests that depend
on it not working.  Fixes some failing tests on CI boxes where the bad
addresses resolve unexpectedly. 

Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/8b8f361b
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/8b8f361b
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/8b8f361b

Branch: refs/heads/master
Commit: 8b8f361bdec516329434376142c0b8ff307ce692
Parents: 250d2ba
Author: Timothy Bish <ta...@gmail.com>
Authored: Thu Aug 20 12:28:35 2015 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Thu Aug 20 12:28:54 2015 -0400

----------------------------------------------------------------------
 .../provider/failover/FailoverUriPoolTest.java  | 24 +++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/8b8f361b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverUriPoolTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverUriPoolTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverUriPoolTest.java
index 8b9452a..3094707 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverUriPoolTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverUriPoolTest.java
@@ -23,7 +23,9 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeFalse;
 
+import java.net.InetAddress;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
@@ -157,7 +159,9 @@ public class FailoverUriPoolTest extends QpidJmsTestCase {
     }
 
     @Test
-    public void testDuplicatesNotAddedUnresolvable() throws URISyntaxException {
+    public void testDuplicatesNotAddedUnresolvable() throws Exception {
+        assumeFalse("Host resolution works when not expected", checkIfResolutionWorks());
+
         FailoverUriPool pool = new FailoverUriPool();
 
         assertTrue(pool.isEmpty());
@@ -179,6 +183,8 @@ public class FailoverUriPoolTest extends QpidJmsTestCase {
 
     @Test
     public void testDuplicatesNotAddedWhenQueryPresentAndUnresolveable() throws URISyntaxException {
+        assumeFalse("Host resolution works when not expected", checkIfResolutionWorks());
+
         FailoverUriPool pool = new FailoverUriPool();
 
         assertTrue(pool.isEmpty());
@@ -318,6 +324,8 @@ public class FailoverUriPoolTest extends QpidJmsTestCase {
 
     @Test
     public void testRemoveWhenUnresolvable() throws URISyntaxException {
+        assumeFalse("Host resolution works when not expected", checkIfResolutionWorks());
+
         FailoverUriPool pool = new FailoverUriPool();
 
         assertTrue(pool.isEmpty());
@@ -333,6 +341,8 @@ public class FailoverUriPoolTest extends QpidJmsTestCase {
 
     @Test
     public void testRemoveWhenQueryPresentAndUnresolveable() throws URISyntaxException {
+        assumeFalse("Host resolution works when not expected", checkIfResolutionWorks());
+
         FailoverUriPool pool = new FailoverUriPool();
 
         assertTrue(pool.isEmpty());
@@ -448,4 +458,16 @@ public class FailoverUriPoolTest extends QpidJmsTestCase {
             assertEquals(uris.size() - (i + 1), pool.size());
         }
     }
+
+    private boolean checkIfResolutionWorks() {
+        boolean resolutionWorks = false;
+        try {
+            resolutionWorks = InetAddress.getByName("shouldbeunresolvable") != null;
+            resolutionWorks = InetAddress.getByName("SHOULDBEUNRESOLVABLE") != null;
+            resolutionWorks = InetAddress.getByName("SHOULDBEUNRESOLVABLE2") != null;
+        } catch (Exception e) {
+        }
+
+        return resolutionWorks;
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org