use of org.jboss.pnc.buildagent.client.HttpClientConfiguration in project pnc by project-ncl.
the class DefaultClientFactory method createHttpBuildAgentClient.
@Override
public BuildAgentClient createHttpBuildAgentClient(String terminalUrl, String executionId, Map<String, String> callbackHeaders, List<Request.Header> requestHeaders) throws BuildAgentClientException {
List<Request.Header> headers = callbackHeaders.entrySet().stream().map(e -> new Request.Header(e.getKey(), e.getValue())).collect(Collectors.toList());
HttpClientConfiguration configuration = null;
try {
URL callbackUrl = new URL(StringUtils.stripEndingSlash(pncBaseUrl) + "/build-execution/" + executionId + "/completed");
Request callback = new Request(Request.Method.POST, callbackUrl.toURI(), headers);
configuration = HttpClientConfiguration.newBuilder().termBaseUrl(terminalUrl).callback(callback).livenessResponseTimeout(30000L).retryConfig(retryConfig).requestHeaders(requestHeaders).build();
} catch (MalformedURLException | URISyntaxException e) {
new BuildAgentClientException("Invalid callback URL.", e);
}
return new BuildAgentHttpClient(httpClient, configuration);
}
use of org.jboss.pnc.buildagent.client.HttpClientConfiguration in project pnc by project-ncl.
the class EAPModulesAccessTest method shouldBeAbleToCreteBuildAgentClient.
/**
* Requires access to undertow-core because of HttpClient usage
*/
@Test
public void shouldBeAbleToCreteBuildAgentClient() throws BuildAgentClientException {
HttpClientConfiguration configuration = HttpClientConfiguration.newBuilder().termBaseUrl("http://localhost/").livenessResponseTimeout(30000L).build();
BuildAgentClient client = new BuildAgentHttpClient(configuration);
Assert.assertNotNull(client);
}
Aggregations