Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CAMEL-21638]: Enable ppc64le support for camel-elasticsearch #16869

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion components/camel-elasticsearch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

<properties>
<!-- Elasticsearch container is not available on these platforms -->
<skipITs.ppc64le>true</skipITs.ppc64le>
<skipITs.s390x>true</skipITs.s390x>

<camel.surefire.reuseForks>false</camel.surefire.reuseForks>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,19 @@ public class ElasticsearchTestSupport extends CamelTestSupport {
@Override
protected void setupResources() throws Exception {
super.setupResources();
String scheme = service.getSslContext().isPresent() ? "https" : "http";
HttpHost host
= new HttpHost(service.getElasticSearchHost(), service.getPort(), "https");
= new HttpHost(service.getElasticSearchHost(), service.getPort(), scheme);
final RestClientBuilder builder = RestClient.builder(host);
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(service.getUsername(), service.getPassword()));
builder.setHttpClientConfigCallback(
httpClientBuilder -> {
httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
httpClientBuilder.setSSLContext(service.getSslContext().orElseThrow());
service.getSslContext().ifPresent(sslContext -> {
httpClientBuilder.setSSLContext(sslContext);
});
return httpClientBuilder;
});
restClient = builder.build();
Expand All @@ -86,11 +89,13 @@ protected void cleanupResources() throws Exception {
@Override
protected CamelContext createCamelContext() throws Exception {
final ElasticsearchComponent elasticsearchComponent = new ElasticsearchComponent();
elasticsearchComponent.setEnableSSL(true);
elasticsearchComponent.setEnableSSL(service.getSslContext().isPresent());
elasticsearchComponent.setHostAddresses(service.getHttpHostAddress());
elasticsearchComponent.setUser(service.getUsername());
elasticsearchComponent.setPassword(service.getPassword());
elasticsearchComponent.setCertificatePath("file:%s".formatted(service.getCertificatePath().orElseThrow()));
service.getCertificatePath().ifPresent(certificatePath -> {
elasticsearchComponent.setCertificatePath("file:%s".formatted(certificatePath));
});

CamelContext context = super.createCamelContext();
context.addComponent("elasticsearch", elasticsearchComponent);
Expand Down
Loading