Search in sources :

Example 16 with ProcessorDefinition

use of com.redhat.service.smartevents.infra.models.processors.ProcessorDefinition in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorServiceTest method testToResponse.

@Test
void testToResponse() {
    Bridge b = Fixtures.createBridge();
    Processor p = Fixtures.createProcessor(b, READY);
    Action action = Fixtures.createKafkaAction();
    ProcessorDefinition definition = new ProcessorDefinition(Collections.emptySet(), "", action);
    p.setDefinition(definition);
    ProcessorResponse r = processorService.toResponse(p);
    assertThat(r).isNotNull();
    assertThat(r.getHref()).isEqualTo(APIConstants.USER_API_BASE_PATH + b.getId() + "/processors/" + p.getId());
    assertThat(r.getName()).isEqualTo(p.getName());
    assertThat(r.getStatus()).isEqualTo(p.getStatus());
    assertThat(r.getType()).isEqualTo(p.getType());
    assertThat(r.getId()).isEqualTo(p.getId());
    assertThat(r.getSubmittedAt()).isEqualTo(p.getSubmittedAt());
    assertThat(r.getPublishedAt()).isEqualTo(p.getPublishedAt());
    assertThat(r.getKind()).isEqualTo("Processor");
    assertThat(r.getTransformationTemplate()).isEmpty();
    assertThat(r.getAction().getType()).isEqualTo(KafkaTopicAction.TYPE);
}
Also used : Action(com.redhat.service.smartevents.infra.models.gateways.Action) KafkaTopicAction(com.redhat.service.smartevents.processor.actions.kafkatopic.KafkaTopicAction) Processor(com.redhat.service.smartevents.manager.models.Processor) ProcessorResponse(com.redhat.service.smartevents.manager.api.models.responses.ProcessorResponse) ProcessorDefinition(com.redhat.service.smartevents.infra.models.processors.ProcessorDefinition) Bridge(com.redhat.service.smartevents.manager.models.Bridge) Test(org.junit.jupiter.api.Test) QuarkusTest(io.quarkus.test.junit.QuarkusTest) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

ProcessorDefinition (com.redhat.service.smartevents.infra.models.processors.ProcessorDefinition)16 Action (com.redhat.service.smartevents.infra.models.gateways.Action)12 Processor (com.redhat.service.smartevents.manager.models.Processor)9 KafkaTopicAction (com.redhat.service.smartevents.processor.actions.kafkatopic.KafkaTopicAction)7 HashMap (java.util.HashMap)5 WebhookAction (com.redhat.service.smartevents.processor.actions.webhook.WebhookAction)4 ProcessorDTO (com.redhat.service.smartevents.infra.models.dto.ProcessorDTO)3 BaseFilter (com.redhat.service.smartevents.infra.models.filters.BaseFilter)3 SendToBridgeAction (com.redhat.service.smartevents.processor.actions.sendtobridge.SendToBridgeAction)3 Source (com.redhat.service.smartevents.infra.models.gateways.Source)2 ProcessorResponse (com.redhat.service.smartevents.manager.api.models.responses.ProcessorResponse)2 Bridge (com.redhat.service.smartevents.manager.models.Bridge)2 AlreadyExistingItemException (com.redhat.service.smartevents.infra.exceptions.definitions.user.AlreadyExistingItemException)1 BadRequestException (com.redhat.service.smartevents.infra.exceptions.definitions.user.BadRequestException)1 ProcessorLifecycleException (com.redhat.service.smartevents.infra.exceptions.definitions.user.ProcessorLifecycleException)1 StringEquals (com.redhat.service.smartevents.infra.models.filters.StringEquals)1 SlackAction (com.redhat.service.smartevents.processor.actions.slack.SlackAction)1 SlackSource (com.redhat.service.smartevents.processor.sources.slack.SlackSource)1 QuarkusTest (io.quarkus.test.junit.QuarkusTest)1 HashSet (java.util.HashSet)1