Search in sources :

Example 1 with ActionInvoker

use of com.redhat.service.smartevents.processor.actions.ActionInvoker in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class WebhookActionInvokerBuilderTest method testInvokerWithBasicAuth.

@Test
void testInvokerWithBasicAuth() {
    ProcessorDTO processor = createProcessor();
    processor.getDefinition().getResolvedAction().getParameters().put(BASIC_AUTH_USERNAME_PARAM, TEST_USERNAME);
    processor.getDefinition().getResolvedAction().getParameters().put(BASIC_AUTH_PASSWORD_PARAM, TEST_PASSWORD);
    ActionInvoker actionInvoker = builder.build(processor, processor.getDefinition().getResolvedAction());
    assertThat(actionInvoker).isNotNull().isInstanceOf(WebhookActionInvoker.class);
    WebhookActionInvoker webhookActionInvoker = (WebhookActionInvoker) actionInvoker;
    assertThat(webhookActionInvoker.getEndpoint()).isEqualTo(TEST_ENDPOINT);
    assertThat(webhookActionInvoker.getWebClient()).isNotNull();
    assertThat(webhookActionInvoker.getOidcClient()).isNull();
    assertThat(webhookActionInvoker.getBasicAuthUsername()).isEqualTo(TEST_USERNAME);
    assertThat(webhookActionInvoker.getBasicAuthPassword()).isEqualTo(TEST_PASSWORD);
}
Also used : ActionInvoker(com.redhat.service.smartevents.processor.actions.ActionInvoker) ProcessorDTO(com.redhat.service.smartevents.infra.models.dto.ProcessorDTO) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 2 with ActionInvoker

use of com.redhat.service.smartevents.processor.actions.ActionInvoker in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class WebhookActionInvokerBuilderTest method testInvokerWithSslVerificationDisabled.

@Test
void testInvokerWithSslVerificationDisabled() {
    ProcessorDTO processor = createProcessor();
    processor.getDefinition().getResolvedAction().getParameters().put(SSL_VERIFICATION_DISABLED, "true");
    ActionInvoker actionInvoker = builder.build(processor, processor.getDefinition().getResolvedAction());
    assertThat(actionInvoker).isNotNull().isInstanceOf(WebhookActionInvoker.class);
    WebhookActionInvoker webhookActionInvoker = (WebhookActionInvoker) actionInvoker;
    assertThat(webhookActionInvoker.getEndpoint()).isEqualTo(TEST_ENDPOINT);
    assertThat(webhookActionInvoker.getWebClient()).isNotNull();
    assertThat(webhookActionInvoker.getOidcClient()).isNull();
    assertThat(webhookActionInvoker.getBasicAuthUsername()).isNull();
    assertThat(webhookActionInvoker.getBasicAuthPassword()).isNull();
}
Also used : ActionInvoker(com.redhat.service.smartevents.processor.actions.ActionInvoker) ProcessorDTO(com.redhat.service.smartevents.infra.models.dto.ProcessorDTO) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 3 with ActionInvoker

use of com.redhat.service.smartevents.processor.actions.ActionInvoker in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class WebhookActionInvokerBuilderTest method testInvoker.

@Test
void testInvoker() {
    ProcessorDTO processor = createProcessor();
    ActionInvoker actionInvoker = builder.build(processor, processor.getDefinition().getResolvedAction());
    assertThat(actionInvoker).isNotNull().isInstanceOf(WebhookActionInvoker.class);
    WebhookActionInvoker webhookActionInvoker = (WebhookActionInvoker) actionInvoker;
    assertThat(webhookActionInvoker.getEndpoint()).isEqualTo(TEST_ENDPOINT);
    assertThat(webhookActionInvoker.getWebClient()).isNotNull();
    assertThat(webhookActionInvoker.getOidcClient()).isNull();
    assertThat(webhookActionInvoker.getBasicAuthUsername()).isNull();
    assertThat(webhookActionInvoker.getBasicAuthPassword()).isNull();
}
Also used : ActionInvoker(com.redhat.service.smartevents.processor.actions.ActionInvoker) ProcessorDTO(com.redhat.service.smartevents.infra.models.dto.ProcessorDTO) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 4 with ActionInvoker

use of com.redhat.service.smartevents.processor.actions.ActionInvoker in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class KafkaTopicActionInvokerBuilderTest method getActionInvoker.

@Test
void getActionInvoker() {
    ProcessorDTO p = createProcessorWithActionForTopic(TOPIC_NAME);
    ActionInvoker actionInvoker = builder.build(p, p.getDefinition().getResolvedAction());
    assertThat(actionInvoker).isNotNull();
    verify(kafkaAdmin).listTopics();
}
Also used : ActionInvoker(com.redhat.service.smartevents.processor.actions.ActionInvoker) ProcessorDTO(com.redhat.service.smartevents.infra.models.dto.ProcessorDTO) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Aggregations

ProcessorDTO (com.redhat.service.smartevents.infra.models.dto.ProcessorDTO)4 ActionInvoker (com.redhat.service.smartevents.processor.actions.ActionInvoker)4 QuarkusTest (io.quarkus.test.junit.QuarkusTest)4 Test (org.junit.jupiter.api.Test)4