Search in sources :

Example 31 with ProcessorDTO

use of com.redhat.service.smartevents.infra.models.dto.ProcessorDTO 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 32 with ProcessorDTO

use of com.redhat.service.smartevents.infra.models.dto.ProcessorDTO in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class KafkaTopicActionInvokerBuilderTest method getActionInvoker_requestedTopicDoesNotExist.

@Test
void getActionInvoker_requestedTopicDoesNotExist() {
    ProcessorDTO p = createProcessorWithActionForTopic("thisTopicDoesNotExist");
    assertThatExceptionOfType(GatewayProviderException.class).isThrownBy(() -> builder.build(p, p.getDefinition().getResolvedAction()));
    verify(kafkaAdmin).listTopics();
}
Also used : ProcessorDTO(com.redhat.service.smartevents.infra.models.dto.ProcessorDTO) GatewayProviderException(com.redhat.service.smartevents.infra.exceptions.definitions.user.GatewayProviderException) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 33 with ProcessorDTO

use of com.redhat.service.smartevents.infra.models.dto.ProcessorDTO 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)33 Test (org.junit.jupiter.api.Test)24 QuarkusTest (io.quarkus.test.junit.QuarkusTest)22 BridgeDTO (com.redhat.service.smartevents.infra.models.dto.BridgeDTO)5 TestSecurity (io.quarkus.test.security.TestSecurity)5 KafkaConnectionDTO (com.redhat.service.smartevents.infra.models.dto.KafkaConnectionDTO)4 Action (com.redhat.service.smartevents.infra.models.gateways.Action)4 ProcessorDefinition (com.redhat.service.smartevents.infra.models.processors.ProcessorDefinition)4 BridgeRequest (com.redhat.service.smartevents.manager.api.models.requests.BridgeRequest)4 ProcessorRequest (com.redhat.service.smartevents.manager.api.models.requests.ProcessorRequest)4 BridgeResponse (com.redhat.service.smartevents.manager.api.models.responses.BridgeResponse)4 ActionInvoker (com.redhat.service.smartevents.processor.actions.ActionInvoker)4 TypeRef (io.restassured.common.mapper.TypeRef)4 ArrayList (java.util.ArrayList)4 CountDownLatch (java.util.concurrent.CountDownLatch)4 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)4 BaseFilter (com.redhat.service.smartevents.infra.models.filters.BaseFilter)3 StringEquals (com.redhat.service.smartevents.infra.models.filters.StringEquals)3 HashMap (java.util.HashMap)3 ItemNotFoundException (com.redhat.service.smartevents.infra.exceptions.definitions.user.ItemNotFoundException)2