[jboss-cvs] JBossAS SVN: r108911 - in branches/JBoss-AS-6.0.x_ipv6/testsuite: src/main/org/jboss/test/hellojrmpiiop/test and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Oct 25 15:48:39 EDT 2010


Author: rachmatowicz at jboss.com
Date: 2010-10-25 15:48:38 -0400 (Mon, 25 Oct 2010)
New Revision: 108911

Modified:
   branches/JBoss-AS-6.0.x_ipv6/testsuite/build.xml
   branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/hellojrmpiiop/test/HelloTimingStressTestCase.java
   branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/jaxr/scout/JaxrBaseTestCase.java
   branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/jaxr/scout/basic/JaxrJNDIConnectionTestCase.java
   branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/webservice/admindevel/ExampleTestCase.java
   branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/ws/JBossWSTest.java
   branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/ws/jaxws/ejb3Integration/WebServiceTestCase.java
   branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefClientTestCase.java
   branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefEJB3TestCase.java
   branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefServletTestCase.java
Log:
Fix URL generation in WebServices test cases (JBAS-8540)

Modified: branches/JBoss-AS-6.0.x_ipv6/testsuite/build.xml
===================================================================
--- branches/JBoss-AS-6.0.x_ipv6/testsuite/build.xml	2010-10-25 19:33:36 UTC (rev 108910)
+++ branches/JBoss-AS-6.0.x_ipv6/testsuite/build.xml	2010-10-25 19:48:38 UTC (rev 108911)
@@ -2948,6 +2948,7 @@
          <sysproperty key="jaxr.publish.url" value="http://${node0.url}:8080/juddi/publish"/>
          <sysproperty key="scout.proxy.transportClass" value="org.jboss.jaxr.scout.transport.SaajTransport"/>
          <sysproperty key="host.name" value="${node0}"/>
+         <sysproperty key="host.name.url" value="${node0.url}"/>
          <sysproperty key="jndi.bind.name" value="JAXR"/>
          <sysproperty key="jaxr.debug" value="true"/>
          <sysproperty key="java.endorsed.dirs" value="${jboss.dist}/lib/endorsed"/>

Modified: branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/hellojrmpiiop/test/HelloTimingStressTestCase.java
===================================================================
--- branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/hellojrmpiiop/test/HelloTimingStressTestCase.java	2010-10-25 19:33:36 UTC (rev 108910)
+++ branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/hellojrmpiiop/test/HelloTimingStressTestCase.java	2010-10-25 19:48:38 UTC (rev 108911)
@@ -60,7 +60,7 @@
       super(name);
       URL url;
       // JBAS-8540
-      String hostForURL = getServerHostForURL();
+      String hostForURL = System.getProperty("jbosstest.server.host.url","localhost");
 
       url = ClassLoader.getSystemResource("iiop.jndi.properties");
       iiopJndiProps = new java.util.Properties();

Modified: branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/jaxr/scout/JaxrBaseTestCase.java
===================================================================
--- branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/jaxr/scout/JaxrBaseTestCase.java	2010-10-25 19:33:36 UTC (rev 108910)
+++ branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/jaxr/scout/JaxrBaseTestCase.java	2010-10-25 19:48:38 UTC (rev 108911)
@@ -504,13 +504,14 @@
 
     protected InitialContext getClientContext() throws NamingException
     {
-        String hostname = System.getProperty("host.name", "localhost");
-        if (hostname == null)
-            throw new IllegalStateException("host.name system property not present");
+    	// JBAS-8540
+        String hostnameForURL = System.getProperty("host.name.url", "localhost");
+        if (hostnameForURL == null)
+            throw new IllegalStateException("host.name.url system property not present");
         Properties env = new Properties();
         env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
         env.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
-        env.setProperty(Context.PROVIDER_URL, "jnp://" + hostname + ":1099");
+        env.setProperty(Context.PROVIDER_URL, "jnp://" + hostnameForURL + ":1099");
         return new InitialContext(env);
     }
 

Modified: branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/jaxr/scout/basic/JaxrJNDIConnectionTestCase.java
===================================================================
--- branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/jaxr/scout/basic/JaxrJNDIConnectionTestCase.java	2010-10-25 19:33:36 UTC (rev 108910)
+++ branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/jaxr/scout/basic/JaxrJNDIConnectionTestCase.java	2010-10-25 19:48:38 UTC (rev 108911)
@@ -53,11 +53,14 @@
 
     protected InitialContext getClientContext() throws NamingException
     {
-        String hostname = System.getProperty("host.name");
+    	// JBAS-8540
+        String hostnameForURL = System.getProperty("host.name.url", "localhost");
+        if (hostnameForURL == null)
+            throw new IllegalStateException("host.name.url system property not present");        
         Properties env = new Properties();
         env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
         env.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
-        env.setProperty(Context.PROVIDER_URL, "jnp://" + hostname + ":1099");
+        env.setProperty(Context.PROVIDER_URL, "jnp://" + hostnameForURL + ":1099");
         return new InitialContext(env);
     }
 }

Modified: branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/webservice/admindevel/ExampleTestCase.java
===================================================================
--- branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/webservice/admindevel/ExampleTestCase.java	2010-10-25 19:33:36 UTC (rev 108910)
+++ branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/webservice/admindevel/ExampleTestCase.java	2010-10-25 19:48:38 UTC (rev 108911)
@@ -55,9 +55,35 @@
       {
          InitialContext iniCtx = getClientContext();
          Service service = (Service)iniCtx.lookup("java:comp/env/service/HelloService");
+
+         // JBAS-8540 debugging
+         URL wsdl = service.getWSDLDocumentLocation() ;
+         printURLContents(wsdl) ;
+         
          helloPort = (Hello)service.getPort(Hello.class);
       }
    }
+   
+   private void printURLContents(URL url) {
+	   BufferedReader in = null ;
+	   String inputLine = null ;
+	   
+	   // the WSDL URL is correct
+	   // the WSDL contents are incorrect, carrying an invalid soap:address location=
+	   log.debug("URL = " + url + ": contents: START") ;
+	   
+	   try {
+	   in = new BufferedReader(new InputStreamReader(url.openStream())) ;
+	   
+	   while ((inputLine = in.readLine()) != null)
+	    log.debug(inputLine);
+	   
+	   in.close();
+	   } catch(IOException e) {
+		   e.printStackTrace() ;
+	   }
+	   log.debug("URL contents: END") ;
+   }
 
    public void testHelloString() throws Exception
    {

Modified: branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/ws/JBossWSTest.java
===================================================================
--- branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/ws/JBossWSTest.java	2010-10-25 19:33:36 UTC (rev 108910)
+++ branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/ws/JBossWSTest.java	2010-10-25 19:48:38 UTC (rev 108911)
@@ -153,6 +153,25 @@
       String hostName = System.getProperty("jbosstest.server.host", "localhost");
       return hostName;
    }
+   
+   /**
+    * Returns the JBoss server host from system property "jbosstest.server.host"
+    * in a form suitable for inclusion in URLs (see RFC 2732).
+    * JBAS-8540
+    */
+   public String getServerHostForURL()
+   {
+      String hostName = getServerHost() ;
+      
+      if (hostName == null)
+    	  return hostName;	
+      
+      // check for IPv6 literal
+      if (hostName.indexOf(":") != -1)
+    	  return "[" + hostName + "]" ;
+      else 
+    	  return hostName ;
+   }   
 
    public static void assertEquals(Element expElement, Element wasElement, boolean ignoreWhitespace)
    {

Modified: branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/ws/jaxws/ejb3Integration/WebServiceTestCase.java
===================================================================
--- branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/ws/jaxws/ejb3Integration/WebServiceTestCase.java	2010-10-25 19:33:36 UTC (rev 108910)
+++ branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/ws/jaxws/ejb3Integration/WebServiceTestCase.java	2010-10-25 19:48:38 UTC (rev 108911)
@@ -62,8 +62,9 @@
     */
    public void testWebService() throws Exception
    {
+	   // JBAS-8540
       Service service = Service.create(
-        new URL("http://"+getServerHost()+":8080/webservices-ejb3/SimpleEndpoint?wsdl"),
+        new URL("http://"+getServerHostForURL()+":8080/webservices-ejb3/SimpleEndpoint?wsdl"),
         new QName("http://ejb3Integration.jaxws.ws.test.jboss.org/","SimpleEndpointService")
       );
 
@@ -79,8 +80,9 @@
     */
    public void testWebServiceContext() throws Exception
    {
+	   // JBAS-8540
       Service service = Service.create(
-        new URL("http://"+getServerHost()+":8080/webservices-ejb3/WebServiceContextEndpoint?wsdl"),
+        new URL("http://"+getServerHostForURL()+":8080/webservices-ejb3/WebServiceContextEndpoint?wsdl"),
         new QName("http://ejb3Integration.jaxws.ws.test.jboss.org/","WebServiceContextEndpointService")
       );
 
@@ -93,6 +95,7 @@
    public void testWebServiceRef() throws Exception
    {
       InitialContext iniCtx = getInitialContext();
+      // JBAS-8540 FIX-ME
       if ("localhost".equals(getServerHost())) //requires AS bound to localhost, as this uses @WebServiceRef(wsdlLocation = "http://localhost..")
       {
          BusinessInterface ejb3Remote = (BusinessInterface)iniCtx.lookup("/test-webservices/WebServiceRefBean");
@@ -109,8 +112,9 @@
     */
    public void testHandlerContext() throws Exception
    {
+	   // JBAS-8540
       Service service = Service.create(
-        new URL("http://"+getServerHost()+":8080/webservices-ejb3/HandlerContextEndpoint?wsdl"),
+        new URL("http://"+getServerHostForURL()+":8080/webservices-ejb3/HandlerContextEndpoint?wsdl"),
         new QName("http://ejb3Integration.jaxws.ws.test.jboss.org/","HandlerContextEndpointService")
       );
 

Modified: branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefClientTestCase.java
===================================================================
--- branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefClientTestCase.java	2010-10-25 19:33:36 UTC (rev 108910)
+++ branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefClientTestCase.java	2010-10-25 19:48:38 UTC (rev 108911)
@@ -40,7 +40,8 @@
  */
 public class WebServiceRefClientTestCase extends JBossWSTest
 {
-   public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-webserviceref";
+	// JBAS-8540
+   public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHostForURL() + ":8080/jaxws-webserviceref";
    
    public static Test suite()
    {

Modified: branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefEJB3TestCase.java
===================================================================
--- branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefEJB3TestCase.java	2010-10-25 19:33:36 UTC (rev 108910)
+++ branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefEJB3TestCase.java	2010-10-25 19:48:38 UTC (rev 108911)
@@ -40,7 +40,8 @@
  */
 public class WebServiceRefEJB3TestCase extends JBossWSTest
 {
-   public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-webserviceref";
+	// JBAS-8540
+   public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHostForURL() + ":8080/jaxws-webserviceref";
    
    public static Test suite()
    {

Modified: branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefServletTestCase.java
===================================================================
--- branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefServletTestCase.java	2010-10-25 19:33:36 UTC (rev 108910)
+++ branches/JBoss-AS-6.0.x_ipv6/testsuite/src/main/org/jboss/test/ws/jaxws/webserviceref/WebServiceRefServletTestCase.java	2010-10-25 19:48:38 UTC (rev 108911)
@@ -41,7 +41,8 @@
  */
 public class WebServiceRefServletTestCase extends JBossWSTest
 {
-   public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-webserviceref";
+	// JBAS-8540
+   public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHostForURL() + ":8080/jaxws-webserviceref";
    
    public static Test suite()
    {



More information about the jboss-cvs-commits mailing list