java Camel/Quarkus - AdviceWith无法通过id找到路线

cu6pst1q  于 5个月前  发布在  Java
关注(0)|答案(1)|浏览(76)

我有以下路线:

from("direct:someRoute")
.id("someRoute")
.log(...)
.to("sql-stored:someProcedure(BIGINT ${exchangeProperty.someVal})")
.id("someCall")
.log(...)
.end()

字符串
我正在尝试用预存数据替换someCall REST调用以进行测试。
我的测试是这样的:

@QuarkusTest
public Class Tests{

    @Inject
    CamelContext camelContext

    @BeforeEach
    public void setup(){
        AdviceWith.adviceWith(
            this.camelContext,
            "someRoute",
            a -> {
                a.weaveById("someCall")
                    .replace()
                    .setBody()
                    .constant("{}")
            }
        );
    }

    @Test
    public void testOne(){
        //...
    }
    @Test
    public void testTwo(){
        //...
    }
}


然而,当我运行测试时,我得到以下错误:

  • 第一个测试错误:
  • Cannot advice route as route with id: someRoute does not exists
  • 第二个测试错误:
  • There are no outputs with matches: someCall in the route: <routeToString, oddly with no mention of the someCall route, or even an sql route>

对我来说似乎是奇怪的错误,查看日志和路由肯定会被拾取,更奇怪的是someCall引用不在toString中。

更新

刚刚意识到这发生在第一次测试之后的测试中。似乎我的问题与@BeforeEach中的面孔有关.

更新2

在测试开始时尝试调用context.stop()context.start(),但得到一个错误,说不支持。
尝试使用CamelQuarkusTestSupport最终完成了第一个测试,但是每个额外的测试都有一个没有路由的空CamelQuarkus

vc9ivgsu

vc9ivgsu1#

这是因为您应该将ID设置为:

.routeId("someRoute")

字符串

相关问题