You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ni...@apache.org on 2007/03/15 14:44:50 UTC

svn commit: r518627 [2/2] - in /incubator/cxf/trunk: integration/jca/ rt/ rt/bindings/http/ rt/databinding/aegis/ rt/transports/http/ rt/transports/http/src/java/ rt/transports/http/src/main/java/org/apache/cxf/transport/http/ rt/transports/http/src/ma...

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java?view=diff&rev=518627&r1=518626&r2=518627
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java Thu Mar 15 06:44:47 2007
@@ -20,38 +20,22 @@
 package org.apache.cxf.transport.servlet;
 
 import java.io.IOException;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
 import java.net.URL;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Map;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.helpers.HttpHeaderHelper;
-import org.apache.cxf.io.AbstractWrappedOutputStream;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.service.model.EndpointInfo;
-import org.apache.cxf.transport.AbstractDestination;
-import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.ConduitInitiator;
 import org.apache.cxf.transport.MessageObserver;
 import org.apache.cxf.transport.http.AbstractHTTPDestination;
 
 
 public class ServletDestination extends AbstractHTTPDestination {
-
-    public static final String HTTP_REQUEST =
-        "HTTP_SERVLET_REQUEST";
-    public static final String HTTP_RESPONSE =
-        "HTTP_SERVLET_RESPONSE"; 
     
     static final Logger LOG = Logger.getLogger(ServletDestination.class.getName());
         
@@ -81,48 +65,9 @@
     protected Logger getLogger() {
         return LOG;
     }
-
-    /**
-     * @param inMessage the incoming message
-     * @return the inbuilt backchannel
-     */
-    protected Conduit getInbuiltBackChannel(Message inMessage) {
-        HttpServletResponse response = (HttpServletResponse)inMessage.get(HTTP_RESPONSE);
-        return new BackChannelConduit(response);
-    }
+  
    
-   
-        
-    /**
-     * Copy the request headers into the message.
-     * 
-     * @param message the current message
-     * @param headers the current set of headers
-     */
-    protected void copyRequestHeaders(Message message, Map<String, List<String>> headers) {
-        HttpServletRequest req = (HttpServletRequest)message.get(HTTP_REQUEST);
-        for (Enumeration e = req.getHeaderNames(); e.hasMoreElements();) {
-            String fname = (String)e.nextElement();
-            
-            List<String> values;
-            if (headers.containsKey(fname)) {
-                values = headers.get(fname);
-            } else {
-                values = new ArrayList<String>();
-                headers.put(HttpHeaderHelper.getHeaderKey(fname), values);
-            }
-            for (Enumeration e2 = req.getHeaders(fname); e2.hasMoreElements();) {
-                String val = (String)e2.nextElement();
-                values.add(val);
-            }
-        }
-    }    
-    /**
-     * Copy the response headers into the response.
-     * 
-     * @param message the current message
-     * @param headers the current set of headers
-     */
+    
     protected void copyResponseHeaders(Message message, HttpServletResponse response) {
         String ct = (String) message.get(Message.CONTENT_TYPE);
         String enc = (String) message.get(Message.ENCODING);
@@ -135,9 +80,7 @@
         } else if (enc != null) {
             response.setContentType("text/xml; charset=" + enc);
         }
-        
-    }
-    
+    }    
     
     
     protected void doMessage(MessageImpl inMessage) throws IOException {
@@ -155,104 +98,7 @@
             }
         }
         
-    }
-    
-    protected class BackChannelConduit
-        extends AbstractDestination.AbstractBackChannelConduit {
-        
-        protected HttpServletResponse response;
-        
-        BackChannelConduit(HttpServletResponse resp) {
-            response = resp;
-        }
-
-        /**
-         * Send an outbound message, assumed to contain all the name-value
-         * mappings of the corresponding input message (if any). 
-         * 
-         * @param message the message to be sent.
-         */
-        public void send(Message message) throws IOException {
-            message.put(HTTP_RESPONSE, response);
-            message.setContent(OutputStream.class,
-                               new WrappedOutputStream(message, response));
-        }
-    }
-    
-    private class WrappedOutputStream extends AbstractWrappedOutputStream {
-        
-        protected HttpServletResponse response;
-        
-        WrappedOutputStream(Message m, HttpServletResponse resp) {
-            super(m);
-            response = resp;
-        }
-
-        /**
-         * Perform any actions required on stream flush (freeze headers,
-         * reset output stream ... etc.)
-         */
-        protected void doFlush() throws IOException {
-            OutputStream responseStream = flushHeaders(outMessage);
-            if (null != responseStream && !alreadyFlushed()) {
-                resetOut(responseStream, true);
-            }
-        }
-
-        /**
-         * Perform any actions required on stream closure (handle response etc.)
-         */
-        protected void doClose() {
-            commitResponse();
-        }
-
-        protected void onWrite() throws IOException {            
-        }
-        
-        private void commitResponse() {
-            try {
-                response.flushBuffer();
-            } catch (IOException e) {
-                LOG.severe(e.getMessage());
-            }
-        }
-    }
-    
-    protected OutputStream flushHeaders(Message outMessage) throws IOException {
-        updateResponseHeaders(outMessage);
-        Object responseObj = outMessage.get(HTTP_RESPONSE);
-        OutputStream responseStream = null;
-        if (responseObj instanceof HttpServletResponse) {
-            HttpServletResponse response = (HttpServletResponse)responseObj;
-                
-            Integer i = (Integer)outMessage.get(Message.RESPONSE_CODE);
-            if (i != null) {
-                int status = i.intValue();
-                response.setStatus(status);                
-            } else {
-                response.setStatus(HttpURLConnection.HTTP_OK);
-            }
-            
-            copyResponseHeaders(outMessage, response);
-            responseStream = response.getOutputStream();
-                    
-            if (isOneWay(outMessage)) {
-                response.flushBuffer();
-            }
-        } else {
-            LOG.log(Level.WARNING, "UNEXPECTED_RESPONSE_TYPE_MSG", responseObj.getClass());
-            throw new IOException("UNEXPECTED_RESPONSE_TYPE_MSG" + responseObj.getClass());
-        }
-    
-        if (isOneWay(outMessage)) {
-            outMessage.remove(HTTP_RESPONSE);
-        }
-        return responseStream;
-    }
-    
-    protected boolean isOneWay(Message message) {
-        return message.getExchange() != null && message.getExchange().isOneWay();
-    }
+    }   
 
     public MessageObserver getMessageObserver() {
         return this.incomingObserver;

Modified: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java?view=diff&rev=518627&r1=518626&r2=518627
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java Thu Mar 15 06:44:47 2007
@@ -33,6 +33,9 @@
 import java.util.List;
 import java.util.Map;
 
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletOutputStream;
+
 import junit.framework.TestCase;
 
 import org.apache.cxf.bus.CXFBusImpl;
@@ -63,8 +66,8 @@
     private Proxy proxy;
     private Message inMessage;
     private MessageObserver observer;
-    private OutputStream os;
-    private InputStream is;
+    private ServletOutputStream os;
+    private ServletInputStream is;
     private IMocksControl control;
     
     public void setUp() throws Exception {
@@ -139,7 +142,8 @@
         contentTypes.add("text/xml");
         contentTypes.add("charset=utf8");
         headers.put("content-type", contentTypes);
-        message.put(Message.PROTOCOL_HEADERS, headers);        
+        message.put(Message.PROTOCOL_HEADERS, headers);
+        
         
         AuthorizationPolicy authPolicy = new AuthorizationPolicy();
         authPolicy.setUserName("BJ");
@@ -199,9 +203,9 @@
                     ((HttpURLConnection)connection).setChunkedStreamingMode(2048);
                     EasyMock.expectLastCall();                    
                 }
-            }         
+            }
         }
-
+               
         CXFBusImpl bus = new CXFBusImpl();
         URL decoupledURL = null;
         if (decoupled) {
@@ -222,13 +226,14 @@
         }
         
         control.replay();
-        
+
         HTTPConduit conduit = new HTTPConduit(bus, 
                                               endpointInfo,
                                               null,
                                               connectionFactory);
         conduit.retrieveConnectionFactory();
 
+        
         if (send) {
             conduit.getClient().setConnectionTimeout(303030);
             conduit.getClient().setReceiveTimeout(404040);
@@ -239,14 +244,14 @@
                 } 
             }
         }
-
+        
         if (decoupled) {
             conduit.getClient().setDecoupledEndpoint(decoupledURL.toString());
             assertNotNull("expected back channel", conduit.getBackChannel());
         } else {
             assertNull("unexpected back channel", conduit.getBackChannel());
         }
-
+       
         observer = new MessageObserver() {
             public void onMessage(Message m) {
                 inMessage = m;
@@ -284,7 +289,7 @@
         }
         
         
-        os = EasyMock.createMock(OutputStream.class);
+        os = EasyMock.createMock(ServletOutputStream.class);
         connection.getOutputStream();
         EasyMock.expectLastCall().andReturn(os);
         os.write(PAYLOAD.getBytes(), 0, PAYLOAD.length());
@@ -298,9 +303,9 @@
         EasyMock.expectLastCall();
         
         verifyHandleResponse(decoupled);
-
-        control.replay();
         
+        control.replay();
+                
         wrappedOS.flush();
         wrappedOS.flush();
         wrappedOS.close();
@@ -370,7 +375,7 @@
             String responseString = Integer.toString(responseCode);
             EasyMock.expectLastCall().andReturn(responseString).times(2);
         }
-        is = EasyMock.createMock(InputStream.class);
+        is = EasyMock.createMock(ServletInputStream.class);
         connection.getInputStream();
         EasyMock.expectLastCall().andReturn(is);
     }
@@ -390,10 +395,10 @@
                      inMessage.get(DECOUPLED_CHANNEL_MESSAGE));
         assertEquals("unexpected HTTP_REQUEST set",
                      false,
-                     inMessage.containsKey(HTTPConduit.HTTP_REQUEST));
+                     inMessage.containsKey(AbstractHTTPDestination.HTTP_REQUEST));
         assertEquals("unexpected HTTP_RESPONSE set",
                      false,
-                     inMessage.containsKey(HTTPConduit.HTTP_RESPONSE));
+                     inMessage.containsKey(AbstractHTTPDestination.HTTP_RESPONSE));
         assertEquals("unexpected Message.ASYNC_POST_RESPONSE_DISPATCH set",
                      false,
                      inMessage.containsKey(Message.ASYNC_POST_RESPONSE_DISPATCH));

Modified: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyContextInspectorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyContextInspectorTest.java?view=diff&rev=518627&r1=518626&r2=518627
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyContextInspectorTest.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyContextInspectorTest.java Thu Mar 15 06:44:47 2007
@@ -23,17 +23,17 @@
 
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
-import org.mortbay.http.HttpContext;
+import org.mortbay.jetty.handler.ContextHandler;
 
 
 public class JettyContextInspectorTest extends TestCase {
     private static final String CONTEXT_PATH = "/foo/bar";
-    private HttpContext context;
+    private ContextHandler context;
     private IMocksControl control;
     
     public void setUp() throws Exception {
         control = EasyMock.createNiceControl();
-        context = control.createMock(HttpContext.class);
+        context = control.createMock(ContextHandler.class);
         context.getContextPath();
         EasyMock.expectLastCall().andReturn(CONTEXT_PATH);
         control.replay();

Modified: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java?view=diff&rev=518627&r1=518626&r2=518627
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java Thu Mar 15 06:44:47 2007
@@ -21,15 +21,16 @@
 
 
 import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.URL;
 import java.util.ArrayList;
-import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletOutputStream;
+
 import junit.framework.TestCase;
 
 import org.apache.cxf.Bus;
@@ -37,23 +38,25 @@
 import org.apache.cxf.common.util.Base64Utility;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.configuration.security.AuthorizationPolicy;
+import org.apache.cxf.configuration.security.SSLServerPolicy;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.io.AbstractCachedOutputStream;
 import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.security.transport.TLSSessionInfo;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.ConduitInitiator;
 import org.apache.cxf.transport.MessageObserver;
-import org.apache.cxf.transports.http.QueryHandler;
-import org.apache.cxf.transports.http.QueryHandlerRegistry;
 import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.wsdl.EndpointReferenceUtils;
 import org.easymock.classextension.EasyMock;
-import org.easymock.classextension.IMocksControl;
-import org.mortbay.http.handler.AbstractHttpHandler;
+import org.mortbay.jetty.HttpFields;
+import org.mortbay.jetty.Request;
+import org.mortbay.jetty.Response;
+import org.mortbay.jetty.handler.AbstractHandler;
 
 public class JettyHTTPDestinationTest extends TestCase {
     protected static final String AUTH_HEADER = "Authorization";
@@ -77,26 +80,21 @@
     private ServerEngine engine;
     private HTTPServerPolicy policy;
     private JettyHTTPDestination destination;
-    private TestHttpRequest request;
-    private TestHttpResponse response;
+    private Request request;
+    private Response response;
     private Message inMessage;
     private Message outMessage;
     private MessageObserver observer;
-    private InputStream is;
-    private OutputStream os;
-    private IMocksControl control;
-    private WSDLQueryHandler wsdlQueryHandler;
-    private QueryHandlerRegistry  queryHandlerRegistry;
-    private List<QueryHandler> queryHandlerList; 
+    private ServletInputStream is;
+    private ServletOutputStream os;
+    
 
     
     public void setUp() throws Exception {
-        control = EasyMock.createNiceControl();
+        //control = EasyMock.createNiceControl();
     }
 
     public void tearDown() {
-        //control.verify();
-        control = null;
         bus = null;
         conduitInitiator = null;
         decoupledBackChannel = null;
@@ -126,35 +124,25 @@
     }
 
     public void testDoServiceRedirectURL() throws Exception {
-        destination = setUpDestination(false, false);
+        destination = setUpDestination(false);
         setUpDoService(true);
-        destination.doService(request, response);
-
-        assertEquals("unexpected sendRedirect calls",
-                     1,
-                     response.getSendRedirectCallCount());
-        assertEquals("unexpected commit calls",
-                     1,
-                     response.getCommitCallCount());
-        assertEquals("unexpected setHandled calls",
-                     1,
-                     request.getHandledCallCount());
+        destination.doService(request, response);        
     }
 
     public void testDoService() throws Exception {
-        destination = setUpDestination(false, false);
+        destination = setUpDestination(false);
         setUpDoService(false);
         destination.doService(request, response);
         verifyDoService();
     }
     
     public void testDoServiceWithHttpGET() throws Exception {
-        destination = setUpDestination(false, false);
+        destination = setUpDestination(false);
         setUpDoService(false,
                        false,
                        false,
                        "GET",
-                       "?customerId=abc&cutomerAdd=def");
+                       "?customerId=abc&cutomerAdd=def", 200);
         destination.doService(request, response);
         
         assertNotNull("unexpected null message", inMessage);
@@ -163,29 +151,15 @@
                      "GET");
         assertEquals("unexpected path",
                      inMessage.get(Message.PATH_INFO),
-                     "bar/foo");
+                     "/bar/foo");
         assertEquals("unexpected query",
                      inMessage.get(Message.QUERY_STRING),
                      "?customerId=abc&cutomerAdd=def");
 
     }
-    
-    public void testDoServiceWithHttpGETandQueryWSDL() throws Exception {
-        destination = setUpDestination(false, true);
-        setUpDoService(false,
-                       false,
-                       false,
-                       "GET",
-                       "?wsdl");
-        
-        destination.doService(request, response);
-        assertNotNull("unexpected null response", response);
-        assertEquals("text/xml", response.getContentType());
-        
-    }
 
     public void testGetAnonBackChannel() throws Exception {
-        destination = setUpDestination(false, false);
+        destination = setUpDestination(false);
         setUpDoService(false);
         destination.doService(request, response);
         setUpInMessage();
@@ -200,7 +174,7 @@
     }
     
     public void testGetBackChannelSend() throws Exception {
-        destination = setUpDestination(false, false);
+        destination = setUpDestination(false);
         setUpDoService(false, true);
         destination.doService(request, response);
         setUpInMessage();
@@ -212,8 +186,8 @@
     }
 
     public void testGetBackChannelSendFault() throws Exception {
-        destination = setUpDestination(false, false);
-        setUpDoService(false, true);
+        destination = setUpDestination(false);
+        setUpDoService(false, true, 500);
         destination.doService(request, response);
         setUpInMessage();
         Conduit backChannel =
@@ -224,8 +198,8 @@
     }
     
     public void testGetBackChannelSendOneway() throws Exception {
-        destination = setUpDestination(false, false);
-        setUpDoService(false, true);
+        destination = setUpDestination(false);
+        setUpDoService(false, true, 500);
         destination.doService(request, response);
         setUpInMessage();
         Conduit backChannel =
@@ -236,9 +210,9 @@
     }
 
     public void testGetBackChannelSendDecoupled() throws Exception {
-        destination = setUpDestination(false, false);
+        destination = setUpDestination(false);
         replyTo = getEPR(NOWHERE + "response/foo");
-        setUpDoService(false, true, true);
+        setUpDoService(false, true, true, 202);
         destination.doService(request, response);
         setUpInMessage();
         
@@ -262,56 +236,56 @@
     
     public void testServerPolicyInServiceModel()
         throws Exception {
+        policy = new HTTPServerPolicy();
         address = getEPR("bar/foo");
         bus = new CXFBusImpl();
         
-        conduitInitiator = control.createMock(ConduitInitiator.class);
-        engine = control.createMock(ServerEngine.class);
+        conduitInitiator = EasyMock.createMock(ConduitInitiator.class);
         endpointInfo = new EndpointInfo();
         endpointInfo.setAddress(NOWHERE + "bar/foo");
-       
-        HTTPServerPolicy customPolicy = new HTTPServerPolicy();
-        endpointInfo.addExtensor(customPolicy);
-
-        control.replay();
+        endpointInfo.addExtensor(policy);  
+        endpointInfo.addExtensor(new SSLServerPolicy());    
         
-        JettyHTTPDestination dest = new JettyHTTPDestination(bus,
+        engine = EasyMock.createMock(ServerEngine.class);
+        EasyMock.replay();
+
+        AbstractHTTPDestination dest = new JettyHTTPDestination(bus,
                                                              conduitInitiator,
                                                              endpointInfo,
                                                              engine);
-        assertEquals(customPolicy, dest.getServer());
+        assertEquals(policy, dest.getServer());
     }
-        
+    
     private JettyHTTPDestination setUpDestination()
         throws Exception {
-        return setUpDestination(false, false);
+        return setUpDestination(false);
     };
     
-    private JettyHTTPDestination setUpDestination(boolean contextMatchOnStem, boolean mockedBus)
-        throws Exception {
+    private JettyHTTPDestination setUpDestination(boolean contextMatchOnStem)
+        throws Exception {        
+        
+        policy = new HTTPServerPolicy();
         address = getEPR("bar/foo");
-        if (!mockedBus) {
-            bus = new CXFBusImpl();
-        } else {
-            bus = control.createMock(Bus.class);
-        }
+        bus = new CXFBusImpl();
+        conduitInitiator = EasyMock.createMock(ConduitInitiator.class);
         
-        conduitInitiator = control.createMock(ConduitInitiator.class);
-        engine = control.createMock(ServerEngine.class);
+        engine = EasyMock.createMock(ServerEngine.class);        
         endpointInfo = new EndpointInfo();
         endpointInfo.setAddress(NOWHERE + "bar/foo");
-       
-        engine.addServant(EasyMock.eq(new URL(NOWHERE + "bar/foo")),
-                          EasyMock.isA(AbstractHttpHandler.class));
+        endpointInfo.addExtensor(policy);    
+        endpointInfo.getExtensor(SSLServerPolicy.class);
+        endpointInfo.addExtensor(new SSLServerPolicy());
         
-        control.replay();
+        engine.addServant(EasyMock.eq(new URL(NOWHERE + "bar/foo")),
+                          EasyMock.isA(AbstractHandler.class));
+        EasyMock.expectLastCall();
+        EasyMock.replay(engine);
         
         JettyHTTPDestination dest = new JettyHTTPDestination(bus,
                                                              conduitInitiator,
                                                              endpointInfo,
                                                              engine);
-        dest.retrieveEngine();
-        policy = dest.getServer();
+        dest.retrieveEngine();        
         observer = new MessageObserver() {
             public void onMessage(Message m) {
                 inMessage = m;
@@ -322,11 +296,10 @@
     }
     
     private void setUpRemoveServant() throws Exception {
-        control.verify();
-        control.reset();
+        EasyMock.reset(engine);
         engine.removeServant(EasyMock.eq(new URL(NOWHERE + "bar/foo")));
         EasyMock.expectLastCall();
-        control.replay();
+        EasyMock.replay(engine);
     }
     
     private void setUpDoService(boolean setRedirectURL) throws Exception {
@@ -338,67 +311,97 @@
         setUpDoService(setRedirectURL,
                        sendResponse,
                        false);
-    }        
+    }
+    
+    private void setUpDoService(boolean setRedirectURL,
+                                boolean sendResponse, int status) throws Exception {
+        String method = "POST";
+        String query = "?name";
+        setUpDoService(setRedirectURL, sendResponse, false, method, query, status);
+    }
+    
+    private void setUpDoService(boolean setRedirectURL,
+                                boolean sendResponse, boolean decoupled, int status) throws Exception {
+        String method = "POST";
+        String query = "?name";
+        setUpDoService(setRedirectURL, sendResponse, decoupled, method, query, status);
+    }
 
     private void setUpDoService(boolean setRedirectURL,
             boolean sendResponse,
             boolean decoupled) throws Exception {
         String method = "POST";
         String query = "?name";
-        setUpDoService(setRedirectURL, sendResponse, decoupled, method, query);
+        setUpDoService(setRedirectURL, sendResponse, decoupled, method, query, 200);
     }
-
+   
     private void setUpDoService(boolean setRedirectURL,
                                 boolean sendResponse,
                                 boolean decoupled,
                                 String method,
-                                String query) throws Exception {
-
-        control.verify();
-        control.reset();
-
-        is = EasyMock.createMock(InputStream.class);
-        os = EasyMock.createMock(OutputStream.class);
+                                String query,
+                                int status) throws Exception {
+        is = EasyMock.createMock(ServletInputStream.class);
+        os = EasyMock.createMock(ServletOutputStream.class);
+        request = EasyMock.createMock(Request.class);
+        response = EasyMock.createMock(Response.class);
+       
+        request.getMethod();
+        EasyMock.expectLastCall().andReturn(method);
         
-        // EasyMock does not seem able to properly mock calls to HttpRequest
-        // or HttpResponse - expectations set seem to be ignored.
-        // Hence we use hand-crafted sub-classes instead of mocks.
-        //
-        //request = EasyMock.createMock(HttpRequest.class);
-        //response = EasyMock.createMock(HttpResponse.class);
-        request = new TestHttpRequest(method, is, "bar/foo", query);
-        response = new TestHttpResponse(os);
+        if ("GET".equals(method)) {            
+            request.getQueryString();
+            EasyMock.expectLastCall().andReturn(query);            
+        } 
         
         if (setRedirectURL) {
             policy.setRedirectURL(NOWHERE + "foo/bar");
-            //response.sendRedirect(EasyMock.eq(NOWHERE + "foo/bar"));
-            //EasyMock.expectLastCall();
-            //response.commit();
-            //EasyMock.expectLastCall();
-            //request.setHandled(true);
-            //EasyMock.expectLastCall();
-        } else {
-            //request.getMethod();
-            //EasyMock.expectLastCall().andReturn("POST").times(2);
-            //request.getInputStream();
-            //EasyMock.expectLastCall().andReturn(is);
-            //request.getPath();
-            //EasyMock.expectLastCall().andReturn("bar/foo");
-            //request.getQuery();
-            //EasyMock.expectLastCall().andReturn(QUERY);
-            //request.setHandled(true);
-            //EasyMock.expectLastCall();  
-            //response.commit();
-            //EasyMock.expectLastCall();
-            //if (sendResponse) {
-            //    response.getOutputStream();
-            //    EasyMock.expectLastCall().andReturn(os);
-            //    response.commit();
-            //    EasyMock.expectLastCall();                
-            //}
-            if ("GET".equals(method) && "?wsdl".equals(query)) {
-                verifyGetWSDLQuery();
+            response.sendRedirect(EasyMock.eq(NOWHERE + "foo/bar"));
+            EasyMock.expectLastCall();
+            response.flushBuffer();
+            EasyMock.expectLastCall();
+            request.setHandled(true);
+            EasyMock.expectLastCall();
+        } else { // method is POST 
+            EasyMock.expect(request.getMethod()).andReturn(method);            
+            EasyMock.expect(request.getInputStream()).andReturn(is);
+            EasyMock.expect(request.getContextPath()).andReturn("/bar");
+            EasyMock.expect(request.getPathInfo()).andReturn("/foo");
+            EasyMock.expect(request.getQueryString()).andReturn(query);            
+            EasyMock.expect(request.getContentType()).andReturn("text/xml charset=utf8");
+            
+            HttpFields httpFields = new HttpFields();
+            httpFields.add("content-type", "text/xml");
+            httpFields.add("content-type", "charset=utf8");
+            httpFields.put(JettyHTTPDestinationTest.AUTH_HEADER, JettyHTTPDestinationTest.BASIC_AUTH);
+            
+            EasyMock.expect(request.getHeaderNames()).andReturn(httpFields.getFieldNames());
+            request.getHeaders("content-type");
+            EasyMock.expectLastCall().andReturn(httpFields.getValues("content-type"));
+            request.getHeaders(JettyHTTPDestinationTest.AUTH_HEADER);
+            EasyMock.expectLastCall().andReturn(httpFields.getValues(JettyHTTPDestinationTest.AUTH_HEADER));
+                                              
+            EasyMock.expect(request.getInputStream()).andReturn(is);
+            request.setHandled(true);
+            EasyMock.expectLastCall();  
+            response.flushBuffer();
+            EasyMock.expectLastCall();
+            if (sendResponse) {
+                response.setStatus(status);
+                EasyMock.expectLastCall();
+                response.setContentType("text/xml charset=utf8");
+                EasyMock.expectLastCall();
+                response.addHeader(EasyMock.isA(String.class), EasyMock.isA(String.class));
+                EasyMock.expectLastCall().anyTimes();
+                response.getOutputStream();
+                EasyMock.expectLastCall().andReturn(os);
+                response.getStatus();
+                EasyMock.expectLastCall().andReturn(status).anyTimes();
+                response.flushBuffer();
+                EasyMock.expectLastCall();                
             }
+            request.getAttribute("javax.net.ssl.session");
+            EasyMock.expectLastCall().andReturn(null);
         }
         
         if (decoupled) {
@@ -406,11 +409,15 @@
             conduitInitiator.getConduit(EasyMock.isA(EndpointInfo.class),
                                         EasyMock.eq(replyTo));
             EasyMock.expectLastCall().andReturn(decoupledBackChannel);
-            decoupledBackChannel.send(EasyMock.eq(outMessage));
+            decoupledBackChannel.setMessageObserver(EasyMock.isA(MessageObserver.class));
+            EasyMock.expectLastCall();
+            decoupledBackChannel.send(EasyMock.isA(Message.class));
             EasyMock.expectLastCall();
+            EasyMock.replay(conduitInitiator);
+            EasyMock.replay(decoupledBackChannel);
         }
-        
-        control.replay();
+        EasyMock.replay(response);
+        EasyMock.replay(request);
     }
     
     private void setUpInMessage() {
@@ -436,23 +443,6 @@
         challenges.add(CUSTOM_CHALLENGE);
         responseHeaders.put(CHALLENGE_HEADER, challenges);
     }
-    
-    private void verifyGetWSDLQuery() throws Exception {
-        wsdlQueryHandler = control.createMock(WSDLQueryHandler.class);
-        queryHandlerRegistry = control.createMock(QueryHandlerRegistry.class);
-        queryHandlerList = new ArrayList<QueryHandler>();
-        queryHandlerList.add(wsdlQueryHandler);
-        bus.getExtension(QueryHandlerRegistry.class);
-        EasyMock.expectLastCall().andReturn(queryHandlerRegistry);
-        queryHandlerRegistry.getHandlers();
-        EasyMock.expectLastCall().andReturn(queryHandlerList);
-        wsdlQueryHandler.isRecognizedQuery("http://localhost/bar/foo?wsdl", endpointInfo);
-        EasyMock.expectLastCall().andReturn(true);   
-        wsdlQueryHandler.getResponseContentType("http://localhost/bar/foo?wsdl");
-        EasyMock.expectLastCall().andReturn("text/xml");
-        wsdlQueryHandler.writeResponse("http://localhost/bar/foo?wsdl", endpointInfo, os);
-        EasyMock.expectLastCall().once();
-    }
 
     private void verifyDoService() throws Exception {
         assertNotNull("unexpected null message", inMessage);
@@ -467,38 +457,22 @@
                      "POST");
         assertEquals("unexpected path",
                      inMessage.get(Message.PATH_INFO),
-                     "bar/foo");
+                     "/bar/foo");
         assertEquals("unexpected query",
                      inMessage.get(Message.QUERY_STRING),
                      "?name");
-        verifyRequestHeaders();
-        
+        assertNull("unexpected query",
+                   inMessage.get(TLSSessionInfo.class));
+        verifyRequestHeaders();      
         
-        assertEquals("unexpected getMethod calls",
-                     1,
-                     request.getMethodCallCount());
-        assertEquals("unexpected getInputStream calls",
-                     1,
-                     request.getInputStreamCallCount());
-        assertEquals("unexpected getPath calls",
-                     1,
-                     request.getPathCallCount());
-        assertEquals("unexpected getQuery calls",
-                     1,
-                     request.getQueryCallCount());
-        assertEquals("unexpected setHandled calls",
-                     1,
-                     request.getHandledCallCount());
+       
     }
 
     private void verifyRequestHeaders() throws Exception {
         Map<String, List<String>> requestHeaders =
             CastUtils.cast((Map<?, ?>)inMessage.get(Message.PROTOCOL_HEADERS));
         assertNotNull("expected request headers",
-                      requestHeaders);
-        assertEquals("expected getFieldNames",
-                     1,
-                     request.getFieldNamesCallCount());
+                      requestHeaders);        
         List<String> values = requestHeaders.get("content-type");
         assertNotNull("expected field", values);
         assertEquals("unexpected values", 2, values.size());
@@ -525,10 +499,10 @@
             CastUtils.cast((Map<?, ?>)outMsg.get(Message.PROTOCOL_HEADERS));
         assertNotNull("expected response headers",
                       responseHeaders);
-        assertEquals("expected addField",
+        /*assertEquals("expected addField",
                      3,
                      response.getAddFieldCallCount());
-        Enumeration e = response.getFieldValues(CHALLENGE_HEADER);
+        Enumeration e = response.getHeaders(CHALLENGE_HEADER);
         List<String> challenges = new ArrayList<String>();
         while (e.hasMoreElements()) {
             challenges.add((String)e.nextElement());
@@ -538,7 +512,7 @@
         assertTrue("expected challenge",
                    challenges.contains(DIGEST_CHALLENGE));
         assertTrue("expected challenge",
-                   challenges.contains(CUSTOM_CHALLENGE));
+                   challenges.contains(CUSTOM_CHALLENGE));*/
     }
     
     private void verifyBackChannelSend(Conduit backChannel,
@@ -558,10 +532,7 @@
         OutputStream responseOS = outMsg.getContent(OutputStream.class);
         assertNotNull("expected output stream", responseOS);
         assertTrue("unexpected output stream type",
-                   responseOS instanceof AbstractCachedOutputStream);
-        assertEquals("expected commit",
-                     1,
-                     response.getCommitCallCount());
+                   responseOS instanceof AbstractCachedOutputStream);        
         
         outMsg.put(Message.RESPONSE_CODE, status);          
         responseOS.write(PAYLOAD.getBytes());
@@ -571,44 +542,28 @@
         OutputStream underlyingOS =
             ((AbstractCachedOutputStream)responseOS).getOut();
         assertTrue("unexpected underlying output stream type",
-                   underlyingOS instanceof ByteArrayOutputStream);
-        assertEquals("expected getOutputStream",
-                     0,
-                     response.getOutputStreamCallCount());
+                   underlyingOS instanceof ByteArrayOutputStream);       
         outMsg.getExchange().setOneWay(oneway);
         responseOS.flush();
-        assertEquals("expected setStatus",
-                     1,
-                     response.getStatusCallCount());
+      
         assertEquals("unexpected status",
                      status,
                      response.getStatus());
-        if (status == 500) {
-            assertEquals("unexpected status message",
-                         "Internal Server Error",
-                         response.getReason());
-        }
+        
         verifyResponseHeaders(outMsg);
-        assertEquals("expected getOutputStream",
-                     1,
-                     response.getOutputStreamCallCount());
+        
         underlyingOS = ((AbstractCachedOutputStream)responseOS).getOut();
         assertFalse("unexpected underlying output stream type: "
                     + underlyingOS.getClass(),
                     underlyingOS instanceof ByteArrayOutputStream);
-        assertEquals("expected commit",
-                     oneway ? 2 : 1,
-                     response.getCommitCallCount());
+       
         if (oneway) {
             assertNull("unexpected HTTP response",
                        outMsg.get(JettyHTTPDestination.HTTP_RESPONSE));
         } else {
             assertNotNull("expected HTTP response",
                            outMsg.get(JettyHTTPDestination.HTTP_RESPONSE));
-            responseOS.close();
-            assertEquals("expected commit",
-                         2,
-                         response.getCommitCallCount());
+            responseOS.close();            
         }
     }
     

Modified: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/https/HttpsURLConnectionFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/https/HttpsURLConnectionFactoryTest.java?view=diff&rev=518627&r1=518626&r2=518627
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/https/HttpsURLConnectionFactoryTest.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/https/HttpsURLConnectionFactoryTest.java Thu Mar 15 06:44:47 2007
@@ -27,8 +27,6 @@
 
 import junit.framework.TestCase;
 
-import org.apache.cxf.configuration.security.FiltersType;
-import org.apache.cxf.configuration.security.ObjectFactory;
 import org.apache.cxf.configuration.security.SSLClientPolicy;
 
 
@@ -37,11 +35,6 @@
     protected static final String DROP_BACK_SRC_DIR = 
         "../../../../../../../"
         + "src/test/java/org/apache/cxf/transport/https/";
-    
-    private static final String[] EXPORT_CIPHERS =
-    {"SSL_RSA_WITH_NULL_MD5", "SSL_RSA_EXPORT_WITH_RC4_40_MD5", "SSL_RSA_WITH_DES_CBC_SHA"};
-    private static final String[] NON_EXPORT_CIPHERS =
-    {"SSL_RSA_WITH_RC4_128_MD5", "SSL_RSA_WITH_3DES_EDE_CBC_SHA"};
 
     private TestHttpsURLConnection connection;
     
@@ -131,7 +124,7 @@
     */
 
     public void testSetAllData() throws Exception {
-        
+
         String keyStoreStr = getPath("resources/defaultkeystore");
         SSLClientPolicy sslClientPolicy = new SSLClientPolicy();
         sslClientPolicy.setKeystore(keyStoreStr);
@@ -148,13 +141,7 @@
         sslClientPolicy.setCertValidator("Anything");
         sslClientPolicy.setProxyHost("Anything");
         sslClientPolicy.setProxyPort(new Long(1234));
-        for (int i = 0; i < EXPORT_CIPHERS.length; i++) {
-            sslClientPolicy.getCiphersuites().add(EXPORT_CIPHERS[i]);
-        }
-        for (int i = 0; i < NON_EXPORT_CIPHERS.length; i++) {
-            sslClientPolicy.getCiphersuites().add(NON_EXPORT_CIPHERS[i]);
-        }
-        
+
         String trustStoreStr = getPath("resources/defaulttruststore");
         sslClientPolicy.setTrustStore(trustStoreStr);
         TestLogHandler handler = new TestLogHandler();
@@ -195,16 +182,8 @@
                                     + "algorithm has not been set in configuration "
                                     + "so the default value PKIX will be used."));
 
-        assertFalse("Ciphersuites config not picked up", handler
-            .checkLogContainsString("The cipher suites have not been configured, " 
-                                    + "default values will be used."));        
-        assertFalse("Unexpected included ciphersuite filter",
-                   handler.checkLogContainsString("suite is included by the filter."));
-        assertFalse("Unexpected excluded ciphersuite fuilter",
-                   handler.checkLogContainsString("suite is excluded by the filter."));
-        assertFalse("Unexpected ciphersuite filtering",
-                   handler.checkLogContainsString("The enabled cipher suites have been filtered down to"));
-        
+        assertTrue("Ciphersuites is being being read from somewhere unknown", handler
+            .checkLogContainsString("The cipher suite has not been set, default values " + "will be used."));
         assertTrue("Truststore type not being read", handler
             .checkLogContainsString("The key store type has been set in " + "configuration to JKS"));
 
@@ -218,100 +197,6 @@
             .checkLogContainsString("Unsupported SSLClientPolicy property : MaxChainLength"));
         assertTrue("CertValidator caching set but no warning about not supported", handler
             .checkLogContainsString("Unsupported SSLClientPolicy property : CertValidator"));
-    }
-    
-    public void testDefaultedCipherSuiteFilters() throws Exception {
-        
-        String keyStoreStr = getPath("resources/defaultkeystore");
-        SSLClientPolicy sslClientPolicy = new SSLClientPolicy();
-        sslClientPolicy.setKeystore(keyStoreStr);
-        sslClientPolicy.setKeystoreType("JKS");
-
-        sslClientPolicy.setKeyPassword("defaultkeypass");
-        sslClientPolicy.setKeystorePassword("defaultkeypass");
-        sslClientPolicy.setTrustStoreType("JKS");
-        sslClientPolicy.setSecureSocketProtocol("TLSv1");
-
-        String trustStoreStr = getPath("resources/defaulttruststore");
-        sslClientPolicy.setTrustStore(trustStoreStr);
-        TestLogHandler handler = new TestLogHandler();
-        HttpsURLConnectionFactory factory = createFactory(sslClientPolicy,
-                                                          "https://dummyurl",
-                                                          handler);
-
-        factory.decorate(connection);
-
-        assertTrue("Ciphersuites is being being read from somewhere unknown", 
-                   handler.checkLogContainsString("The cipher suites have not been configured," 
-                                                  + " falling back to cipher suite filters."));
-        assertTrue("Expected defaulted ciphersuite filters", 
-                   handler.checkLogContainsString("The cipher suite filters have not been configured,"
-                                                  + " falling back to default filters."));
-        for (int i = 0; i < EXPORT_CIPHERS.length; i++) {
-            assertTrue("Expected included ciphersuite not included: " + EXPORT_CIPHERS[i],
-                       handler.checkLogContainsString(EXPORT_CIPHERS[i]
-                                                      + " cipher suite is included by the filter."));
-        }
-        for (int i = 0; i < NON_EXPORT_CIPHERS.length; i++) {
-            assertTrue("Expected excluded ciphersuite not included: " + NON_EXPORT_CIPHERS[i],
-                       handler.checkLogContainsString(NON_EXPORT_CIPHERS[i]
-                                                      + " cipher suite is excluded by the filter."));
-        }
-        assertTrue("Expected excluded ciphersuite not included",
-                   handler.checkLogContainsString("The enabled cipher suites have been filtered down to")); 
-        
-    }
-    
-    public void testNonDefaultedCipherSuiteFilters() throws Exception {
-        
-        String keyStoreStr = getPath("resources/defaultkeystore");
-        SSLClientPolicy sslClientPolicy = new SSLClientPolicy();
-        sslClientPolicy.setKeystore(keyStoreStr);
-        sslClientPolicy.setKeystoreType("JKS");
-
-        sslClientPolicy.setKeyPassword("defaultkeypass");
-        sslClientPolicy.setKeystorePassword("defaultkeypass");
-        sslClientPolicy.setTrustStoreType("JKS");
-        sslClientPolicy.setSecureSocketProtocol("TLSv1");
-
-        // reverse default sense of include/exlcude
-        FiltersType filters = new ObjectFactory().createFiltersType();
-        for (int i = 0; i < NON_EXPORT_CIPHERS.length; i++) {
-            filters.getInclude().add(NON_EXPORT_CIPHERS[i]);
-        }
-        for (int i = 0; i < EXPORT_CIPHERS.length; i++) {
-            filters.getExclude().add(EXPORT_CIPHERS[i]);
-        }
-        sslClientPolicy.setCiphersuiteFilters(filters);
-        
-        String trustStoreStr = getPath("resources/defaulttruststore");
-        sslClientPolicy.setTrustStore(trustStoreStr);
-        TestLogHandler handler = new TestLogHandler();
-        HttpsURLConnectionFactory factory = createFactory(sslClientPolicy,
-                                                          "https://dummyurl",
-                                                          handler);
-
-        factory.decorate(connection);
-
-        assertTrue("Ciphersuites is being being read from somewhere unknown",
-                   handler.checkLogContainsString("The cipher suites have not been configured," 
-                                                  + " falling back to cipher suite filters."));
-        assertFalse("Unexpected defaulted ciphersuite filters", 
-                     handler.checkLogContainsString("The cipher suite filters have not been configured,"
-                                                    + " falling back to default filters."));
-        for (int i = 0; i < NON_EXPORT_CIPHERS.length; i++) {
-            assertTrue("Expected included ciphersuite not included: " + NON_EXPORT_CIPHERS[i],
-                       handler.checkLogContainsString(NON_EXPORT_CIPHERS[i]
-                                                      + " cipher suite is included by the filter."));
-        }
-        for (int i = 0; i < EXPORT_CIPHERS.length; i++) {
-            assertTrue("Expected excluded ciphersuite not included: " + EXPORT_CIPHERS[i],
-                       handler.checkLogContainsString(EXPORT_CIPHERS[i]
-                                                      + " cipher suite is excluded by the filter."));
-        }
-        assertTrue("Expected excluded ciphersuite not included",
-                   handler.checkLogContainsString("The enabled cipher suites have been filtered down to")); 
-        
     }
 
     public void testAllValidDataJKS() throws Exception {

Modified: incubator/cxf/trunk/systests/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/pom.xml?view=diff&rev=518627&r1=518626&r2=518627
==============================================================================
--- incubator/cxf/trunk/systests/pom.xml (original)
+++ incubator/cxf/trunk/systests/pom.xml Thu Mar 15 06:44:47 2007
@@ -102,7 +102,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-rt-transports-http2</artifactId>
+            <artifactId>cxf-rt-transports-http</artifactId>
             <version>${project.version}</version>
         </dependency>
         <dependency>