Search in sources :

Example 1 with ProxyServer

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

the class ProxyPublishConsumeWithoutZKTest method setup.

@BeforeMethod
public void setup() throws Exception {
    super.internalSetup();
    super.producerBaseSetup();
    port = PortManager.nextFreePort();
    WebSocketProxyConfiguration config = new WebSocketProxyConfiguration();
    config.setWebServicePort(port);
    config.setClusterName("use");
    config.setServiceUrl(pulsar.getWebServiceAddress());
    config.setServiceUrlTls(pulsar.getWebServiceAddressTls());
    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 : WebSocketProxyConfiguration(org.apache.pulsar.websocket.service.WebSocketProxyConfiguration) WebSocketService(org.apache.pulsar.websocket.WebSocketService) ProxyServer(org.apache.pulsar.websocket.service.ProxyServer) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 2 with ProxyServer

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

the class ProxyAuthenticationTest method setup.

@BeforeMethod
public void setup() throws Exception {
    super.internalSetup();
    super.producerBaseSetup();
    port = PortManager.nextFreePort();
    WebSocketProxyConfiguration config = new WebSocketProxyConfiguration();
    config.setWebServicePort(port);
    config.setClusterName("use");
    config.setAuthenticationEnabled(true);
    config.setGlobalZookeeperServers("dummy-zk-servers");
    config.setSuperUserRoles(Sets.newHashSet("pulsar.super_user"));
    // If this is not set, 500 error occurs.
    config.setGlobalZookeeperServers("dummy");
    if (methodName.equals("authenticatedSocketTest") || methodName.equals("statsTest")) {
        config.setAuthenticationProviders(Sets.newHashSet("org.apache.pulsar.websocket.proxy.MockAuthenticationProvider"));
    } else {
        config.setAuthenticationProviders(Sets.newHashSet("org.apache.pulsar.websocket.proxy.MockUnauthenticationProvider"));
    }
    if (methodName.equals("anonymousSocketTest")) {
        config.setAnonymousUserRole("anonymousUser");
    }
    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 : WebSocketProxyConfiguration(org.apache.pulsar.websocket.service.WebSocketProxyConfiguration) WebSocketService(org.apache.pulsar.websocket.WebSocketService) ProxyServer(org.apache.pulsar.websocket.service.ProxyServer) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 3 with ProxyServer

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

the class ProxyPublishConsumeTest method setup.

@BeforeMethod
public void setup() throws Exception {
    conf.setBacklogQuotaCheckIntervalInSeconds(TIME_TO_CHECK_BACKLOG_QUOTA);
    super.internalSetup();
    super.producerBaseSetup();
    port = PortManager.nextFreePort();
    WebSocketProxyConfiguration config = new WebSocketProxyConfiguration();
    config.setWebServicePort(port);
    config.setClusterName("use");
    config.setGlobalZookeeperServers("dummy-zk-servers");
    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 : WebSocketProxyConfiguration(org.apache.pulsar.websocket.service.WebSocketProxyConfiguration) WebSocketService(org.apache.pulsar.websocket.WebSocketService) ProxyServer(org.apache.pulsar.websocket.service.ProxyServer) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 4 with ProxyServer

use of org.apache.pulsar.websocket.service.ProxyServer 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)4 ProxyServer (org.apache.pulsar.websocket.service.ProxyServer)4 WebSocketProxyConfiguration (org.apache.pulsar.websocket.service.WebSocketProxyConfiguration)4 BeforeMethod (org.testng.annotations.BeforeMethod)4 URI (java.net.URI)1 AuthenticationTls (org.apache.pulsar.client.impl.auth.AuthenticationTls)1