mirror of https://github.com/apache/activemq.git
Changed timeout, see https://issues.apache.org/jira/browse/AMQ-4876
This commit is contained in:
parent
61fadba43a
commit
6540f04a40
|
@ -28,7 +28,9 @@ import javax.net.ssl.SSLSocketFactory;
|
||||||
import javax.net.ssl.TrustManager;
|
import javax.net.ssl.TrustManager;
|
||||||
import javax.net.ssl.X509TrustManager;
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
import org.apache.activemq.broker.BrokerService;
|
import org.apache.activemq.broker.BrokerService;
|
||||||
import org.apache.activemq.broker.TransportConnector;
|
import org.apache.activemq.broker.TransportConnector;
|
||||||
|
@ -36,15 +38,21 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||||
|
|
||||||
public class SslContextNBrokerServiceTest extends TestCase {
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
public class SslContextNBrokerServiceTest {
|
||||||
private static final transient Logger LOG = LoggerFactory.getLogger(SslContextNBrokerServiceTest.class);
|
private static final transient Logger LOG = LoggerFactory.getLogger(SslContextNBrokerServiceTest.class);
|
||||||
|
|
||||||
private ClassPathXmlApplicationContext context;
|
private ClassPathXmlApplicationContext context;
|
||||||
Map<String, BrokerService> beansOfType;
|
Map<String, BrokerService> beansOfType;
|
||||||
|
|
||||||
public void testConfigurationIsolation() throws Exception {
|
@Test(timeout = 2 * 60 * 1000)
|
||||||
|
public void testDummyConfigurationIsolation() throws Exception {
|
||||||
assertTrue("dummy bean has dummy cert", verifyCredentials("dummy"));
|
assertTrue("dummy bean has dummy cert", verifyCredentials("dummy"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(timeout = 2 * 60 * 1000)
|
||||||
|
public void testActiveMQDotOrgConfigurationIsolation() throws Exception {
|
||||||
assertTrue("good bean has amq cert", verifyCredentials("activemq.org"));
|
assertTrue("good bean has amq cert", verifyCredentials("activemq.org"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +61,7 @@ public class SslContextNBrokerServiceTest extends TestCase {
|
||||||
BrokerService broker = getBroker(name);
|
BrokerService broker = getBroker(name);
|
||||||
assertNotNull(name, broker);
|
assertNotNull(name, broker);
|
||||||
broker.start();
|
broker.start();
|
||||||
|
broker.waitUntilStarted();
|
||||||
try {
|
try {
|
||||||
result = verifySslCredentials(broker);
|
result = verifySslCredentials(broker);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -72,7 +81,7 @@ public class SslContextNBrokerServiceTest extends TestCase {
|
||||||
SSLSocketFactory factory = context.getSocketFactory();
|
SSLSocketFactory factory = context.getSocketFactory();
|
||||||
LOG.info("Connecting to broker: " + broker.getBrokerName() + " on: " + brokerUri.getHost() + ":" + brokerUri.getPort());
|
LOG.info("Connecting to broker: " + broker.getBrokerName() + " on: " + brokerUri.getHost() + ":" + brokerUri.getPort());
|
||||||
SSLSocket socket = (SSLSocket) factory.createSocket(brokerUri.getHost(), brokerUri.getPort());
|
SSLSocket socket = (SSLSocket) factory.createSocket(brokerUri.getHost(), brokerUri.getPort());
|
||||||
socket.setSoTimeout(5000);
|
socket.setSoTimeout(60 * 1000);
|
||||||
socket.startHandshake();
|
socket.startHandshake();
|
||||||
socket.close();
|
socket.close();
|
||||||
|
|
||||||
|
@ -105,16 +114,16 @@ public class SslContextNBrokerServiceTest extends TestCase {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Before
|
||||||
protected void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
// System.setProperty("javax.net.debug", "ssl");
|
// System.setProperty("javax.net.debug", "ssl");
|
||||||
Thread.currentThread().setContextClassLoader(SslContextNBrokerServiceTest.class.getClassLoader());
|
Thread.currentThread().setContextClassLoader(SslContextNBrokerServiceTest.class.getClassLoader());
|
||||||
context = new ClassPathXmlApplicationContext("org/apache/activemq/transport/tcp/n-brokers-ssl.xml");
|
context = new ClassPathXmlApplicationContext("org/apache/activemq/transport/tcp/n-brokers-ssl.xml");
|
||||||
beansOfType = context.getBeansOfType(BrokerService.class);
|
beansOfType = context.getBeansOfType(BrokerService.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@After
|
||||||
protected void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
context.destroy();
|
context.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue