Search in sources :

Example 26 with ProcessorResponse

use of com.redhat.service.smartevents.manager.api.models.responses.ProcessorResponse 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)

Example 27 with ProcessorResponse

use of com.redhat.service.smartevents.manager.api.models.responses.ProcessorResponse in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorAPITest method addProcessorWithNullFiltersToBridge.

@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void addProcessorWithNullFiltersToBridge() {
    BridgeResponse bridgeResponse = createAndDeployBridge();
    Response response = TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor", TestUtils.createKafkaAction()));
    assertThat(response.getStatusCode()).isEqualTo(202);
    ProcessorResponse processorResponse = response.as(ProcessorResponse.class);
    assertThat(processorResponse.getName()).isEqualTo("myProcessor");
    assertThat(processorResponse.getFilters()).isNull();
    assertThat(processorResponse.getTransformationTemplate()).isNull();
    assertRequestedAction(processorResponse);
}
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) ProcessorResponse(com.redhat.service.smartevents.manager.api.models.responses.ProcessorResponse) 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)

Aggregations

ProcessorResponse (com.redhat.service.smartevents.manager.api.models.responses.ProcessorResponse)27 QuarkusTest (io.quarkus.test.junit.QuarkusTest)22 Test (org.junit.jupiter.api.Test)22 TestSecurity (io.quarkus.test.security.TestSecurity)21 ProcessorRequest (com.redhat.service.smartevents.manager.api.models.requests.ProcessorRequest)20 BridgeResponse (com.redhat.service.smartevents.manager.api.models.responses.BridgeResponse)20 ProcessorListResponse (com.redhat.service.smartevents.manager.api.models.responses.ProcessorListResponse)20 Response (io.restassured.response.Response)11 BaseFilter (com.redhat.service.smartevents.infra.models.filters.BaseFilter)7 StringEquals (com.redhat.service.smartevents.infra.models.filters.StringEquals)7 Bridge (com.redhat.service.smartevents.manager.models.Bridge)7 Processor (com.redhat.service.smartevents.manager.models.Processor)5 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)3 Action (com.redhat.service.smartevents.infra.models.gateways.Action)2 ProcessorDefinition (com.redhat.service.smartevents.infra.models.processors.ProcessorDefinition)2 BridgeContext (com.redhat.service.smartevents.integration.tests.context.BridgeContext)2 KafkaTopicAction (com.redhat.service.smartevents.processor.actions.kafkatopic.KafkaTopicAction)2 When (io.cucumber.java.en.When)2 JsonObject (io.vertx.core.json.JsonObject)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2