use of org.apache.druid.java.util.http.client.HttpClient in project druid by druid-io.
the class HttpShuffleClientTest method mockClient.
private HttpShuffleClient mockClient(int numFailures) throws FileNotFoundException {
HttpClient httpClient = EasyMock.strictMock(HttpClient.class);
if (numFailures == 0) {
EasyMock.expect(httpClient.go(EasyMock.anyObject(), EasyMock.anyObject())).andReturn(Futures.immediateFuture(new FileInputStream(segmentFile))).andReturn(Futures.immediateFuture(new FileInputStream(segmentFile)));
} else {
EasyMock.expect(httpClient.go(EasyMock.anyObject(), EasyMock.anyObject())).andReturn(Futures.immediateFailedFuture(new RuntimeException())).times(numFailures).andReturn(Futures.immediateFuture(new FileInputStream(segmentFile))).andReturn(Futures.immediateFuture(new FileInputStream(segmentFile)));
}
EasyMock.replay(httpClient);
return new HttpShuffleClient(httpClient);
}
use of org.apache.druid.java.util.http.client.HttpClient in project druid by druid-io.
the class AbstractAuthConfigurationTest method verifyInvalidAuthNameFails.
protected void verifyInvalidAuthNameFails(String endpoint) {
HttpClient adminClient = new CredentialedHttpClient(new BasicCredentials("admin", "priest"), httpClient);
HttpUtil.makeRequestWithExpectedStatus(adminClient, HttpMethod.POST, endpoint, "SERIALIZED_DATA".getBytes(StandardCharsets.UTF_8), HttpResponseStatus.INTERNAL_SERVER_ERROR);
}
use of org.apache.druid.java.util.http.client.HttpClient in project druid by druid-io.
the class AbstractAuthConfigurationTest method verifyAdminOptionsRequest.
protected void verifyAdminOptionsRequest() {
HttpClient adminClient = new CredentialedHttpClient(new BasicCredentials("admin", "priest"), httpClient);
testOptionsRequests(adminClient);
}
use of org.apache.druid.java.util.http.client.HttpClient in project druid by druid-io.
the class ITTLSTest method checkAccessWithRevokedCert.
@Test
public void checkAccessWithRevokedCert() {
LOG.info("---------Testing TLS resource access when client certificate has been revoked---------");
HttpClient revokedClient = makeCustomHttpClient("client_tls/revoked_client.jks", "revoked_druid");
checkFailedAccessRevoked(revokedClient, HttpMethod.GET, config.getCoordinatorTLSUrl());
checkFailedAccessRevoked(revokedClient, HttpMethod.GET, config.getOverlordTLSUrl());
checkFailedAccessRevoked(revokedClient, HttpMethod.GET, config.getBrokerTLSUrl());
checkFailedAccessRevoked(revokedClient, HttpMethod.GET, config.getHistoricalTLSUrl());
checkFailedAccessRevoked(revokedClient, HttpMethod.GET, config.getRouterTLSUrl());
makeRequest(revokedClient, HttpMethod.GET, config.getPermissiveRouterTLSUrl() + "/status", null);
makeRequest(revokedClient, HttpMethod.GET, config.getNoClientAuthRouterTLSUrl() + "/status", null);
}
use of org.apache.druid.java.util.http.client.HttpClient in project druid by druid-io.
the class ITTLSTest method checkAccessWithNotCASignedCert.
@Test
public void checkAccessWithNotCASignedCert() {
LOG.info("---------Testing TLS resource access when client certificate is signed by a non-CA intermediate cert---------");
HttpClient notCAClient = makeCustomHttpClient("client_tls/invalid_ca_client.jks", "invalid_ca_client");
checkFailedAccessNotCA(notCAClient, HttpMethod.GET, config.getCoordinatorTLSUrl());
checkFailedAccessNotCA(notCAClient, HttpMethod.GET, config.getOverlordTLSUrl());
checkFailedAccessNotCA(notCAClient, HttpMethod.GET, config.getBrokerTLSUrl());
checkFailedAccessNotCA(notCAClient, HttpMethod.GET, config.getHistoricalTLSUrl());
checkFailedAccessNotCA(notCAClient, HttpMethod.GET, config.getRouterTLSUrl());
checkFailedAccessNotCA(notCAClient, HttpMethod.GET, config.getPermissiveRouterTLSUrl());
makeRequest(notCAClient, HttpMethod.GET, config.getNoClientAuthRouterTLSUrl() + "/status", null);
}
Aggregations