Author: gnodet
Date: Mon Oct 9 14:41:55 2006
New Revision: 454526
URL: http://svn.apache.org/viewvc?view=rev&rev=454526
Log:
Refactor HttpComponent and HttpSpringComponent into the same class which now
extends the DefaultComponent
Removed:
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpLifeCycle.java
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpSpringComponent.java
Modified:
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpComponent.java
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpEndpoint.java
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpManagedServlet.java
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpWsdl1Deployer.java
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpXBeanDeployer.java
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java
incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpConsumerTest.java
incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpProviderTest.java
incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSoapTest.java
incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpTxTest.java
incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpURITest.java
incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpWsdlTest.java
Modified:
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpComponent.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpComponent.java?view=diff&rev=454526&r1=454525&r2=454526
==============================================================================
---
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpComponent.java
(original)
+++
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpComponent.java
Mon Oct 9 14:41:55 2006
@@ -16,60 +16,253 @@
*/
package org.apache.servicemix.http;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.jbi.messaging.MessageExchange;
import javax.jbi.servicedesc.ServiceEndpoint;
+import javax.xml.namespace.QName;
-import org.apache.servicemix.common.BaseComponent;
-import org.apache.servicemix.common.BaseLifeCycle;
+import org.apache.activemq.util.IntrospectionSupport;
+import org.apache.activemq.util.URISupport;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
+import org.apache.commons.httpclient.params.HttpConnectionManagerParams;
import org.apache.servicemix.common.BaseServiceUnitManager;
+import org.apache.servicemix.common.DefaultComponent;
import org.apache.servicemix.common.Deployer;
+import org.apache.servicemix.common.Endpoint;
+import org.apache.servicemix.common.ServiceUnit;
+import org.apache.servicemix.common.xbean.BaseXBeanDeployer;
import org.apache.servicemix.http.jetty.JCLLogger;
+import org.apache.servicemix.http.jetty.JettyContextManager;
+import org.apache.servicemix.jbi.security.auth.AuthenticationService;
+import org.apache.servicemix.jbi.security.auth.impl.JAASAuthenticationService;
+import org.apache.servicemix.jbi.security.keystore.KeystoreManager;
import org.w3c.dom.DocumentFragment;
-public class HttpComponent extends BaseComponent {
+/**
+ *
+ * @author gnodet
+ * @org.apache.xbean.XBean element="component"
+ * description="An http component"
+ */
+public class HttpComponent extends DefaultComponent {
static {
JCLLogger.init();
}
- /* (non-Javadoc)
- * @see org.servicemix.common.BaseComponent#createLifeCycle()
+ protected ContextManager server;
+ protected HttpClient client;
+ protected MultiThreadedHttpConnectionManager connectionManager;
+ protected HttpConfiguration configuration = new HttpConfiguration();
+ protected HttpEndpoint[] endpoints;
+
+ /**
+ * @return the endpoints
*/
- protected BaseLifeCycle createLifeCycle() {
- return new HttpLifeCycle(this);
+ public HttpEndpoint[] getEndpoints() {
+ return endpoints;
}
- /* (non-Javadoc)
- * @see org.servicemix.common.BaseComponent#createServiceUnitManager()
+ /**
+ * @param endpoints the endpoints to set
*/
- public BaseServiceUnitManager createServiceUnitManager() {
- Deployer[] deployers = new Deployer[] { new HttpXBeanDeployer(this),
new HttpWsdl1Deployer(this) };
- return new BaseServiceUnitManager(this, deployers);
+ public void setEndpoints(HttpEndpoint[] endpoints) {
+ this.endpoints = endpoints;
}
- /* (non-Javadoc)
- * @see
javax.jbi.component.Component#resolveEndpointReference(org.w3c.dom.DocumentFragment)
- */
- public ServiceEndpoint resolveEndpointReference(DocumentFragment epr) {
- return HttpResolvedEndpoint.resolveEndpoint(epr);
+ public ContextManager getServer() {
+ return server;
+ }
+
+ public void setServer(ContextManager server) {
+ this.server = server;
+ }
+
+ public HttpClient getClient() {
+ return client;
+ }
+
+ public void setClient(HttpClient client) {
+ this.client = client;
}
/**
- * @return the configuration
+ * @return Returns the configuration.
* @org.apache.xbean.Flat
*/
public HttpConfiguration getConfiguration() {
- return ((HttpLifeCycle) getLifeCycle()).getConfiguration();
+ return configuration;
+ }
+
+ public void setConfiguration(HttpConfiguration configuration) {
+ this.configuration = configuration;
+ }
+
+ /* (non-Javadoc)
+ * @see org.servicemix.common.BaseComponentLifeCycle#getExtensionMBean()
+ */
+ protected Object getExtensionMBean() throws Exception {
+ return configuration;
+ }
+
+ protected void doInit() throws Exception {
+ super.doInit();
+ // Load configuration
+ configuration.setRootDir(context.getWorkspaceRoot());
+ configuration.load();
+ // Lookup keystoreManager and authenticationService
+ if (configuration.getKeystoreManager() == null) {
+ try {
+ String name = configuration.getKeystoreManagerName();
+ Object km = context.getNamingContext().lookup(name);
+ configuration.setKeystoreManager((KeystoreManager) km);
+ } catch (Throwable e) {
+ // ignore
+ }
+ }
+ if (configuration.getAuthenticationService() == null) {
+ try {
+ String name = configuration.getAuthenticationServiceName();
+ Object as = context.getNamingContext().lookup(name);
+ configuration.setAuthenticationService((AuthenticationService)
as);
+ } catch (Throwable e) {
+ configuration.setAuthenticationService(new
JAASAuthenticationService());
+ }
+ }
+ // Create client
+ if (client == null) {
+ connectionManager = new MultiThreadedHttpConnectionManager();
+ HttpConnectionManagerParams params = new
HttpConnectionManagerParams();
+
params.setDefaultMaxConnectionsPerHost(configuration.getMaxConnectionsPerHost());
+
params.setMaxTotalConnections(configuration.getMaxTotalConnections());
+ connectionManager.setParams(params);
+ client = new HttpClient(connectionManager);
+ }
+ // Create serverManager
+ if (configuration.isManaged()) {
+ server = new ManagedContextManager();
+ } else {
+ JettyContextManager server = new JettyContextManager();
+ server.setMBeanServer(context.getMBeanServer());
+ this.server = server;
+ }
+ server.setConfiguration(configuration);
+ server.init();
+ }
+
+ protected void doShutDown() throws Exception {
+ super.doShutDown();
+ if (server != null) {
+ ContextManager s = server;
+ server = null;
+ s.shutDown();
+ }
+ if (connectionManager != null) {
+ connectionManager.shutdown();
+ }
+ }
+
+ protected void doStart() throws Exception {
+ server.start();
+ super.doStart();
+ }
+
+ protected void doStop() throws Exception {
+ super.doStop();
+ server.stop();
+ }
+
+ protected QName getEPRServiceName() {
+ return HttpResolvedEndpoint.EPR_SERVICE;
+ }
+
+ protected Endpoint getResolvedEPR(ServiceEndpoint ep) throws Exception {
+ // We receive an exchange for an EPR that has not been used yet.
+ // Register a provider endpoint and restart processing.
+ HttpEndpoint httpEp = new HttpEndpoint();
+ httpEp.setServiceUnit(new ServiceUnit(component));
+ httpEp.setService(ep.getServiceName());
+ httpEp.setEndpoint(ep.getEndpointName());
+ httpEp.setRole(MessageExchange.Role.PROVIDER);
+ URI uri = new URI(ep.getEndpointName());
+ Map map = URISupport.parseQuery(uri.getQuery());
+ if( IntrospectionSupport.setProperties(httpEp, map, "http.") ) {
+ uri = URISupport.createRemainingURI(uri, map);
+ }
+ if (httpEp.getLocationURI() == null) {
+ httpEp.setLocationURI(uri.toString());
+ }
+ httpEp.activateDynamic();
+ return httpEp;
}
/**
- * @param configuration the configuration to set
+ * @return the keystoreManager
*/
- public void setConfiguration(HttpConfiguration configuration) {
- ((HttpLifeCycle) getLifeCycle()).setConfiguration(configuration);
+ public KeystoreManager getKeystoreManager() {
+ return configuration.getKeystoreManager();
+ }
+
+ /**
+ * @param keystoreManager the keystoreManager to set
+ */
+ public void setKeystoreManager(KeystoreManager keystoreManager) {
+ this.configuration.setKeystoreManager(keystoreManager);
+ }
+
+ /**
+ * @return the authenticationService
+ */
+ public AuthenticationService getAuthenticationService() {
+ return configuration.getAuthenticationService();
}
+ /**
+ * @param authenticationService the authenticationService to set
+ */
+ public void setAuthenticationService(AuthenticationService
authenticationService) {
+ this.configuration.setAuthenticationService(authenticationService);
+ }
+
+ /**
+ * When servicemix-http is embedded inside a web application and configured
+ * to reuse the existing servlet container, this method will create and
+ * return the HTTPProcessor which will handle all servlet calls
+ * @param mappings
+ */
public HttpProcessor getMainProcessor() {
- return ((HttpLifeCycle) getLifeCycle()).getMainProcessor();
+ return server.getMainProcessor();
}
+ /* (non-Javadoc)
+ * @see org.servicemix.common.BaseComponent#createServiceUnitManager()
+ */
+ public BaseServiceUnitManager createServiceUnitManager() {
+ Deployer[] deployers = new Deployer[] { new BaseXBeanDeployer(this,
getEndpointClasses()),
+ new HttpWsdl1Deployer(this) };
+ return new BaseServiceUnitManager(this, deployers);
+ }
+
+ /* (non-Javadoc)
+ * @see
javax.jbi.component.Component#resolveEndpointReference(org.w3c.dom.DocumentFragment)
+ */
+ public ServiceEndpoint resolveEndpointReference(DocumentFragment epr) {
+ return HttpResolvedEndpoint.resolveEndpoint(epr);
+ }
+
+ protected List getConfiguredEndpoints() {
+ List answer = new ArrayList();
+ answer.addAll(asList(getEndpoints()));
+ return answer;
+ }
+
+ protected Class[] getEndpointClasses() {
+ return new Class[] { HttpEndpoint.class };
+ }
+
}
Modified:
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpEndpoint.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpEndpoint.java?view=diff&rev=454526&r1=454525&r2=454526
==============================================================================
---
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpEndpoint.java
(original)
+++
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpEndpoint.java
Mon Oct 9 14:41:55 2006
@@ -18,7 +18,7 @@
import java.net.URI;
-import javax.jbi.component.ComponentLifeCycle;
+import javax.jbi.management.DeploymentException;
import javax.jbi.servicedesc.ServiceEndpoint;
import javax.wsdl.Binding;
import javax.wsdl.Definition;
@@ -30,6 +30,7 @@
import javax.xml.namespace.QName;
import org.apache.servicemix.common.ExchangeProcessor;
+import org.apache.servicemix.common.ManagementSupport;
import org.apache.servicemix.http.processors.ConsumerProcessor;
import org.apache.servicemix.http.processors.ProviderProcessor;
import org.apache.servicemix.http.tools.PortTypeDecorator;
@@ -205,10 +206,10 @@
if (!location.endsWith("/")) {
location += "/";
}
- HttpLifeCycle lf = (HttpLifeCycle)
getServiceUnit().getComponent().getLifeCycle();
- if (lf.getConfiguration().isManaged()) {
+ HttpComponent comp = (HttpComponent)
getServiceUnit().getComponent();
+ if (comp.getConfiguration().isManaged()) {
// TODO: need to find the port of the web server
- location = "http://localhost" +
lf.getConfiguration().getMapping() + new URI(location).getPath();
+ location = "http://localhost" +
comp.getConfiguration().getMapping() + new URI(location).getPath();
}
if
(portType.getQName().getNamespaceURI().equals(service.getNamespaceURI())) {
if (isSoap()) {
@@ -265,15 +266,33 @@
}
public AuthenticationService getAuthenticationService() {
- ComponentLifeCycle lf = getServiceUnit().getComponent().getLifeCycle();
- return ((HttpLifeCycle) lf).getAuthenticationService();
+ HttpComponent comp = (HttpComponent) getServiceUnit().getComponent();
+ return comp.getAuthenticationService();
}
public KeystoreManager getKeystoreManager() {
- ComponentLifeCycle lf = getServiceUnit().getComponent().getLifeCycle();
- return ((HttpLifeCycle) lf).getKeystoreManager();
+ HttpComponent comp = (HttpComponent) getServiceUnit().getComponent();
+ return comp.getKeystoreManager();
}
+ public void validate() throws DeploymentException {
+ if (getRole() == null) {
+ throw failure("deploy", "Endpoint must have a defined role", null);
+ }
+ if (getLocationURI() == null) {
+ throw failure("deploy", "Endpoint must have a defined
locationURI", null);
+ }
+ }
+ protected DeploymentException failure(String task, String info, Throwable
e) {
+ ManagementSupport.Message msg = new ManagementSupport.Message();
+ msg.setComponent(serviceUnit.getComponent().getComponentName());
+ msg.setTask(task);
+ msg.setResult("FAILED");
+ msg.setType("ERROR");
+ msg.setMessage(info);
+ msg.setException(e);
+ return new
DeploymentException(ManagementSupport.createComponentMessage(msg));
+ }
}
Modified:
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpManagedServlet.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpManagedServlet.java?view=diff&rev=454526&r1=454525&r2=454526
==============================================================================
---
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpManagedServlet.java
(original)
+++
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpManagedServlet.java
Mon Oct 9 14:41:55 2006
@@ -69,23 +69,12 @@
if (componentMBean == null) {
throw new IllegalStateException("Unable to find component " +
componentName);
}
- if (componentMBean.getComponent() instanceof HttpSpringComponent) {
- HttpSpringComponent component = (HttpSpringComponent)
componentMBean.getComponent();
- String mapping = config.getInitParameter(MAPPING_PROPERTY);
- if (mapping != null) {
- component.getConfiguration().setMapping(mapping);
- }
- processor = component.getMainProcessor();
- } else if (componentMBean.getComponent() instanceof HttpComponent) {
- HttpComponent component = (HttpComponent)
componentMBean.getComponent();
- String mapping = config.getInitParameter(MAPPING_PROPERTY);
- if (mapping != null) {
- component.getConfiguration().setMapping(mapping);
- }
- processor = component.getMainProcessor();
- } else {
- throw new IllegalStateException("The component is not an instance
of HttpSpringComponent");
+ HttpComponent component = (HttpComponent)
componentMBean.getComponent();
+ String mapping = config.getInitParameter(MAPPING_PROPERTY);
+ if (mapping != null) {
+ component.getConfiguration().setMapping(mapping);
}
+ processor = component.getMainProcessor();
}
protected void service(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
Modified:
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpWsdl1Deployer.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpWsdl1Deployer.java?view=diff&rev=454526&r1=454525&r2=454526
==============================================================================
---
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpWsdl1Deployer.java
(original)
+++
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpWsdl1Deployer.java
Mon Oct 9 14:41:55 2006
@@ -22,8 +22,8 @@
import javax.wsdl.extensions.soap.SOAPAddress;
import javax.wsdl.extensions.soap.SOAPBinding;
-import org.apache.servicemix.common.BaseComponent;
import org.apache.servicemix.common.Endpoint;
+import org.apache.servicemix.common.ServiceMixComponent;
import org.apache.servicemix.common.wsdl1.AbstractWsdl1Deployer;
import org.apache.servicemix.common.wsdl1.JbiEndpoint;
@@ -33,7 +33,7 @@
*/
public class HttpWsdl1Deployer extends AbstractWsdl1Deployer {
- public HttpWsdl1Deployer(BaseComponent component) {
+ public HttpWsdl1Deployer(ServiceMixComponent component) {
super(component);
}
@@ -56,7 +56,6 @@
endpoint.setDefaultMep(jbiEndpoint.getDefaultMep());
endpoint.setDefaultOperation(jbiEndpoint.getDefaultOperation());
endpoint.setLocationURI(((HTTPAddress)
portElement).getLocationURI());
- endpoint.setBinding(bindingElement);
return endpoint;
} else if (portElement instanceof SOAPAddress && bindingElement
instanceof SOAPBinding) {
HttpEndpoint endpoint = new HttpEndpoint();
@@ -65,7 +64,6 @@
endpoint.setDefaultMep(jbiEndpoint.getDefaultMep());
endpoint.setDefaultOperation(jbiEndpoint.getDefaultOperation());
endpoint.setLocationURI(((SOAPAddress)
portElement).getLocationURI());
- endpoint.setBinding(bindingElement);
return endpoint;
} else {
return null;
Modified:
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpXBeanDeployer.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpXBeanDeployer.java?view=diff&rev=454526&r1=454525&r2=454526
==============================================================================
---
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpXBeanDeployer.java
(original)
+++
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpXBeanDeployer.java
Mon Oct 9 14:41:55 2006
@@ -18,6 +18,7 @@
import org.apache.servicemix.common.BaseComponent;
import org.apache.servicemix.common.Endpoint;
+import org.apache.servicemix.common.ManagementSupport;
import org.apache.servicemix.common.xbean.AbstractXBeanDeployer;
import javax.jbi.management.DeploymentException;
@@ -42,5 +43,16 @@
return true;
}
+
+ protected DeploymentException failure(String task, String info, Throwable
e) {
+ ManagementSupport.Message msg = new ManagementSupport.Message();
+ msg.setComponent(component.getComponentName());
+ msg.setTask(task);
+ msg.setResult("FAILED");
+ msg.setType("ERROR");
+ msg.setMessage(info);
+ msg.setException(e);
+ return new
DeploymentException(ManagementSupport.createComponentMessage(msg));
+ }
}
Modified:
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java?view=diff&rev=454526&r1=454525&r2=454526
==============================================================================
---
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java
(original)
+++
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java
Mon Oct 9 14:41:55 2006
@@ -39,8 +39,8 @@
import org.apache.servicemix.common.BaseLifeCycle;
import org.apache.servicemix.common.ExchangeProcessor;
import org.apache.servicemix.http.ContextManager;
+import org.apache.servicemix.http.HttpComponent;
import org.apache.servicemix.http.HttpEndpoint;
-import org.apache.servicemix.http.HttpLifeCycle;
import org.apache.servicemix.http.HttpProcessor;
import org.apache.servicemix.http.SslParameters;
import org.apache.servicemix.http.jetty.JaasJettyPrincipal;
@@ -259,8 +259,8 @@
}
protected ContextManager getServerManager() {
- HttpLifeCycle lf = (HttpLifeCycle)
endpoint.getServiceUnit().getComponent().getLifeCycle();
- return lf.getServer();
+ HttpComponent comp = (HttpComponent)
endpoint.getServiceUnit().getComponent();
+ return comp.getServer();
}
protected void generateDocument(HttpServletResponse response, Node node)
throws Exception {
Modified:
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java?view=diff&rev=454526&r1=454525&r2=454526
==============================================================================
---
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java
(original)
+++
incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java
Mon Oct 9 14:41:55 2006
@@ -24,7 +24,6 @@
import java.util.Iterator;
import java.util.Map;
-import javax.jbi.component.ComponentLifeCycle;
import javax.jbi.messaging.DeliveryChannel;
import javax.jbi.messaging.ExchangeStatus;
import javax.jbi.messaging.Fault;
@@ -49,9 +48,9 @@
import org.apache.commons.httpclient.protocol.ProtocolSocketFactory;
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.http.HttpLifeCycle;
import org.apache.servicemix.soap.Context;
import org.apache.servicemix.soap.SoapHelper;
import org.apache.servicemix.soap.marshalers.SoapMessage;
@@ -244,8 +243,8 @@
}
protected HttpConfiguration getConfiguration(HttpEndpoint endpoint) {
- ComponentLifeCycle lf =
endpoint.getServiceUnit().getComponent().getLifeCycle();
- return ((HttpLifeCycle) lf).getConfiguration();
+ HttpComponent comp = (HttpComponent)
endpoint.getServiceUnit().getComponent();
+ return comp.getConfiguration();
}
public void stop() throws Exception {
@@ -272,8 +271,8 @@
}
protected RequestEntity writeMessage(SoapWriter writer) throws Exception {
- HttpLifeCycle lf = (HttpLifeCycle)
endpoint.getServiceUnit().getComponent().getLifeCycle();
- if (lf.getConfiguration().isStreamingEnabled()) {
+ HttpComponent comp = (HttpComponent)
endpoint.getServiceUnit().getComponent();
+ if (comp.getConfiguration().isStreamingEnabled()) {
return new StreamingRequestEntity(writer);
} else {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -283,8 +282,8 @@
}
protected HttpClient getClient() {
- HttpLifeCycle lf = (HttpLifeCycle)
endpoint.getServiceUnit().getComponent().getLifeCycle();
- return lf.getClient();
+ HttpComponent comp = (HttpComponent)
endpoint.getServiceUnit().getComponent();
+ return comp.getClient();
}
public static class StreamingRequestEntity implements RequestEntity {
Modified:
incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpConsumerTest.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpConsumerTest.java?view=diff&rev=454526&r1=454525&r2=454526
==============================================================================
---
incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpConsumerTest.java
(original)
+++
incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpConsumerTest.java
Mon Oct 9 14:41:55 2006
@@ -62,7 +62,7 @@
protected long testInOnly(String msg, boolean streaming) throws Exception {
// HTTP Component
HttpComponent component = new HttpComponent();
- ((HttpLifeCycle)
component.getLifeCycle()).getConfiguration().setStreamingEnabled(streaming);
+ component.getConfiguration().setStreamingEnabled(streaming);
container.activateComponent(component, "HTTPComponent");
// Add a receiver component
@@ -111,7 +111,7 @@
protected long testInOut(String msg, boolean streaming) throws Exception {
// HTTP Component
HttpComponent component = new HttpComponent();
- ((HttpLifeCycle)
component.getLifeCycle()).getConfiguration().setStreamingEnabled(streaming);
+ component.getConfiguration().setStreamingEnabled(streaming);
container.activateComponent(component, "HTTPComponent");
// Add a receiver component
@@ -163,10 +163,16 @@
public void testInOnly() throws Exception {
testInOnly("<hello>world</hello>", false);
+ // Pause to avoid reusing the same http connection
+ // to read the wsdl, has the server has changed
+ Thread.sleep(1000);
}
public void testInOut() throws Exception {
testInOut("<hello>world</hello>", true);
+ // Pause to avoid reusing the same http connection
+ // to read the wsdl, has the server has changed
+ Thread.sleep(1000);
}
public void testPerfInOnlyWithBigMessage() throws Exception {
Modified:
incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpProviderTest.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpProviderTest.java?view=diff&rev=454526&r1=454525&r2=454526
==============================================================================
---
incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpProviderTest.java
(original)
+++
incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpProviderTest.java
Mon Oct 9 14:41:55 2006
@@ -60,8 +60,7 @@
protected long testInOnly(String msg, boolean streaming) throws
Exception {
// HTTP Component
HttpComponent component = new HttpComponent();
- ((HttpLifeCycle) component.getLifeCycle()).getConfiguration()
- .setStreamingEnabled(streaming);
+ component.getConfiguration().setStreamingEnabled(streaming);
container.activateComponent(component, "HttpProviderTest");
// Add a receiver component
@@ -71,7 +70,7 @@
container.activateComponent(asReceiver);
// Add the http receiver
- HttpSpringComponent connector = new HttpSpringComponent();
+ HttpComponent connector = new HttpComponent();
HttpEndpoint endpoint = new HttpEndpoint();
endpoint.setRole(Role.CONSUMER);
endpoint.setLocationURI("http://localhost:8192/");
@@ -121,8 +120,7 @@
protected String testInOut(String msg, boolean streaming) throws
Exception {
// HTTP Component
HttpComponent component = new HttpComponent();
- ((HttpLifeCycle) component.getLifeCycle()).getConfiguration()
- .setStreamingEnabled(streaming);
+ component.getConfiguration().setStreamingEnabled(streaming);
container.activateComponent(component, "HTTPComponent");
// Add a echo component
@@ -132,7 +130,7 @@
container.activateComponent(asReceiver);
// Add the http receiver
- HttpSpringComponent connector = new HttpSpringComponent();
+ HttpComponent connector = new HttpComponent();
HttpEndpoint endpoint = new HttpEndpoint();
endpoint.setRole(Role.CONSUMER);
endpoint.setLocationURI("http://localhost:8192/");
Modified:
incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSoapTest.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSoapTest.java?view=diff&rev=454526&r1=454525&r2=454526
==============================================================================
---
incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSoapTest.java
(original)
+++
incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSoapTest.java
Mon Oct 9 14:41:55 2006
@@ -85,7 +85,7 @@
}
public void testFaultOnParse() throws Exception {
- HttpSpringComponent http = new HttpSpringComponent();
+ HttpComponent http = new HttpComponent();
HttpEndpoint ep = new HttpEndpoint();
ep.setService(new QName("urn:test", "echo"));
ep.setEndpoint("echo");
@@ -110,7 +110,7 @@
echo.setEndpoint("echo");
container.activateComponent(echo, "echo");
- HttpSpringComponent http = new HttpSpringComponent();
+ HttpComponent http = new HttpComponent();
HttpEndpoint ep1 = new HttpEndpoint();
ep1.setService(new QName("urn:test", "echo"));
@@ -145,7 +145,7 @@
echo.setEndpoint("echo");
container.activateComponent(echo, "echo");
- HttpSpringComponent http = new HttpSpringComponent();
+ HttpComponent http = new HttpComponent();
HttpEndpoint ep1 = new HttpEndpoint();
ep1.setService(new QName("urn:test", "s1"));
@@ -186,7 +186,7 @@
echo.setEndpoint("echo");
container.activateComponent(echo, "echo");
- HttpSpringComponent http = new HttpSpringComponent();
+ HttpComponent http = new HttpComponent();
HttpEndpoint ep1 = new HttpEndpoint();
ep1.setService(new QName("urn:test", "s1"));
@@ -274,7 +274,7 @@
ep3.setDefaultMep(URI.create("http://www.w3.org/2004/08/wsdl/in-out"));
ep3.setSoap(true);
- HttpSpringComponent http = new HttpSpringComponent();
+ HttpComponent http = new HttpComponent();
http.setEndpoints(new HttpEndpoint[] { ep1, ep2, ep3 });
container.activateComponent(http, "http1");
@@ -337,7 +337,7 @@
ep3.setDefaultMep(URI.create("http://www.w3.org/2004/08/wsdl/in-out"));
ep3.setSoap(true);
- HttpSpringComponent http = new HttpSpringComponent();
+ HttpComponent http = new HttpComponent();
http.setEndpoints(new HttpEndpoint[] { ep1, ep2, ep3 });
container.activateComponent(http, "http1");
@@ -394,7 +394,7 @@
ep3.setDefaultMep(URI.create("http://www.w3.org/2004/08/wsdl/in-only"));
ep3.setSoap(true);
- HttpSpringComponent http = new HttpSpringComponent();
+ HttpComponent http = new HttpComponent();
http.setEndpoints(new HttpEndpoint[] { ep1, ep2, ep3 });
container.activateComponent(http, "http1");
@@ -427,7 +427,7 @@
echo.setEndpoint("echo");
container.activateComponent(echo, "echo");
- HttpSpringComponent http = new HttpSpringComponent();
+ HttpComponent http = new HttpComponent();
HttpEndpoint ep0 = new HttpEndpoint();
ep0.setService(new QName("urn:test", "s0"));
Modified:
incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpTxTest.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpTxTest.java?view=diff&rev=454526&r1=454525&r2=454526
==============================================================================
---
incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpTxTest.java
(original)
+++
incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpTxTest.java
Mon Oct 9 14:41:55 2006
@@ -101,7 +101,7 @@
ep1.setDefaultMep(URI.create("http://www.w3.org/2004/08/wsdl/in-out"));
ep1.setSoap(true);
- HttpSpringComponent http = new HttpSpringComponent();
+ HttpComponent http = new HttpComponent();
http.setEndpoints(new HttpEndpoint[] { ep0, ep1 });
jbi.activateComponent(http, "http");
@@ -139,7 +139,7 @@
ep1.setDefaultMep(URI.create("http://www.w3.org/2004/08/wsdl/in-out"));
ep1.setSoap(true);
- HttpSpringComponent http = new HttpSpringComponent();
+ HttpComponent http = new HttpComponent();
http.setEndpoints(new HttpEndpoint[] { ep0, ep1 });
jbi.activateComponent(http, "http");
Modified:
incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpURITest.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpURITest.java?view=diff&rev=454526&r1=454525&r2=454526
==============================================================================
---
incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpURITest.java
(original)
+++
incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpURITest.java
Mon Oct 9 14:41:55 2006
@@ -53,7 +53,7 @@
}
public void testResolveEndpoint() throws Exception {
- HttpSpringComponent http = new HttpSpringComponent();
+ HttpComponent http = new HttpComponent();
HttpEndpoint ep = new HttpEndpoint();
ep.setRole(MessageExchange.Role.CONSUMER);
ep.setService(ReceiverComponent.SERVICE);
@@ -67,7 +67,7 @@
jbi.activateComponent(receiver, "receiver");
DefaultServiceMixClient client = new DefaultServiceMixClient(jbi);
- DocumentFragment epr =
URIResolver.createWSAEPR("http://localhost:8192?http.soap=true");
+ DocumentFragment epr =
URIResolver.createWSAEPR("http://localhost:8192/?http.soap=true");
ServiceEndpoint se = client.getContext().resolveEndpointReference(epr);
assertNotNull(se);
Modified:
incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpWsdlTest.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpWsdlTest.java?view=diff&rev=454526&r1=454525&r2=454526
==============================================================================
---
incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpWsdlTest.java
(original)
+++
incubator/servicemix/trunk/servicemix-http/src/test/java/org/apache/servicemix/http/HttpWsdlTest.java
Mon Oct 9 14:41:55 2006
@@ -85,7 +85,7 @@
ep.setRoleAsString("consumer");
ep.setLocationURI("http://localhost:" + portNumber + "/Service");
ep.setSoap(true);
- HttpSpringComponent http = new HttpSpringComponent();
+ HttpComponent http = new HttpComponent();
http.setEndpoints(new HttpEndpoint[] { ep });
container.activateComponent(http, "HttpWsdlTest");
@@ -181,7 +181,7 @@
ep.setRoleAsString("consumer");
ep.setLocationURI("http://localhost:8196/Service/");
ep.setWsdlResource(new
UrlResource("http://www.ws-i.org/SampleApplications/SupplyChainManagement/2002-08/Retailer.wsdl"));
- HttpSpringComponent http = new HttpSpringComponent();
+ HttpComponent http = new HttpComponent();
http.setEndpoints(new HttpEndpoint[] { ep });
container.activateComponent(http, "HttpWsdlTest");