Skip to content

Latest commit

 

History

History
83 lines (63 loc) · 4.87 KB

README.md

File metadata and controls

83 lines (63 loc) · 4.87 KB

TNB - Fuse Products

This module contains the logic for working with supported fuse products on both local machine and OpenShift.

For each product there are two main areas covered:

  • deployment - deploying and undeploying product (where applicable)
  • integrations - creating, starting, stopping of integrations

The integration code is generated from a "meta" Integration Builder class and 0..x Customizers for given system-x services using the javaparser framework. See RouteBuilders guide for more details.

In order to deploy the integration in Openshift, it is possible to implement a specific strategy listed in OpenshiftDeployStrategyType enum and instantiated by OpenshiftDeployStrategyFactory searching for OpenshiftDeployStrategy classes. The implementation class must be a OpenshiftDeployer in order to execute all deployment phases. You can run the deployment strategy via property openshift.deploy.strategy

There are several integration builder classes to use dependending on the use-case:

  • AbstractIntegrationBuilder serves as a base for creating integrations on all products (so there are methods related to every product only)
  • AbstractGitIntegrationBuilder
  • AbstractMavenGitIntegrationBuilder
  • CamelKIntegrationBuilder that extends AbstractIntegrationBuilder and adds methods related to camel-k only
  • SpringBootIntegrationBuilder that extends AbstractIntegrationBuilder and adds methods related to camel on springboot only

Customizers are used when the integration should run on all products, but the configuration differs between products. In that case, you need to use a customizer, where you have access to the IntegrationBuilder and all its methods.

Again, there are multiple customizers you can use:

Instead of creating new SpringBoot|Quarkus|CamelK customizers, you can use Customizers enum, for example:

Customizers.CAMELK.customize(ib -> ...)

There are also customizer implementations for common modifications needed for a given product. You can check them out in customizer sub-package inside the product's package.

The integrations are created differently for each product:

  • camel on springboot:
    • an application skeleton is generated from the archetype
    • the integration code is dumped as a java file in the app skeleton
  • camel quarkus:
    • an application skeleton is generated from the io.quarkus:quarkus-maven-plugin:<version>:create maven plugin
    • the integration code is dumped as a java file in the app skeleton
  • camel-k:
    • the integration code is dumped as a String and the integration is created as the Integration object in OpenShift

All products are implementing JUnit 5 extensions so creating a fuse product in your test is as simple as adding following piece of code:

@RegisterExtension
public static Product product = ProductFactory.create();

In this case a correct product instance is determined based on system property fuse.product (camelspringboot, camelquarkus, camelk) and based on openshift.url property presence (determines if the deployment is local or openshift)

If you want a specific instance of a given fuse product, you can use:

@RegisterExtension
public static CamelK camelk = ProductFactory.create(CamelK.class);

for example to test features specific to Camel-K only.