Camel Quarkus 3.36.0 Migration Guide

The following guide outlines how to adapt your code to changes that were made in Camel Quarkus 3.36.0.

CamelQuarkusTestSupport - AdviceWith improvements

The testing framework has been significantly improved to make AdviceWith easier to use and more reliable.

Automatic route starting after advice

Routes that are not advised are now automatically started after doBeforeEach() or @BeforeEach completes. This means you no longer need to manually call startRouteDefinitions() when using AdviceWith.

Before (3.35.0 and earlier):

@BeforeEach
public void beforeEach() throws Exception {
    AdviceWith.adviceWith(context, "my-route", route -> {
        route.weaveByToUri("kafka:*").replace().to("mock:result");
    });

    // Required to start non-advised routes
    startRouteDefinitions();
}

After (3.36.0):

@BeforeEach
void beforeEach() throws Exception {
    AdviceWith.adviceWith(this.context, "my-route", route -> {
        route.weaveByToUri("kafka:*").replace().to("mock:result");
    });

    // startRouteDefinitions() is no longer needed - auto-start handles this
}

New adviceRoute() helper method

A new adviceRoute() helper method has been added to simplify per-test-method advice. This method handles route lifecycle (stop, advice, start) automatically.

Example:

@Test
void testWithDifferentAdvice() throws Exception {
    adviceRoute("my-route", route -> {
        route.weaveByToUri("kafka:*").replace().to("mock:stub");
    });

    // Test assertions...
}

This is particularly useful when different tests in the same class need different advice applied.

Automatic advice cleanup

Advice modifications are now automatically cleaned up between test methods to prevent interference between tests. This ensures that each test starts with a clean route state.

For more details, see the Testing guide.