use of com.redhat.service.bridge.infra.models.actions.BaseAction in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class SendToBridgeActionTransformer method transform.
@Override
public BaseAction transform(BaseAction action, String bridgeId, String customerId, String processorId) {
String destinationBridgeId = action.getParameters().getOrDefault(SendToBridgeAction.BRIDGE_ID_PARAM, bridgeId);
Bridge destinationBridge = bridgesService.getReadyBridge(destinationBridgeId, customerId);
Map<String, String> parameters = new HashMap<>();
try {
parameters.put(WebhookAction.ENDPOINT_PARAM, getBridgeWebhookUrl(destinationBridge.getEndpoint()));
parameters.put(WebhookAction.USE_TECHNICAL_BEARER_TOKEN, "true");
} catch (MalformedURLException e) {
throw new ActionProviderException("Can't find events webhook for bridge " + destinationBridgeId);
}
BaseAction transformedAction = new BaseAction();
transformedAction.setType(WebhookAction.TYPE);
transformedAction.setParameters(parameters);
return transformedAction;
}
use of com.redhat.service.bridge.infra.models.actions.BaseAction in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorAPITest method assertRequestedAction.
private void assertRequestedAction(ProcessorResponse processorResponse) {
BaseAction baseAction = processorResponse.getAction();
assertThat(baseAction).isNotNull();
assertThat(baseAction.getType()).isEqualTo(KafkaTopicAction.TYPE);
assertThat(baseAction.getParameters().get(KafkaTopicAction.TOPIC_PARAM)).isEqualTo(TestConstants.DEFAULT_KAFKA_TOPIC);
}
use of com.redhat.service.bridge.infra.models.actions.BaseAction in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorAPITest method addProcessorToBridge_missingActionParameters.
@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void addProcessorToBridge_missingActionParameters() {
BridgeResponse bridgeResponse = createAndDeployBridge();
BaseAction action = createKafkaAction();
action.getParameters().clear();
action.getParameters().put("thisIsNotCorrect", "myTopic");
Set<BaseFilter> filters = Collections.singleton(new StringEquals("json.key", "value"));
Response response = TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor", filters, null, action));
assertThat(response.getStatusCode()).isEqualTo(400);
}
use of com.redhat.service.bridge.infra.models.actions.BaseAction in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class SendToBridgeActionTransformerTest method testActionWithSameBridgeId.
@Test
void testActionWithSameBridgeId() {
BaseAction inputAction = actionWithBridgeId(bridge.getId());
BaseAction transformedAction = transformer.transform(inputAction, bridge.getId(), TEST_CUSTOMER_ID, "");
assertValid(transformedAction, BRIDGE_WEBHOOK);
}
use of com.redhat.service.bridge.infra.models.actions.BaseAction in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class SendToBridgeActionTransformerTest method testActionWithOtherBridgeId.
@Test
void testActionWithOtherBridgeId() {
BaseAction inputAction = actionWithBridgeId(otherBridge.getId());
BaseAction transformedAction = transformer.transform(inputAction, bridge.getId(), TEST_CUSTOMER_ID, "");
assertValid(transformedAction, OTHER_BRIDGE_WEBHOOK);
}
Aggregations