From f27db935c3fc92ed33b6e1c13a35ba8061bd07b9 Mon Sep 17 00:00:00 2001 From: Guillaume Duval Date: Fri, 13 Dec 2024 15:28:53 +0100 Subject: [PATCH] Update mocks --- .../email/EmailRouteBuilderTest.java | 23 +++---------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/connector-email/src/test/java/com/redhat/cloud/notifications/connector/email/EmailRouteBuilderTest.java b/connector-email/src/test/java/com/redhat/cloud/notifications/connector/email/EmailRouteBuilderTest.java index bc84c9c7e3..17cfb1cc8c 100644 --- a/connector-email/src/test/java/com/redhat/cloud/notifications/connector/email/EmailRouteBuilderTest.java +++ b/connector-email/src/test/java/com/redhat/cloud/notifications/connector/email/EmailRouteBuilderTest.java @@ -30,7 +30,6 @@ import static com.redhat.cloud.notifications.connector.ConnectorRoutesTest.KAFKA_SOURCE_MOCK; import static com.redhat.cloud.notifications.connector.ConnectorToEngineRouteBuilder.CONNECTOR_TO_ENGINE; import static com.redhat.cloud.notifications.connector.EngineToConnectorRouteBuilder.ENGINE_TO_CONNECTOR; -import static com.redhat.cloud.notifications.connector.EngineToConnectorRouteBuilder.KAFKA_REINJECTION; import static com.redhat.cloud.notifications.connector.IncomingCloudEventFilter.X_RH_NOTIFICATIONS_CONNECTOR_HEADER; import static com.redhat.cloud.notifications.connector.IncomingCloudEventProcessor.CLOUD_EVENT_DATA; import static com.redhat.cloud.notifications.connector.IncomingCloudEventProcessor.CLOUD_EVENT_ID; @@ -74,32 +73,21 @@ public void configure() throws Exception { "direct:" + CONNECTOR_TO_ENGINE, "direct:" + SPLIT_AND_SEND ); + mockEndpointsAndSkip("kafka:" + emailConnectorConfig.getOutgoingKafkaTopic()); } }); adviceWith(CONNECTOR_TO_ENGINE, context(), new AdviceWithRouteBuilder() { @Override public void configure() throws Exception { - mockEndpoints("kafka:" + emailConnectorConfig.getOutgoingKafkaTopic()); + mockEndpointsAndSkip("kafka:" + emailConnectorConfig.getOutgoingKafkaTopic()); } }); adviceWith(SPLIT_AND_SEND, context(), new AdviceWithRouteBuilder() { @Override public void configure() throws Exception { - mockEndpoints( - "direct:" + SEND_EMAIL_BOP - ); - } - }); - - adviceWith(KAFKA_REINJECTION, context(), new AdviceWithRouteBuilder() { - @Override - public void configure() { - // because we will change kafka endpoint to an internal endpoint, exchange properties will be sent as well to this endpoint - // we have to remove them to be sure that properties will be loaded from kafka header and message only in case of re-injection - weaveByToUri("kafka:*").before().removeProperties("*", "camel*"); - weaveByToUri("kafka:*").replace().to(KAFKA_SOURCE_MOCK); + mockEndpoints("direct:" + SEND_EMAIL_BOP); } }); @@ -125,11 +113,6 @@ void initMocks(ExpectationResponseCallback verifyEmptyRequest, ExpectationRespon initCamelRoutes(); camelRoutesInitialised = true; } - - splitRoute.reset(); - bopRoute.reset(); - kafkaConnectorToEngine.reset(); - kafkaEngineToConnector.reset(); } @Test