Search in sources :

Example 6 with KafkaConnectionDTO

use of com.redhat.service.smartevents.infra.models.dto.KafkaConnectionDTO 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)

Aggregations

BridgeDTO (com.redhat.service.smartevents.infra.models.dto.BridgeDTO)6 KafkaConnectionDTO (com.redhat.service.smartevents.infra.models.dto.KafkaConnectionDTO)6 BridgeRequest (com.redhat.service.smartevents.manager.api.models.requests.BridgeRequest)5 ProcessorRequest (com.redhat.service.smartevents.manager.api.models.requests.ProcessorRequest)5 BridgeResponse (com.redhat.service.smartevents.manager.api.models.responses.BridgeResponse)5 QuarkusTest (io.quarkus.test.junit.QuarkusTest)5 TestSecurity (io.quarkus.test.security.TestSecurity)5 Test (org.junit.jupiter.api.Test)5 ProcessorDTO (com.redhat.service.smartevents.infra.models.dto.ProcessorDTO)4 TypeRef (io.restassured.common.mapper.TypeRef)4 ArrayList (java.util.ArrayList)4 BaseFilter (com.redhat.service.smartevents.infra.models.filters.BaseFilter)2 StringEquals (com.redhat.service.smartevents.infra.models.filters.StringEquals)2 Action (com.redhat.service.smartevents.infra.models.gateways.Action)1 KafkaTopicAction (com.redhat.service.smartevents.processor.actions.kafkatopic.KafkaTopicAction)1 SendToBridgeAction (com.redhat.service.smartevents.processor.actions.sendtobridge.SendToBridgeAction)1 WebhookAction (com.redhat.service.smartevents.processor.actions.webhook.WebhookAction)1 ResponseLoggingFilter (io.restassured.filter.log.ResponseLoggingFilter)1