use of com.redhat.service.smartevents.infra.models.filters.StringBeginsWith in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class FilterEvaluatorFactoryFEELTest method testStringBeginsWithTemplate.
@Test
public void testStringBeginsWithTemplate() {
String expectedSingle = "if (starts with (data.name, \"jrota\")) then \"OK\" else \"NOT_OK\"";
String templateSingle = TEMPLATE_FACTORY_FEEL.getTemplateByFilterType(new StringBeginsWith("data.name", Arrays.asList("jrota")));
assertThat(templateSingle).isEqualTo(expectedSingle);
String expectedMulti = "if (starts with (data.name, \"jacopo\")) or (starts with (data.name, \"rota\")) then \"OK\" else \"NOT_OK\"";
String templateMulti = TEMPLATE_FACTORY_FEEL.getTemplateByFilterType(new StringBeginsWith("data.name", Arrays.asList("jacopo", "rota")));
assertThat(templateMulti).isEqualTo(expectedMulti);
}
use of com.redhat.service.smartevents.infra.models.filters.StringBeginsWith 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