[jbossws-commits] JBossWS SVN: r10852 - stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Wed Oct 7 09:33:45 EDT 2009


Author: richard.opalka at jboss.com
Date: 2009-10-07 09:33:45 -0400 (Wed, 07 Oct 2009)
New Revision: 10852

Modified:
   stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointServlet.java
   stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointTestCase.java
Log:
[JBWS-2674][JBWS-2754] don't use proprietary API (WIP)

Modified: stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointServlet.java
===================================================================
--- stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointServlet.java	2009-10-07 13:32:00 UTC (rev 10851)
+++ stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointServlet.java	2009-10-07 13:33:45 UTC (rev 10852)
@@ -39,23 +39,20 @@
 
 import org.jboss.logging.Logger;
 import org.jboss.wsf.common.DOMUtils;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
-import org.jboss.wsf.spi.http.HttpContext;
-import org.jboss.wsf.spi.http.HttpServer;
-import org.jboss.wsf.spi.http.HttpServerFactory;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 
 /**
- * Test Endpoint deployment
+ * Tests Endpoint deployment in J2EE environment.
  *
- * @author Thomas.Diesler at jboss.org
- * @since 12-Jul-2006
+ * @author <a href="mailto:tdiesler at redhat.com">Thomas Diesler</a>
+ * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
  */
 public class EndpointServlet extends HttpServlet
 {
-   private Endpoint endpoint;
+   
+   private Endpoint endpoint1;
+   private Endpoint endpoint2;
    private static final String TEST_ELEMENT = "<fabrikam:CustomerKey xmlns:fabrikam='http://example.com/fabrikam'>123456789</fabrikam:CustomerKey>";
    
    @Override
@@ -63,25 +60,16 @@
    {
       super.init(config);
       
-      // Create the endpoint
-      EndpointBean epImpl = new EndpointBean();
-      endpoint = Endpoint.create(SOAPBinding.SOAP11HTTP_BINDING, epImpl);
-
-      // Create and start the HTTP server
-      SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
-      HttpServer httpServer = spiProvider.getSPI(HttpServerFactory.class).getHttpServer();
-      httpServer.start();
-      
-      // Create the context and publish the endpoint
-      HttpContext context = httpServer.createContext("/jaxws-endpoint");
-      endpoint.publish(context);
+      endpoint1 = Endpoint.create(SOAPBinding.SOAP11HTTP_BINDING, new EndpointBean());
+      endpoint1.publish("http://localhost:8080/jaxws-endpoint");
+      endpoint2 = Endpoint.publish("http://localhost:8080/jaxws-endpoint2/endpoint/long/path", EndpointBean.class);
    }
    
    @Override
    public void destroy()
    {
-      // Stop the endpoint
-      endpoint.stop();
+      endpoint1.stop();
+      endpoint2.stop();
       
       super.destroy();
    }
@@ -99,16 +87,15 @@
       String retStr = port.echo(param);
       
       //Test epr
-      assertEndpointReference(endpoint.getEndpointReference(DOMUtils.parse(TEST_ELEMENT)), TEST_ELEMENT);
-      assertEndpointReference(endpoint.getEndpointReference(W3CEndpointReference.class, (Element[])null), null);
+      assertEndpointReference(endpoint1.getEndpointReference(DOMUtils.parse(TEST_ELEMENT)), TEST_ELEMENT);
+      assertEndpointReference(endpoint1.getEndpointReference(W3CEndpointReference.class, (Element[])null), null);
 
       // Return the result
       PrintWriter pw = new PrintWriter(res.getWriter());
       pw.print(retStr);
+      pw.close();
    }
    
-
-   
    private void assertEndpointReference(EndpointReference epr, String refPar) throws IOException
    {
       Logger.getLogger(this.getClass()).info("epr: "+epr);
@@ -121,7 +108,6 @@
       assert("http://127.0.0.1:8080/jaxws-endpoint".equals(addresses.item(0).getFirstChild().getNodeValue()));
       if (refPar != null)
       {
-         //TODO enhance this check
          assert(epr.toString().contains(refPar));
       }
    }

Modified: stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointTestCase.java
===================================================================
--- stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointTestCase.java	2009-10-07 13:32:00 UTC (rev 10851)
+++ stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointTestCase.java	2009-10-07 13:33:45 UTC (rev 10852)
@@ -57,12 +57,10 @@
 
    public void testWSDLAccess() throws Exception
    {
-      URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-endpoint?wsdl");
-      WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
-      Definition wsdlDefinition = wsdlReader.readWSDL(wsdlURL.toString());
-      assertNotNull(wsdlDefinition);
+      readWSDL(new URL("http://" + getServerHost() + ":8080/jaxws-endpoint?wsdl"));
+      readWSDL(new URL("http://" + getServerHost() + ":8080/jaxws-endpoint2/endpoint/long/path?wsdl"));
    }
-
+   
    public void testClientAccess() throws Exception
    {
       // Create the port
@@ -83,4 +81,11 @@
       assertEquals("hello-world", br.readLine());
    }
 
+   private void readWSDL(URL wsdlURL) throws Exception
+   {
+      WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
+      Definition wsdlDefinition = wsdlReader.readWSDL(wsdlURL.toString());
+      assertNotNull(wsdlDefinition);
+   }
+
 }



More information about the jbossws-commits mailing list