Search in sources :

Example 56 with ProcessorRequest

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

the class ShardBridgesSyncAPITest method updateProcessorStatus.

@Test
@TestSecurity(user = DEFAULT_CUSTOMER_ID)
public void updateProcessorStatus() {
    BridgeResponse bridgeResponse = TestUtils.createBridge(new BridgeRequest(DEFAULT_BRIDGE_NAME)).as(BridgeResponse.class);
    BridgeDTO bridge = new BridgeDTO(bridgeResponse.getId(), bridgeResponse.getName(), TEST_BRIDGE_ENDPOINT, DEFAULT_CUSTOMER_ID, DEFAULT_USER_NAME, READY, new KafkaConnectionDTO());
    TestUtils.updateBridge(bridge);
    TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest(DEFAULT_PROCESSOR_NAME, TestUtils.createKafkaAction()));
    final List<ProcessorDTO> processors = new ArrayList<>();
    await().atMost(5, SECONDS).untilAsserted(() -> {
        processors.clear();
        processors.addAll(TestUtils.getProcessorsToDeployOrDelete().as(new TypeRef<List<ProcessorDTO>>() {
        }));
        assertThat(processors.size()).isEqualTo(1);
    });
    ProcessorDTO processor = processors.get(0);
    processor.setStatus(READY);
    TestUtils.updateProcessor(processor);
    await().atMost(5, SECONDS).untilAsserted(() -> {
        processors.clear();
        processors.addAll(TestUtils.getProcessorsToDeployOrDelete().as(new TypeRef<List<ProcessorDTO>>() {
        }));
        assertThat(processors).isEmpty();
    });
}
Also used : BridgeRequest(com.redhat.service.smartevents.manager.api.models.requests.BridgeRequest) BridgeDTO(com.redhat.service.smartevents.infra.models.dto.BridgeDTO) KafkaConnectionDTO(com.redhat.service.smartevents.infra.models.dto.KafkaConnectionDTO) ProcessorDTO(com.redhat.service.smartevents.infra.models.dto.ProcessorDTO) TypeRef(io.restassured.common.mapper.TypeRef) ProcessorRequest(com.redhat.service.smartevents.manager.api.models.requests.ProcessorRequest) ArrayList(java.util.ArrayList) 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 57 with ProcessorRequest

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

Example 58 with ProcessorRequest

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

the class ProcessorAPITest method getProcessor_processorDoesNotExist.

@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void getProcessor_processorDoesNotExist() {
    BridgeResponse bridgeResponse = createAndDeployBridge();
    Response response = TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor", TestUtils.createKafkaAction()));
    assertThat(response.getStatusCode()).isEqualTo(202);
    Response found = TestUtils.getProcessor(bridgeResponse.getId(), "doesNotExist");
    assertThat(found.getStatusCode()).isEqualTo(404);
}
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) 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 59 with ProcessorRequest

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

Aggregations

ProcessorRequest (com.redhat.service.smartevents.manager.api.models.requests.ProcessorRequest)59 Test (org.junit.jupiter.api.Test)49 QuarkusTest (io.quarkus.test.junit.QuarkusTest)47 BridgeResponse (com.redhat.service.smartevents.manager.api.models.responses.BridgeResponse)41 TestSecurity (io.quarkus.test.security.TestSecurity)40 ProcessorListResponse (com.redhat.service.smartevents.manager.api.models.responses.ProcessorListResponse)36 ProcessorResponse (com.redhat.service.smartevents.manager.api.models.responses.ProcessorResponse)36 Response (io.restassured.response.Response)27 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)13 BaseFilter (com.redhat.service.smartevents.infra.models.filters.BaseFilter)11 StringEquals (com.redhat.service.smartevents.infra.models.filters.StringEquals)11 Bridge (com.redhat.service.smartevents.manager.models.Bridge)11 Action (com.redhat.service.smartevents.infra.models.gateways.Action)10 Processor (com.redhat.service.smartevents.manager.models.Processor)8 SlackAction (com.redhat.service.smartevents.processor.actions.slack.SlackAction)8 MethodSource (org.junit.jupiter.params.provider.MethodSource)8 BridgeDTO (com.redhat.service.smartevents.infra.models.dto.BridgeDTO)6 BridgeRequest (com.redhat.service.smartevents.manager.api.models.requests.BridgeRequest)6 KafkaTopicAction (com.redhat.service.smartevents.processor.actions.kafkatopic.KafkaTopicAction)6 SendToBridgeAction (com.redhat.service.smartevents.processor.actions.sendtobridge.SendToBridgeAction)6