Skip to content

Commit

Permalink
Upgrade to Camel 3.1.0 - WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnetherton committed Feb 23, 2020
1 parent 3e4a3fd commit 8eebc84
Show file tree
Hide file tree
Showing 45 changed files with 976 additions and 260 deletions.
27 changes: 11 additions & 16 deletions catalog/camel-quarkus-catalog/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@

<parent>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>catalog</artifactId>
<artifactId>camel-quarkus-build-parent</artifactId>
<version>1.1.0-SNAPSHOT</version>
<relativePath>../../poms/build-parent/pom.xml</relativePath>
</parent>

<artifactId>camel-catalog-quarkus</artifactId>
Expand All @@ -35,33 +36,27 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-catalog</artifactId>
<version>${camel.version}</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<scope>test</scope>
</dependency>

<!-- logging -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.12.1</version>
<groupId>org.jboss.slf4j</groupId>
<artifactId>slf4j-jboss-logging</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.12.1</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.12.1</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@
import java.util.List;

import org.apache.camel.catalog.CamelCatalog;
import org.apache.camel.catalog.CatalogHelper;
import org.apache.camel.catalog.RuntimeProvider;
import org.apache.camel.catalog.impl.CatalogHelper;

/**
* A Quarkus based {@link RuntimeProvider} which only includes the supported Camel components, data formats, and languages
* A Quarkus based {@link RuntimeProvider} which only includes the supported Camel components, data formats, and
* languages
* which can be installed in Quarkus using the Camel extensions.
*/
public class QuarkusRuntimeProvider implements RuntimeProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@

import org.apache.camel.catalog.CamelCatalog;
import org.apache.camel.catalog.DefaultCamelCatalog;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class QuarkusRuntimeProviderTest {

static CamelCatalog catalog;

@BeforeClass
@BeforeAll
public static void createCamelCatalog() {
catalog = new DefaultCamelCatalog();
catalog.setRuntimeProvider(new QuarkusRuntimeProvider());
Expand Down
8 changes: 4 additions & 4 deletions docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ In case you are missing some Camel feature in the list:
== Camel Components

// components: START
Number of Camel components: 65 in 56 JAR artifacts (0 deprecated)
Number of Camel components: 66 in 57 JAR artifacts (0 deprecated)

[width="100%",cols="4,1,5",options="header"]
|===
Expand Down Expand Up @@ -64,7 +64,7 @@ Number of Camel components: 65 in 56 JAR artifacts (0 deprecated)
`aws-sqs:queueNameOrArn` | 0.2.0 | The aws-sqs component is used for sending and receiving messages to Amazon's SQS service.

| link:https://camel.apache.org/components/latest/aws-translate-component.html[AWS Translate] (camel-quarkus-aws-translate) +
`aws-translate:label` | 1.0.0-M3 | The aws-kms is used for managing Amazon Translate
`aws-translate:label` | 1.0.0-M3 | The aws-translate component is used for managing Amazon Translate

| link:https://camel.apache.org/components/latest/bean-component.html[Bean] (camel-quarkus-bean) +
`bean:beanName` | 0.2.0 | The bean component is for invoking Java beans from Camel.
Expand All @@ -76,7 +76,7 @@ Number of Camel components: 65 in 56 JAR artifacts (0 deprecated)
`box:apiName/methodName` | 1.2.0 | For uploading downloading and managing files folders groups collaborations etc on box DOT com.

| link:https://camel.apache.org/components/latest/class-component.html[Class] (camel-quarkus-bean) +
`class:beanName` | 0.2.0 | The class component is for invoking Java classes (Java beans) from Camel.
`class:beanName` | 0.2.0 | The Class component is for invoking Java classes (Java beans) from Camel.

| link:https://camel.apache.org/components/latest/consul-component.html[Consul] (camel-quarkus-consul) +
`consul:apiEndpoint` | 1.0.0-M3 | The camel consul component allows you to work with Consul, a distributed, highly available, datacenter-aware, service discovery and configuration system.
Expand Down Expand Up @@ -273,7 +273,7 @@ Number of Camel languages: 9 in 3 JAR artifacts (0 deprecated)

| link:https://camel.apache.org/components/latest/bean-language.html[Bean method] (camel-quarkus-bean) | 0.2.0 | To use a Java bean (aka method call) in Camel expressions or predicates.

| link:https://camel.apache.org/components/latest/constant-language.html[Constant] (camel-quarkus-core) | 0.2.0 | To use a constant value in Camel expressions or predicates.
| link:https://camel.apache.org/components/latest/constant-language.html[Constant] (camel-quarkus-core) | 0.2.0 | To use a constant value in Camel expressions or predicates. Important: this is a fixed constant value that is only set once during starting up the route, do not use this if you want dynamic values during routing.

| link:https://camel.apache.org/components/latest/exchangeProperty-language.html[ExchangeProperty] (camel-quarkus-core) | 0.2.0 | To use a Camel Exchange property in expressions or predicates.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceDirectoryBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;

class BindyProcessor {

Expand All @@ -28,4 +30,14 @@ FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}

@BuildStep
ReflectiveClassBuildItem reflectiveClasses() {
return new ReflectiveClassBuildItem(false, false, "com.ibm.icu.text.BreakIteratorFactory");
}

@BuildStep
NativeImageResourceDirectoryBuildItem resourceBundles() {
return new NativeImageResourceDirectoryBuildItem("com/ibm/icu/impl/data");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@
*/
package org.apache.camel.quarkus.component.consul.deployment;

import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;

class ConsulProcessor {
private static final String FEATURE = "camel-consul";
Expand All @@ -35,14 +33,4 @@ ExtensionSslNativeSupportBuildItem activateSslNativeSupport() {
return new ExtensionSslNativeSupportBuildItem(FEATURE);
}

@BuildStep
void reflectiveClasses(BuildProducer<ReflectiveClassBuildItem> reflectiveClasses) {
reflectiveClasses.produce(new ReflectiveClassBuildItem(
true,
false,
"org.apache.camel.component.consul.ConsulConfiguration",
"org.apache.camel.component.consul.ConsulClientConfiguration",
"org.apache.camel.component.consul.health.ConsulHealthCheckRepositoryConfiguration",
"org.apache.camel.component.consul.cloud.ConsulServiceRegistryConfiguration"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.quarkus.jaxb.deployment.JaxbFileRootBuildItem;
import org.apache.camel.quarkus.component.xml.XmlRecorder;
import org.apache.camel.quarkus.core.deployment.CamelModelJAXBContextFactoryBuildItem;
import org.apache.camel.quarkus.core.deployment.CamelModelToXMLDumperBuildItem;
import org.apache.camel.quarkus.core.deployment.CamelRoutesLoaderBuildItems;
import org.apache.camel.quarkus.core.deployment.CamelSupport;
import org.apache.camel.quarkus.support.common.CamelCapabilities;
Expand Down Expand Up @@ -56,7 +57,13 @@ CamelModelJAXBContextFactoryBuildItem contextFactory(XmlRecorder recorder) {
@BuildStep
@Record(value = ExecutionTime.STATIC_INIT, optional = true)
CamelRoutesLoaderBuildItems.Xml xmlLoader(XmlRecorder recorder) {
return new CamelRoutesLoaderBuildItems.Xml(recorder.newDefaultXmlLoader());
return new CamelRoutesLoaderBuildItems.Xml(recorder.newJaxbXMLRoutesDefinitionLoader());
}

@BuildStep
@Record(value = ExecutionTime.STATIC_INIT, optional = true)
CamelModelToXMLDumperBuildItem xmlModelDumper(XmlRecorder recorder) {
return new CamelModelToXMLDumperBuildItem(recorder.newJaxbModelToXMLDumper());
}

@BuildStep
Expand Down
4 changes: 4 additions & 0 deletions extensions/core-xml/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-xml-jaxb</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@
import org.apache.camel.impl.DefaultModelJAXBContextFactory;
import org.apache.camel.model.ValidateDefinition;
import org.apache.camel.model.validator.PredicateValidatorDefinition;
import org.apache.camel.quarkus.core.XmlRoutesLoader;
import org.apache.camel.reifier.ProcessorReifier;
import org.apache.camel.reifier.ValidateReifier;
import org.apache.camel.reifier.validator.PredicateValidatorReifier;
import org.apache.camel.reifier.validator.ValidatorReifier;
import org.apache.camel.spi.ModelJAXBContextFactory;
import org.apache.camel.spi.ModelToXMLDumper;
import org.apache.camel.spi.XMLRoutesDefinitionLoader;
import org.apache.camel.xml.jaxb.JaxbModelToXMLDumper;
import org.apache.camel.xml.jaxb.JaxbXMLRoutesDefinitionLoader;
import org.graalvm.nativeimage.ImageInfo;

@Recorder
Expand All @@ -47,12 +50,30 @@ public RuntimeValue<ModelJAXBContextFactory> newContextFactory() {
return new RuntimeValue<>(factory);
}

public RuntimeValue<XmlRoutesLoader> newDefaultXmlLoader() {
return new RuntimeValue<>(new DefaultXmlRoutesLoader());
public RuntimeValue<XMLRoutesDefinitionLoader> newJaxbXMLRoutesDefinitionLoader() {
return new RuntimeValue<>(new JaxbXMLRoutesDefinitionLoader());
}

public RuntimeValue<ModelToXMLDumper> newJaxbModelToXMLDumper() {
return new RuntimeValue<>(new JaxbModelToXMLDumper());
}

public void initXmlReifiers() {
ProcessorReifier.registerReifier(ValidateDefinition.class, ValidateReifier::new);
ValidatorReifier.registerReifier(PredicateValidatorDefinition.class, PredicateValidatorReifier::new);
}

/*
@Override
protected XMLRoutesDefinitionLoader createXMLRoutesDefinitionLoader() {
return xmlLoader;
}
@Override
protected ModelToXMLDumper createModelToXMLDumper() {
return modelDumper;
}
*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,15 @@ public CamelModelJAXBContextFactoryBuildItem createJaxbContextFactory(CamelRecor
@Overridable
@BuildStep
@Record(value = ExecutionTime.STATIC_INIT, optional = true)
public CamelRoutesLoaderBuildItems.Xml createXmlLoader(CamelRecorder recorder) {
return new CamelRoutesLoaderBuildItems.Xml(recorder.newDisabledXmlRoutesLoader());
public CamelRoutesLoaderBuildItems.Xml createXMLRoutesLoader(CamelRecorder recorder) {
return new CamelRoutesLoaderBuildItems.Xml(recorder.newDisabledXMLRoutesDefinitionLoader());
}

@Overridable
@BuildStep
@Record(value = ExecutionTime.STATIC_INIT, optional = true)
public CamelModelToXMLDumperBuildItem createModelToXMLDumper(CamelRecorder recorder) {
return new CamelModelToXMLDumperBuildItem(recorder.newDisabledModelToXMLDumper());
}

@BuildStep
Expand All @@ -355,6 +362,7 @@ CamelContextBuildItem context(
CamelTypeConverterRegistryBuildItem typeConverterRegistry,
CamelModelJAXBContextFactoryBuildItem contextFactory,
CamelRoutesLoaderBuildItems.Xml xmlLoader,
CamelModelToXMLDumperBuildItem modelDumper,
CamelFactoryFinderResolverBuildItem factoryFinderResolverBuildItem,
BeanContainerBuildItem beanContainer,
CamelConfig config) {
Expand All @@ -364,6 +372,7 @@ CamelContextBuildItem context(
typeConverterRegistry.getRegistry(),
contextFactory.getContextFactory(),
xmlLoader.getLoader(),
modelDumper.getValue(),
factoryFinderResolverBuildItem.getFactoryFinderResolver(),
beanContainer.getValue(),
CamelSupport.getCamelVersion(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.quarkus.core;
package org.apache.camel.quarkus.core.deployment;

import java.io.InputStream;
import io.quarkus.builder.item.SimpleBuildItem;
import io.quarkus.runtime.RuntimeValue;
import org.apache.camel.spi.ModelToXMLDumper;

import org.apache.camel.CamelContext;
import org.apache.camel.model.RoutesDefinition;
import org.apache.camel.model.rest.RestsDefinition;
public final class CamelModelToXMLDumperBuildItem extends SimpleBuildItem {
private final RuntimeValue<ModelToXMLDumper> value;

public interface XmlRoutesLoader {

RoutesDefinition loadRoutesDefinition(CamelContext context, InputStream inputStream) throws Exception;

RestsDefinition loadRestsDefinition(CamelContext context, InputStream is) throws Exception;
public CamelModelToXMLDumperBuildItem(RuntimeValue<ModelToXMLDumper> value) {
this.value = value;
}

public RuntimeValue<ModelToXMLDumper> getValue() {
return value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import io.quarkus.builder.item.SimpleBuildItem;
import io.quarkus.runtime.RuntimeValue;
import org.apache.camel.quarkus.core.RegistryRoutesLoader;
import org.apache.camel.quarkus.core.XmlRoutesLoader;
import org.apache.camel.spi.XMLRoutesDefinitionLoader;

public final class CamelRoutesLoaderBuildItems {
private CamelRoutesLoaderBuildItems() {
Expand All @@ -41,16 +41,16 @@ public RuntimeValue<RegistryRoutesLoader> getLoader() {
}

/**
* Holds the {@link XmlRoutesLoader} instance.
* Holds the {@link XMLRoutesDefinitionLoader} instance.
*/
public static final class Xml extends SimpleBuildItem {
private final RuntimeValue<XmlRoutesLoader> value;
private final RuntimeValue<XMLRoutesDefinitionLoader> value;

public Xml(RuntimeValue<XmlRoutesLoader> value) {
public Xml(RuntimeValue<XMLRoutesDefinitionLoader> value) {
this.value = value;
}

public RuntimeValue<XmlRoutesLoader> getLoader() {
public RuntimeValue<XMLRoutesDefinitionLoader> getLoader() {
return value;
}
}
Expand Down
10 changes: 4 additions & 6 deletions extensions/core/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,15 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-engine</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jaxp</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-base</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-catalog</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-caffeine-lrucache</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
* Bridges {@link MainSupport} events to CDI.
*/
public class CamelMainEventDispatcher implements org.apache.camel.main.MainListener {
@Override
public void beforeConfigure(BaseMainSupport main) {
fireEvent(CamelMainEvents.BeforeConfigure.class, new CamelMainEvents.BeforeConfigure());
}

@Override
public void configure(CamelContext context) {
fireEvent(CamelMainEvents.Configure.class, new CamelMainEvents.Configure());
Expand Down

0 comments on commit 8eebc84

Please sign in to comment.