servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tt...@apache.org
Subject svn commit: r533074 [3/4] - in /incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src: main/java/org/apache/servicemix/http/ main/java/org/apache/servicemix/http/endpoints/ main/java/org/apache/servicemix/http/jetty/ main/java/or...
Date Fri, 27 Apr 2007 12:23:23 GMT
Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java?view=diff&rev=533074&r1=533073&r2=533074
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java (original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java Fri Apr 27 05:23:20 2007
@@ -34,13 +34,13 @@
 import javax.jbi.messaging.NormalizedMessage;
 import javax.servlet.http.HttpServletRequest;
 
+import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap;
 import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
 import org.apache.commons.httpclient.Header;
 import org.apache.commons.httpclient.HostConfiguration;
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpHost;
 import org.apache.commons.httpclient.HttpMethod;
-import org.apache.commons.httpclient.HttpMethodRetryHandler;
 import org.apache.commons.httpclient.HttpStatus;
 import org.apache.commons.httpclient.URI;
 import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
@@ -54,7 +54,6 @@
 import org.apache.servicemix.JbiConstants;
 import org.apache.servicemix.common.ExchangeProcessor;
 import org.apache.servicemix.http.HttpComponent;
-import org.apache.servicemix.http.HttpConfiguration;
 import org.apache.servicemix.http.HttpEndpoint;
 import org.apache.servicemix.soap.Context;
 import org.apache.servicemix.soap.SoapHelper;
@@ -62,25 +61,22 @@
 import org.apache.servicemix.soap.marshalers.SoapReader;
 import org.apache.servicemix.soap.marshalers.SoapWriter;
 
-import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap;
-
 /**
  * 
  * @author Guillaume Nodet
  * @version $Revision: 370186 $
  * @since 3.0
  */
-public class ProviderProcessor implements ExchangeProcessor {
+public class ProviderProcessor extends AbstractProcessor implements ExchangeProcessor {
 
     private static Log log = LogFactory.getLog(ProviderProcessor.class);
 
-    protected HttpEndpoint endpoint;
     protected SoapHelper soapHelper;
     protected DeliveryChannel channel;
     private Map methods;
     
     public ProviderProcessor(HttpEndpoint endpoint) {
-        this.endpoint = endpoint;
+        super(endpoint);
         this.soapHelper = new SoapHelper(endpoint);
         this.methods = new ConcurrentHashMap();
     }
@@ -101,8 +97,7 @@
     }
 
     public void process(MessageExchange exchange) throws Exception {
-        if (exchange.getStatus() == ExchangeStatus.DONE || 
-            exchange.getStatus() == ExchangeStatus.ERROR) {
+        if (exchange.getStatus() == ExchangeStatus.DONE || exchange.getStatus() == ExchangeStatus.ERROR) {
             PostMethod method = (PostMethod) methods.remove(exchange.getExchangeId());
             if (method != null) {
                 method.releaseConnection();
@@ -130,28 +125,21 @@
         Context context = soapHelper.createContext(soapMessage);
         soapHelper.onSend(context);
         SoapWriter writer = soapHelper.getSoapMarshaler().createWriter(soapMessage);
-        Map headers = (Map) nm.getProperty(JbiConstants.PROTOCOL_HEADERS);
-        if (headers != null) {
-            for (Iterator it = headers.keySet().iterator(); it.hasNext();) {
-                String name = (String) it.next();
-                String value = (String) headers.get(name);
-                method.addRequestHeader(name, value);
-            }
-        }
+        copyHeaderInformation(nm, method);
         RequestEntity entity = writeMessage(writer);
         // remove content-type header that may have been part of the in message
-        method.removeRequestHeader(Constants.HEADER_CONTENT_TYPE);
-        method.addRequestHeader(Constants.HEADER_CONTENT_TYPE, entity.getContentType());
+        method.removeRequestHeader(HEADER_CONTENT_TYPE);
+        method.addRequestHeader(HEADER_CONTENT_TYPE, entity.getContentType());
         if (entity.getContentLength() < 0) {
-            method.removeRequestHeader(Constants.HEADER_CONTENT_LENGTH);
+            method.removeRequestHeader(HEADER_CONTENT_LENGTH);
         } else {
-            method.setRequestHeader(Constants.HEADER_CONTENT_LENGTH, Long.toString(entity.getContentLength()));
+            method.setRequestHeader(HEADER_CONTENT_LENGTH, Long.toString(entity.getContentLength()));
         }
-        if (endpoint.isSoap() && method.getRequestHeader(Constants.HEADER_SOAP_ACTION) == null) {
+        if (endpoint.isSoap() && method.getRequestHeader(HEADER_SOAP_ACTION) == null) {
             if (endpoint.getSoapAction() != null) {
-                method.setRequestHeader(Constants.HEADER_SOAP_ACTION, endpoint.getSoapAction());
+                method.setRequestHeader(HEADER_SOAP_ACTION, endpoint.getSoapAction());
             } else {
-                method.setRequestHeader(Constants.HEADER_SOAP_ACTION, "\"\"");
+                method.setRequestHeader(HEADER_SOAP_ACTION, "\"\"");
             }
         }
         method.setRequestEntity(entity);
@@ -162,14 +150,14 @@
             method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(retries, true));
             // Set authentication
             if (endpoint.getBasicAuthentication() != null) {
-                endpoint.getBasicAuthentication().applyCredentials( getClient() );
+                endpoint.getBasicAuthentication().applyCredentials(getClient());
             }
             // Execute the HTTP method
             int response = getClient().executeMethod(getHostConfiguration(locationURI), method);
             if (response != HttpStatus.SC_OK && response != HttpStatus.SC_ACCEPTED) {
-                if (exchange instanceof InOnly == false) {
+                if (!(exchange instanceof InOnly)) {
                     SoapReader reader = soapHelper.getSoapMarshaler().createReader();
-                    Header contentType = method.getResponseHeader(Constants.HEADER_CONTENT_TYPE);
+                    Header contentType = method.getResponseHeader(HEADER_CONTENT_TYPE);
                     soapMessage = reader.read(method.getResponseBodyAsStream(), 
                                               contentType != null ? contentType.getValue() : null);
                     context.setFaultMessage(soapMessage);
@@ -191,45 +179,9 @@
                 }
             }
             if (exchange instanceof InOut) {
-                NormalizedMessage msg = exchange.createMessage();
-                SoapReader reader = soapHelper.getSoapMarshaler().createReader();
-                Header contentType = method.getResponseHeader(Constants.HEADER_CONTENT_TYPE);
-                soapMessage = reader.read(method.getResponseBodyAsStream(), 
-                                          contentType != null ? contentType.getValue() : null);
-                context.setOutMessage(soapMessage);
-                soapHelper.onAnswer(context);
-                msg.setProperty(JbiConstants.PROTOCOL_HEADERS, getHeaders(method));
-                soapHelper.getJBIMarshaler().toNMS(msg, soapMessage);
-                ((InOut) exchange).setOutMessage(msg);
-                if (txSync) {
-                    channel.sendSync(exchange);
-                } else {
-                    methods.put(exchange.getExchangeId(), method);
-                    channel.send(exchange);
-                    close = false;
-                }
+                close = processInOut(exchange, method, context, txSync, close);
             } else if (exchange instanceof InOptionalOut) {
-                if (method.getResponseContentLength() == 0) {
-                    exchange.setStatus(ExchangeStatus.DONE);
-                    channel.send(exchange);
-                } else {
-                    NormalizedMessage msg = exchange.createMessage();
-                    SoapReader reader = soapHelper.getSoapMarshaler().createReader();
-                    soapMessage = reader.read(method.getResponseBodyAsStream(), 
-                                              method.getResponseHeader(Constants.HEADER_CONTENT_TYPE).getValue());
-                    context.setOutMessage(soapMessage);
-                    soapHelper.onAnswer(context);
-                    msg.setProperty(JbiConstants.PROTOCOL_HEADERS, getHeaders(method));
-                    soapHelper.getJBIMarshaler().toNMS(msg, soapMessage);
-                    ((InOptionalOut) exchange).setOutMessage(msg);
-                    if (txSync) {
-                        channel.sendSync(exchange);
-                    } else {
-                        methods.put(exchange.getExchangeId(), method);
-                        channel.send(exchange);
-                        close = false;
-                    }
-                }
+                close = processInOptionalOut(method, exchange, context, txSync, close);
             } else {
                 exchange.setStatus(ExchangeStatus.DONE);
                 channel.send(exchange);
@@ -241,6 +193,64 @@
         }
     }
 
+    private void copyHeaderInformation(NormalizedMessage nm, PostMethod method) {
+        Map headers = (Map) nm.getProperty(JbiConstants.PROTOCOL_HEADERS);
+        if (headers != null) {
+            for (Iterator it = headers.keySet().iterator(); it.hasNext();) {
+                String name = (String) it.next();
+                String value = (String) headers.get(name);
+                method.addRequestHeader(name, value);
+            }
+        }
+    }
+
+    private boolean processInOptionalOut(PostMethod method, MessageExchange exchange, Context context, boolean txSync,
+                                         boolean close) throws Exception {
+        if (method.getResponseContentLength() == 0) {
+            exchange.setStatus(ExchangeStatus.DONE);
+            channel.send(exchange);
+        } else {
+            NormalizedMessage msg = exchange.createMessage();
+            SoapReader reader = soapHelper.getSoapMarshaler().createReader();
+            SoapMessage soapMessage = reader.read(method.getResponseBodyAsStream(),
+                                      method.getResponseHeader(HEADER_CONTENT_TYPE).getValue());
+            context.setOutMessage(soapMessage);
+            soapHelper.onAnswer(context);
+            msg.setProperty(JbiConstants.PROTOCOL_HEADERS, getHeaders(method));
+            soapHelper.getJBIMarshaler().toNMS(msg, soapMessage);
+            ((InOptionalOut) exchange).setOutMessage(msg);
+            if (txSync) {
+                channel.sendSync(exchange);
+            } else {
+                methods.put(exchange.getExchangeId(), method);
+                channel.send(exchange);
+                close = false;
+            }
+        }
+        return close;
+    }
+
+    private boolean processInOut(MessageExchange exchange, PostMethod method, Context context, boolean txSync,
+                                 boolean close) throws Exception {
+        NormalizedMessage msg = exchange.createMessage();
+        SoapReader reader = soapHelper.getSoapMarshaler().createReader();
+        Header contentType = method.getResponseHeader(HEADER_CONTENT_TYPE);
+        SoapMessage soapMessage = reader.read(method.getResponseBodyAsStream(), contentType != null ? contentType.getValue() : null);
+        context.setOutMessage(soapMessage);
+        soapHelper.onAnswer(context);
+        msg.setProperty(JbiConstants.PROTOCOL_HEADERS, getHeaders(method));
+        soapHelper.getJBIMarshaler().toNMS(msg, soapMessage);
+        ((InOut) exchange).setOutMessage(msg);
+        if (txSync) {
+            channel.sendSync(exchange);
+        } else {
+            methods.put(exchange.getExchangeId(), method);
+            channel.send(exchange);
+            close = false;
+        }
+        return close;
+    }
+
     private HostConfiguration getHostConfiguration(String locationURI) throws Exception {
         HostConfiguration host;
         URI uri = new URI(locationURI, false);
@@ -272,11 +282,6 @@
     public void start() throws Exception {
         channel = endpoint.getServiceUnit().getComponent().getComponentContext().getDeliveryChannel();
     }
-    
-    protected HttpConfiguration getConfiguration() {
-        HttpComponent comp = (HttpComponent) endpoint.getServiceUnit().getComponent();
-        return comp.getConfiguration();
-    }
 
     public void stop() throws Exception {
     }
@@ -300,7 +305,7 @@
         }
         return headers;
     }
-	
+
     protected RequestEntity writeMessage(SoapWriter writer) throws Exception {
         if (getConfiguration().isStreamingEnabled()) {
             return new StreamingRequestEntity(writer);

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/tools/PortTypeDecorator.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/tools/PortTypeDecorator.java?view=diff&rev=533074&r1=533073&r2=533074
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/tools/PortTypeDecorator.java (original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/main/java/org/apache/servicemix/http/tools/PortTypeDecorator.java Fri Apr 27 05:23:20 2007
@@ -16,8 +16,6 @@
  */
 package org.apache.servicemix.http.tools;
 
-import java.io.File;
-import java.io.FileOutputStream;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -48,15 +46,17 @@
 import com.ibm.wsdl.extensions.soap.SOAPFaultImpl;
 import com.ibm.wsdl.extensions.soap.SOAPOperationImpl;
 
-public class PortTypeDecorator {
+public final class PortTypeDecorator {
 
-    public static Definition createImportDef(Definition definition,
-                                             String targetNamespace,
-                                             String importUri) throws Exception {
+    private PortTypeDecorator() {
+    }
+    
+    public static Definition createImportDef(Definition definition, String targetNamespace, String importUri)
+        throws Exception {
         // Create definition
         Definition def = WSDLFactory.newInstance().newDefinition();
         def.setTargetNamespace(targetNamespace);
-        
+
         // Add namespaces
         Map namespaces = definition.getNamespaces();
         for (Iterator iter = namespaces.keySet().iterator(); iter.hasNext();) {
@@ -66,34 +66,25 @@
         }
         def.addNamespace("tns", targetNamespace);
         def.addNamespace("tnspt", definition.getTargetNamespace());
-        
+
         // Create import
         Import imp = def.createImport();
         imp.setNamespaceURI(definition.getTargetNamespace());
         imp.setLocationURI(importUri);
         imp.setDefinition(definition);
         def.addImport(imp);
-        
+
         return def;
     }
-    
-    public static void decorate(Definition def,
-                                PortType portType,
-                                String locationUri) throws Exception {
-        decorate(def,
-                 portType,
-                 locationUri,
-                 portType.getQName().getLocalPart() + "Binding",
-                 portType.getQName().getLocalPart() + "Service",
-                 "JBI");
+
+    public static void decorate(Definition def, PortType portType, String locationUri) throws Exception {
+        decorate(def, portType, locationUri, portType.getQName().getLocalPart() + "Binding", portType.getQName()
+                        .getLocalPart()
+                        + "Service", "JBI");
     }
-    
-    public static void decorate(Definition def,
-                                PortType portType,
-                                String locationUri,
-                                String bindingName,
-                                String serviceName,
-                                String portName) throws Exception {
+
+    public static void decorate(Definition def, PortType portType, String locationUri, String bindingName,
+                    String serviceName, String portName) throws Exception {
         def.addNamespace("wsdlsoap", "http://schemas.xmlsoap.org/wsdl/soap/");
         // Create binding
         Binding binding = def.createBinding();
@@ -155,14 +146,12 @@
         service.addPort(port);
         def.addService(service);
     }
-    
-    public static Definition decorate(Definition definition,
-                                      String importUri,
-                                      String targetNamespace,
-                                      String locationUri) throws Exception {
+
+    public static Definition decorate(Definition definition, String importUri, String targetNamespace,
+                    String locationUri) throws Exception {
         // Create definition
         Definition def = createImportDef(definition, targetNamespace, importUri);
-        
+
         // Iterator through port types
         for (Iterator it = definition.getPortTypes().values().iterator(); it.hasNext();) {
             PortType portType = (PortType) it.next();
@@ -170,5 +159,5 @@
         }
         return def;
     }
-    
+
 }

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/ConsumerEndpointTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/ConsumerEndpointTest.java?view=diff&rev=533074&r1=533073&r2=533074
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/ConsumerEndpointTest.java (original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/ConsumerEndpointTest.java Fri Apr 27 05:23:20 2007
@@ -16,43 +16,32 @@
  */
 package org.apache.servicemix.http;
 
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.activation.DataHandler;
-import javax.activation.DataSource;
-import javax.jbi.messaging.ExchangeStatus;
-import javax.jbi.messaging.InOut;
 import javax.jbi.messaging.MessageExchange;
 import javax.jbi.messaging.MessagingException;
 import javax.jbi.messaging.NormalizedMessage;
 import javax.xml.namespace.QName;
 import javax.xml.transform.TransformerException;
 
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.traversal.NodeIterator;
+
 import junit.framework.TestCase;
 
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.methods.PostMethod;
 import org.apache.commons.httpclient.methods.StringRequestEntity;
-import org.apache.servicemix.client.DefaultServiceMixClient;
-import org.apache.servicemix.client.Destination;
 import org.apache.servicemix.components.http.InvalidStatusResponseException;
 import org.apache.servicemix.components.util.EchoComponent;
 import org.apache.servicemix.components.util.MockServiceComponent;
 import org.apache.servicemix.components.util.TransformComponentSupport;
-import org.apache.servicemix.http.endpoints.DefaultHttpConsumerMarshaler;
 import org.apache.servicemix.http.endpoints.HttpConsumerEndpoint;
 import org.apache.servicemix.http.endpoints.HttpSoapConsumerEndpoint;
 import org.apache.servicemix.jbi.container.JBIContainer;
 import org.apache.servicemix.jbi.jaxp.SourceTransformer;
 import org.apache.servicemix.jbi.jaxp.StringSource;
 import org.apache.servicemix.jbi.messaging.MessageExchangeSupport;
-import org.apache.servicemix.jbi.util.ByteArrayDataSource;
 import org.apache.servicemix.jbi.util.DOMUtil;
-import org.apache.servicemix.jbi.util.FileUtil;
 import org.apache.servicemix.soap.bindings.soap.Soap11;
 import org.apache.servicemix.soap.bindings.soap.Soap12;
 import org.apache.servicemix.soap.bindings.soap.SoapConstants;
@@ -61,17 +50,12 @@
 import org.apache.servicemix.tck.ReceiverComponent;
 import org.apache.xpath.CachedXPathAPI;
 import org.springframework.core.io.ClassPathResource;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.traversal.NodeIterator;
 
 public class ConsumerEndpointTest extends TestCase {
 
     protected JBIContainer container;
     protected SourceTransformer transformer = new SourceTransformer();
-    
+
     protected void setUp() throws Exception {
         container = new JBIContainer();
         container.setUseMBeanServer(false);
@@ -79,13 +63,13 @@
         container.setEmbedded(true);
         container.init();
     }
-    
+
     protected void tearDown() throws Exception {
         if (container != null) {
             container.shutDown();
         }
     }
-    
+
     protected String textValueOfXPath(Node node, String xpath) throws TransformerException {
         CachedXPathAPI cachedXPathAPI = new CachedXPathAPI();
         NodeIterator iterator = cachedXPathAPI.selectNodeIterator(node, xpath);
@@ -95,10 +79,8 @@
             if (element == null) {
                 return "";
             }
-            String text = DOMUtil.getElementText(element);
-            return text;
-        }
-        else if (root != null) {
+            return DOMUtil.getElementText(element);
+        } else if (root != null) {
             return root.getNodeValue();
         } else {
             return null;
@@ -113,15 +95,15 @@
         ep.setTargetService(new QName("urn:test", "recv"));
         ep.setLocationURI("http://localhost:8192/ep1/");
         ep.setDefaultMep(MessageExchangeSupport.IN_ONLY);
-        http.setEndpoints(new HttpEndpointType[] { ep });
+        http.setEndpoints(new HttpEndpointType[] {ep});
         container.activateComponent(http, "http");
-        
+
         ReceiverComponent recv = new ReceiverComponent();
         recv.setService(new QName("urn:test", "recv"));
         container.activateComponent(recv, "recv");
 
         container.start();
-        
+
         PostMethod post = new PostMethod("http://localhost:8192/ep1/");
         post.setRequestEntity(new StringRequestEntity("<hello>world</hello>"));
         new HttpClient().executeMethod(post);
@@ -131,7 +113,7 @@
         if (post.getStatusCode() != 202) {
             throw new InvalidStatusResponseException(post.getStatusCode());
         }
-        
+
         recv.getMessageList().assertMessagesReceived(1);
     }
 
@@ -142,16 +124,16 @@
         ep.setEndpoint("ep");
         ep.setTargetService(new QName("urn:test", "echo"));
         ep.setLocationURI("http://localhost:8192/ep1/");
-        http.setEndpoints(new HttpEndpointType[] { ep });
+        http.setEndpoints(new HttpEndpointType[] {ep});
         container.activateComponent(http, "http");
-        
+
         EchoComponent echo = new EchoComponent();
         echo.setService(new QName("urn:test", "echo"));
         echo.setEndpoint("endpoint");
         container.activateComponent(echo, "echo");
 
         container.start();
-        
+
         PostMethod post = new PostMethod("http://localhost:8192/ep1/");
         post.setRequestEntity(new StringRequestEntity("<hello>world</hello>"));
         new HttpClient().executeMethod(post);
@@ -164,7 +146,7 @@
             throw new InvalidStatusResponseException(post.getStatusCode());
         }
     }
-    
+
     protected void initSoapEndpoints(boolean useJbiWrapper) throws Exception {
         HttpComponent http = new HttpComponent();
         HttpSoapConsumerEndpoint ep1 = new HttpSoapConsumerEndpoint();
@@ -183,14 +165,14 @@
         ep2.setWsdl(new ClassPathResource("/org/apache/servicemix/http/HelloWorld-DOC.wsdl"));
         ep2.setValidateWsdl(false); // TODO: Soap 1.2 not handled yet
         ep2.setUseJbiWrapper(useJbiWrapper);
-        http.setEndpoints(new HttpEndpointType[] { ep1, ep2 });
+        http.setEndpoints(new HttpEndpointType[] {ep1, ep2});
         container.activateComponent(http, "http");
         container.start();
     }
-    
+
     public void testHttpSoap11FaultOnEnvelope() throws Exception {
         initSoapEndpoints(true);
-        
+
         PostMethod post = new PostMethod("http://localhost:8192/ep1/");
         post.setRequestEntity(new StringRequestEntity("<hello>world</hello>"));
         new HttpClient().executeMethod(post);
@@ -210,7 +192,7 @@
 
     public void testHttpSoap12FaultOnEnvelope() throws Exception {
         initSoapEndpoints(true);
-        
+
         PostMethod post = new PostMethod("http://localhost:8192/ep2/");
         post.setRequestEntity(new StringRequestEntity("<hello>world</hello>"));
         new HttpClient().executeMethod(post);
@@ -235,9 +217,11 @@
 
     public void testHttpSoap11UnkownOp() throws Exception {
         initSoapEndpoints(true);
-        
+
         PostMethod post = new PostMethod("http://localhost:8192/ep1/");
-        post.setRequestEntity(new StringRequestEntity("<s:Envelope xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'><s:Body><hello>world</hello></s:Body></s:Envelope>"));
+        post.setRequestEntity(new StringRequestEntity(
+                        "<s:Envelope xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'>"
+                                        + "<s:Body><hello>world</hello></s:Body>" + "</s:Envelope>"));
         new HttpClient().executeMethod(post);
         String res = post.getResponseBodyAsString();
         System.err.println(res);
@@ -254,49 +238,33 @@
     }
 
     /*
-    public void testHttpSoapAttachments() throws Exception {
-        initSoapEndpoints(true);
-        
-        HttpComponent http = new HttpComponent();
-        HttpEndpoint ep0 = new HttpEndpoint();
-        ep0.setService(new QName("urn:test", "s0"));
-        ep0.setEndpoint("ep0");
-        ep0.setLocationURI("http://localhost:8192/ep1/");
-        ep0.setRoleAsString("provider");
-        ep0.setSoapVersion("1.1");
-        ep0.setSoap(true);
-        http.setEndpoints(new HttpEndpoint[] { ep0 });
-        container.activateComponent(http, "http2");
-        
-        MockServiceComponent echo = new MockServiceComponent();
-        echo.setService(new QName("urn:test", "echo"));
-        echo.setEndpoint("endpoint");
-        echo.setResponseXml("<jbi:message xmlns:jbi='http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper'><jbi:part><HelloResponse xmlns='uri:HelloWorld' /></jbi:part></jbi:message>");
-        container.activateComponent(echo, "echo");
-
-        DefaultServiceMixClient client = new DefaultServiceMixClient(container);
-        Destination d = client.createDestination("service:urn:test:s0");
-        InOut me = d.createInOutExchange();
-        me.getInMessage().setContent(new StringSource("<HelloRequest xmlns='uri:HelloWorld'/>"));
-        Map<QName, DocumentFragment> headers = new HashMap<QName, DocumentFragment>();
-        Document doc = DOMUtil.newDocument();
-        DocumentFragment fragment = doc.createDocumentFragment();
-        DomUtil.createElement(fragment, new QName("uri:HelloWorld", "HelloHeader"));
-        headers.put(new QName("uri:HelloWorld", "HelloHeader"), fragment);
-        me.getInMessage().setProperty(org.apache.servicemix.JbiConstants.SOAP_HEADERS, headers);
-        File f = new File(getClass().getResource("servicemix.jpg").getFile());
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        FileUtil.copyInputStream(new FileInputStream(f), baos);
-        DataSource ds = new ByteArrayDataSource(baos.toByteArray(), "image/jpeg");
-        DataHandler dh = new DataHandler(ds);
-        me.getInMessage().addAttachment("image", dh);
-        client.sendSync(me);
-        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
-        assertNull(me.getFault());
-        assertEquals(1, me.getOutMessage().getAttachmentNames().size());
-        client.done(me);
-    }
-    */
+     * public void testHttpSoapAttachments() throws Exception { initSoapEndpoints(true);
+     * 
+     * HttpComponent http = new HttpComponent(); HttpEndpoint ep0 = new HttpEndpoint(); ep0.setService(new
+     * QName("urn:test", "s0")); ep0.setEndpoint("ep0"); ep0.setLocationURI("http://localhost:8192/ep1/");
+     * ep0.setRoleAsString("provider"); ep0.setSoapVersion("1.1"); ep0.setSoap(true); http.setEndpoints(new
+     * HttpEndpoint[] { ep0 }); container.activateComponent(http, "http2");
+     * 
+     * MockServiceComponent echo = new MockServiceComponent(); echo.setService(new QName("urn:test", "echo"));
+     * echo.setEndpoint("endpoint"); echo.setResponseXml("<jbi:message
+     * xmlns:jbi='http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper'><jbi:part><HelloResponse xmlns='uri:HelloWorld' />
+     * </jbi:part></jbi:message>");
+     * container.activateComponent(echo, "echo");
+     * 
+     * DefaultServiceMixClient client = new DefaultServiceMixClient(container); Destination d =
+     * client.createDestination("service:urn:test:s0"); InOut me = d.createInOutExchange();
+     * me.getInMessage().setContent(new StringSource("<HelloRequest xmlns='uri:HelloWorld'/>")); Map<QName,
+     * DocumentFragment> headers = new HashMap<QName, DocumentFragment>(); Document doc = DOMUtil.newDocument();
+     * DocumentFragment fragment = doc.createDocumentFragment(); DomUtil.createElement(fragment, new
+     * QName("uri:HelloWorld", "HelloHeader")); headers.put(new QName("uri:HelloWorld", "HelloHeader"), fragment);
+     * me.getInMessage().setProperty(org.apache.servicemix.JbiConstants.SOAP_HEADERS, headers); File f = new
+     * File(getClass().getResource("servicemix.jpg").getFile()); ByteArrayOutputStream baos = new
+     * ByteArrayOutputStream(); FileUtil.copyInputStream(new FileInputStream(f), baos); DataSource ds = new
+     * ByteArrayDataSource(baos.toByteArray(), "image/jpeg"); DataHandler dh = new DataHandler(ds);
+     * me.getInMessage().addAttachment("image", dh); client.sendSync(me); assertEquals(ExchangeStatus.ACTIVE,
+     * me.getStatus()); assertNull(me.getFault()); assertEquals(1, me.getOutMessage().getAttachmentNames().size());
+     * client.done(me); }
+     */
 
     public void testHttpSoap11() throws Exception {
         initSoapEndpoints(true);
@@ -304,11 +272,16 @@
         MockServiceComponent echo = new MockServiceComponent();
         echo.setService(new QName("urn:test", "echo"));
         echo.setEndpoint("endpoint");
-        echo.setResponseXml("<jbi:message xmlns:jbi='http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper'><jbi:part><HelloResponse xmlns='uri:HelloWorld' /></jbi:part></jbi:message>");
+        echo.setResponseXml("<jbi:message xmlns:jbi='http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper'>"
+                        + "<jbi:part><HelloResponse xmlns='uri:HelloWorld' /></jbi:part>" + "</jbi:message>");
         container.activateComponent(echo, "echo");
 
         PostMethod post = new PostMethod("http://localhost:8192/ep1/");
-        post.setRequestEntity(new StringRequestEntity("<s:Envelope xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'><s:Header><HelloHeader xmlns='uri:HelloWorld'/></s:Header><s:Body><HelloRequest xmlns='uri:HelloWorld'>world</HelloRequest></s:Body></s:Envelope>"));
+        post.setRequestEntity(new StringRequestEntity(
+                        "<s:Envelope xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'>"
+                                        + "<s:Header><HelloHeader xmlns='uri:HelloWorld'/></s:Header>"
+                                        + "<s:Body><HelloRequest xmlns='uri:HelloWorld'>world</HelloRequest></s:Body>"
+                                        + "</s:Envelope>"));
         new HttpClient().executeMethod(post);
         String res = post.getResponseBodyAsString();
         System.err.println(res);
@@ -325,7 +298,8 @@
         initSoapEndpoints(true);
 
         TransformComponentSupport mock = new TransformComponentSupport() {
-            protected boolean transform(MessageExchange exchange, NormalizedMessage in, NormalizedMessage out) throws MessagingException {
+            protected boolean transform(MessageExchange exchange, NormalizedMessage in, NormalizedMessage out)
+                throws MessagingException {
                 Element elem;
                 try {
                     elem = transformer.toDOMElement(in.getContent());
@@ -334,16 +308,23 @@
                     throw new MessagingException(e);
                 }
                 assertEquals(JbiConstants.WSDL11_WRAPPER_MESSAGE, DomUtil.getQName(elem));
-                out.setContent(new StringSource("<jbi:message xmlns:jbi='http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper'><jbi:part><HelloResponse xmlns='uri:HelloWorld'>world</HelloResponse></jbi:part></jbi:message> "));
+                out.setContent(
+                         new StringSource("<jbi:message xmlns:jbi='http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper'>"
+                                   + "<jbi:part><HelloResponse xmlns='uri:HelloWorld'>world</HelloResponse></jbi:part>"
+                                   + "</jbi:message> "));
                 return true;
-            }            
+            }
         };
         mock.setService(new QName("urn:test", "echo"));
         mock.setEndpoint("endpoint");
         container.activateComponent(mock, "mock");
 
         PostMethod post = new PostMethod("http://localhost:8192/ep2/");
-        post.setRequestEntity(new StringRequestEntity("<s:Envelope xmlns:s='http://www.w3.org/2003/05/soap-envelope'><s:Header><HelloHeader xmlns='uri:HelloWorld'/></s:Header><s:Body><HelloRequest xmlns='uri:HelloWorld'>world</HelloRequest></s:Body></s:Envelope>"));
+        post.setRequestEntity(
+                        new StringRequestEntity("<s:Envelope xmlns:s='http://www.w3.org/2003/05/soap-envelope'>"
+                                + "<s:Header><HelloHeader xmlns='uri:HelloWorld'/></s:Header>"
+                                + "<s:Body><HelloRequest xmlns='uri:HelloWorld'>world</HelloRequest></s:Body>"
+                                + "</s:Envelope>"));
         new HttpClient().executeMethod(post);
         String res = post.getResponseBodyAsString();
         System.err.println(res);
@@ -360,7 +341,8 @@
         initSoapEndpoints(false);
 
         TransformComponentSupport mock = new TransformComponentSupport() {
-            protected boolean transform(MessageExchange exchange, NormalizedMessage in, NormalizedMessage out) throws MessagingException {
+            protected boolean transform(MessageExchange exchange, NormalizedMessage in, NormalizedMessage out)
+                throws MessagingException {
                 Element elem;
                 try {
                     elem = transformer.toDOMElement(in.getContent());
@@ -371,7 +353,7 @@
                 assertEquals(new QName("uri:HelloWorld", "HelloRequest"), DomUtil.getQName(elem));
                 out.setContent(new StringSource("<HelloResponse xmlns='uri:HelloWorld'>world</HelloResponse>"));
                 return true;
-            }            
+            }
         };
         mock.setCopyProperties(false);
         mock.setService(new QName("urn:test", "echo"));
@@ -379,7 +361,11 @@
         container.activateComponent(mock, "mock");
 
         PostMethod post = new PostMethod("http://localhost:8192/ep2/");
-        post.setRequestEntity(new StringRequestEntity("<s:Envelope xmlns:s='http://www.w3.org/2003/05/soap-envelope'><s:Header><HelloHeader xmlns='uri:HelloWorld'/></s:Header><s:Body><HelloRequest xmlns='uri:HelloWorld'>world</HelloRequest></s:Body></s:Envelope>"));
+        post.setRequestEntity(
+                        new StringRequestEntity("<s:Envelope xmlns:s='http://www.w3.org/2003/05/soap-envelope'>"
+                                + "<s:Header><HelloHeader xmlns='uri:HelloWorld'/></s:Header>"
+                                + "<s:Body><HelloRequest xmlns='uri:HelloWorld'>world</HelloRequest></s:Body>"
+                                + "</s:Envelope>"));
         new HttpClient().executeMethod(post);
         String res = post.getResponseBodyAsString();
         System.err.println(res);

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpAddressingTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpAddressingTest.java?view=diff&rev=533074&r1=533073&r2=533074
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpAddressingTest.java (original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpAddressingTest.java Fri Apr 27 05:23:20 2007
@@ -27,19 +27,20 @@
 import javax.xml.namespace.QName;
 import javax.xml.transform.stream.StreamSource;
 
+import org.w3c.dom.Node;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.servicemix.client.DefaultServiceMixClient;
 import org.apache.servicemix.jbi.jaxp.SourceTransformer;
 import org.apache.servicemix.jbi.util.FileUtil;
 import org.apache.servicemix.tck.SpringTestSupport;
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.w3c.dom.Node;
 import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
 
 public class HttpAddressingTest extends SpringTestSupport {
 
-    private static Log logger =  LogFactory.getLog(HttpAddressingTest.class);
+    private static Log logger = LogFactory.getLog(HttpAddressingTest.class);
 
     public void testOk() throws Exception {
         DefaultServiceMixClient client = new DefaultServiceMixClient(jbi);
@@ -63,7 +64,7 @@
             assertNotNull(textValueOfXPath(node, "//*[local-name()='MessageID']"));
         }
     }
-    
+
     public void testOkFromUrl() throws Exception {
         URLConnection connection = new URL("http://localhost:8192/Service/").openConnection();
         connection.setDoOutput(true);
@@ -78,31 +79,24 @@
         FileUtil.copyInputStream(is, baos);
         System.err.println(baos.toString());
     }
-    
+
     public void testBad() throws Exception {
         /*
          * Disable this test until http://jira.codehaus.org/browse/JETTY-99 or
-         *   http://issues.apache.org/activemq/browse/SM-541
-         * 
-        // This test is bit weird, because the http consumer is not soap
-        // so it will just forward the HTTP error
-        //
-        // TODO: note that WSA based faults are not created
-        //
-        DefaultServiceMixClient client = new DefaultServiceMixClient(jbi);
-        InOut me = client.createInOutExchange();
-        me.setService(new QName("http://test", "MyProviderService"));
-        InputStream fis = getClass().getResourceAsStream("bad-addressing-request.xml");
-        me.getInMessage().setContent(new StreamSource(fis));
-        client.sendSync(me);
-        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
-        assertNotNull(me.getFault());
-        logger.info(new SourceTransformer().toString(me.getFault().getContent()));
-        */
+         * http://issues.apache.org/activemq/browse/SM-541
+         *  // This test is bit weird, because the http consumer is not soap 
+         *  // so it will just forward the HTTP error // //
+         * TODO: note that WSA based faults are not created // DefaultServiceMixClient client = new
+         * DefaultServiceMixClient(jbi); InOut me = client.createInOutExchange(); me.setService(new QName("http://test",
+         * "MyProviderService")); InputStream fis = getClass().getResourceAsStream("bad-addressing-request.xml");
+         * me.getInMessage().setContent(new StreamSource(fis)); client.sendSync(me); assertEquals(ExchangeStatus.ACTIVE,
+         * me.getStatus()); assertNotNull(me.getFault()); logger.info(new
+         * SourceTransformer().toString(me.getFault().getContent()));
+         */
     }
-    
+
     protected AbstractXmlApplicationContext createBeanFactory() {
         return new ClassPathXmlApplicationContext("org/apache/servicemix/http/addressing.xml");
     }
-    
+
 }

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpConsumerTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpConsumerTest.java?view=diff&rev=533074&r1=533073&r2=533074
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpConsumerTest.java (original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpConsumerTest.java Fri Apr 27 05:23:20 2007
@@ -31,6 +31,8 @@
 
 import junit.framework.TestCase;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.servicemix.client.DefaultServiceMixClient;
 import org.apache.servicemix.components.http.HttpInvoker;
 import org.apache.servicemix.components.http.HttpSoapClientMarshaler;
@@ -40,11 +42,9 @@
 import org.apache.servicemix.jbi.jaxp.SourceTransformer;
 import org.apache.servicemix.tck.Receiver;
 import org.apache.servicemix.tck.ReceiverComponent;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 public class HttpConsumerTest extends TestCase {
-    private static Log logger =  LogFactory.getLog(HttpConsumerTest.class);
+    private static Log logger = LogFactory.getLog(HttpConsumerTest.class);
 
     protected JBIContainer container;
 
@@ -110,7 +110,6 @@
         return t1 - t0;
     }
 
-
     protected long testInOut(String msg, boolean streaming) throws Exception {
         // HTTP Component
         HttpComponent component = new HttpComponent();
@@ -187,14 +186,14 @@
         for (int i = 0; i < sizeInKb; i++) {
             sb.append("<hello>");
             for (int j = 0; j < 1024 - 15; j++) {
-                sb.append((char) ('A' + (int)(Math.random() * ('Z' - 'A' + 1))));
+                sb.append((char) ('A' + (int) (Math.random() * ('Z' - 'A' + 1))));
             }
             sb.append("</hello>");
         }
         sb.append("</hello>");
         String str = sb.toString();
 
-        for(int i = 0; i < nbRuns; i++) {
+        for (int i = 0; i < nbRuns; i++) {
             System.gc();
             long dt = testInOnly(str, false);
             logger.info("No Streaming: " + dt);
@@ -202,7 +201,7 @@
             setUp();
         }
 
-        for(int i = 0; i < nbRuns; i++) {
+        for (int i = 0; i < nbRuns; i++) {
             System.gc();
             long dt = testInOnly(str, true);
             logger.info("Streaming: " + dt);

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpManagedTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpManagedTest.java?view=diff&rev=533074&r1=533073&r2=533074
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpManagedTest.java (original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpManagedTest.java Fri Apr 27 05:23:20 2007
@@ -42,20 +42,20 @@
 import org.springframework.web.context.ContextLoaderListener;
 
 public class HttpManagedTest extends TestCase {
-    private static Log logger =  LogFactory.getLog(HttpManagedTest.class);
+    private static Log logger = LogFactory.getLog(HttpManagedTest.class);
 
     private Server server;
-    
+
     protected void shutDown() throws Exception {
         if (server != null) {
             server.stop();
         }
     }
-    
+
     public void test() throws Exception {
         ContextHandler context = new ContextHandler();
         context.setContextPath("/test");
-        context.setEventListeners(new EventListener[] { new ContextLoaderListener() });
+        context.setEventListeners(new EventListener[] {new ContextLoaderListener()});
         Map initParams = new HashMap();
         initParams.put("contextConfigLocation", "classpath:org/apache/servicemix/http/spring-web.xml");
         initParams.put("contextClass", XmlWebApplicationContext.class.getName());
@@ -64,36 +64,38 @@
         holder.setName("jbiServlet");
         holder.setClassName(HttpManagedServlet.class.getName());
         ServletHandler handler = new ServletHandler();
-        handler.setServlets(new ServletHolder[] { holder });
+        handler.setServlets(new ServletHolder[] {holder});
         ServletMapping mapping = new ServletMapping();
         mapping.setServletName("jbiServlet");
         mapping.setPathSpec("/*");
-        handler.setServletMappings(new ServletMapping[] { mapping });
+        handler.setServletMappings(new ServletMapping[] {mapping});
         context.setHandler(handler);
 
         ContextHandlerCollection contexts = new ContextHandlerCollection();
         HandlerCollection handlers = new HandlerCollection();
-        handlers.setHandlers(new Handler[] { contexts });
+        handlers.setHandlers(new Handler[] {contexts});
         contexts.addHandler(context);
 
         SelectChannelConnector connector = new SelectChannelConnector();
         connector.setHost("localhost");
         connector.setPort(8190);
-        
+
         server = new Server();
-        server.setConnectors(new Connector[] { connector });
+        server.setConnectors(new Connector[] {connector});
         server.setHandler(handlers);
         server.start();
-        
+
         logger.info("Started");
-        
+
         PostMethod post = new PostMethod("http://localhost:8190/test/jbi/Service/");
-        post.setRequestEntity(new StringRequestEntity("<soap:Envelope xmlns:soap='http://www.w3.org/2003/05/soap-envelope'><soap:Body><hello>world</hello></soap:Body></soap:Envelope>"));
+        post.setRequestEntity(new StringRequestEntity(
+                        "<soap:Envelope xmlns:soap='http://www.w3.org/2003/05/soap-envelope'>"
+                                        + "<soap:Body><hello>world</hello></soap:Body>" + "</soap:Envelope>"));
         new HttpClient().executeMethod(post);
         if (post.getStatusCode() != 200) {
             throw new InvalidStatusResponseException(post.getStatusCode());
         }
         logger.info(post.getResponseBodyAsString());
-        
+
     }
 }

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpProviderTest.java?view=diff&rev=533074&r1=533073&r2=533074
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpProviderTest.java (original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpProviderTest.java Fri Apr 27 05:23:20 2007
@@ -29,6 +29,9 @@
 
 import junit.framework.TestCase;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.servicemix.JbiConstants;
 import org.apache.servicemix.client.DefaultServiceMixClient;
 import org.apache.servicemix.components.http.HttpConnector;
 import org.apache.servicemix.components.util.EchoComponent;
@@ -37,12 +40,10 @@
 import org.apache.servicemix.jbi.jaxp.SourceTransformer;
 import org.apache.servicemix.tck.Receiver;
 import org.apache.servicemix.tck.ReceiverComponent;
-import org.apache.servicemix.JbiConstants;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 public class HttpProviderTest extends TestCase {
-    private static Log logger =  LogFactory.getLog(HttpProviderTest.class);
+
+    private static Log logger = LogFactory.getLog(HttpProviderTest.class);
 
     protected JBIContainer container;
 
@@ -86,17 +87,14 @@
         URL url = getClass().getClassLoader().getResource("provider/http.wsdl");
         File path = new File(new URI(url.toString()));
         path = path.getParentFile();
-        component.getServiceUnitManager().deploy("provider",
-                path.getAbsolutePath());
+        component.getServiceUnitManager().deploy("provider", path.getAbsolutePath());
         component.getServiceUnitManager().start("provider");
 
         // Call it
         DefaultServiceMixClient client = new DefaultServiceMixClient(container);
         RobustInOnly in = client.createRobustInOnlyExchange();
-        in.setInterfaceName(new QName("http://http.servicemix.org/Test",
-                "ProviderInterface"));
-        in.getInMessage().setContent(
-                new StreamSource(new ByteArrayInputStream(msg.getBytes())));
+        in.setInterfaceName(new QName("http://http.servicemix.org/Test", "ProviderInterface"));
+        in.getInMessage().setContent(new StreamSource(new ByteArrayInputStream(msg.getBytes())));
 
         long t0 = System.currentTimeMillis();
         client.sendSync(in);
@@ -108,24 +106,21 @@
 
         component.getServiceUnitManager().stop("provider");
         component.getServiceUnitManager().shutDown("provider");
-        component.getServiceUnitManager().undeploy("provider",
-                path.getAbsolutePath());
+        component.getServiceUnitManager().undeploy("provider", path.getAbsolutePath());
 
         return t1 - t0;
     }
 
     /**
-     * The http.wsdl specifies the location URI as localhost:8192.
-     * Set a NormalizedMessage property to override this value.
-     * Therefore don't start the HttpConnector on 8192, rather on
-     * another port to prove this functionality works.
+     * The http.wsdl specifies the location URI as localhost:8192. Set a NormalizedMessage property to override this
+     * value. Therefore don't start the HttpConnector on 8192, rather on another port to prove this functionality works.
+     * 
      * @param msg
      * @param streaming
      * @return
      * @throws Exception
      */
-    protected long testInOnlyOverrideDestination(String msg, boolean streaming)
-            throws Exception {
+    protected long testInOnlyOverrideDestination(String msg, boolean streaming) throws Exception {
         // HTTP Component
         HttpComponent component = new HttpComponent();
         component.getConfiguration().setStreamingEnabled(streaming);
@@ -151,19 +146,15 @@
         URL url = getClass().getClassLoader().getResource("provider/http.wsdl");
         File path = new File(new URI(url.toString()));
         path = path.getParentFile();
-        component.getServiceUnitManager().deploy("provider",
-                path.getAbsolutePath());
+        component.getServiceUnitManager().deploy("provider", path.getAbsolutePath());
         component.getServiceUnitManager().start("provider");
 
         // Call it
         DefaultServiceMixClient client = new DefaultServiceMixClient(container);
         RobustInOnly in = client.createRobustInOnlyExchange();
-        in.setInterfaceName(new QName("http://http.servicemix.org/Test",
-                "ProviderInterface"));
-        in.getInMessage().setContent(
-                new StreamSource(new ByteArrayInputStream(msg.getBytes())));
-        in.getInMessage().setProperty(JbiConstants.HTTP_DESTINATION_URI,
-                "http://localhost:9192/CheckAvailability");
+        in.setInterfaceName(new QName("http://http.servicemix.org/Test", "ProviderInterface"));
+        in.getInMessage().setContent(new StreamSource(new ByteArrayInputStream(msg.getBytes())));
+        in.getInMessage().setProperty(JbiConstants.HTTP_DESTINATION_URI, "http://localhost:9192/CheckAvailability");
 
         long t0 = System.currentTimeMillis();
         client.sendSync(in);
@@ -175,8 +166,7 @@
 
         component.getServiceUnitManager().stop("provider");
         component.getServiceUnitManager().shutDown("provider");
-        component.getServiceUnitManager().undeploy("provider",
-                path.getAbsolutePath());
+        component.getServiceUnitManager().undeploy("provider", path.getAbsolutePath());
 
         return t1 - t0;
     }
@@ -207,17 +197,14 @@
         URL url = getClass().getClassLoader().getResource("provider/http.wsdl");
         File path = new File(new URI(url.toString()));
         path = path.getParentFile();
-        component.getServiceUnitManager().deploy("provider",
-                path.getAbsolutePath());
+        component.getServiceUnitManager().deploy("provider", path.getAbsolutePath());
         component.getServiceUnitManager().start("provider");
 
         // Call it
         DefaultServiceMixClient client = new DefaultServiceMixClient(container);
         InOut inout = client.createInOutExchange();
-        inout.setInterfaceName(new QName("http://http.servicemix.org/Test",
-                "ProviderInterface"));
-        inout.getInMessage().setContent(
-                new StreamSource(new ByteArrayInputStream(msg.getBytes())));
+        inout.setInterfaceName(new QName("http://http.servicemix.org/Test", "ProviderInterface"));
+        inout.getInMessage().setContent(new StreamSource(new ByteArrayInputStream(msg.getBytes())));
 
         long t0 = System.currentTimeMillis();
         client.sendSync(inout);
@@ -228,10 +215,8 @@
         assertNotNull(inout.getOutMessage());
         assertNotNull(inout.getOutMessage().getContent());
         SourceTransformer sourceTransformer = new SourceTransformer();
-        String reply = sourceTransformer.toString(inout.getOutMessage()
-                .getContent());
-        String inputMesage = sourceTransformer.toString(new StreamSource(
-                new ByteArrayInputStream(msg.getBytes())));
+        String reply = sourceTransformer.toString(inout.getOutMessage().getContent());
+        String inputMesage = sourceTransformer.toString(new StreamSource(new ByteArrayInputStream(msg.getBytes())));
         logger.info("Msg Sent [" + inputMesage + "]");
         logger.info("Msg Recieved [" + reply + "]");
 
@@ -240,8 +225,7 @@
 
         component.getServiceUnitManager().stop("provider");
         component.getServiceUnitManager().shutDown("provider");
-        component.getServiceUnitManager().undeploy("provider",
-                path.getAbsolutePath());
+        component.getServiceUnitManager().undeploy("provider", path.getAbsolutePath());
 
         logger.info("Executed in " + (t1 - t0) + "ms");
 
@@ -253,9 +237,9 @@
     }
 
     /**
-     * JIRA SM-695.
-     * Tests the ability of the ProviderProcessor to override
-     * the locationURI using the property JbiConstants.HTTP_DESTINATION_URI
+     * JIRA SM-695. Tests the ability of the ProviderProcessor to override the locationURI using the property
+     * JbiConstants.HTTP_DESTINATION_URI
+     * 
      * @throws Exception
      */
     public void testInOnlyOverrideDestination() throws Exception {
@@ -275,8 +259,7 @@
         for (int i = 0; i < sizeInKb; i++) {
             sb.append("\t<hello>");
             for (int j = 0; j < 1024 - 15; j++) {
-                sb
-                        .append((char) ('A' + (int) (Math.random() * ('Z' - 'A' + 1))));
+                sb.append((char) ('A' + (int) (Math.random() * ('Z' - 'A' + 1))));
             }
             sb.append("</hello>\n");
         }
@@ -284,10 +267,9 @@
         String str = sb.toString();
 
         /*
-           * for(int i = 0; i < nbRuns; i++) { System.gc(); long dt =
-           * testInOnly(str, false); System.err.println("No Streaming: " + dt);
-           * tearDown(); setUp(); }
-           */
+         * for(int i = 0; i < nbRuns; i++) { System.gc(); long dt = testInOnly(str, false); System.err.println("No
+         * Streaming: " + dt); tearDown(); setUp(); }
+         */
 
         for (int i = 0; i < nbRuns; i++) {
             System.gc();
@@ -299,7 +281,7 @@
     }
 
     public void testInOutWithBigMessage() throws Exception {
-        int sizeInKb = 640*1024;
+        int sizeInKb = 640 * 1024;
 
         StringBuffer sb = new StringBuffer();
         sb.append("<hello>\n");

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSoapTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSoapTest.java?view=diff&rev=533074&r1=533073&r2=533074
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSoapTest.java (original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSoapTest.java Fri Apr 27 05:23:20 2007
@@ -35,8 +35,14 @@
 import javax.xml.namespace.QName;
 import javax.xml.transform.stream.StreamSource;
 
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
 import junit.framework.TestCase;
 
+import com.ibm.wsdl.util.xml.DOMUtils;
+
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpMethod;
 import org.apache.commons.httpclient.HttpMethodRetryHandler;
@@ -62,17 +68,12 @@
 import org.apache.servicemix.soap.marshalers.JBIMarshaler;
 import org.apache.servicemix.soap.marshalers.SoapMarshaler;
 import org.apache.servicemix.tck.ReceiverComponent;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import com.ibm.wsdl.util.xml.DOMUtils;
 
 public class HttpSoapTest extends TestCase {
-    private static Log logger =  LogFactory.getLog(HttpSoapTest.class);
+    private static Log logger = LogFactory.getLog(HttpSoapTest.class);
 
     protected JBIContainer container;
-    
+
     protected void setUp() throws Exception {
         container = new JBIContainer();
         container.setUseMBeanServer(false);
@@ -80,13 +81,13 @@
         container.setEmbedded(true);
         container.init();
     }
-    
+
     protected void tearDown() throws Exception {
         if (container != null) {
             container.shutDown();
         }
     }
-    
+
     public void testFaultOnParse() throws Exception {
         HttpComponent http = new HttpComponent();
         HttpEndpoint ep = new HttpEndpoint();
@@ -96,10 +97,10 @@
         ep.setRoleAsString("consumer");
         ep.setDefaultMep(URI.create("http://www.w3.org/2004/08/wsdl/in-out"));
         ep.setSoap(true);
-        http.setEndpoints(new HttpEndpoint[] { ep });
+        http.setEndpoints(new HttpEndpoint[] {ep});
         container.activateComponent(http, "http");
         container.start();
-        
+
         PostMethod method = new PostMethod("http://localhost:8192/ep1/");
         method.setRequestEntity(new StringRequestEntity("<hello>world</hello>"));
         int state = new HttpClient().executeMethod(method);
@@ -112,9 +113,9 @@
         echo.setService(new QName("urn:test", "echo"));
         echo.setEndpoint("echo");
         container.activateComponent(echo, "echo");
-        
+
         HttpComponent http = new HttpComponent();
-        
+
         HttpEndpoint ep1 = new HttpEndpoint();
         ep1.setService(new QName("urn:test", "echo"));
         ep1.setEndpoint("echo");
@@ -122,34 +123,34 @@
         ep1.setRoleAsString("consumer");
         ep1.setDefaultMep(URI.create("http://www.w3.org/2004/08/wsdl/in-out"));
         ep1.setSoap(true);
-        
+
         HttpEndpoint ep2 = new HttpEndpoint();
         ep2.setService(new QName("urn:test", "s2"));
         ep2.setEndpoint("ep2");
         ep2.setLocationURI("http://localhost:8192/ep1/");
         ep2.setRoleAsString("provider");
         ep2.setSoap(true);
-        
-        http.setEndpoints(new HttpEndpoint[] { ep1, ep2 });
-        
+
+        http.setEndpoints(new HttpEndpoint[] {ep1, ep2});
+
         container.activateComponent(http, "http");
-        
+
         container.start();
-        
+
         ServiceMixClient client = new DefaultServiceMixClient(container);
-        client.request(new ServiceNameEndpointResolver(new QName("urn:test", "s2")), null, null, 
-                       new StreamSource(getClass().getResourceAsStream("soap-request.xml")));
-        
+        client.request(new ServiceNameEndpointResolver(new QName("urn:test", "s2")), null, null, new StreamSource(
+                        getClass().getResourceAsStream("soap-request.xml")));
+
     }
-    
+
     public void testSoapRoundtripConsumerProvider() throws Exception {
         EchoComponent echo = new EchoComponent();
         echo.setService(new QName("urn:test", "echo"));
         echo.setEndpoint("echo");
         container.activateComponent(echo, "echo");
-        
+
         HttpComponent http = new HttpComponent();
-        
+
         HttpEndpoint ep1 = new HttpEndpoint();
         ep1.setService(new QName("urn:test", "s1"));
         ep1.setEndpoint("ep1");
@@ -158,20 +159,20 @@
         ep1.setRoleAsString("consumer");
         ep1.setDefaultMep(URI.create("http://www.w3.org/2004/08/wsdl/in-out"));
         ep1.setSoap(true);
-        
+
         HttpEndpoint ep2 = new HttpEndpoint();
         ep2.setService(new QName("urn:test", "s2"));
         ep2.setEndpoint("ep2");
         ep2.setLocationURI("http://localhost:8192/ep1/");
         ep2.setRoleAsString("provider");
         ep2.setSoap(true);
-        
-        http.setEndpoints(new HttpEndpoint[] { ep1, ep2 });
-        
+
+        http.setEndpoints(new HttpEndpoint[] {ep1, ep2});
+
         container.activateComponent(http, "http");
-        
+
         container.start();
-        
+
         ServiceMixClient client = new DefaultServiceMixClient(container);
         Destination dest = client.createDestination("service:urn:test:s2");
         InOut me = dest.createInOutExchange();
@@ -188,9 +189,9 @@
         echo.setService(new QName("urn:test", "echo"));
         echo.setEndpoint("echo");
         container.activateComponent(echo, "echo");
-        
+
         HttpComponent http = new HttpComponent();
-        
+
         HttpEndpoint ep1 = new HttpEndpoint();
         ep1.setService(new QName("urn:test", "s1"));
         ep1.setEndpoint("ep1");
@@ -199,14 +200,14 @@
         ep1.setRoleAsString("consumer");
         ep1.setDefaultMep(URI.create("http://www.w3.org/2004/08/wsdl/in-out"));
         ep1.setSoap(true);
-        
+
         HttpEndpoint ep2 = new HttpEndpoint();
         ep2.setService(new QName("urn:test", "s2"));
         ep2.setEndpoint("ep2");
         ep2.setLocationURI("http://localhost:8192/ep3/");
         ep2.setRoleAsString("provider");
         ep2.setSoap(true);
-        
+
         HttpEndpoint ep3 = new HttpEndpoint();
         ep3.setService(new QName("urn:test", "s3"));
         ep3.setEndpoint("ep3");
@@ -215,20 +216,22 @@
         ep3.setRoleAsString("consumer");
         ep3.setDefaultMep(URI.create("http://www.w3.org/2004/08/wsdl/in-out"));
         ep3.setSoap(true);
-        
-        http.setEndpoints(new HttpEndpoint[] { ep1, ep2, ep3 });
-        
+
+        http.setEndpoints(new HttpEndpoint[] {ep1, ep2, ep3});
+
         container.activateComponent(http, "http");
-        
+
         container.start();
-        
+
         PostMethod method = new PostMethod("http://localhost:8192/ep1/");
         method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new HttpMethodRetryHandler() {
             public boolean retryMethod(HttpMethod method, IOException exception, int executionCount) {
                 return false;
             }
         });
-        method.setRequestEntity(new StringRequestEntity("<env:Envelope xmlns:env='http://www.w3.org/2003/05/soap-envelope'><env:Body><hello>world</hello></env:body</env:Envelope>"));
+        method.setRequestEntity(new StringRequestEntity(
+                        "<env:Envelope xmlns:env='http://www.w3.org/2003/05/soap-envelope'>"
+                        + "<env:Body><hello>world</hello></env:body>" + "</env:Envelope>"));
         int state = new HttpClient().executeMethod(method);
         assertEquals(HttpServletResponse.SC_OK, state);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -238,7 +241,8 @@
 
     public void testSoapFault12() throws Exception {
         TransformComponentSupport echo = new TransformComponentSupport() {
-            protected boolean transform(MessageExchange exchange, NormalizedMessage in, NormalizedMessage out) throws MessagingException {
+            protected boolean transform(MessageExchange exchange, NormalizedMessage in, NormalizedMessage out)
+                throws MessagingException {
                 Fault f = exchange.createFault();
                 f.setContent(new StringSource("<hello xmlns='myuri'>this is a fault</hello>"));
                 f.setProperty(JBIMarshaler.SOAP_FAULT_REASON, "My reason");
@@ -248,41 +252,33 @@
         echo.setService(new QName("urn:test", "echo"));
         echo.setEndpoint("echo");
         container.activateComponent(echo, "echo");
-        
-        HttpEndpoint ep1 = new HttpEndpoint();
-        ep1.setService(new QName("urn:test", "http"));
-        ep1.setEndpoint("ep1");
+
+        HttpEndpoint ep1 = createInOutEndpoint("ep1");
         ep1.setTargetService(new QName("urn:test", "echo"));
         ep1.setTargetEndpoint("echo");
         ep1.setLocationURI("http://localhost:8193/ep1/");
         ep1.setRoleAsString("consumer");
-        ep1.setDefaultMep(URI.create("http://www.w3.org/2004/08/wsdl/in-out"));
         ep1.setSoap(true);
-        
-        HttpEndpoint ep2 = new HttpEndpoint();
-        ep2.setService(new QName("urn:test", "http"));
-        ep2.setEndpoint("ep2");
+
+        HttpEndpoint ep2 = createInOutEndpoint("ep2");
         ep2.setTargetService(new QName("urn:test", "http"));
         ep2.setTargetEndpoint("ep3");
         ep2.setLocationURI("http://localhost:8193/ep2/");
         ep2.setRoleAsString("consumer");
-        ep2.setDefaultMep(URI.create("http://www.w3.org/2004/08/wsdl/in-out"));
         ep2.setSoap(true);
-        
-        HttpEndpoint ep3 = new HttpEndpoint();
-        ep3.setService(new QName("urn:test", "http"));
-        ep3.setEndpoint("ep3");
+
+        HttpEndpoint ep3 = createInOutEndpoint("ep3");
         ep3.setLocationURI("http://localhost:8193/ep1/");
         ep3.setRoleAsString("provider");
         ep3.setDefaultMep(URI.create("http://www.w3.org/2004/08/wsdl/in-out"));
         ep3.setSoap(true);
-        
+
         HttpComponent http = new HttpComponent();
-        http.setEndpoints(new HttpEndpoint[] { ep1, ep2, ep3 });
+        http.setEndpoints(new HttpEndpoint[] {ep1, ep2, ep3});
         container.activateComponent(http, "http1");
-        
+
         container.start();
-        
+
         PostMethod method = new PostMethod("http://localhost:8193/ep2/");
         method.setRequestEntity(new InputStreamRequestEntity(getClass().getResourceAsStream("soap-request-12.xml")));
         int state = new HttpClient().executeMethod(method);
@@ -326,10 +322,11 @@
         e = DOMUtils.getFirstChildElement(e);
         assertEquals(new QName(SoapMarshaler.SOAP_12_URI, SoapMarshaler.FAULT), DOMUtil.getQName(e));
     }
-    
+
     public void testSoapFault11() throws Exception {
         TransformComponentSupport echo = new TransformComponentSupport() {
-            protected boolean transform(MessageExchange exchange, NormalizedMessage in, NormalizedMessage out) throws MessagingException {
+            protected boolean transform(MessageExchange exchange, NormalizedMessage in, NormalizedMessage out)
+                throws MessagingException {
                 Fault f = exchange.createFault();
                 f.setContent(new StringSource("<hello xmlns='myuri'>this is a fault</hello>"));
                 f.setProperty(JBIMarshaler.SOAP_FAULT_REASON, "My reason");
@@ -339,44 +336,35 @@
         echo.setService(new QName("urn:test", "echo"));
         echo.setEndpoint("echo");
         container.activateComponent(echo, "echo");
-        
-        HttpEndpoint ep1 = new HttpEndpoint();
-        ep1.setService(new QName("urn:test", "http"));
-        ep1.setEndpoint("ep1");
+
+        HttpEndpoint ep1 = createInOutEndpoint("ep1");
         ep1.setTargetService(new QName("urn:test", "echo"));
         ep1.setTargetEndpoint("echo");
         ep1.setLocationURI("http://localhost:8194/ep1/");
         ep1.setRoleAsString("consumer");
-        ep1.setDefaultMep(URI.create("http://www.w3.org/2004/08/wsdl/in-out"));
         ep1.setSoap(true);
         ep1.setSoapVersion("1.1");
-        
-        HttpEndpoint ep2 = new HttpEndpoint();
-        ep2.setService(new QName("urn:test", "http"));
-        ep2.setEndpoint("ep2");
+
+        HttpEndpoint ep2 = createInOutEndpoint("ep2");
         ep2.setTargetService(new QName("urn:test", "http"));
         ep2.setTargetEndpoint("ep3");
         ep2.setLocationURI("http://localhost:8194/ep2/");
         ep2.setRoleAsString("consumer");
-        ep2.setDefaultMep(URI.create("http://www.w3.org/2004/08/wsdl/in-out"));
         ep2.setSoap(true);
         ep2.setSoapVersion("1.1");
-        
-        HttpEndpoint ep3 = new HttpEndpoint();
-        ep3.setService(new QName("urn:test", "http"));
-        ep3.setEndpoint("ep3");
+
+        HttpEndpoint ep3 = createInOutEndpoint("ep3");
         ep3.setLocationURI("http://localhost:8194/ep1/");
         ep3.setRoleAsString("provider");
-        ep3.setDefaultMep(URI.create("http://www.w3.org/2004/08/wsdl/in-out"));
         ep3.setSoap(true);
         ep3.setSoapVersion("1.1");
-        
+
         HttpComponent http = new HttpComponent();
-        http.setEndpoints(new HttpEndpoint[] { ep1, ep2, ep3 });
+        http.setEndpoints(new HttpEndpoint[] {ep1, ep2, ep3});
         container.activateComponent(http, "http1");
-        
+
         container.start();
-        
+
         PostMethod method = new PostMethod("http://localhost:8194/ep2/");
         method.setRequestEntity(new InputStreamRequestEntity(getClass().getResourceAsStream("soap-request.xml")));
         int state = new HttpClient().executeMethod(method);
@@ -392,7 +380,7 @@
         assertEquals(new QName(SoapMarshaler.SOAP_11_URI, SoapMarshaler.BODY), DOMUtil.getQName(e));
         e = DOMUtils.getFirstChildElement(e);
         assertEquals(new QName(SoapMarshaler.SOAP_11_URI, SoapMarshaler.FAULT), DOMUtil.getQName(e));
-        
+
         method = new PostMethod("http://localhost:8194/ep2/");
         method.setRequestBody("hello");
         state = new HttpClient().executeMethod(method);
@@ -427,45 +415,35 @@
         echo.setService(new QName("urn:test", "echo"));
         echo.setEndpoint("echo");
         container.activateComponent(echo, "echo");
-        
-        HttpEndpoint ep1 = new HttpEndpoint();
-        ep1.setService(new QName("urn:test", "http"));
-        ep1.setEndpoint("ep1");
+
+        HttpEndpoint ep1 = createInOnlyEndpoint("ep1");
         ep1.setTargetService(new QName("urn:test", "echo"));
         ep1.setTargetEndpoint("echo");
         ep1.setLocationURI("http://localhost:8193/ep1/");
         ep1.setRoleAsString("consumer");
-        ep1.setDefaultMep(URI.create("http://www.w3.org/2004/08/wsdl/in-only"));
         ep1.setSoap(false);
-        
-        HttpEndpoint ep2 = new HttpEndpoint();
-        ep2.setService(new QName("urn:test", "http"));
-        ep2.setEndpoint("ep2");
+
+        HttpEndpoint ep2 = createInOnlyEndpoint("ep2");
         ep2.setTargetService(new QName("urn:test", "http"));
         ep2.setTargetEndpoint("ep3");
         ep2.setLocationURI("http://localhost:8193/ep2/");
         ep2.setRoleAsString("consumer");
-        ep2.setDefaultMep(URI.create("http://www.w3.org/2004/08/wsdl/in-only"));
         ep2.setSoap(true);
-        
-        HttpEndpoint ep3 = new HttpEndpoint();
-        ep3.setService(new QName("urn:test", "http"));
-        ep3.setEndpoint("ep3");
+
+        HttpEndpoint ep3 = createInOnlyEndpoint("ep3");
         ep3.setLocationURI("http://localhost:8193/ep1/");
-        ep3.setRoleAsString("provider");
-        ep3.setDefaultMep(URI.create("http://www.w3.org/2004/08/wsdl/in-only"));
         ep3.setSoap(true);
-        
+
         HttpComponent http = new HttpComponent();
-        http.setEndpoints(new HttpEndpoint[] { ep1, ep2, ep3 });
+        http.setEndpoints(new HttpEndpoint[] {ep1, ep2, ep3});
         container.activateComponent(http, "http1");
-        
+
         container.start();
-        
+
         PostMethod method = new PostMethod("http://localhost:8193/ep2/");
         method.setRequestEntity(new InputStreamRequestEntity(getClass().getResourceAsStream("request.xml")));
         new HttpClient().executeMethod(method);
-        
+
         echo.getMessageList().assertMessagesReceived(1);
         List msgs = echo.getMessageList().flushMessages();
         NormalizedMessage msg = (NormalizedMessage) msgs.get(0);
@@ -482,22 +460,22 @@
         e = DOMUtil.getFirstChildElement(e);
         assertEquals(new QName("", "clientSessionGuid"), DOMUtil.getQName(e));
     }
-    
+
     public void testAttachments() throws Exception {
         EchoComponent echo = new EchoComponent();
         echo.setService(new QName("urn:test", "echo"));
         echo.setEndpoint("echo");
         container.activateComponent(echo, "echo");
-        
+
         HttpComponent http = new HttpComponent();
-        
+
         HttpEndpoint ep0 = new HttpEndpoint();
         ep0.setService(new QName("urn:test", "s0"));
         ep0.setEndpoint("ep0");
         ep0.setLocationURI("http://localhost:8192/ep1/");
         ep0.setRoleAsString("provider");
         ep0.setSoap(true);
-        
+
         HttpEndpoint ep1 = new HttpEndpoint();
         ep1.setService(new QName("urn:test", "s1"));
         ep1.setEndpoint("ep1");
@@ -506,14 +484,14 @@
         ep1.setRoleAsString("consumer");
         ep1.setDefaultMep(URI.create("http://www.w3.org/2004/08/wsdl/in-out"));
         ep1.setSoap(true);
-        
+
         HttpEndpoint ep2 = new HttpEndpoint();
         ep2.setService(new QName("urn:test", "s2"));
         ep2.setEndpoint("ep2");
         ep2.setLocationURI("http://localhost:8192/ep3/");
         ep2.setRoleAsString("provider");
         ep2.setSoap(true);
-        
+
         HttpEndpoint ep3 = new HttpEndpoint();
         ep3.setService(new QName("urn:test", "s3"));
         ep3.setEndpoint("ep3");
@@ -522,13 +500,13 @@
         ep3.setRoleAsString("consumer");
         ep3.setDefaultMep(URI.create("http://www.w3.org/2004/08/wsdl/in-out"));
         ep3.setSoap(true);
-        
-        http.setEndpoints(new HttpEndpoint[] { ep0, ep1, ep2, ep3 });
-        
+
+        http.setEndpoints(new HttpEndpoint[] {ep0, ep1, ep2, ep3});
+
         container.activateComponent(http, "http");
-        
+
         container.start();
-        
+
         DefaultServiceMixClient client = new DefaultServiceMixClient(container);
         Destination d = client.createDestination("service:urn:test:s0");
         InOut me = d.createInOutExchange();
@@ -544,5 +522,23 @@
         assertEquals(1, me.getOutMessage().getAttachmentNames().size());
         client.done(me);
     }
-    
+
+    private HttpEndpoint createInOnlyEndpoint(String name) {
+        HttpEndpoint ep = createHttpEndpoint(name);
+        ep.setDefaultMep(URI.create("http://www.w3.org/2004/08/wsdl/in-only"));
+        return ep;
+    }
+
+    private HttpEndpoint createInOutEndpoint(String name) {
+        HttpEndpoint ep = createHttpEndpoint(name);
+        ep.setDefaultMep(URI.create("http://www.w3.org/2004/08/wsdl/in-out"));
+        return ep;
+    }
+
+    private HttpEndpoint createHttpEndpoint(String name) {
+        HttpEndpoint ep = new HttpEndpoint();
+        ep.setService(new QName("urn:test", "http"));
+        ep.setEndpoint(name);
+        return ep;
+    }
 }

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSpringTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSpringTest.java?view=diff&rev=533074&r1=533073&r2=533074
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSpringTest.java (original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSpringTest.java Fri Apr 27 05:23:20 2007
@@ -41,7 +41,7 @@
 
 public class HttpSpringTest extends SpringTestSupport {
 
-    private static Log logger =  LogFactory.getLog(HttpSpringTest.class);
+    private static Log logger = LogFactory.getLog(HttpSpringTest.class);
 
     protected void setUp() throws Exception {
         if (logger.isDebugEnabled()) {
@@ -49,7 +49,7 @@
         }
         super.setUp();
     }
-    
+
     public void test() throws Exception {
         DefaultServiceMixClient client = new DefaultServiceMixClient(jbi);
         InOut me = client.createInOutExchange();
@@ -91,9 +91,7 @@
     public void testMimeWithHttpClient() throws Exception {
         File f = new File(getClass().getResource("servicemix.jpg").getFile());
         PostMethod filePost = new PostMethod("http://localhost:8192/Service/");
-        Part[] parts = { 
-            new StringPart("request", "<dummy/>"),
-            new FilePart(f.getName(), f) };
+        Part[] parts = {new StringPart("request", "<dummy/>"), new FilePart(f.getName(), f)};
         RequestEntity entity = new MultipartRequestEntity(parts, filePost.getParams());
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         entity.writeRequest(baos);
@@ -108,5 +106,5 @@
     protected AbstractXmlApplicationContext createBeanFactory() {
         return new ClassPathXmlApplicationContext("org/apache/servicemix/http/spring.xml");
     }
-    
+
 }

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpTxTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpTxTest.java?view=diff&rev=533074&r1=533073&r2=533074
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpTxTest.java (original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpTxTest.java Fri Apr 27 05:23:20 2007
@@ -53,7 +53,7 @@
         tm = new GeronimoPlatformTransactionManager();
 
         jbi = new JBIContainer();
-        jbi.setFlows(new Flow[] { new SedaFlow(), new JCAFlow() });
+        jbi.setFlows(new Flow[] {new SedaFlow(), new JCAFlow()});
         jbi.setEmbedded(true);
         jbi.setUseMBeanServer(false);
         jbi.setCreateMBeanServer(false);
@@ -94,7 +94,7 @@
         ep1.setSoap(true);
         
         HttpComponent http = new HttpComponent();
-        http.setEndpoints(new HttpEndpoint[] { ep0, ep1 });
+        http.setEndpoints(new HttpEndpoint[] {ep0, ep1});
         jbi.activateComponent(http, "http");
 
         DefaultServiceMixClient client = new DefaultServiceMixClient(jbi);
@@ -132,7 +132,7 @@
         ep1.setSoap(true);
         
         HttpComponent http = new HttpComponent();
-        http.setEndpoints(new HttpEndpoint[] { ep0, ep1 });
+        http.setEndpoints(new HttpEndpoint[] {ep0, ep1});
         jbi.activateComponent(http, "http");
 
         DefaultServiceMixClient client = new DefaultServiceMixClient(jbi);

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpURITest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpURITest.java?view=diff&rev=533074&r1=533073&r2=533074
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpURITest.java (original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpURITest.java Fri Apr 27 05:23:20 2007
@@ -24,8 +24,13 @@
 import javax.jbi.messaging.NormalizedMessage;
 import javax.jbi.servicedesc.ServiceEndpoint;
 
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Element;
+
 import junit.framework.TestCase;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.servicemix.client.DefaultServiceMixClient;
 import org.apache.servicemix.jbi.container.JBIContainer;
 import org.apache.servicemix.jbi.jaxp.SourceTransformer;
@@ -33,13 +38,9 @@
 import org.apache.servicemix.jbi.messaging.MessageExchangeSupport;
 import org.apache.servicemix.jbi.resolver.URIResolver;
 import org.apache.servicemix.tck.ReceiverComponent;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.Element;
 
 public class HttpURITest extends TestCase {
-    private static Log logger =  LogFactory.getLog(HttpURITest.class);
+    private static Log logger = LogFactory.getLog(HttpURITest.class);
 
     private JBIContainer jbi;
 
@@ -63,7 +64,7 @@
         ep.setEndpoint(ReceiverComponent.ENDPOINT);
         ep.setLocationURI("http://localhost:8192/");
         ep.setDefaultMep(MessageExchangeSupport.IN_ONLY);
-        http.setEndpoints(new HttpEndpoint[] { ep });
+        http.setEndpoints(new HttpEndpoint[] {ep});
         jbi.activateComponent(http, "servicemix-http");
 
         ReceiverComponent receiver = new ReceiverComponent();

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpWsdlTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpWsdlTest.java?view=diff&rev=533074&r1=533073&r2=533074
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpWsdlTest.java (original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpWsdlTest.java Fri Apr 27 05:23:20 2007
@@ -24,14 +24,14 @@
 import javax.wsdl.Operation;
 import javax.wsdl.Output;
 import javax.wsdl.Part;
-import javax.wsdl.Port;
 import javax.wsdl.PortType;
-import javax.wsdl.Service;
 import javax.wsdl.WSDLException;
 import javax.wsdl.factory.WSDLFactory;
 import javax.wsdl.xml.WSDLReader;
 import javax.xml.namespace.QName;
 
+import org.w3c.dom.Document;
+
 import junit.framework.TestCase;
 
 import org.apache.commons.httpclient.HttpClient;
@@ -43,12 +43,11 @@
 import org.apache.servicemix.jbi.jaxp.StringSource;
 import org.apache.servicemix.jbi.messaging.MessageExchangeSupport;
 import org.springframework.core.io.UrlResource;
-import org.w3c.dom.Document;
 
 public class HttpWsdlTest extends TestCase {
 
     protected JBIContainer container;
-    
+
     protected void setUp() throws Exception {
         container = new JBIContainer();
         container.setUseMBeanServer(false);
@@ -56,7 +55,7 @@
         container.setEmbedded(true);
         container.init();
     }
-    
+
     protected void tearDown() throws Exception {
         if (container != null) {
             container.shutDown();
@@ -78,7 +77,7 @@
         asEcho.setEndpoint("myConsumer");
         asEcho.setService(new QName("http://test", "MyConsumerService"));
         container.activateComponent(asEcho);
-        
+
         // HTTP Component
         HttpEndpoint ep = new HttpEndpoint();
         ep.setService(new QName("http://test", "MyConsumerService"));
@@ -87,9 +86,9 @@
         ep.setLocationURI("http://localhost:" + portNumber + "/Service");
         ep.setSoap(true);
         HttpComponent http = new HttpComponent();
-        http.setEndpoints(new HttpEndpoint[] { ep });
+        http.setEndpoints(new HttpEndpoint[] {ep});
         container.activateComponent(http, "HttpWsdlTest");
-        
+
         // Start container
         container.start();
 
@@ -98,7 +97,7 @@
         assertEquals(HttpServletResponse.SC_OK, state);
         Document doc = (Document) new SourceTransformer().toDOMNode(new StringSource(get.getResponseBodyAsString()));
         get.releaseConnection();
-        
+
         // Test WSDL
         WSDLFactory factory = WSDLFactory.newInstance();
         WSDLReader reader = factory.newWSDLReader();
@@ -108,10 +107,8 @@
         assertNotNull(definition.getImports());
         assertEquals(1, definition.getImports().size());
         WSDLFactory.newInstance().newWSDLWriter().writeWSDL(definition, System.err);
-        Service svc = (Service) definition.getServices().values().iterator().next();
-        Port port = (Port) svc.getPorts().values().iterator().next();
     }
-    
+
     protected Definition createDefinition(boolean rpc) throws WSDLException {
         Definition def = WSDLFactory.newInstance().newDefinition();
         def.setTargetNamespace("http://porttype.test");
@@ -159,21 +156,21 @@
         WSDLFactory.newInstance().newWSDLWriter().writeWSDL(def, System.err);
         return def;
     }
-    
+
     public void testWithNonStandaloneWsdlDoc() throws Exception {
         testWSDL(createDefinition(false), 8192);
     }
-    
+
     public void testWithNonStandaloneWsdlRpc() throws Exception {
         testWSDL(createDefinition(true), 8193);
     }
-    
+
     public void testWithExistingBinding() throws Exception {
         String uri = getClass().getResource("bound-wsdl.wsdl").toString();
         Definition def = WSDLFactory.newInstance().newWSDLReader().readWSDL(uri);
         testWSDL(def, 8194);
     }
-    
+
     public void testExternalNonStandaloneWsdl() throws Exception {
         // HTTP Component
         HttpEndpoint ep = new HttpEndpoint();
@@ -182,11 +179,12 @@
         ep.setRoleAsString("consumer");
         ep.setLocationURI("http://localhost:8196/Service/");
         ep.setDefaultMep(MessageExchangeSupport.IN_OUT);
-        ep.setWsdlResource(new UrlResource("http://www.ws-i.org/SampleApplications/SupplyChainManagement/2002-08/Retailer.wsdl"));
+        ep.setWsdlResource(new UrlResource(
+                        "http://www.ws-i.org/SampleApplications/SupplyChainManagement/2002-08/Retailer.wsdl"));
         HttpComponent http = new HttpComponent();
-        http.setEndpoints(new HttpEndpoint[] { ep });
+        http.setEndpoints(new HttpEndpoint[] {ep});
         container.activateComponent(http, "HttpWsdlTest");
-        
+
         // Start container
         container.start();
 
@@ -195,7 +193,7 @@
         assertEquals(HttpServletResponse.SC_OK, state);
         Document doc = (Document) new SourceTransformer().toDOMNode(new StringSource(get.getResponseBodyAsString()));
         get.releaseConnection();
-        
+
         // Test WSDL
         WSDLFactory factory = WSDLFactory.newInstance();
         WSDLReader reader = factory.newWSDLReader();
@@ -205,5 +203,5 @@
         assertNotNull(def.getImports());
         assertEquals(1, def.getImports().size());
     }
-    
+
 }



Mime
View raw message