use of org.graylog.shaded.elasticsearch7.org.apache.http.ProtocolVersion in project robovm by robovm.
the class RequestWrapper method getRequestLine.
public RequestLine getRequestLine() {
String method = getMethod();
ProtocolVersion ver = getProtocolVersion();
String uritext = null;
if (uri != null) {
uritext = uri.toASCIIString();
}
if (uritext == null || uritext.length() == 0) {
uritext = "/";
}
return new BasicRequestLine(method, uritext, ver);
}
use of org.graylog.shaded.elasticsearch7.org.apache.http.ProtocolVersion in project gocd by gocd.
the class SslInfrastructureServiceTest method shouldInvalidateKeystore.
@Test
public void shouldInvalidateKeystore() throws Exception {
temporaryFolder.create();
File configFile = temporaryFolder.newFile();
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("https", 1, 2), 200, null));
when(httpResponse.getEntity()).thenReturn(new StringEntity(RegistrationJSONizer.toJson(createRegistration())));
when(agentRegistry.guidPresent()).thenReturn(true);
when(httpClient.execute(any(HttpRequestBase.class))).thenReturn(httpResponse);
when(agentRegistry.tokenPresent()).thenReturn(true);
shouldCreateSslInfrastructure();
sslInfrastructureService.registerIfNecessary(new AgentAutoRegistrationPropertiesImpl(configFile));
assertThat(GoAgentServerClientBuilder.AGENT_CERTIFICATE_FILE, exists());
verify(httpClient, times(1)).execute(any(HttpRequestBase.class));
sslInfrastructureService.registerIfNecessary(new AgentAutoRegistrationPropertiesImpl(configFile));
verify(httpClient, times(1)).execute(any(HttpRequestBase.class));
sslInfrastructureService.invalidateAgentCertificate();
sslInfrastructureService.registerIfNecessary(new AgentAutoRegistrationPropertiesImpl(configFile));
verify(httpClient, times(2)).execute(any(HttpRequestBase.class));
}
use of org.graylog.shaded.elasticsearch7.org.apache.http.ProtocolVersion in project wildfly-camel by wildfly-extras.
the class HipchatConsumerIntegrationTest method sendInOnlyMultipleUsers.
@Test
public void sendInOnlyMultipleUsers() throws Exception {
CamelContext camelctx = createCamelContext();
MockEndpoint result = camelctx.getEndpoint("mock:result", MockEndpoint.class);
result.expectedMessageCount(1);
camelctx.start();
try {
String expectedResponse = //
"{\n" + //
" \"items\" : [\n" + //
" {\n" + //
" \"date\" : \"2015-01-19T22:07:11.030740+00:00\",\n" + //
" \"from\" : {\n" + //
" \"id\" : 1647095,\n" + //
" \"links\" : {\n" + //
" \"self\" : \"https://api.hipchat.com/v2/user/1647095\"\n" + //
" },\n" + //
" \"mention_name\" : \"notifier\",\n" + //
" \"name\" : \"Message Notifier\"\n" + //
" },\n" + //
" \"id\" : \"6567c6f7-7c1b-43cf-bed0-792b1d092919\",\n" + //
" \"mentions\" : [ ],\n" + //
" \"message\" : \"Unit test Alert\",\n" + //
" \"type\" : \"message\"\n" + //
" }\n" + //
" ],\n" + //
" \"links\" : {\n" + //
" \"self\" : \"https://api.hipchat.com/v2/user/%40ShreyasPurohit/history/latest\"\n" + //
" },\n" + //
" \"maxResults\" : 1,\n" + //
" \"startIndex\" : 0\n" + "}";
HttpEntity mockHttpEntity = mock(HttpEntity.class);
when(mockHttpEntity.getContent()).thenReturn(new ByteArrayInputStream(expectedResponse.getBytes(StandardCharsets.UTF_8)));
when(closeableHttpResponse.getEntity()).thenReturn(mockHttpEntity);
when(closeableHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, ""));
result.assertIsSatisfied();
assertCommonResultExchange(result.getExchanges().get(0));
} finally {
camelctx.stop();
}
}
use of org.graylog.shaded.elasticsearch7.org.apache.http.ProtocolVersion in project scribejava by scribejava.
the class OauthAsyncCompletionHandlerTest method shouldReleaseLatchOnCancel.
@Test
public void shouldReleaseLatchOnCancel() throws Exception {
handler = new OAuthAsyncCompletionHandler<>(callback, ALL_GOOD_RESPONSE_CONVERTER);
final HttpResponse response = new BasicHttpResponse(new BasicStatusLine(new ProtocolVersion("4", 1, 1), 200, "ok"));
final BasicHttpEntity entity = new BasicHttpEntity();
entity.setContent(new ByteArrayInputStream(new byte[0]));
response.setEntity(entity);
handler.cancelled();
assertNull(callback.getResponse());
assertNotNull(callback.getThrowable());
assertTrue(callback.getThrowable() instanceof CancellationException);
// verify latch is released
try {
handler.getResult();
fail();
} catch (ExecutionException expected) {
// expected
}
}
use of org.graylog.shaded.elasticsearch7.org.apache.http.ProtocolVersion in project scribejava by scribejava.
the class OauthAsyncCompletionHandlerTest method shouldReleaseLatchOnSuccess.
@Test
public void shouldReleaseLatchOnSuccess() throws Exception {
handler = new OAuthAsyncCompletionHandler<>(callback, ALL_GOOD_RESPONSE_CONVERTER);
final HttpResponse response = new BasicHttpResponse(new BasicStatusLine(new ProtocolVersion("4", 1, 1), 200, "ok"));
final BasicHttpEntity entity = new BasicHttpEntity();
entity.setContent(new ByteArrayInputStream(new byte[0]));
response.setEntity(entity);
handler.completed(response);
assertNotNull(callback.getResponse());
assertNull(callback.getThrowable());
// verify latch is released
assertEquals("All good", handler.getResult());
}
Aggregations