You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ff...@apache.org on 2012/08/17 09:56:24 UTC
svn commit: r1374169 [3/3] - in /servicemix/components/trunk: ./
bindings/servicemix-cxf-bc/ bindings/servicemix-http/
bindings/servicemix-http/src/main/java/org/apache/servicemix/http/
bindings/servicemix-http/src/main/java/org/apache/servicemix/http/...
Modified: servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/ProviderEndpointTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/ProviderEndpointTest.java?rev=1374169&r1=1374168&r2=1374169&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/ProviderEndpointTest.java (original)
+++ servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/ProviderEndpointTest.java Fri Aug 17 07:56:22 2012
@@ -16,46 +16,38 @@
*/
package org.apache.servicemix.http;
-import java.util.concurrent.atomic.AtomicReference;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.io.IOException;
-
-import javax.jbi.messaging.InOut;
-import javax.jbi.messaging.ExchangeStatus;
-import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.NormalizedMessage;
-import javax.jbi.messaging.MessagingException;
-import javax.jbi.component.ComponentContext;
-import javax.xml.namespace.QName;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.ServletContext;
-
import junit.framework.TestCase;
-
import org.apache.servicemix.client.DefaultServiceMixClient;
import org.apache.servicemix.client.ServiceMixClient;
import org.apache.servicemix.components.util.EchoComponent;
+import org.apache.servicemix.http.endpoints.DefaultHttpConsumerMarshaler;
import org.apache.servicemix.http.endpoints.HttpConsumerEndpoint;
import org.apache.servicemix.http.endpoints.HttpProviderEndpoint;
import org.apache.servicemix.http.endpoints.HttpSoapProviderEndpoint;
-import org.apache.servicemix.http.endpoints.HttpConsumerMarshaler;
-import org.apache.servicemix.http.endpoints.DefaultHttpConsumerMarshaler;
import org.apache.servicemix.jbi.container.JBIContainer;
import org.apache.servicemix.jbi.jaxp.SourceTransformer;
import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.nio.SelectChannelConnector;
+import org.eclipse.jetty.servlet.ServletHandler;
+import org.eclipse.jetty.servlets.ProxyServlet;
import org.springframework.core.io.ClassPathResource;
-import org.mortbay.proxy.AsyncProxyServlet;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.Handler;
-import org.mortbay.jetty.servlet.ServletHandler;
-import org.mortbay.jetty.nio.SelectChannelConnector;
+
+import javax.jbi.component.ComponentContext;
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.InOut;
+import javax.jbi.messaging.MessageExchange;
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.namespace.QName;
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.util.concurrent.atomic.AtomicReference;
public class ProviderEndpointTest extends TestCase {
- Integer port1 = Integer.parseInt(System.getProperty("http.port1"));
- Integer port2 = Integer.parseInt(System.getProperty("http.port2"));
+ Integer port1 = Integer.parseInt(System.getProperty("http.port1", "61101"));
+ Integer port2 = Integer.parseInt(System.getProperty("http.port2", "61102"));
protected JBIContainer container;
protected SourceTransformer transformer = new SourceTransformer();
@@ -334,8 +326,8 @@ public class ProviderEndpointTest extend
connector.setPort(port2);
proxy.addConnector(connector);
ServletHandler handler = new ServletHandler();
- handler.addServletWithMapping(AsyncProxyServlet.class, "/");
- proxy.addHandler(handler);
+ handler.addServletWithMapping(ProxyServlet.class, "/");
+ proxy.setHandler(handler);
proxy.start();
ServiceMixClient client = new DefaultServiceMixClient(container);
Modified: servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/ServerManagerTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/ServerManagerTest.java?rev=1374169&r1=1374168&r2=1374169&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/ServerManagerTest.java (original)
+++ servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/ServerManagerTest.java Fri Aug 17 07:56:22 2012
@@ -16,11 +16,7 @@
*/
package org.apache.servicemix.http;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
import junit.framework.TestCase;
-
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.methods.GetMethod;
@@ -28,18 +24,21 @@ import org.apache.commons.httpclient.met
import org.apache.commons.httpclient.methods.StringRequestEntity;
import org.apache.servicemix.components.http.InvalidStatusResponseException;
import org.apache.servicemix.http.jetty.JettyContextManager;
-import org.mortbay.jetty.handler.ContextHandler;
-import org.mortbay.thread.QueuedThreadPool;
+import org.eclipse.jetty.server.handler.ContextHandler;
+import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
public class ServerManagerTest extends TestCase {
private final static Logger logger = LoggerFactory.getLogger(ServerManagerTest.class);
- String port1 = System.getProperty("http.port1");
- String port2 = System.getProperty("http.port2");
- String port3 = System.getProperty("http.port3");
+ String port1 = System.getProperty("http.port1", "61101");
+ String port2 = System.getProperty("http.port2", "61101");
+ String port3 = System.getProperty("http.port3", "61101");
protected JettyContextManager server;
protected HttpConfiguration configuration;
Modified: servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/WsdlRoundtripTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/WsdlRoundtripTest.java?rev=1374169&r1=1374168&r2=1374169&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/WsdlRoundtripTest.java (original)
+++ servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/WsdlRoundtripTest.java Fri Aug 17 07:56:22 2012
@@ -16,7 +16,16 @@
*/
package org.apache.servicemix.http;
-import java.io.StringWriter;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.servicemix.jbi.jaxp.SourceTransformer;
+import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.apache.servicemix.tck.SpringTestSupport;
+import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.w3c.dom.Document;
import javax.servlet.http.HttpServletResponse;
import javax.wsdl.Binding;
@@ -26,24 +35,13 @@ import javax.wsdl.extensions.Extensibili
import javax.wsdl.extensions.soap.SOAPOperation;
import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.apache.servicemix.jbi.jaxp.SourceTransformer;
-import org.apache.servicemix.jbi.jaxp.StringSource;
-import org.apache.servicemix.tck.SpringTestSupport;
-import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
-import org.springframework.context.support.AbstractXmlApplicationContext;
+import java.io.StringWriter;
public class WsdlRoundtripTest extends SpringTestSupport {
private final Logger logger = LoggerFactory.getLogger(WsdlRoundtripTest.class);
- String port1 = System.getProperty("http.port1");
+ String port1 = System.getProperty("http.port1", "61101");
protected AbstractXmlApplicationContext createBeanFactory() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[] { "org/apache/servicemix/http/wsdlroundtrip.xml" }, false);
Modified: servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/addressing/AddressingConsumerTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/addressing/AddressingConsumerTest.java?rev=1374169&r1=1374168&r2=1374169&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/addressing/AddressingConsumerTest.java (original)
+++ servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/addressing/AddressingConsumerTest.java Fri Aug 17 07:56:22 2012
@@ -1,36 +1,34 @@
package org.apache.servicemix.http.addressing;
-import java.net.URLConnection;
-import java.net.URL;
-import java.io.OutputStream;
-import java.io.InputStream;
-import java.io.ByteArrayOutputStream;
-
-import javax.xml.namespace.QName;
-import javax.jbi.servicedesc.ServiceEndpoint;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-
import junit.framework.TestCase;
+import org.apache.servicemix.components.util.EchoComponent;
+import org.apache.servicemix.executors.impl.ExecutorFactoryImpl;
import org.apache.servicemix.http.HttpComponent;
import org.apache.servicemix.http.HttpEndpointType;
import org.apache.servicemix.http.endpoints.HttpSoapConsumerEndpoint;
import org.apache.servicemix.jbi.container.JBIContainer;
import org.apache.servicemix.jbi.util.FileUtil;
-import org.apache.servicemix.executors.impl.ExecutorFactoryImpl;
-import org.apache.servicemix.soap.ws.addressing.WsAddressingPolicy;
import org.apache.servicemix.soap.api.Policy;
import org.apache.servicemix.soap.util.DomUtil;
-import org.apache.servicemix.components.util.EchoComponent;
+import org.apache.servicemix.soap.ws.addressing.WsAddressingPolicy;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
+import org.w3c.dom.Document;
+
+import javax.jbi.servicedesc.ServiceEndpoint;
+import javax.xml.namespace.QName;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.net.URLConnection;
public class AddressingConsumerTest extends TestCase {
private final Logger logger = LoggerFactory.getLogger(AddressingConsumerTest.class);
- String port1 = System.getProperty("http.port1");
+ String port1 = System.getProperty("http.port1", "61101");
protected JBIContainer container;
protected void setUp() throws Exception {
Modified: servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/DefaultHttpProviderMarshalerTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/DefaultHttpProviderMarshalerTest.java?rev=1374169&r1=1374168&r2=1374169&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/DefaultHttpProviderMarshalerTest.java (original)
+++ servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/DefaultHttpProviderMarshalerTest.java Fri Aug 17 07:56:22 2012
@@ -1,21 +1,19 @@
package org.apache.servicemix.http.endpoints;
-import java.util.HashMap;
-
-import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.NormalizedMessage;
-
+import junit.framework.TestCase;
import org.apache.servicemix.expression.PropertyExpression;
import org.apache.servicemix.http.jetty.SmxHttpExchange;
import org.apache.servicemix.jbi.jaxp.StringSource;
import org.apache.servicemix.tck.mock.MockExchangeFactory;
-import org.mortbay.jetty.HttpMethods;
+import org.eclipse.jetty.http.HttpMethods;
-import junit.framework.TestCase;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.NormalizedMessage;
+import java.util.HashMap;
public class DefaultHttpProviderMarshalerTest extends TestCase {
- String port1 = System.getProperty("http.port1");
+ String port1 = System.getProperty("http.port1", "61101");
private DefaultHttpProviderMarshaler defHttpProviderMarshaler;
Modified: servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/HttpConsumerLateResponseHandlingTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/HttpConsumerLateResponseHandlingTest.java?rev=1374169&r1=1374168&r2=1374169&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/HttpConsumerLateResponseHandlingTest.java (original)
+++ servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/HttpConsumerLateResponseHandlingTest.java Fri Aug 17 07:56:22 2012
@@ -23,13 +23,16 @@ import org.apache.commons.httpclient.met
import org.apache.servicemix.components.util.EchoComponent;
import org.apache.servicemix.http.HttpComponent;
import org.apache.servicemix.http.HttpEndpointType;
+import org.apache.servicemix.http.LateResponseStrategy;
import org.apache.servicemix.http.PortFinder;
import org.apache.servicemix.http.exception.LateResponseException;
import org.apache.servicemix.jbi.container.JBIContainer;
import org.apache.servicemix.jbi.helper.MessageUtil;
import javax.jbi.JBIException;
-import javax.jbi.messaging.*;
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.MessagingException;
import javax.xml.namespace.QName;
import java.io.IOException;
import java.util.concurrent.CountDownLatch;
@@ -62,21 +65,21 @@ public class HttpConsumerLateResponseHan
}
public void testInOutWithStrategyError() throws Exception {
- MessageExchange exchange = doTestInOutWithStrategy(HttpConsumerEndpoint.LateResponseStrategy.error);
+ MessageExchange exchange = doTestInOutWithStrategy(LateResponseStrategy.error);
assertEquals("Exchange should have ended in ERROR", ExchangeStatus.ERROR, exchange.getStatus());
assertTrue("Expecting a LateResponseException, but was " + exchange.getError().getClass().getName(),
exchange.getError() instanceof LateResponseException);
}
public void testInOutWithStrategyWarning() throws Exception {
- MessageExchange exchange = doTestInOutWithStrategy(HttpConsumerEndpoint.LateResponseStrategy.warning);
+ MessageExchange exchange = doTestInOutWithStrategy(LateResponseStrategy.warning);
assertEquals("Exchange should have ended normally", ExchangeStatus.DONE, exchange.getStatus());
}
/*
* Perform test for strategy and return MessageExchange object being sent/received
*/
- private MessageExchange doTestInOutWithStrategy(HttpConsumerEndpoint.LateResponseStrategy strategy) throws JBIException, IOException, InterruptedException {
+ private MessageExchange doTestInOutWithStrategy(LateResponseStrategy strategy) throws JBIException, IOException, InterruptedException {
HttpComponent http = new HttpComponent();
HttpConsumerEndpoint ep = new HttpConsumerEndpoint();
ep.setService(new QName("urn:test", "svc"));
Modified: servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/HttpProviderExpirationTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/HttpProviderExpirationTest.java?rev=1374169&r1=1374168&r2=1374169&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/HttpProviderExpirationTest.java (original)
+++ servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/HttpProviderExpirationTest.java Fri Aug 17 07:56:22 2012
@@ -16,17 +16,7 @@
*/
package org.apache.servicemix.http.endpoints;
-import java.net.URI;
-
-import javax.jbi.messaging.InOut;
-import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.NormalizedMessage;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.namespace.QName;
-
import junit.framework.TestCase;
-
import org.apache.activemq.broker.BrokerService;
import org.apache.servicemix.client.DefaultServiceMixClient;
import org.apache.servicemix.client.Destination;
@@ -38,6 +28,14 @@ import org.apache.servicemix.jbi.jaxp.St
import org.apache.servicemix.jbi.nmr.flow.Flow;
import org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow;
+import javax.jbi.messaging.InOut;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+import java.net.URI;
+
/**
*
* @author ioannis canellos
@@ -45,7 +43,7 @@ import org.apache.servicemix.jbi.nmr.flo
public class HttpProviderExpirationTest extends TestCase {
String activemq = System.getProperty("activemq.port");
- String port1 = System.getProperty("http.port1");
+ String port1 = System.getProperty("http.port1", "61101");
private JBIContainer jbi;
private BrokerService broker;
Modified: servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/SerializedMarshalerTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/SerializedMarshalerTest.java?rev=1374169&r1=1374168&r2=1374169&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/SerializedMarshalerTest.java (original)
+++ servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/endpoints/SerializedMarshalerTest.java Fri Aug 17 07:56:22 2012
@@ -16,17 +16,9 @@
*/
package org.apache.servicemix.http.endpoints;
-import javax.jbi.component.ComponentContext;
-import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessagingException;
-import javax.jbi.messaging.NormalizedMessage;
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
-
+import junit.framework.TestCase;
import org.apache.servicemix.components.util.TransformComponentSupport;
import org.apache.servicemix.http.HttpComponent;
import org.apache.servicemix.http.HttpEndpointType;
@@ -41,10 +33,16 @@ import org.springframework.remoting.supp
import org.springframework.remoting.support.RemoteInvocation;
import org.springframework.remoting.support.RemoteInvocationResult;
+import javax.jbi.component.ComponentContext;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.MessagingException;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.xml.namespace.QName;
+
public class SerializedMarshalerTest extends TestCase {
- String port1 = System.getProperty("http.port1");
+ String port1 = System.getProperty("http.port1", "61101");
protected JBIContainer container;
protected ComponentContext context;
Modified: servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/exception/HttpTimeoutExceptionTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/exception/HttpTimeoutExceptionTest.java?rev=1374169&r1=1374168&r2=1374169&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/exception/HttpTimeoutExceptionTest.java (original)
+++ servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/exception/HttpTimeoutExceptionTest.java Fri Aug 17 07:56:22 2012
@@ -37,7 +37,7 @@ public class HttpTimeoutExceptionTest ex
}
public void testMessageWithNullExchange() throws MessagingException {
- HttpTimeoutException exception = new HttpTimeoutException(null);
+ HttpTimeoutException exception = new HttpTimeoutException((String)null);
assertNotNull("We still expect some kind of message", exception.getMessage());
}
Modified: servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/jetty/ContinuationHelperTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/jetty/ContinuationHelperTest.java?rev=1374169&r1=1374168&r2=1374169&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/jetty/ContinuationHelperTest.java (original)
+++ servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/jetty/ContinuationHelperTest.java Fri Aug 17 07:56:22 2012
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.servicemix.http.jetty;
-
-import junit.framework.TestCase;
-import org.mortbay.util.ajax.Continuation;
-
-import static org.apache.servicemix.http.jetty.ContinuationHelper.isNewContinuation;
-
-/**
- * Test case for {@link ContinuationHelper}
- */
-public class ContinuationHelperTest extends TestCase {
-
-
- public void testIsNewContinuation() {
- assertTrue(isNewContinuation(new MockContinuation(true, null, null)));
- assertTrue(isNewContinuation(new MockContinuation(false, false, false)));
-
- assertFalse(isNewContinuation(new MockContinuation(false, true, false)));
- assertFalse(isNewContinuation(new MockContinuation(false, false, true)));
- }
-
- protected static final class MockContinuation implements Continuation {
-
- private boolean isNew;
- private Boolean pending;
- private Boolean resumed;
-
- protected MockContinuation(boolean isNew, Boolean pending, Boolean resumed) {
- super();
- this.isNew = isNew;
- this.pending = pending;
- this.resumed = resumed;
- }
-
- public boolean suspend(long l) {
- throw new UnsupportedOperationException("Not yet supported");
- }
-
- public void resume() {
- throw new UnsupportedOperationException("Not yet supported");
- }
-
- public void reset() {
- throw new UnsupportedOperationException("Not yet supported");
- }
-
- public boolean isNew() {
- return isNew;
- }
-
- public boolean isPending() {
- return pending;
- }
-
- public boolean isResumed() {
- return resumed;
- }
-
- public Object getObject() {
- throw new UnsupportedOperationException("Not yet supported");
- }
-
- public void setObject(Object o) {
- throw new UnsupportedOperationException("Not yet supported");
- }
- }
-}
Modified: servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/jetty/JaasUserRealmTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/jetty/JaasUserRealmTest.java?rev=1374169&r1=1374168&r2=1374169&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/jetty/JaasUserRealmTest.java (original)
+++ servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/jetty/JaasUserRealmTest.java Fri Aug 17 07:56:22 2012
@@ -16,17 +16,15 @@
*/
package org.apache.servicemix.http.jetty;
-import java.security.GeneralSecurityException;
-import java.security.Principal;
-
-import javax.security.auth.Subject;
-
import junit.framework.TestCase;
-
import org.apache.servicemix.common.security.AuthenticationService;
+import org.eclipse.jetty.server.UserIdentity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.security.auth.Subject;
+import java.security.GeneralSecurityException;
+
public class JaasUserRealmTest extends TestCase {
private final static Logger logger = LoggerFactory.getLogger(JaasUserRealmTest.class);
@@ -51,55 +49,41 @@ public class JaasUserRealmTest extends T
// Test authenticate() when username is null
public void testAuthenticateUsernameIsNull() throws Exception {
- assertNull("authenticate() should return null for null username", jaasUserRealm.authenticate(null, null, null));
+ assertNull("authenticate() should return null for null username", jaasUserRealm.login(null, null));
}
// Test authenticate() when authenticationService's authenticate throws
// a GeneralSecurityException
public void testAuthenticateFails() throws Exception {
String msg = "authenticate() should return null when authService authenticate fails";
- assertNull(msg, jaasUserRealm.authenticate(USERNAME, null, null));
+ assertNull(msg, jaasUserRealm.login(USERNAME, null));
}
// Test authenticate() when authenticationService's authenticate is successful.
public void testAuthenticateSuccess() throws Exception {
- Principal userPrincipal = jaasUserRealm.authenticate(USERNAME, PASSWORD, null);
+ UserIdentity userPrincipal = jaasUserRealm.login(USERNAME, PASSWORD);
assertNotNull("authenticate() should return non-null Principal", userPrincipal);
}
// Test logout() when user logged in
public void testLogoutUserLoggedIn() throws Exception {
// authenticate the user
- Principal userPrincipal = jaasUserRealm.authenticate(USERNAME, PASSWORD, null);
+ UserIdentity userPrincipal = jaasUserRealm.login(USERNAME, PASSWORD);
// now log them out
jaasUserRealm.logout(userPrincipal);
// verify the user is not in the map
- assertNull("logout() should have removed principal: " + USERNAME, jaasUserRealm.getPrincipal(USERNAME));
+ assertNull("logout() should have removed principal: " + USERNAME, jaasUserRealm.loadUser(USERNAME));
}
// Test logout() when user not logged in
public void testLogoutUserNotLoggedIn() throws Exception {
- Principal userPrincipal = new JaasJettyPrincipal(USERNAME);
+ UserIdentity userPrincipal = new JaasJettyPrincipal(new Subject(), USERNAME, null);
// user principal not added to the map via authenticate
jaasUserRealm.logout(userPrincipal);
// verify the user is not in the map
- assertNull("logout() should have removed principal: " + USERNAME, jaasUserRealm.getPrincipal(USERNAME));
- }
-
- // Test reauthenticate() when user logged in
- public void testReauthenticateUserLoggedIn() throws Exception {
- Principal userPrincipal = jaasUserRealm.authenticate(USERNAME, PASSWORD, null);
-
- assertTrue("reauthenticate() should return true for logged in user", jaasUserRealm.reauthenticate(userPrincipal));
- }
-
- // Test reauthenticate() when user not logged in
- public void testReauthenticateUserNotLoggedIn() throws Exception {
- Principal userPrincipal = new JaasJettyPrincipal(USERNAME);
-
- assertFalse("reauthenticate() should return false for user not logged in", jaasUserRealm.reauthenticate(userPrincipal));
+ assertNull("logout() should have removed principal: " + USERNAME, jaasUserRealm.loadUser(USERNAME));
}
// Mock implementation of an AuthenticationService to help with testing.
Modified: servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/jetty/SmxHttpExchangeTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/jetty/SmxHttpExchangeTest.java?rev=1374169&r1=1374168&r2=1374169&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/jetty/SmxHttpExchangeTest.java (original)
+++ servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/jetty/SmxHttpExchangeTest.java Fri Aug 17 07:56:22 2012
@@ -21,7 +21,7 @@ import java.io.Reader;
import junit.framework.TestCase;
-import org.mortbay.io.ByteArrayBuffer;
+import org.eclipse.jetty.io.ByteArrayBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/security/HttpSecurityTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/security/HttpSecurityTest.java?rev=1374169&r1=1374168&r2=1374169&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/security/HttpSecurityTest.java (original)
+++ servicemix/components/trunk/bindings/servicemix-http/src/test/java/org/apache/servicemix/http/security/HttpSecurityTest.java Fri Aug 17 07:56:22 2012
@@ -16,16 +16,6 @@
*/
package org.apache.servicemix.http.security;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.net.URL;
-
-import javax.servlet.http.HttpServletResponse;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Element;
-
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.auth.AuthScope;
@@ -36,13 +26,21 @@ import org.apache.servicemix.jbi.jaxp.St
import org.apache.servicemix.jbi.util.FileUtil;
import org.apache.servicemix.tck.SpringTestSupport;
import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.w3c.dom.Element;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.net.URL;
public class HttpSecurityTest extends SpringTestSupport {
private final static Logger logger = LoggerFactory.getLogger(HttpSecurityTest.class);
- String port1 = System.getProperty("http.port1");
+ String port1 = System.getProperty("http.port1", "61101");
static {
String path = System.getProperty("java.security.auth.login.config");
Modified: servicemix/components/trunk/bindings/servicemix-http/src/test/resources/log4j-tests.properties
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-http/src/test/resources/log4j-tests.properties?rev=1374169&r1=1374168&r2=1374169&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-http/src/test/resources/log4j-tests.properties (original)
+++ servicemix/components/trunk/bindings/servicemix-http/src/test/resources/log4j-tests.properties Fri Aug 17 07:56:22 2012
@@ -21,7 +21,7 @@
#
# The logging properties used during tests..
#
-log4j.rootLogger=DEBUG, out
+log4j.rootLogger=DEBUG, stdout
log4j.logger.org.apache.activemq=INFO
log4j.logger.org.apache.activemq.spring=WARN
Modified: servicemix/components/trunk/engines/servicemix-jsr181/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/engines/servicemix-jsr181/pom.xml?rev=1374169&r1=1374168&r2=1374169&view=diff
==============================================================================
--- servicemix/components/trunk/engines/servicemix-jsr181/pom.xml (original)
+++ servicemix/components/trunk/engines/servicemix-jsr181/pom.xml Fri Aug 17 07:56:22 2012
@@ -98,7 +98,7 @@
</exclusion>
<exclusion>
<groupId>jetty</groupId>
- <artifactId>org.mortbay.jetty</artifactId>
+ <artifactId>org.eclipse.jetty</artifactId>
</exclusion>
<exclusion>
<groupId>commons-httpclient</groupId>
@@ -152,7 +152,7 @@
</exclusion>
<exclusion>
<groupId>jetty</groupId>
- <artifactId>org.mortbay.jetty</artifactId>
+ <artifactId>org.eclipse.jetty</artifactId>
</exclusion>
<exclusion>
<groupId>commons-httpclient</groupId>
Modified: servicemix/components/trunk/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/pom.xml?rev=1374169&r1=1374168&r2=1374169&view=diff
==============================================================================
--- servicemix/components/trunk/pom.xml (original)
+++ servicemix/components/trunk/pom.xml Fri Aug 17 07:56:22 2012
@@ -52,11 +52,11 @@
<repositories>
<!-- ServiceMix Maven Repository, required at least for opensaml -->
- <repository>
+ <!--repository>
<id>servicemix-m2-repo</id>
<name>Servicemix Maven2 Repository</name>
<url>http://svn.apache.org/repos/asf/servicemix/m2-repo/</url>
- </repository>
+ </repository-->
</repositories>
<properties>
@@ -129,7 +129,7 @@
<jaxb-xjc.version>2.1.12</jaxb-xjc.version>
<jdom.version>1.1</jdom.version>
<jencks.version>2.2</jencks.version>
- <jetty.version>6.1.26</jetty.version>
+ <jetty.version>7.5.4.v20111024</jetty.version>
<junit.version>4.7</junit.version>
<log4j.version>1.2.16</log4j.version>
<mx4j.version>3.0.1</mx4j.version>
@@ -507,28 +507,43 @@
<version>${jencks.version}</version>
</dependency>
<dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-client</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-client</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-security</artifactId>
+ <version>${jetty.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-jmx</artifactId>
+ <version>${jetty.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-server</artifactId>
+ <version>${jetty.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-webapp</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-management</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-servlet</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-util</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-servlets</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-sslengine</artifactId>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-continuation</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
@@ -757,8 +772,8 @@
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
- <artifactId>maven-jetty-plugin</artifactId>
- <version>6.1.25</version>
+ <artifactId>jetty-maven-plugin</artifactId>
+ <version>${jetty.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Modified: servicemix/components/trunk/shared-libraries/servicemix-common/src/test/java/org/apache/servicemix/common/util/MessageUtilTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/shared-libraries/servicemix-common/src/test/java/org/apache/servicemix/common/util/MessageUtilTest.java?rev=1374169&r1=1374168&r2=1374169&view=diff
==============================================================================
--- servicemix/components/trunk/shared-libraries/servicemix-common/src/test/java/org/apache/servicemix/common/util/MessageUtilTest.java (original)
+++ servicemix/components/trunk/shared-libraries/servicemix-common/src/test/java/org/apache/servicemix/common/util/MessageUtilTest.java Fri Aug 17 07:56:22 2012
@@ -16,8 +16,10 @@
*/
package org.apache.servicemix.common.util;
-import java.net.URL;
-import java.util.Set;
+import junit.framework.TestCase;
+import org.apache.servicemix.jbi.jaxp.SourceTransformer;
+import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.apache.servicemix.tck.mock.MockMessageExchange;
import javax.activation.DataHandler;
import javax.jbi.messaging.Fault;
@@ -25,15 +27,10 @@ import javax.jbi.messaging.MessageExchan
import javax.jbi.messaging.NormalizedMessage;
import javax.mail.util.ByteArrayDataSource;
import javax.security.auth.Subject;
-import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamSource;
-
-import junit.framework.TestCase;
-
-import org.apache.servicemix.common.util.MessageUtil;
-import org.apache.servicemix.jbi.jaxp.SourceTransformer;
-import org.apache.servicemix.jbi.jaxp.StringSource;
-import org.apache.servicemix.tck.mock.MockMessageExchange;
+import java.net.URL;
+import java.util.Set;
public class MessageUtilTest extends TestCase {
@@ -88,12 +85,13 @@ public class MessageUtilTest extends Tes
MessageUtil.NormalizedMessageImpl nmsg2 = new MessageUtil.NormalizedMessageImpl(src);
assertNull(nmsg2.getContent());
- URL url = new URL("http://schemas.xmlsoap.org/soap/http");
+ URL url = getClass().getClassLoader().getResource(getClass().getName().replace('.','/')+".class");
+
DataHandler urlDataHandler = new DataHandler(url);
src.addAttachment("urlId", urlDataHandler);
MessageUtil.NormalizedMessageImpl nmsg3 = new MessageUtil.NormalizedMessageImpl(src);
DataHandler dh = nmsg3.getAttachment("urlId");
- assertTrue(dh.getDataSource().getContentType().startsWith("text/html"));
+ assertTrue(dh.getDataSource().getContentType().startsWith("application/java-vm"));
}
public void testTransfers() throws Exception {