[jboss-cvs] JBossAS SVN: r109361 - projects/test/trunk/src/main/java/org/jboss/test.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Nov 18 09:41:09 EST 2010


Author: rachmatowicz at jboss.com
Date: 2010-11-18 09:41:08 -0500 (Thu, 18 Nov 2010)
New Revision: 109361

Added:
   projects/test/trunk/src/main/java/org/jboss/test/JBossTestUtil.java
Log:
Add JBossTestUtil as a holder of static utility methods for test cases (JBAS-8540)

Added: projects/test/trunk/src/main/java/org/jboss/test/JBossTestUtil.java
===================================================================
--- projects/test/trunk/src/main/java/org/jboss/test/JBossTestUtil.java	                        (rev 0)
+++ projects/test/trunk/src/main/java/org/jboss/test/JBossTestUtil.java	2010-11-18 14:41:08 UTC (rev 109361)
@@ -0,0 +1,54 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.test;
+
+import org.jboss.logging.Logger;
+
+/**
+ *  Static class to provide utility functions that cross the class hierarchy.
+ *  
+ *  @author <a href="mailto:Richard.Achmatowicz at jboss.org">Richard Achmatowicz</a> 
+ *  @version $Revision$
+ */
+public class JBossTestUtil
+{
+   private static Logger log = Logger.getLogger(JBossTestUtil.class);
+
+   /**
+    * Utility to check if a hostname is an IPv6 literal and is so, add surrounding brackets
+    * for use in URLs
+    * 
+    * @param hostname
+    * @return hostname suitable for use in URLs
+    */
+   public static String fixHostnameForURL(String host)
+   {
+       if (host == null)
+	   return host ;
+
+       // if the hostname is an IPv6 literal, enclose it in brackets
+       if (host.indexOf(':') != -1)
+	   return "[" + host + "]" ;
+       else 
+	   return host ;
+   }   
+}
\ No newline at end of file



More information about the jboss-cvs-commits mailing list