use of org.apache.pulsar.broker.ServiceConfiguration in project incubator-pulsar by apache.
the class AuthenticationServiceTest method testAuthenticationHttp.
@Test(timeOut = 10000)
public void testAuthenticationHttp() throws Exception {
ServiceConfiguration config = new ServiceConfiguration();
Set<String> providersClassNames = Sets.newHashSet(MockAuthenticationProvider.class.getName());
config.setAuthenticationProviders(providersClassNames);
config.setAuthenticationEnabled(true);
AuthenticationService service = new AuthenticationService(config);
HttpServletRequest request = mock(HttpServletRequest.class);
when(request.getRemoteAddr()).thenReturn("192.168.1.1");
when(request.getRemotePort()).thenReturn(8080);
when(request.getHeader(anyString())).thenReturn("data");
String result = service.authenticateHttpRequest(request);
assertEquals(result, s_authentication_success);
service.close();
}
use of org.apache.pulsar.broker.ServiceConfiguration in project incubator-pulsar by apache.
the class MockedPulsarServiceBaseTest method resetConfig.
protected void resetConfig() {
this.conf = new ServiceConfiguration();
this.conf.setBrokerServicePort(BROKER_PORT);
this.conf.setBrokerServicePortTls(BROKER_PORT_TLS);
this.conf.setAdvertisedAddress("localhost");
this.conf.setWebServicePort(BROKER_WEBSERVICE_PORT);
this.conf.setWebServicePortTls(BROKER_WEBSERVICE_PORT_TLS);
this.conf.setClusterName(configClusterName);
// there are TLS tests in here, they need to use localhost because of the certificate
this.conf.setAdvertisedAddress("localhost");
this.conf.setManagedLedgerCacheSizeMB(8);
this.conf.setActiveConsumerFailoverDelayTimeMillis(0);
this.conf.setDefaultNumberOfNamespaceBundles(1);
this.conf.setZookeeperServers("localhost:2181");
this.conf.setGlobalZookeeperServers("localhost:3181");
}
Aggregations