cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r542785 - in /incubator/cxf/trunk: rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/ rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/ systests/src/test/java/org/apache/cxf/systest/jms/ systests/src/test/ja...
Date Wed, 30 May 2007 09:36:59 GMT
Author: ningjiang
Date: Wed May 30 02:36:58 2007
New Revision: 542785

URL: http://svn.apache.org/viewvc?view=rev&rev=542785
Log:
1. [CXF-695]Added the contextpath paramenter in the severlet systest.

2. set the temp date directory for the ActiveMQ jms broker 

Modified:
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DispatchInterceptor.java
    incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSBrokerSetup.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/EmbeddedJMSBrokerLauncher.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/AbstractServletTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/HttpBindingServletTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/JsFrontEndServletTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/SpringServletTest.java

Modified: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DispatchInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DispatchInterceptor.java?view=diff&rev=542785&r1=542784&r2=542785
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DispatchInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DispatchInterceptor.java
Wed May 30 02:36:58 2007
@@ -23,7 +23,7 @@
 
 import org.apache.cxf.binding.http.URIMapper;
 import org.apache.cxf.common.i18n.BundleUtils;
-import org.apache.cxf.endpoint.Endpoint;
+//import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
@@ -43,13 +43,17 @@
 
     public void handleMessage(Message message) {
         String path = (String)message.get(Message.PATH_INFO);
+        String address = (String)message.get(Message.BASE_PATH);
         String method = (String)message.get(Message.HTTP_REQUEST_METHOD);
         
-        String address = message.getExchange().get(Endpoint.class).getEndpointInfo().getAddress();
-        int idx = address.indexOf('/', 7);
-        if (idx != -1) {
-            address = address.substring(idx);
-        }
+        //String address = message.getExchange().get(Endpoint.class).getEndpointInfo().getAddress();
+        
+        if (address.startsWith("http")) {
+            int idx = address.indexOf('/', 7);       
+            if (idx != -1) {
+                address = address.substring(idx);
+            }
+        }    
         
         if (path.startsWith(address)) {
             path = path.substring(address.length());

Modified: incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSBrokerSetup.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSBrokerSetup.java?view=diff&rev=542785&r1=542784&r2=542785
==============================================================================
--- incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSBrokerSetup.java
(original)
+++ incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSBrokerSetup.java
Wed May 30 02:36:58 2007
@@ -19,6 +19,8 @@
 
 package org.apache.cxf.transport.jms;
 
+import java.io.File;
+
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.store.memory.MemoryPersistenceAdapter;
 
@@ -76,7 +78,8 @@
                 //ContainerWapper container;
                 BrokerService broker = new BrokerService();
                 synchronized (this) {                                     
-                    broker.setPersistenceAdapter(new MemoryPersistenceAdapter());
+                    broker.setPersistenceAdapter(new MemoryPersistenceAdapter());       
            
+                    broker.setTmpDataDirectory(new File("./target"));
                     broker.addConnector(brokerUrl);
                     broker.start();
                     Thread.sleep(200);

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/EmbeddedJMSBrokerLauncher.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/EmbeddedJMSBrokerLauncher.java?view=diff&rev=542785&r1=542784&r2=542785
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/EmbeddedJMSBrokerLauncher.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/EmbeddedJMSBrokerLauncher.java
Wed May 30 02:36:58 2007
@@ -18,6 +18,8 @@
  */
 package org.apache.cxf.systest.jms;
 
+import java.io.File;
+
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.store.memory.MemoryPersistenceAdapter;
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
@@ -39,6 +41,7 @@
         try {                
             broker = new BrokerService();
             broker.setPersistenceAdapter(new MemoryPersistenceAdapter());
+            broker.setTmpDataDirectory(new File("./target"));
             broker.addConnector(brokerUrl1);
             broker.start();            
         } catch (Exception e) {

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/AbstractServletTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/AbstractServletTest.java?view=diff&rev=542785&r1=542784&r2=542785
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/AbstractServletTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/AbstractServletTest.java
Wed May 30 02:36:58 2007
@@ -34,15 +34,16 @@
 import org.junit.Before;
 
 public abstract class AbstractServletTest extends AbstractCXFTest {
-
+    public static final String CONTEXT = "/mycontext";
+    public static final String CONTEXT_URL = "http://localhost/mycontext";
     protected ServletRunner sr;
 
     @Before
     public void setUp() throws Exception {
-        sr = new ServletRunner(getResourceAsStream(getConfiguration()));
+        sr = new ServletRunner(getResourceAsStream(getConfiguration()), CONTEXT);
         
         try {
-            sr.newClient().getResponse("http://localhost/services/");
+            sr.newClient().getResponse(CONTEXT_URL + "/services");
         } catch (HttpNotFoundException e) {
             // ignore, we just want to boot up the servlet
         }   

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java?view=diff&rev=542785&r1=542784&r2=542785
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
Wed May 30 02:36:58 2007
@@ -51,7 +51,7 @@
     }
 
     private void invoke(String encoding) throws Exception {        
-        WebRequest req = new PostMethodWebRequest("http://localhost/services/greeter", 
+        WebRequest req = new PostMethodWebRequest(CONTEXT_URL + "/services/greeter", 
             getClass().getResourceAsStream("GreeterMessage.xml"), 
             "text/xml; charset=" + encoding);
         
@@ -76,17 +76,17 @@
         ServletUnitClient client = newClient();
         client.setExceptionsThrownOnErrorStatus(false);
 
-        WebResponse res = client.getResponse("http://localhost/services");    
+        WebResponse res = client.getResponse(CONTEXT_URL + "/services");    
         
         WebLink[] links = res.getLinks();
         assertEquals("There should get one link for service", 1, links.length);
-        assertEquals("http://localhost/services/greeter?wsdl", links[0].getURLString());
      
+        assertEquals(CONTEXT_URL + "/services/greeter?wsdl", links[0].getURLString());  
    
         assertEquals("text/html", res.getContentType());
         
-        res = client.getResponse("http://localhost/services/");
+        res = client.getResponse(CONTEXT_URL + "/services");
         links = res.getLinks();
         assertEquals("There should get one link for service", 1, links.length);
-        assertEquals("http://localhost/services/greeter?wsdl", links[0].getURLString());
      
+        assertEquals(CONTEXT_URL + "/services/greeter?wsdl", links[0].getURLString());  
    
         assertEquals("text/html", res.getContentType());
     }
     
@@ -95,7 +95,7 @@
         ServletUnitClient client = newClient();
         client.setExceptionsThrownOnErrorStatus(true);
         
-        WebRequest req = new GetMethodQueryWebRequest("http://localhost/services/greeter?wsdl");
+        WebRequest req = new GetMethodQueryWebRequest(CONTEXT_URL + "/services/greeter?wsdl");
         
         WebResponse res = client.getResponse(req); 
         assertEquals(200, res.getResponseCode());
@@ -103,7 +103,7 @@
         assertTrue("the wsdl should contain the opertion greetMe",
                    res.getText().contains("<wsdl:operation name=\"greetMe\">"));
         assertTrue("the soap address should changed",
-                   res.getText().contains("<soap:address location=\"http://localhost/services/greeter\""));
+                   res.getText().contains("<soap:address location=\"" + CONTEXT_URL +
"/services/greeter\""));
         
     }
 
@@ -112,14 +112,14 @@
         ServletUnitClient client = newClient();
         client.setExceptionsThrownOnErrorStatus(false);
 
-        WebResponse res = client.getResponse("http://localhost/services/NoSuchService");
+        WebResponse res = client.getResponse(CONTEXT_URL + "/services/NoSuchService");
         assertEquals(404, res.getResponseCode());
         assertEquals("text/html", res.getContentType());
     }
 
     @Test
     public void testServiceWsdlNotFound() throws Exception {
-        WebRequest req = new GetMethodWebRequest("http://localhost/services/NoSuchService?wsdl");
+        WebRequest req = new GetMethodWebRequest(CONTEXT_URL + "/services/NoSuchService?wsdl");
 
         expectErrorCode(req, 404, "Response code 404 required for invalid WSDL url.");
     }
@@ -130,14 +130,14 @@
         client.setExceptionsThrownOnErrorStatus(true);
 
         WebRequest req 
-            = new GetMethodQueryWebRequest("http://localhost/services/greeter?wsdl");
+            = new GetMethodQueryWebRequest(CONTEXT_URL + "/services/greeter?wsdl");
         WebResponse res = client.getResponse(req); 
         assertEquals(200, res.getResponseCode());
         String text = res.getText();
         assertEquals("text/xml", res.getContentType());
-        assertTrue(text.contains("http://localhost/services/greeter?wsdl=test_import.xsd"));
+        assertTrue(text.contains(CONTEXT_URL + "/services/greeter?wsdl=test_import.xsd"));
 
-        req = new GetMethodQueryWebRequest("http://localhost/services/greeter?wsdl=test_import.xsd");
+        req = new GetMethodQueryWebRequest(CONTEXT_URL + "/services/greeter?wsdl=test_import.xsd");
         res = client.getResponse(req); 
         assertEquals(200, res.getResponseCode());
         text = res.getText();

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java?view=diff&rev=542785&r1=542784&r2=542785
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java
Wed May 30 02:36:58 2007
@@ -45,7 +45,7 @@
     public void testPostInvokeServices() throws Exception {
         newClient();
         
-        WebRequest req = new PostMethodWebRequest("http://localhost/services/greeter",
+        WebRequest req = new PostMethodWebRequest(CONTEXT_URL + "/services/greeter",
                 getClass().getResourceAsStream("GreeterMessage.xml"),
                 "text/xml; charset=UTF-8");
         

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/HttpBindingServletTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/HttpBindingServletTest.java?view=diff&rev=542785&r1=542784&r2=542785
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/HttpBindingServletTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/HttpBindingServletTest.java
Wed May 30 02:36:58 2007
@@ -54,7 +54,7 @@
         client.setExceptionsThrownOnErrorStatus(false);
         
         WebRequest req = 
-            new GetMethodQueryWebRequest("http://localhost/services/restful/customers");
+            new GetMethodQueryWebRequest(CONTEXT_URL + "/services/restful/customers");
         
         WebResponse response = client.getResponse(req);        
         Document doc = DOMUtils.readXml(response.getInputStream());
@@ -65,7 +65,7 @@
         assertValid("/c:customers/c:customer/c:id[text()='123']", doc);
         assertValid("/c:customers/c:customer/c:name[text()='Dan Diephouse']", doc);
         
-        req = new GetMethodQueryWebRequest("http://localhost/services/restful/customers/123");
+        req = new GetMethodQueryWebRequest(CONTEXT_URL + "/services/restful/customers/123");
         response = client.getResponse(req);        
         doc = DOMUtils.readXml(response.getInputStream());
         assertNotNull(doc);
@@ -75,7 +75,7 @@
         assertValid("/c:customer/c:name[text()='Dan Diephouse']", doc);
         
         // Try invalid customer
-        req = new GetMethodQueryWebRequest("http://localhost/services/restful/customers/0");
+        req = new GetMethodQueryWebRequest(CONTEXT_URL + "/services/restful/customers/0");
         response = client.getResponse(req); 
         
         assertEquals("Expect the wrong response code", response.getResponseCode(), 500);
@@ -85,7 +85,7 @@
         assertValid("//c:CustomerNotFoundDetails", doc);
         
         PostMethodWebRequest postReq = 
-            new PostMethodWebRequest("http://localhost/services/restful/customers", 
+            new PostMethodWebRequest(CONTEXT_URL + "/services/restful/customers", 
                                  getClass().getResourceAsStream("add.xml"),
                                  "text/xml; charset=UTF-8");
         response = client.getResponse(postReq);
@@ -94,7 +94,7 @@
         assertValid("/c:addCustomer", doc);
         
         PutMethodWebRequest putReq = 
-            new PutMethodWebRequest("http://localhost/services/restful/customers/123", 
+            new PutMethodWebRequest(CONTEXT_URL + "/services/restful/customers/123", 
                                  getClass().getResourceAsStream("update.xml"),
                                  "text/xml; charset=UTF-8");
         response = client.getResponse(putReq);
@@ -103,7 +103,7 @@
         assertValid("/c:updateCustomer", doc);
       
         // Get the updated document
-        req = new GetMethodQueryWebRequest("http://localhost/services/restful/customers/123");
+        req = new GetMethodQueryWebRequest(CONTEXT_URL + "/services/restful/customers/123");
         response = client.getResponse(req);
         doc = DOMUtils.readXml(response.getInputStream());
         assertNotNull(doc);  

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/JsFrontEndServletTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/JsFrontEndServletTest.java?view=diff&rev=542785&r1=542784&r2=542785
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/JsFrontEndServletTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/JsFrontEndServletTest.java
Wed May 30 02:36:58 2007
@@ -36,7 +36,7 @@
     @Test
     public void testPostInvokeServices() throws Exception {
                 
-        WebRequest req = new PostMethodWebRequest("http://localhost/services/Greeter",
+        WebRequest req = new PostMethodWebRequest(CONTEXT_URL + "/services/Greeter",
                 getClass().getResourceAsStream("GreeterMessage.xml"),
                 "text/xml; charset=UTF-8");
         

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/SpringServletTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/SpringServletTest.java?view=diff&rev=542785&r1=542784&r2=542785
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/SpringServletTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/SpringServletTest.java
Wed May 30 02:36:58 2007
@@ -45,13 +45,13 @@
     @Test
     public void testInvokingSpringBeans() throws Exception {
 
-        WebRequest req = new PostMethodWebRequest("http://localhost/services/Greeter",
+        WebRequest req = new PostMethodWebRequest(CONTEXT_URL + "/services/Greeter",
             getClass().getResourceAsStream("GreeterMessage.xml"),
             "text/xml; charset=utf-8");
 
         invokingEndpoint(req);
         
-        req = new PostMethodWebRequest("http://localhost/services/Greeter1",
+        req = new PostMethodWebRequest(CONTEXT_URL + "/services/Greeter1",
             getClass().getResourceAsStream("GreeterMessage.xml"), "text/xml; charset=utf-8");
         
         invokingEndpoint(req);
@@ -77,7 +77,7 @@
         client.setExceptionsThrownOnErrorStatus(true);
         
         WebRequest req = 
-            new GetMethodQueryWebRequest("http://localhost/services/Greeter/greetMe?"
+            new GetMethodQueryWebRequest(CONTEXT_URL + "/services/Greeter/greetMe?"
                                          + "requestType=hello");
         
         WebResponse response = client.getResponse(req);        
@@ -87,7 +87,7 @@
         assertValid("//h:greetMeResponse", doc);
         
         req = 
-            new GetMethodQueryWebRequest("http://localhost/services/Greeter1/greetMe?"
+            new GetMethodQueryWebRequest(CONTEXT_URL + "/services/Greeter1/greetMe?"
                                          + "requestType=hello");
         
         response = client.getResponse(req);        
@@ -104,15 +104,15 @@
         client.setExceptionsThrownOnErrorStatus(true);
         
         WebRequest req = 
-            new GetMethodQueryWebRequest("http://localhost/services/Greeter?wsdl"); 
+            new GetMethodQueryWebRequest(CONTEXT_URL + "/services/Greeter?wsdl"); 
        
-        WebResponse res = client.getResponse(req); 
+        WebResponse res = client.getResponse(req);        
         assertEquals(200, res.getResponseCode());
         assertEquals("text/xml", res.getContentType());
         assertTrue("the wsdl should contain the opertion greetMe",
                    res.getText().contains("<wsdl:operation name=\"greetMe\">"));
         assertTrue("the soap address should changed",
-                   res.getText().contains("<soap:address location=\"http://localhost/services/Greeter"));
+                   res.getText().contains("<soap:address location=\"" + CONTEXT_URL +
"/services/Greeter"));
         
         
         



Mime
View raw message