mirror of https://github.com/apache/activemq.git
Merge pull request #390 from coheigea/AMQ-7289
AMQ-7289 - Fix failing HTTP tests
This commit is contained in:
commit
9ecb9750e5
|
@ -67,7 +67,7 @@ public class SecureSocketConnectorFactory extends SocketConnectorFactory {
|
|||
|
||||
SslContextFactory factory;
|
||||
if (contextFactory == null) {
|
||||
factory = new SslContextFactory();
|
||||
factory = new SslContextFactory.Server();
|
||||
if (context != null) {
|
||||
// Should not be using this method since it does not use all of the values
|
||||
// from the passed SslContext instance.....
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.eclipse.jetty.security.ConstraintMapping;
|
|||
import org.eclipse.jetty.security.ConstraintSecurityHandler;
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
import org.eclipse.jetty.util.security.Constraint;
|
||||
import org.eclipse.jetty.xml.XmlConfiguration;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -61,7 +62,7 @@ abstract public class WebTransportServerSupport extends TransportServerSupport {
|
|||
if (!file.exists()) {
|
||||
throw new IllegalArgumentException("Jetty XML not found: " + file.getAbsolutePath());
|
||||
}
|
||||
XmlConfiguration xmlConfiguration = new XmlConfiguration(file.toURI().toURL());
|
||||
XmlConfiguration xmlConfiguration = new XmlConfiguration(Resource.newResource(file));
|
||||
server = (Server) xmlConfiguration.configure();
|
||||
} catch (Throwable t) {
|
||||
throw new IllegalStateException("Jetty configuration can't be loaded", t);
|
||||
|
|
|
@ -47,13 +47,13 @@ public class HttpTraceTestSupport {
|
|||
}
|
||||
|
||||
public static void testHttpTraceEnabled(final String uri, final int expectedStatus) throws Exception {
|
||||
testHttpTraceEnabled(uri, expectedStatus, new SslContextFactory());
|
||||
testHttpTraceEnabled(uri, expectedStatus, new SslContextFactory.Client());
|
||||
}
|
||||
|
||||
public static void testHttpTraceEnabled(final String uri, final int expectedStatus, SslContextFactory
|
||||
sslContextFactory) throws Exception {
|
||||
HttpClient httpClient = sslContextFactory != null ? new HttpClient(sslContextFactory) :
|
||||
new HttpClient(new SslContextFactory());
|
||||
new HttpClient(new SslContextFactory.Client());
|
||||
httpClient.start();
|
||||
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
|
|
@ -39,7 +39,7 @@ public class MQTTWSSubProtocolTest extends WSTransportTestSupport {
|
|||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
wsClient = new WebSocketClient(new SslContextFactory(true));
|
||||
wsClient = new WebSocketClient(new SslContextFactory.Client(true));
|
||||
wsClient.start();
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ public class MQTTWSTransportTest extends WSTransportTestSupport {
|
|||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
wsClient = new WebSocketClient(new SslContextFactory(true));
|
||||
wsClient = new WebSocketClient(new SslContextFactory.Client(true));
|
||||
wsClient.start();
|
||||
|
||||
request = new ClientUpgradeRequest();
|
||||
|
|
|
@ -78,7 +78,7 @@ public class MQTTWSTransportWillTest extends WSTransportTestSupport {
|
|||
//turn off advisory support
|
||||
broker = createBroker(true, false);
|
||||
|
||||
wsClient = new WebSocketClient(new SslContextFactory(true));
|
||||
wsClient = new WebSocketClient(new SslContextFactory.Client(true));
|
||||
wsClient.start();
|
||||
|
||||
request = new ClientUpgradeRequest();
|
||||
|
|
|
@ -150,7 +150,7 @@ public class StompWSSubProtocolTest extends WSTransportTestSupport {
|
|||
request.setSubProtocols(subProtocol);
|
||||
}
|
||||
|
||||
wsClient = new WebSocketClient(new SslContextFactory(true));
|
||||
wsClient = new WebSocketClient(new SslContextFactory.Client(true));
|
||||
wsClient.start();
|
||||
|
||||
wsClient.connect(wsStompConnection, wsConnectUri, request);
|
||||
|
|
|
@ -57,7 +57,7 @@ public class StompWSTransportTest extends WSTransportTestSupport {
|
|||
ClientUpgradeRequest request = new ClientUpgradeRequest();
|
||||
request.setSubProtocols("v11.stomp");
|
||||
|
||||
wsClient = new WebSocketClient(new SslContextFactory(true));
|
||||
wsClient = new WebSocketClient(new SslContextFactory.Client(true));
|
||||
wsClient.start();
|
||||
|
||||
wsClient.connect(wsStompConnection, wsConnectUri, request);
|
||||
|
|
|
@ -163,7 +163,7 @@ public class WSTransportTest extends WSTransportTestSupport {
|
|||
protected void testGet(final String uri, SslContextFactory
|
||||
sslContextFactory) throws Exception {
|
||||
HttpClient httpClient = sslContextFactory != null ? new HttpClient(sslContextFactory) :
|
||||
new HttpClient(new SslContextFactory());
|
||||
new HttpClient(new SslContextFactory.Client());
|
||||
httpClient.start();
|
||||
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
|
|
@ -38,7 +38,8 @@ public class WSSTransportHttpTraceTest extends WSTransportHttpTraceTest {
|
|||
@Override
|
||||
@Test(timeout=10000)
|
||||
public void testHttpTraceEnabled() throws Exception {
|
||||
SslContextFactory factory = new SslContextFactory();
|
||||
SslContextFactory factory = new SslContextFactory.Client();
|
||||
factory.setEndpointIdentificationAlgorithm(null); // service cert does not contain a SAN
|
||||
factory.setSslContext(broker.getSslContext().getSSLContext());
|
||||
|
||||
HttpTraceTestSupport.testHttpTraceEnabled("https://127.0.0.1:61623", expectedStatus, factory);
|
||||
|
|
|
@ -77,7 +77,7 @@ public class WSSTransportNeedClientAuthTest {
|
|||
public void testStompNeedClientAuth() throws Exception {
|
||||
StompWSConnection wsStompConnection = new StompWSConnection();
|
||||
System.out.println("starting connection");
|
||||
SslContextFactory factory = new SslContextFactory();
|
||||
SslContextFactory factory = new SslContextFactory.Client();
|
||||
factory.setKeyStorePath(KEYSTORE);
|
||||
factory.setKeyStorePassword(PASSWORD);
|
||||
factory.setKeyStoreType(KEYSTORE_TYPE);
|
||||
|
@ -110,7 +110,7 @@ public class WSSTransportNeedClientAuthTest {
|
|||
|
||||
@Test
|
||||
public void testMQTTNeedClientAuth() throws Exception {
|
||||
SslContextFactory factory = new SslContextFactory();
|
||||
SslContextFactory factory = new SslContextFactory.Client();
|
||||
factory.setKeyStorePath(KEYSTORE);
|
||||
factory.setKeyStorePassword(PASSWORD);
|
||||
factory.setKeyStoreType(KEYSTORE_TYPE);
|
||||
|
|
|
@ -46,7 +46,8 @@ public class WSSTransportTest extends WSTransportTest {
|
|||
@Override
|
||||
@Test(timeout=10000)
|
||||
public void testGet() throws Exception {
|
||||
SslContextFactory factory = new SslContextFactory();
|
||||
SslContextFactory factory = new SslContextFactory.Client();
|
||||
factory.setEndpointIdentificationAlgorithm(null); // service cert does not contain a SAN
|
||||
factory.setSslContext(broker.getSslContext().getSSLContext());
|
||||
|
||||
testGet("https://127.0.0.1:" + port, factory);
|
||||
|
|
Loading…
Reference in New Issue