Search in sources :

Example 46 with Action

use of com.redhat.service.smartevents.infra.models.gateways.Action in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorAPITest method addProcessorWithEmptyChannelParameterToBridge.

@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void addProcessorWithEmptyChannelParameterToBridge() {
    BridgeResponse bridgeResponse = createAndDeployBridge();
    Action action = TestUtils.createKafkaAction();
    action.setType(SlackAction.TYPE);
    Map<String, String> params = new HashMap<>();
    params.put(SlackAction.CHANNEL_PARAM, "");
    params.put(SlackAction.WEBHOOK_URL_PARAM, "https://example.com");
    action.setMapParameters(params);
    Response response = TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor", null, null, action));
    assertThat(response.getStatusCode()).isEqualTo(202);
}
Also used : ProcessorResponse(com.redhat.service.smartevents.manager.api.models.responses.ProcessorResponse) ProcessorListResponse(com.redhat.service.smartevents.manager.api.models.responses.ProcessorListResponse) BridgeResponse(com.redhat.service.smartevents.manager.api.models.responses.BridgeResponse) Response(io.restassured.response.Response) Action(com.redhat.service.smartevents.infra.models.gateways.Action) KafkaTopicAction(com.redhat.service.smartevents.processor.actions.kafkatopic.KafkaTopicAction) SlackAction(com.redhat.service.smartevents.processor.actions.slack.SlackAction) SendToBridgeAction(com.redhat.service.smartevents.processor.actions.sendtobridge.SendToBridgeAction) HashMap(java.util.HashMap) ProcessorRequest(com.redhat.service.smartevents.manager.api.models.requests.ProcessorRequest) BridgeResponse(com.redhat.service.smartevents.manager.api.models.responses.BridgeResponse) TestSecurity(io.quarkus.test.security.TestSecurity) Test(org.junit.jupiter.api.Test) QuarkusTest(io.quarkus.test.junit.QuarkusTest)

Example 47 with Action

use of com.redhat.service.smartevents.infra.models.gateways.Action in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class TestUtils method createKafkaAction.

public static Action createKafkaAction() {
    Action r = new Action();
    r.setType(KafkaTopicAction.TYPE);
    Map<String, String> params = new HashMap<>();
    params.put(KafkaTopicAction.TOPIC_PARAM, TestConstants.DEFAULT_KAFKA_TOPIC);
    r.setMapParameters(params);
    return r;
}
Also used : Action(com.redhat.service.smartevents.infra.models.gateways.Action) KafkaTopicAction(com.redhat.service.smartevents.processor.actions.kafkatopic.KafkaTopicAction) WebhookAction(com.redhat.service.smartevents.processor.actions.webhook.WebhookAction) SendToBridgeAction(com.redhat.service.smartevents.processor.actions.sendtobridge.SendToBridgeAction) HashMap(java.util.HashMap)

Example 48 with Action

use of com.redhat.service.smartevents.infra.models.gateways.Action in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class TestUtils method createSendToBridgeAction.

public static Action createSendToBridgeAction(String bridgeId) {
    Action r = new Action();
    r.setType(SendToBridgeAction.TYPE);
    Map<String, String> params = new HashMap<>();
    params.put(SendToBridgeAction.BRIDGE_ID_PARAM, bridgeId);
    r.setMapParameters(params);
    return r;
}
Also used : Action(com.redhat.service.smartevents.infra.models.gateways.Action) KafkaTopicAction(com.redhat.service.smartevents.processor.actions.kafkatopic.KafkaTopicAction) WebhookAction(com.redhat.service.smartevents.processor.actions.webhook.WebhookAction) SendToBridgeAction(com.redhat.service.smartevents.processor.actions.sendtobridge.SendToBridgeAction) HashMap(java.util.HashMap)

Example 49 with Action

use of com.redhat.service.smartevents.infra.models.gateways.Action in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class SendToBridgeActionResolverTest method actionWithoutBridgeId.

private Action actionWithoutBridgeId() {
    Action action = new Action();
    action.setType(SendToBridgeAction.TYPE);
    return action;
}
Also used : Action(com.redhat.service.smartevents.infra.models.gateways.Action) WebhookAction(com.redhat.service.smartevents.processor.actions.webhook.WebhookAction)

Example 50 with Action

use of com.redhat.service.smartevents.infra.models.gateways.Action in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class SendToBridgeActionResolverTest method testActionWithoutOtherBridgeId.

@Test
void testActionWithoutOtherBridgeId() {
    Action inputAction = actionWithoutBridgeId();
    Action resolvedAction = resolver.resolve(inputAction, TEST_CUSTOMER_ID, OTHER_BRIDGE_ID, "");
    assertValid(resolvedAction, OTHER_BRIDGE_WEBHOOK);
}
Also used : Action(com.redhat.service.smartevents.infra.models.gateways.Action) WebhookAction(com.redhat.service.smartevents.processor.actions.webhook.WebhookAction) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Aggregations

Action (com.redhat.service.smartevents.infra.models.gateways.Action)62 KafkaTopicAction (com.redhat.service.smartevents.processor.actions.kafkatopic.KafkaTopicAction)23 QuarkusTest (io.quarkus.test.junit.QuarkusTest)23 Test (org.junit.jupiter.api.Test)23 WebhookAction (com.redhat.service.smartevents.processor.actions.webhook.WebhookAction)21 SlackAction (com.redhat.service.smartevents.processor.actions.slack.SlackAction)13 HashMap (java.util.HashMap)13 ProcessorDefinition (com.redhat.service.smartevents.infra.models.processors.ProcessorDefinition)12 Processor (com.redhat.service.smartevents.manager.models.Processor)12 SendToBridgeAction (com.redhat.service.smartevents.processor.actions.sendtobridge.SendToBridgeAction)12 ProcessorRequest (com.redhat.service.smartevents.manager.api.models.requests.ProcessorRequest)9 Source (com.redhat.service.smartevents.infra.models.gateways.Source)7 BaseFilter (com.redhat.service.smartevents.infra.models.filters.BaseFilter)6 BridgeResponse (com.redhat.service.smartevents.manager.api.models.responses.BridgeResponse)6 Bridge (com.redhat.service.smartevents.manager.models.Bridge)6 TestSecurity (io.quarkus.test.security.TestSecurity)6 ProcessorResponse (com.redhat.service.smartevents.manager.api.models.responses.ProcessorResponse)5 Response (io.restassured.response.Response)5 ProcessorDTO (com.redhat.service.smartevents.infra.models.dto.ProcessorDTO)4 StringEquals (com.redhat.service.smartevents.infra.models.filters.StringEquals)4