Skip to content

Commit

Permalink
Solr native support fixes #1703
Browse files Browse the repository at this point in the history
  • Loading branch information
zbendhiba committed Nov 24, 2020
1 parent a2c368e commit 3609530
Show file tree
Hide file tree
Showing 26 changed files with 936 additions and 134 deletions.
14 changes: 10 additions & 4 deletions docs/modules/ROOT/pages/reference/extensions/solr.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
= Solr
:cq-artifact-id: camel-quarkus-solr
:cq-native-supported: false
:cq-status: Preview
:cq-native-supported: true
:cq-status: Stable
:cq-description: Perform operations against Apache Lucene Solr.
:cq-deprecated: false
:cq-jvm-since: 1.1.0
:cq-native-since: n/a
:cq-native-since: 1.5.0

[.badges]
[.badge-key]##JVM since##[.badge-supported]##1.1.0## [.badge-key]##Native##[.badge-unsupported]##unsupported##
[.badge-key]##JVM since##[.badge-supported]##1.1.0## [.badge-key]##Native since##[.badge-supported]##1.5.0##

Perform operations against Apache Lucene Solr.

Expand All @@ -33,3 +33,9 @@ Please refer to the above links for usage and configuration details.
----

Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.

== SSL in native mode

This extension auto-enables SSL support in native mode. Hence you do not need to add
`quarkus.ssl.native=true` to your `application.properties` yourself. See also
https://quarkus.io/guides/native-and-ssl[Quarkus SSL guide].
6 changes: 3 additions & 3 deletions docs/modules/ROOT/partials/reference/components/solr.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
:cq-artifact-id: camel-quarkus-solr
:cq-artifact-id-base: solr
:cq-native-supported: false
:cq-status: Preview
:cq-native-supported: true
:cq-status: Stable
:cq-deprecated: false
:cq-jvm-since: 1.1.0
:cq-native-since: n/a
:cq-native-since: 1.5.0
:cq-camel-part-name: solr
:cq-camel-part-title: Solr
:cq-camel-part-description: Perform operations against Apache Lucene Solr.
Expand Down
1 change: 0 additions & 1 deletion extensions-jvm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@
<module>sip</module>
<module>smpp</module>
<module>snmp</module>
<module>solr</module>
<module>soroush</module>
<module>spark</module>
<module>splunk</module>
Expand Down

This file was deleted.

1 change: 1 addition & 0 deletions extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@
<module>smallrye-reactive-messaging</module>
<module>snakeyaml</module>
<module>soap</module>
<module>solr</module>
<module>sql</module>
<module>ssh</module>
<module>stream</module>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-solr</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-support-httpclient-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-netty-deployment</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-support-commons-logging-deployment</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@
package org.apache.camel.quarkus.component.solr.deployment;

import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.ExecutionTime;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.pkg.steps.NativeBuild;
import org.apache.camel.quarkus.core.JvmOnlyRecorder;
import org.jboss.logging.Logger;

class SolrProcessor {
Expand All @@ -34,13 +31,8 @@ FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}

/**
* Remove this once this extension starts supporting the native mode.
*/
@BuildStep(onlyIf = NativeBuild.class)
@Record(value = ExecutionTime.RUNTIME_INIT)
void warnJvmInNative(JvmOnlyRecorder recorder) {
JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time
recorder.warnJvmInNative(FEATURE); // warn at runtime
@BuildStep
ExtensionSslNativeSupportBuildItem activateSslNativeSupport() {
return new ExtensionSslNativeSupportBuildItem(FEATURE);
}
}
1 change: 0 additions & 1 deletion extensions-jvm/solr/pom.xml → extensions/solr/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,5 @@
<modules>
<module>deployment</module>
<module>runtime</module>
<module>integration-test</module>
</modules>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

<properties>
<camel.quarkus.jvmSince>1.1.0</camel.quarkus.jvmSince>
<camel.quarkus.nativeSince>1.5.0</camel.quarkus.nativeSince>
</properties>

<dependencyManagement>
Expand All @@ -55,6 +56,18 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-solr</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-support-httpclient</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-netty</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-support-commons-logging</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@
name: "Camel Solr"
description: "Perform operations against Apache Lucene Solr"
metadata:
unlisted: true
guide: "https://camel.apache.org/camel-quarkus/latest/reference/extensions/solr.html"
categories:
- "integration"
status:
- "preview"
- "stable"
1 change: 1 addition & 0 deletions integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
<module>slack</module>
<module>smallrye-reactive-messaging</module>
<module>soap</module>
<module>solr</module>
<module>sql</module>
<module>ssh</module>
<module>stringtemplate</module>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-build-parent-it</artifactId>
<artifactId>camel-quarkus-integration-tests</artifactId>
<version>1.5.0-SNAPSHOT</version>
<relativePath>../../../poms/build-parent-it/pom.xml</relativePath>
</parent>

<artifactId>camel-quarkus-solr-integration-test</artifactId>
<name>Camel Quarkus :: Solr :: Integration Test</name>
<artifactId>camel-quarkus-integration-test-solr</artifactId>
<name>Camel Quarkus :: Integration Tests :: Solr</name>
<description>Integration tests for Camel Quarkus Solr extension</description>

<properties>
<solr.trust-store>${project.basedir}/src/test/resources/ssl/solr-ssl.keystore.jks</solr.trust-store>
<solr.trust-store-password>secret</solr.trust-store-password>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
Expand All @@ -51,6 +55,10 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-jackson</artifactId>
</dependency>

<!-- test dependencies -->
<dependency>
Expand All @@ -63,6 +71,16 @@
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-integration-testcontainers-support</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>solr</artifactId>
<scope>test</scope>
</dependency>

<!-- The following dependencies guarantee that this module is built after them. You can update them by runing `mvn process-resources -Pformat -N` from the source tree root directory -->
<dependency>
Expand All @@ -80,4 +98,52 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<!-- force the locale as we want to explicitly test message interpolation -->
<javax.net.ssl.trustStore>${solr.trust-store}</javax.net.ssl.trustStore>
<javax.net.ssl.trustStorePassword>${solr.trust-store-password}</javax.net.ssl.trustStorePassword>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>native</id>
<activation>
<property>
<name>native</name>
</property>
</activation>
<properties>
<quarkus.package.type>native</quarkus.package.type>
<quarkus.native.additional-build-args>-H:IncludeResources=.*ssl/.*,-J-Djavax.net.ssl.trustStore=${solr.trust-store},
-J-Djavax.net.ssl.trustStorePassword=${solr.trust-store-password}</quarkus.native.additional-build-args>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

</profiles>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.quarkus.component.solr.it;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Observes;
import javax.ws.rs.Consumes;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import io.quarkus.runtime.StartupEvent;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.eclipse.microprofile.config.inject.ConfigProperty;

@ApplicationScoped
@Path("/solr/cloud")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public class SolrCloudResource extends SolrCommonResource {

@ConfigProperty(name = "solr.cloud.url", defaultValue = "localhost:8981/solr/collection1")
String solrUrl;

public void init(@Observes StartupEvent startupEvent) {
solrComponentURI = String.format("solrCloud://%s", solrUrl);
solrClient = new HttpSolrClient.Builder(String.format("http://%s", solrUrl)).build();
}
}

0 comments on commit 3609530

Please sign in to comment.