use of com.redhat.service.smartevents.infra.models.gateways.Source in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorGatewayConstraintValidatorTest method buildTestSource.
private static Source buildTestSource() {
Source source = new Source();
source.setType(TEST_SOURCE_TYPE);
Map<String, String> params = new HashMap<>();
params.put(TEST_PARAM_NAME, TEST_PARAM_VALUE);
source.setMapParameters(params);
return source;
}
use of com.redhat.service.smartevents.infra.models.gateways.Source in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceTest method testUpdateProcessorWithGateway.
@ParameterizedTest
@MethodSource("updateProcessorParams")
void testUpdateProcessorWithGateway(ProcessorRequest request) {
Processor existingProcessor = createReadyProcessorFromRequest(request);
when(processorDAO.findByIdBridgeIdAndCustomerId(DEFAULT_BRIDGE_ID, DEFAULT_PROCESSOR_ID, DEFAULT_CUSTOMER_ID)).thenReturn(existingProcessor);
if (request.getType() == ProcessorType.SOURCE) {
Source dummyNewSource = new Source();
dummyNewSource.setType("DummySource");
request.setSource(dummyNewSource);
} else if (request.getType() == SINK) {
Action dummyNewAction = new Action();
dummyNewAction.setType("DummyAction");
request.setAction(dummyNewAction);
}
assertThatExceptionOfType(BadRequestException.class).isThrownBy(() -> processorService.updateProcessor(DEFAULT_BRIDGE_ID, DEFAULT_PROCESSOR_ID, DEFAULT_CUSTOMER_ID, request));
}
use of com.redhat.service.smartevents.infra.models.gateways.Source in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class SourceResolverTest method createSlackSource.
private Source createSlackSource() {
Source source = new Source();
source.setType(SlackSource.TYPE);
source.setMapParameters(Map.of(CHANNEL_PARAM, "channel", TOKEN_PARAM, "token"));
return source;
}
use of com.redhat.service.smartevents.infra.models.gateways.Source in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class SourceResolverTest method testActionWithoutBridgeId.
@Test
void testActionWithoutBridgeId() {
Source inputSource = createSlackSource();
Action resolvedAction = resolver.resolve(inputSource, CUSTOMER_ID, BRIDGE_ID, PROCESSOR_ID);
assertThat(resolvedAction).isNotNull();
assertThat(resolvedAction.getType()).isEqualTo(WebhookAction.TYPE);
assertThat(resolvedAction.getParameter(WebhookAction.ENDPOINT_PARAM)).isEqualTo(BRIDGE_ENDPOINT);
assertThat(resolvedAction.getParameter(WebhookAction.USE_TECHNICAL_BEARER_TOKEN_PARAM)).isEqualTo("true");
}
use of com.redhat.service.smartevents.infra.models.gateways.Source in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class SourceResolverTest method testActionWithoutOtherBridgeId.
@Test
void testActionWithoutOtherBridgeId() {
Source inputSource = createSlackSource();
assertThatExceptionOfType(GatewayProviderException.class).isThrownBy(() -> resolver.resolve(inputSource, CUSTOMER_ID, OTHER_BRIDGE_ID, PROCESSOR_ID));
}
Aggregations