Skip to main content
TNB supports testing integrations across three Fuse products, each with local and OpenShift deployment capabilities.

Product types

The framework supports the following products via the ProductType enum:
CAMEL_QUARKUS
ProductType
Camel Quarkus integrations running on the Quarkus frameworkValue: camelquarkus
CAMEL_SPRINGBOOT
ProductType
Camel Spring Boot integrations running on Spring BootValue: camelspringboot
CXF_QUARKUS
ProductType
Apache CXF on Quarkus for SOAP and REST web servicesValue: cxfquarkus

Using products in tests

You can create product instances in two ways:

Auto-detection

Let TNB determine the product based on system properties:
import software.tnb.product.ProductFactory;
import software.tnb.product.Product;
import org.junit.jupiter.api.extension.RegisterExtension;

public class MyTest {
    @RegisterExtension
    public static Product product = ProductFactory.create();
}
The product is determined by the fuse.product system property (camelspringboot, camelquarkus, cxfquarkus). Deployment location (local vs OpenShift) is determined by the openshift.url property.

Explicit product

Create a specific product instance for product-specific features:
import software.tnb.product.cq.LocalCamelQuarkus;
import org.junit.jupiter.api.extension.RegisterExtension;

public class QuarkusSpecificTest {
    @RegisterExtension
    public static LocalCamelQuarkus cq = ProductFactory.create(LocalCamelQuarkus.class);
}

Camel Quarkus

Camel Quarkus combines the power of Apache Camel with Quarkus features.

Integration creation

Application skeleton is generated from the io.quarkus:quarkus-maven-plugin:<version>:create Maven plugin, and the integration code is dumped as a Java file in the app skeleton.

Available classes

  • LocalCamelQuarkus: Local deployment
  • OpenshiftCamelQuarkus: OpenShift deployment

Example

import software.tnb.product.integration.builder.IntegrationBuilder;
import org.apache.camel.builder.RouteBuilder;

public class QuarkusTest {
    @RegisterExtension
    public static Product product = ProductFactory.create();
    
    @Test
    public void testQuarkusIntegration() {
        IntegrationBuilder ib = new IntegrationBuilder("my-integration")
            .fromRouteBuilder(new RouteBuilder() {
                @Override
                public void configure() throws Exception {
                    from("timer:tick?period=1000")
                        .log("Tick from Quarkus!");
                }
            })
            .dependencies("timer", "log");
        
        product.createIntegration(ib);
        // Test your integration
    }
}

Camel Spring Boot

Camel Spring Boot provides enterprise integration patterns on the Spring Boot platform.

Integration creation

Application skeleton is generated from the camel-spring-boot archetype, and the integration code is dumped as a Java file in the app skeleton.

Available classes

  • LocalCamelSpringBoot: Local deployment
  • OpenshiftCamelSpringBoot: OpenShift deployment

Spring Boot-specific features

The SpringBootIntegrationBuilder extends the base builder with Spring Boot-specific methods:
import software.tnb.product.csb.integration.builder.SpringBootIntegrationBuilder;

SpringBootIntegrationBuilder ib = new SpringBootIntegrationBuilder("my-sb-integration")
    .fromSpringBootXmlCamelContext("camel-context.xml") // XML-based routes
    .useExistingJar(Path.of("/path/to/app.jar")) // Use pre-built JAR
    .dependencies("timer", "log");
The SpringBootIntegrationBuilder provides methods for XML Camel contexts and using existing JAR files, which are Spring Boot-specific features.

CXF Quarkus

Apache CXF on Quarkus for building SOAP and RESTful web services.

Available classes

  • OpenshiftCxfQuarkus: OpenShift deployment

Use cases

CXF Quarkus is ideal for:
  • SOAP web service integrations
  • REST web service integrations
  • WS-* protocol support
  • Legacy system integration

Product lifecycle

The Product interface extends JUnit 5’s BeforeAllCallback and AfterAllCallback:
public abstract class Product implements BeforeAllCallback, AfterAllCallback {
    public App createIntegration(AbstractIntegrationBuilder<?> integrationBuilder) {
        // Creates and starts the integration
    }
    
    public void removeIntegrations() {
        // Stops all integrations in reverse order
    }
    
    public abstract void setupProduct();
    public abstract void teardownProduct();
}

Multiple integrations

You can create multiple integrations in a single test:
Map<String, App> apps = product.createIntegration(
    new IntegrationBuilder("integration-1")
        .fromRouteBuilder(routeBuilder1)
        .dependencies("timer"),
    new IntegrationBuilder("integration-2")
        .fromRouteBuilder(routeBuilder2)
        .dependencies("http")
);

System properties

Configure product behavior using system properties:
fuse.product
string
required
Specifies which product to useValues: camelquarkus, camelspringboot, cxfquarkus
openshift.url
string
OpenShift cluster URL. If present, deploys to OpenShift; otherwise deploys locally
openshift.deploy.strategy
string
Deployment strategy for OpenShiftValues: JKUBE, BINARY, DEVFILE, CUSTOM, JKUBE_EXT_REPO

Build docs developers (and LLMs) love