Search in sources :

Example 21 with BaseAction

use of com.redhat.service.bridge.infra.models.actions.BaseAction in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class SendToBridgeActionTransformerTest method actionWithBridgeId.

private BaseAction actionWithBridgeId(String bridgeId) {
    BaseAction action = actionWithoutBridgeId();
    action.getParameters().put(SendToBridgeAction.BRIDGE_ID_PARAM, bridgeId);
    return action;
}
Also used : BaseAction(com.redhat.service.bridge.infra.models.actions.BaseAction)

Example 22 with BaseAction

use of com.redhat.service.bridge.infra.models.actions.BaseAction in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class SendToBridgeActionTransformerTest method testActionWithoutBridgeId.

@Test
void testActionWithoutBridgeId() {
    BaseAction inputAction = actionWithoutBridgeId();
    BaseAction transformedAction = transformer.transform(inputAction, bridge.getId(), TEST_CUSTOMER_ID, "");
    assertValid(transformedAction, BRIDGE_WEBHOOK);
}
Also used : BaseAction(com.redhat.service.bridge.infra.models.actions.BaseAction) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 23 with BaseAction

use of com.redhat.service.bridge.infra.models.actions.BaseAction in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class SendToBridgeActionValidatorTest method actionWith.

private BaseAction actionWith(Map<String, String> params) {
    BaseAction b = new BaseAction();
    b.setType(SendToBridgeAction.TYPE);
    b.setParameters(params);
    return b;
}
Also used : BaseAction(com.redhat.service.bridge.infra.models.actions.BaseAction)

Example 24 with BaseAction

use of com.redhat.service.bridge.infra.models.actions.BaseAction in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorDAOTest method createProcessor.

private Processor createProcessor(Bridge bridge, String name) {
    Processor p = new Processor();
    p.setBridge(bridge);
    p.setName(name);
    p.setStatus(ManagedResourceStatus.ACCEPTED);
    p.setSubmittedAt(ZonedDateTime.now());
    p.setPublishedAt(ZonedDateTime.now());
    p.setShardId(TestConstants.SHARD_ID);
    BaseAction a = new BaseAction();
    a.setType(KafkaTopicAction.TYPE);
    Map<String, String> params = new HashMap<>();
    params.put(KafkaTopicAction.TOPIC_PARAM, TestConstants.DEFAULT_KAFKA_TOPIC);
    a.setParameters(params);
    ProcessorDefinition definition = new ProcessorDefinition(Collections.emptySet(), null, a);
    p.setDefinition(mapper.valueToTree(definition));
    processorDAO.persist(p);
    return p;
}
Also used : Processor(com.redhat.service.bridge.manager.models.Processor) HashMap(java.util.HashMap) ProcessorDefinition(com.redhat.service.bridge.infra.models.processors.ProcessorDefinition) BaseAction(com.redhat.service.bridge.infra.models.actions.BaseAction)

Example 25 with BaseAction

use of com.redhat.service.bridge.infra.models.actions.BaseAction in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class Fixtures method createKafkaAction.

public static BaseAction createKafkaAction() {
    BaseAction action = new BaseAction();
    action.setType(KafkaTopicAction.TYPE);
    Map<String, String> params = new HashMap<>();
    params.put(KafkaTopicAction.TOPIC_PARAM, "myTopic");
    action.setParameters(params);
    return action;
}
Also used : HashMap(java.util.HashMap) BaseAction(com.redhat.service.bridge.infra.models.actions.BaseAction)

Aggregations

BaseAction (com.redhat.service.bridge.infra.models.actions.BaseAction)48 Test (org.junit.jupiter.api.Test)20 QuarkusTest (io.quarkus.test.junit.QuarkusTest)15 ProcessorDefinition (com.redhat.service.bridge.infra.models.processors.ProcessorDefinition)13 HashMap (java.util.HashMap)13 ProcessorDTO (com.redhat.service.bridge.infra.models.dto.ProcessorDTO)10 BaseFilter (com.redhat.service.bridge.infra.models.filters.BaseFilter)10 StringEquals (com.redhat.service.bridge.infra.models.filters.StringEquals)9 ProcessorRequest (com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest)9 Processor (com.redhat.service.bridge.manager.models.Processor)7 Bridge (com.redhat.service.bridge.manager.models.Bridge)6 HashSet (java.util.HashSet)6 CloudEvent (io.cloudevents.CloudEvent)5 ProcessorResponse (com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse)4 ValidationResult (com.redhat.service.bridge.actions.ValidationResult)3 BridgeResponse (com.redhat.service.bridge.manager.api.models.responses.BridgeResponse)3 TestSecurity (io.quarkus.test.security.TestSecurity)3 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)3 Connector (com.openshift.cloud.api.connector.models.Connector)2 ConnectorRequest (com.openshift.cloud.api.connector.models.ConnectorRequest)2