use of com.redhat.service.smartevents.infra.models.gateways.Action in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class GatewayConnectorTest method testSlackConnectorPayload.
@Test
public void testSlackConnectorPayload() throws JsonProcessingException {
String channel = "channel";
String webhookURL = "https://www.example.com/webhook";
String topicName = "topic";
String payload = "{" + " \"slack_channel\":\"" + channel + "\"," + " \"slack_webhook_url\":\"" + webhookURL + "\"," + " \"kafka_topic\":\"" + topicName + "\"," + " \"processors\": [" + " {" + " \"log\": {" + " \"multiLine\":true," + " \"showHeaders\":true" + " }" + " }" + " ]" + "}";
JsonNode expectedPayload = mapper.readTree(payload);
Action action = new Action();
action.setType(SlackAction.TYPE);
action.setMapParameters(Map.of(SlackAction.CHANNEL_PARAM, channel, SlackAction.WEBHOOK_URL_PARAM, webhookURL));
JsonNode actualPayload = gatewayConnector.connectorPayload(action, topicName);
assertThat(actualPayload).isEqualTo(expectedPayload);
}
use of com.redhat.service.smartevents.infra.models.gateways.Action in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class KafkaTopicActionValidatorTest method isValid.
@Test
void isValid() {
Action action = createActionWithTopic("myTopic");
assertThat(validator.isValid(action).isValid()).isTrue();
}
Aggregations