Search in sources :

Example 1 with ProcessorDefinition

use of com.redhat.service.smartevents.infra.models.processors.ProcessorDefinition in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ConnectorsServiceTest method processorWith.

private static Processor processorWith(Gateway gateway) {
    Processor processor = new Processor();
    processor.setBridge(new Bridge());
    ProcessorDefinition processorDefinition = new ProcessorDefinition();
    if (gateway instanceof Action) {
        processorDefinition.setRequestedAction((Action) gateway);
        processor.setType(ProcessorType.SINK);
    } else {
        processorDefinition.setRequestedSource((Source) gateway);
        processor.setType(ProcessorType.SOURCE);
    }
    processor.setId(TEST_PROCESSOR_ID);
    processor.setName(TEST_PROCESSOR_NAME);
    processor.setDefinition(processorDefinition);
    return processor;
}
Also used : Action(com.redhat.service.smartevents.infra.models.gateways.Action) SlackAction(com.redhat.service.smartevents.processor.actions.slack.SlackAction) WebhookAction(com.redhat.service.smartevents.processor.actions.webhook.WebhookAction) Processor(com.redhat.service.smartevents.manager.models.Processor) ProcessorDefinition(com.redhat.service.smartevents.infra.models.processors.ProcessorDefinition) Bridge(com.redhat.service.smartevents.manager.models.Bridge)

Example 2 with ProcessorDefinition

use of com.redhat.service.smartevents.infra.models.processors.ProcessorDefinition in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ConnectorsDAOTest method createPersistProcessor.

private Processor createPersistProcessor(Bridge bridge) {
    Processor p = Fixtures.createProcessor(bridge, ManagedResourceStatus.ACCEPTED);
    Action a = new Action();
    a.setType(KafkaTopicAction.TYPE);
    Map<String, String> params = new HashMap<>();
    params.put(KafkaTopicAction.TOPIC_PARAM, TestConstants.DEFAULT_KAFKA_TOPIC);
    a.setMapParameters(params);
    ProcessorDefinition definition = new ProcessorDefinition(Collections.emptySet(), null, a);
    p.setDefinition(definition);
    processorDAO.persist(p);
    return p;
}
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) HashMap(java.util.HashMap) ProcessorDefinition(com.redhat.service.smartevents.infra.models.processors.ProcessorDefinition)

Example 3 with ProcessorDefinition

use of com.redhat.service.smartevents.infra.models.processors.ProcessorDefinition in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorDAOTest method createProcessor.

private Processor createProcessor(Bridge bridge, String name, ProcessorType type) {
    Processor p = new Processor();
    p.setType(type);
    p.setBridge(bridge);
    p.setName(name);
    p.setStatus(ManagedResourceStatus.ACCEPTED);
    p.setSubmittedAt(ZonedDateTime.now());
    p.setPublishedAt(ZonedDateTime.now());
    p.setShardId(TestConstants.SHARD_ID);
    p.setOwner(TestConstants.DEFAULT_USER_NAME);
    Action a = new Action();
    a.setType(KafkaTopicAction.TYPE);
    Map<String, String> params = new HashMap<>();
    params.put(KafkaTopicAction.TOPIC_PARAM, TestConstants.DEFAULT_KAFKA_TOPIC);
    a.setMapParameters(params);
    ProcessorDefinition definition = new ProcessorDefinition(Collections.emptySet(), null, a);
    p.setDefinition(definition);
    processorDAO.persist(p);
    return p;
}
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) HashMap(java.util.HashMap) ProcessorDefinition(com.redhat.service.smartevents.infra.models.processors.ProcessorDefinition)

Example 4 with ProcessorDefinition

use of com.redhat.service.smartevents.infra.models.processors.ProcessorDefinition in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class Fixtures method createProcessor.

public static Processor createProcessor(Bridge b, ManagedResourceStatus status) {
    Processor p = new Processor();
    p.setType(ProcessorType.SINK);
    p.setName(TestConstants.DEFAULT_PROCESSOR_NAME);
    p.setStatus(status);
    p.setPublishedAt(ZonedDateTime.now());
    p.setSubmittedAt(ZonedDateTime.now());
    p.setBridge(b);
    p.setShardId(TestConstants.SHARD_ID);
    p.setOwner(TestConstants.DEFAULT_USER_NAME);
    p.setDefinition(new ProcessorDefinition());
    return p;
}
Also used : Processor(com.redhat.service.smartevents.manager.models.Processor) ProcessorDefinition(com.redhat.service.smartevents.infra.models.processors.ProcessorDefinition)

Example 5 with ProcessorDefinition

use of com.redhat.service.smartevents.infra.models.processors.ProcessorDefinition in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class KafkaTopicActionInvokerBuilderTest method createProcessorWithActionForTopic.

private ProcessorDTO createProcessorWithActionForTopic(String topicName) {
    Action b = new Action();
    b.setType(KafkaTopicAction.TYPE);
    Map<String, String> params = new HashMap<>();
    params.put(KafkaTopicAction.TOPIC_PARAM, topicName);
    b.setMapParameters(params);
    ProcessorDTO p = new ProcessorDTO();
    p.setType(ProcessorType.SINK);
    p.setId("myProcessor");
    p.setDefinition(new ProcessorDefinition(null, null, b));
    p.setBridgeId("myBridge");
    return p;
}
Also used : Action(com.redhat.service.smartevents.infra.models.gateways.Action) HashMap(java.util.HashMap) ProcessorDTO(com.redhat.service.smartevents.infra.models.dto.ProcessorDTO) ProcessorDefinition(com.redhat.service.smartevents.infra.models.processors.ProcessorDefinition)

Aggregations

ProcessorDefinition (com.redhat.service.smartevents.infra.models.processors.ProcessorDefinition)16 Action (com.redhat.service.smartevents.infra.models.gateways.Action)12 Processor (com.redhat.service.smartevents.manager.models.Processor)9 KafkaTopicAction (com.redhat.service.smartevents.processor.actions.kafkatopic.KafkaTopicAction)7 HashMap (java.util.HashMap)5 WebhookAction (com.redhat.service.smartevents.processor.actions.webhook.WebhookAction)4 ProcessorDTO (com.redhat.service.smartevents.infra.models.dto.ProcessorDTO)3 BaseFilter (com.redhat.service.smartevents.infra.models.filters.BaseFilter)3 SendToBridgeAction (com.redhat.service.smartevents.processor.actions.sendtobridge.SendToBridgeAction)3 Source (com.redhat.service.smartevents.infra.models.gateways.Source)2 ProcessorResponse (com.redhat.service.smartevents.manager.api.models.responses.ProcessorResponse)2 Bridge (com.redhat.service.smartevents.manager.models.Bridge)2 AlreadyExistingItemException (com.redhat.service.smartevents.infra.exceptions.definitions.user.AlreadyExistingItemException)1 BadRequestException (com.redhat.service.smartevents.infra.exceptions.definitions.user.BadRequestException)1 ProcessorLifecycleException (com.redhat.service.smartevents.infra.exceptions.definitions.user.ProcessorLifecycleException)1 StringEquals (com.redhat.service.smartevents.infra.models.filters.StringEquals)1 SlackAction (com.redhat.service.smartevents.processor.actions.slack.SlackAction)1 SlackSource (com.redhat.service.smartevents.processor.sources.slack.SlackSource)1 QuarkusTest (io.quarkus.test.junit.QuarkusTest)1 HashSet (java.util.HashSet)1