Search in sources :

Example 16 with HttpTestHelper

use of org.apache.qpid.tests.http.HttpTestHelper in project qpid-broker-j by apache.

the class PortTest method testSwapKeyStoreAndUpdateTlsOnHttpPort.

@Test
public void testSwapKeyStoreAndUpdateTlsOnHttpPort() throws Exception {
    final int port = createHttpPort();
    HttpTestHelper helper = new HttpTestHelper(getBrokerAdmin(), null, port);
    helper.setTls(true);
    helper.setKeyStore(_storeFile.getAbsolutePath(), TLS_RESOURCE.getSecret());
    final Map<String, Object> attributes = getHelper().getJsonAsMap("port/" + _portName);
    final Map<String, Object> ownAttributes = helper.getJsonAsMap("port/" + _portName);
    assertEquals(attributes, ownAttributes);
    final File storeFile = createNewKeyStoreAndSetItOnPort();
    helper.setKeyStore(storeFile.getAbsolutePath(), TLS_RESOURCE.getSecret());
    final Map<String, Object> attributes2 = getHelper().getJsonAsMap("port/" + _portName);
    final Map<String, Object> ownAttributes2 = helper.getJsonAsMap("port/" + _portName);
    assertEquals(attributes2, ownAttributes2);
}
Also used : HttpTestHelper(org.apache.qpid.tests.http.HttpTestHelper) ConfiguredObject(org.apache.qpid.server.model.ConfiguredObject) File(java.io.File) Test(org.junit.Test)

Aggregations

HttpTestHelper (org.apache.qpid.tests.http.HttpTestHelper)16 Test (org.junit.Test)12 ConfiguredObject (org.apache.qpid.server.model.ConfiguredObject)4 HashMap (java.util.HashMap)3 HttpURLConnection (java.net.HttpURLConnection)2 ArrayDeque (java.util.ArrayDeque)2 BaseAction (org.apache.qpid.server.util.BaseAction)2 File (java.io.File)1 IOException (java.io.IOException)1 ConnectException (java.net.ConnectException)1 List (java.util.List)1 Map (java.util.Map)1 Connection (javax.jms.Connection)1 Session (javax.jms.Session)1 TCPTunneler (org.apache.qpid.test.utils.TCPTunneler)1 KeyCertificatePair (org.apache.qpid.test.utils.tls.KeyCertificatePair)1