use of com.redhat.service.smartevents.infra.models.gateways.Action in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgesAPITest method getBridgeWithErrorHandler.
@Test
@TestSecurity(user = DEFAULT_CUSTOMER_ID)
public void getBridgeWithErrorHandler() {
Action errorHandler = createWebhookAction();
Response bridgeCreateResponse = TestUtils.createBridge(new BridgeRequest(DEFAULT_BRIDGE_NAME, errorHandler));
bridgeCreateResponse.then().statusCode(202);
BridgeResponse bridge = bridgeCreateResponse.as(BridgeResponse.class);
BridgeResponse retrievedBridge = TestUtils.getBridge(bridge.getId()).as(BridgeResponse.class);
assertThat(retrievedBridge).isNotNull();
assertThat(retrievedBridge.getId()).isEqualTo(bridge.getId());
assertThat(retrievedBridge.getName()).isEqualTo(bridge.getName());
assertThat(retrievedBridge.getEndpoint()).isEqualTo(bridge.getEndpoint());
assertThat(retrievedBridge.getErrorHandler()).isNotNull();
assertThat(retrievedBridge.getErrorHandler()).isEqualTo(errorHandler);
}
use of com.redhat.service.smartevents.infra.models.gateways.Action in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class TestUtils method createWebhookAction.
public static Action createWebhookAction() {
Action action = new Action();
action.setType(WebhookAction.TYPE);
action.setMapParameters(Map.of(WebhookAction.ENDPOINT_PARAM, "https://webhook.site/a0704e8f-a817-4d02-b30a-b8c49d0132dc"));
return action;
}
use of com.redhat.service.smartevents.infra.models.gateways.Action in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class SourceResolver method resolve.
@Override
public Action resolve(Source source, String customerId, String bridgeId, String processorId) {
Action resolvedAction = new Action();
resolvedAction.setType(WebhookAction.TYPE);
resolvedAction.setMapParameters(Map.of(WebhookAction.ENDPOINT_PARAM, getBridgeWebhookUrl(customerId, bridgeId), WebhookAction.USE_TECHNICAL_BEARER_TOKEN_PARAM, "true"));
return resolvedAction;
}
use of com.redhat.service.smartevents.infra.models.gateways.Action in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class KafkaTopicActionValidatorTest method createActionWithTopic.
private Action createActionWithTopic(String topicName) {
Action action = new Action();
action.setType(KafkaTopicAction.TYPE);
Map<String, String> params = new HashMap<>();
params.put(KafkaTopicAction.TOPIC_PARAM, topicName);
action.setMapParameters(params);
return action;
}
use of com.redhat.service.smartevents.infra.models.gateways.Action in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class KafkaTopicActionValidatorTest method isInvalid_noTopicIsNotValid.
@Test
void isInvalid_noTopicIsNotValid() {
Action action = createActionWithTopic("myTopic");
action.getParameters().remove(KafkaTopicAction.TOPIC_PARAM);
ValidationResult validationResult = validator.isValid(action);
assertThat(validationResult.isValid()).isFalse();
assertThat(validationResult.getMessage()).isEqualTo("$.topic: is missing but it is required");
}
Aggregations