use of com.redhat.service.smartevents.infra.models.gateways.Action in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class KafkaTopicActionValidatorTest method isInvalid_nullParametersMapIsNotValid.
@Test
void isInvalid_nullParametersMapIsNotValid() {
Action action = new Action();
action.setType(KafkaTopicAction.TYPE);
action.setMapParameters(new HashMap<>());
ValidationResult validationResult = validator.isValid(action);
assertThat(validationResult.isValid()).isFalse();
}
use of com.redhat.service.smartevents.infra.models.gateways.Action in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class SlackActionResolver method resolve.
@Override
public Action resolve(Action action, String customerId, String bridgeId, String processorId) {
Action resolvedAction = new Action();
resolvedAction.setParameters(action.getParameters().deepCopy());
resolvedAction.setType(KafkaTopicAction.TYPE);
String connectorTopicName = gatewayConfiguratorService.getConnectorTopicName(processorId);
resolvedAction.getParameters().set(KafkaTopicAction.TOPIC_PARAM, new TextNode(connectorTopicName));
return resolvedAction;
}
use of com.redhat.service.smartevents.infra.models.gateways.Action in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorSteps method processorOfBridgeHasActionOfTypeAndParameters.
@And("^the Processor \"([^\"]*)\" of the Bridge \"([^\"]*)\" has action of type \"([^\"]*)\" and parameters:$")
public void processorOfBridgeHasActionOfTypeAndParameters(String processorName, String testBridgeName, String actionType, DataTable parametersDatatable) {
Action action = getProcessorAction(processorName, testBridgeName);
assertThat(action.getType()).isEqualTo(actionType);
parametersDatatable.asMap().forEach((key, value) -> {
String parameterTextWithoutPlaceholders = ContextResolver.resolveWithScenarioContext(context, value);
assertThat(action.getParameter(key)).isEqualTo(parameterTextWithoutPlaceholders);
});
}
use of com.redhat.service.smartevents.infra.models.gateways.Action in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgesServiceImpl method createBridge.
@Override
@Transactional
public Bridge createBridge(String customerId, String organisationId, String owner, BridgeRequest bridgeRequest) {
if (bridgeDAO.findByNameAndCustomerId(bridgeRequest.getName(), customerId) != null) {
throw new AlreadyExistingItemException(String.format("Bridge with name '%s' already exists for customer with id '%s'", bridgeRequest.getName(), customerId));
}
Bridge bridge = bridgeRequest.toEntity();
bridge.setStatus(ManagedResourceStatus.ACCEPTED);
bridge.setSubmittedAt(ZonedDateTime.now(ZoneOffset.UTC));
bridge.setCustomerId(customerId);
bridge.setOrganisationId(organisationId);
bridge.setOwner(owner);
bridge.setShardId(shardService.getAssignedShardId(bridge.getId()));
// Ensure we connect the ErrorHandler Action to the ErrorHandler back-channel
Action errorHandler = bridgeRequest.getErrorHandler();
bridge.setDefinition(new BridgeDefinition(Objects.nonNull(errorHandler) ? errorHandler : null));
// Bridge and Work creation should always be in the same transaction
bridgeDAO.persist(bridge);
workManager.schedule(bridge);
metricsService.onOperationStart(bridge, MetricsOperation.PROVISION);
LOGGER.info("Bridge with id '{}' has been created for customer '{}'", bridge.getId(), bridge.getCustomerId());
return bridge;
}
use of com.redhat.service.smartevents.infra.models.gateways.Action in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class SendToBridgeActionResolverTest method actionWithBridgeId.
private Action actionWithBridgeId(String bridgeId) {
Action action = actionWithoutBridgeId();
action.setMapParameters(Map.of(SendToBridgeAction.BRIDGE_ID_PARAM, bridgeId));
return action;
}
Aggregations