Search in sources :

Example 11 with WebSocketService

use of org.apache.pulsar.websocket.WebSocketService in project incubator-pulsar by apache.

the class ProxyPublishConsumeTlsTest method setup.

@BeforeMethod
public void setup() throws Exception {
    super.setup();
    super.internalSetUpForNamespace();
    port = PortManager.nextFreePort();
    tlsPort = PortManager.nextFreePort();
    WebSocketProxyConfiguration config = new WebSocketProxyConfiguration();
    config.setWebServicePort(port);
    config.setWebServicePortTls(tlsPort);
    config.setTlsEnabled(true);
    config.setTlsKeyFilePath(TLS_SERVER_KEY_FILE_PATH);
    config.setTlsCertificateFilePath(TLS_SERVER_CERT_FILE_PATH);
    config.setTlsTrustCertsFilePath(TLS_TRUST_CERT_FILE_PATH);
    config.setBrokerClientTrustCertsFilePath(TLS_TRUST_CERT_FILE_PATH);
    config.setClusterName("use");
    config.setGlobalZookeeperServers("dummy-zk-servers");
    config.setBrokerClientAuthenticationParameters("tlsCertFile:" + TLS_CLIENT_CERT_FILE_PATH + ",tlsKeyFile:" + TLS_CLIENT_KEY_FILE_PATH);
    config.setBrokerClientAuthenticationPlugin(AuthenticationTls.class.getName());
    String lookupUrl = new URI("pulsar://localhost:" + BROKER_PORT_TLS).toString();
    service = spy(new WebSocketService(config));
    doReturn(mockZooKeeperClientFactory).when(service).getZooKeeperClientFactory();
    proxyServer = new ProxyServer(config);
    WebSocketServiceStarter.start(proxyServer, service);
    log.info("Proxy Server Started");
}
Also used : AuthenticationTls(org.apache.pulsar.client.impl.auth.AuthenticationTls) WebSocketProxyConfiguration(org.apache.pulsar.websocket.service.WebSocketProxyConfiguration) WebSocketService(org.apache.pulsar.websocket.WebSocketService) URI(java.net.URI) ProxyServer(org.apache.pulsar.websocket.service.ProxyServer) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

WebSocketService (org.apache.pulsar.websocket.WebSocketService)11 WebSocketProxyConfiguration (org.apache.pulsar.websocket.service.WebSocketProxyConfiguration)9 Field (java.lang.reflect.Field)4 PulsarClientImpl (org.apache.pulsar.client.impl.PulsarClientImpl)4 ProxyServer (org.apache.pulsar.websocket.service.ProxyServer)4 BeforeMethod (org.testng.annotations.BeforeMethod)4 Test (org.testng.annotations.Test)4 IOException (java.io.IOException)1 URI (java.net.URI)1 LeaderElectionService (org.apache.pulsar.broker.loadbalance.LeaderElectionService)1 LeaderListener (org.apache.pulsar.broker.loadbalance.LeaderElectionService.LeaderListener)1 LoadResourceQuotaUpdaterTask (org.apache.pulsar.broker.loadbalance.LoadResourceQuotaUpdaterTask)1 LoadSheddingTask (org.apache.pulsar.broker.loadbalance.LoadSheddingTask)1 BrokerService (org.apache.pulsar.broker.service.BrokerService)1 MetricsGenerator (org.apache.pulsar.broker.stats.MetricsGenerator)1 PrometheusMetricsServlet (org.apache.pulsar.broker.stats.prometheus.PrometheusMetricsServlet)1 WebService (org.apache.pulsar.broker.web.WebService)1 AuthenticationTls (org.apache.pulsar.client.impl.auth.AuthenticationTls)1 ClusterData (org.apache.pulsar.common.policies.data.ClusterData)1 WebSocketConsumerServlet (org.apache.pulsar.websocket.WebSocketConsumerServlet)1