use of com.redhat.service.smartevents.infra.models.filters.StringIn in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorAPITest method addProcessorWithWrongFilterFiltersToBridge.
@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void addProcessorWithWrongFilterFiltersToBridge() {
BridgeResponse bridgeResponse = createAndDeployBridge();
Response response = TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor", Collections.singleton(new StringIn("pepe", null)), null, TestUtils.createKafkaAction()));
assertThat(response.getStatusCode()).isEqualTo(400);
}
use of com.redhat.service.smartevents.infra.models.filters.StringIn in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class FilterEvaluatorFactoryFEELTest method stringInWithTemplate.
@Test
public void stringInWithTemplate() {
String expectedMulti = "if list contains ([\"jacopo\",\"rota\"], data.name) then \"OK\" else \"NOT_OK\"";
String templateMulti = TEMPLATE_FACTORY_FEEL.getTemplateByFilterType(new StringIn("data.name", Arrays.asList("jacopo", "rota")));
assertThat(templateMulti).isEqualTo(expectedMulti);
}
use of com.redhat.service.smartevents.infra.models.filters.StringIn in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceTest method testUpdateProcessorWithNoChange.
@ParameterizedTest
@MethodSource("updateProcessorParams")
void testUpdateProcessorWithNoChange(ProcessorRequest request) {
Set<BaseFilter> filters = Set.of(new StringBeginsWith("source", List.of("Storage")), new StringContains("source", List.of("StorageService")), new StringEquals("source", "StorageService"), new StringIn("source", List.of("StorageService")));
request.setFilters(filters);
Processor existingProcessor = createReadyProcessorFromRequest(request);
when(processorDAO.findByIdBridgeIdAndCustomerId(DEFAULT_BRIDGE_ID, DEFAULT_PROCESSOR_ID, DEFAULT_CUSTOMER_ID)).thenReturn(existingProcessor);
Processor updatedProcessor = processorService.updateProcessor(DEFAULT_BRIDGE_ID, DEFAULT_PROCESSOR_ID, DEFAULT_CUSTOMER_ID, request);
assertThat(updatedProcessor.getStatus()).isEqualTo(READY);
assertThat(updatedProcessor).isEqualTo(existingProcessor);
}
Aggregations