[jboss-cvs] JBossAS SVN: r90064 - trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jun 10 15:59:29 EDT 2009


Author: bstansberry at jboss.com
Date: 2009-06-10 15:59:29 -0400 (Wed, 10 Jun 2009)
New Revision: 90064

Modified:
   trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/PreferredMasterElectionPolicyUnitTestCase.java
Log:
Deal with helpful ISPs who resolve bogus host names

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/PreferredMasterElectionPolicyUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/PreferredMasterElectionPolicyUnitTestCase.java	2009-06-10 19:45:35 UTC (rev 90063)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/PreferredMasterElectionPolicyUnitTestCase.java	2009-06-10 19:59:29 UTC (rev 90064)
@@ -163,11 +163,24 @@
 
    public void testUnknownHost() throws Exception
    {
+      String bogusHost = "onceuponatimeinalandfarfarawaylivedamancalledgalder";
       try
       {
-         this.policy.setPreferredMaster("onceuponatimeinalandfarfarawaylivedamancalledgalder:1199");
+         this.policy.setPreferredMaster(bogusHost + ":1199");
          
-         Assert.fail("IllegalArgumentException expected");
+         // If the test env has a "helpful" DNS returns the address of some
+         // ISP web page, this test might fail. Check for and ignore that
+         // condition
+         try
+         {
+            InetAddress addr = InetAddress.getByName(bogusHost);
+            if (addr == null)
+            {
+               // Nope. It didn't resolve so there is a real problem
+               Assert.fail("IllegalArgumentException expected");
+            }
+         }
+         catch (UnknownHostException ignored) {}
       }
       catch (IllegalArgumentException e)
       {




More information about the jboss-cvs-commits mailing list