Skip to content

Commit

Permalink
Update mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
g-duval committed Dec 13, 2024
1 parent c698b20 commit f27db93
Showing 1 changed file with 3 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
});

Expand All @@ -125,11 +113,6 @@ void initMocks(ExpectationResponseCallback verifyEmptyRequest, ExpectationRespon
initCamelRoutes();
camelRoutesInitialised = true;
}

splitRoute.reset();
bopRoute.reset();
kafkaConnectorToEngine.reset();
kafkaEngineToConnector.reset();
}

@Test
Expand Down

0 comments on commit f27db93

Please sign in to comment.