Search in sources :

Example 16 with Processor

use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorServiceTest method testGetProcessorWithReadyDependencies.

@Test
void testGetProcessorWithReadyDependencies() {
    String processor1Name = NEW_PROCESSOR_NAME;
    Processor processor1 = new Processor();
    processor1.setType(SINK);
    processor1.setName(processor1Name);
    processor1.setShardId(TestConstants.SHARD_ID);
    processor1.setStatus(ACCEPTED);
    processor1.setDependencyStatus(READY);
    String processor2Name = "My Processor 2";
    Processor processor2 = new Processor();
    processor2.setType(SINK);
    processor2.setName(processor2Name);
    processor2.setShardId(TestConstants.SHARD_ID);
    processor2.setStatus(DEPROVISION);
    processor2.setDependencyStatus(DELETED);
    when(processorDAO.findByShardIdWithReadyDependencies(TestConstants.SHARD_ID)).thenReturn(List.of(processor1, processor2));
    List<Processor> processors = processorService.findByShardIdWithReadyDependencies(TestConstants.SHARD_ID);
    assertThat(processors).hasSize(2);
    processors.forEach((px) -> assertThat(px.getName()).isIn(processor1Name, processor2Name));
}
Also used : Processor(com.redhat.service.smartevents.manager.models.Processor) Test(org.junit.jupiter.api.Test) QuarkusTest(io.quarkus.test.junit.QuarkusTest) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 17 with Processor

use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorServiceTest method createReadyProcessor.

private static Processor createReadyProcessor() {
    Processor processor = Fixtures.createProcessor(createReadyBridge(), READY);
    processor.setId(DEFAULT_PROCESSOR_ID);
    return processor;
}
Also used : Processor(com.redhat.service.smartevents.manager.models.Processor)

Example 18 with Processor

use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorServiceTest method createProvisioningProcessor.

private static Processor createProvisioningProcessor() {
    Processor processor = Fixtures.createProcessor(createReadyBridge(), PROVISIONING);
    processor.setId(PROVISIONING_PROCESSOR_ID);
    processor.setName(PROVISIONING_PROCESSOR_NAME);
    processor.setPublishedAt(null);
    return processor;
}
Also used : Processor(com.redhat.service.smartevents.manager.models.Processor)

Example 19 with Processor

use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorServiceTest method testCreateErrorHandlerProcessor.

@Test
void testCreateErrorHandlerProcessor() {
    ProcessorRequest processorRequest = new ProcessorRequest(ERROR_HANDLER_PROCESSOR_NAME, TestUtils.createWebhookAction());
    Processor processor = processorService.createErrorHandlerProcessor(DEFAULT_BRIDGE_ID, DEFAULT_CUSTOMER_ID, DEFAULT_USER_NAME, processorRequest);
    doAssertProcessorCreation(processor, processorRequest, ERROR_HANDLER);
}
Also used : Processor(com.redhat.service.smartevents.manager.models.Processor) ProcessorRequest(com.redhat.service.smartevents.manager.api.models.requests.ProcessorRequest) Test(org.junit.jupiter.api.Test) QuarkusTest(io.quarkus.test.junit.QuarkusTest) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 20 with Processor

use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorDAOTest method testGetProcessorsFilterByName.

@Test
void testGetProcessorsFilterByName() {
    Bridge b = createBridge();
    Processor p = createProcessor(b, "foo");
    createProcessor(b, "bar");
    ListResult<Processor> results = processorDAO.findByBridgeIdAndCustomerId(b.getId(), b.getCustomerId(), new QueryProcessorResourceInfo(0, 100, filter().by(p.getName()).build()));
    assertThat(results.getPage()).isZero();
    assertThat(results.getSize()).isEqualTo(1L);
    assertThat(results.getTotal()).isEqualTo(1L);
    assertThat(results.getItems().get(0).getId()).isEqualTo(p.getId());
}
Also used : QueryProcessorResourceInfo(com.redhat.service.smartevents.infra.models.QueryProcessorResourceInfo) Processor(com.redhat.service.smartevents.manager.models.Processor) Bridge(com.redhat.service.smartevents.manager.models.Bridge) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Aggregations

Processor (com.redhat.service.smartevents.manager.models.Processor)82 Bridge (com.redhat.service.smartevents.manager.models.Bridge)45 QuarkusTest (io.quarkus.test.junit.QuarkusTest)36 Test (org.junit.jupiter.api.Test)36 Transactional (javax.transaction.Transactional)20 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)20 Action (com.redhat.service.smartevents.infra.models.gateways.Action)13 QueryProcessorResourceInfo (com.redhat.service.smartevents.infra.models.QueryProcessorResourceInfo)12 ProcessorDefinition (com.redhat.service.smartevents.infra.models.processors.ProcessorDefinition)9 MethodSource (org.junit.jupiter.params.provider.MethodSource)9 ProcessorRequest (com.redhat.service.smartevents.manager.api.models.requests.ProcessorRequest)8 ConnectorEntity (com.redhat.service.smartevents.manager.models.ConnectorEntity)8 Connector (com.openshift.cloud.api.connector.models.Connector)7 Work (com.redhat.service.smartevents.manager.models.Work)7 ConnectorStatusStatus (com.openshift.cloud.api.connector.models.ConnectorStatusStatus)6 ProcessorResponse (com.redhat.service.smartevents.manager.api.models.responses.ProcessorResponse)6 KafkaTopicAction (com.redhat.service.smartevents.processor.actions.kafkatopic.KafkaTopicAction)6 InternalPlatformException (com.redhat.service.smartevents.infra.exceptions.definitions.platform.InternalPlatformException)5 BaseFilter (com.redhat.service.smartevents.infra.models.filters.BaseFilter)5 SlackAction (com.redhat.service.smartevents.processor.actions.slack.SlackAction)5