Search in sources :

Example 1 with StringIn

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);
}
Also used : ProcessorResponse(com.redhat.service.smartevents.manager.api.models.responses.ProcessorResponse) ProcessorListResponse(com.redhat.service.smartevents.manager.api.models.responses.ProcessorListResponse) BridgeResponse(com.redhat.service.smartevents.manager.api.models.responses.BridgeResponse) Response(io.restassured.response.Response) ProcessorRequest(com.redhat.service.smartevents.manager.api.models.requests.ProcessorRequest) BridgeResponse(com.redhat.service.smartevents.manager.api.models.responses.BridgeResponse) StringIn(com.redhat.service.smartevents.infra.models.filters.StringIn) TestSecurity(io.quarkus.test.security.TestSecurity) Test(org.junit.jupiter.api.Test) QuarkusTest(io.quarkus.test.junit.QuarkusTest)

Example 2 with StringIn

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);
}
Also used : StringIn(com.redhat.service.smartevents.infra.models.filters.StringIn) Test(org.junit.jupiter.api.Test)

Example 3 with StringIn

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);
}
Also used : StringEquals(com.redhat.service.smartevents.infra.models.filters.StringEquals) Processor(com.redhat.service.smartevents.manager.models.Processor) StringBeginsWith(com.redhat.service.smartevents.infra.models.filters.StringBeginsWith) BaseFilter(com.redhat.service.smartevents.infra.models.filters.BaseFilter) StringIn(com.redhat.service.smartevents.infra.models.filters.StringIn) StringContains(com.redhat.service.smartevents.infra.models.filters.StringContains) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Aggregations

StringIn (com.redhat.service.smartevents.infra.models.filters.StringIn)3 Test (org.junit.jupiter.api.Test)2 BaseFilter (com.redhat.service.smartevents.infra.models.filters.BaseFilter)1 StringBeginsWith (com.redhat.service.smartevents.infra.models.filters.StringBeginsWith)1 StringContains (com.redhat.service.smartevents.infra.models.filters.StringContains)1 StringEquals (com.redhat.service.smartevents.infra.models.filters.StringEquals)1 ProcessorRequest (com.redhat.service.smartevents.manager.api.models.requests.ProcessorRequest)1 BridgeResponse (com.redhat.service.smartevents.manager.api.models.responses.BridgeResponse)1 ProcessorListResponse (com.redhat.service.smartevents.manager.api.models.responses.ProcessorListResponse)1 ProcessorResponse (com.redhat.service.smartevents.manager.api.models.responses.ProcessorResponse)1 Processor (com.redhat.service.smartevents.manager.models.Processor)1 QuarkusTest (io.quarkus.test.junit.QuarkusTest)1 TestSecurity (io.quarkus.test.security.TestSecurity)1 Response (io.restassured.response.Response)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 MethodSource (org.junit.jupiter.params.provider.MethodSource)1