use of org.apache.pulsar.websocket.service.WebSocketProxyConfiguration 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");
}
use of org.apache.pulsar.websocket.service.WebSocketProxyConfiguration in project incubator-pulsar by apache.
the class ProxyAuthorizationTest method setup.
@BeforeClass
@Override
protected void setup() throws Exception {
conf.setClusterName(configClusterName);
internalSetup();
WebSocketProxyConfiguration config = new WebSocketProxyConfiguration();
Set<String> superUser = Sets.newHashSet("");
config.setAuthorizationEnabled(true);
config.setGlobalZookeeperServers("dummy-zk-servers");
config.setSuperUserRoles(superUser);
config.setClusterName("c1");
config.setWebServicePort(TEST_PORT);
service = spy(new WebSocketService(config));
doReturn(mockZooKeeperClientFactory).when(service).getZooKeeperClientFactory();
service.start();
}
use of org.apache.pulsar.websocket.service.WebSocketProxyConfiguration 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");
}
use of org.apache.pulsar.websocket.service.WebSocketProxyConfiguration 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");
}
Aggregations