Search in sources :

Example 11 with BridgeResponse

use of com.redhat.service.bridge.manager.api.models.responses.BridgeResponse in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorAPITest method addProcessorToBridge_noActionSpecified.

@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void addProcessorToBridge_noActionSpecified() {
    BridgeResponse bridgeResponse = createAndDeployBridge();
    Set<BaseFilter> filters = Collections.singleton(new StringEquals("json.key", "value"));
    Response response = TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor", filters, null, null));
    assertThat(response.getStatusCode()).isEqualTo(400);
}
Also used : StringEquals(com.redhat.service.bridge.infra.models.filters.StringEquals) ProcessorListResponse(com.redhat.service.bridge.manager.api.models.responses.ProcessorListResponse) BridgeResponse(com.redhat.service.bridge.manager.api.models.responses.BridgeResponse) ProcessorResponse(com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse) Response(io.restassured.response.Response) ProcessorRequest(com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest) BridgeResponse(com.redhat.service.bridge.manager.api.models.responses.BridgeResponse) BaseFilter(com.redhat.service.bridge.infra.models.filters.BaseFilter) TestSecurity(io.quarkus.test.security.TestSecurity) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 12 with BridgeResponse

use of com.redhat.service.bridge.manager.api.models.responses.BridgeResponse in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorAPITest method addProcessorToBridge.

@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void addProcessorToBridge() {
    BridgeResponse bridgeResponse = createAndDeployBridge();
    Set<BaseFilter> filters = Collections.singleton(new StringEquals("json.key", "value"));
    Response response = TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor", filters, "{}", createKafkaAction()));
    assertThat(response.getStatusCode()).isEqualTo(201);
    ProcessorResponse processorResponse = response.as(ProcessorResponse.class);
    assertThat(processorResponse.getName()).isEqualTo("myProcessor");
    assertThat(processorResponse.getFilters().size()).isEqualTo(1);
    ProcessorResponse retrieved = TestUtils.getProcessor(bridgeResponse.getId(), processorResponse.getId()).as(ProcessorResponse.class);
    assertThat(retrieved.getName()).isEqualTo("myProcessor");
    assertThat(retrieved.getFilters().size()).isEqualTo(1);
    assertThat(retrieved.getTransformationTemplate()).isEqualTo("{}");
    assertRequestedAction(retrieved);
}
Also used : StringEquals(com.redhat.service.bridge.infra.models.filters.StringEquals) ProcessorListResponse(com.redhat.service.bridge.manager.api.models.responses.ProcessorListResponse) BridgeResponse(com.redhat.service.bridge.manager.api.models.responses.BridgeResponse) ProcessorResponse(com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse) Response(io.restassured.response.Response) ProcessorResponse(com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse) ProcessorRequest(com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest) BridgeResponse(com.redhat.service.bridge.manager.api.models.responses.BridgeResponse) BaseFilter(com.redhat.service.bridge.infra.models.filters.BaseFilter) TestSecurity(io.quarkus.test.security.TestSecurity) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 13 with BridgeResponse

use of com.redhat.service.bridge.manager.api.models.responses.BridgeResponse in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorAPITest method listProcessors_pageOffset.

@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void listProcessors_pageOffset() {
    BridgeResponse bridgeResponse = createAndDeployBridge();
    TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor", createKafkaAction())).as(ProcessorResponse.class);
    ProcessorResponse p2 = TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor2", createKafkaAction())).as(ProcessorResponse.class);
    ProcessorListResponse listResponse = TestUtils.listProcessors(bridgeResponse.getId(), 1, 1).as(ProcessorListResponse.class);
    assertThat(listResponse.getPage()).isEqualTo(1L);
    assertThat(listResponse.getSize()).isEqualTo(1L);
    assertThat(listResponse.getTotal()).isEqualTo(2L);
    assertThat(listResponse.getItems().get(0).getId()).isEqualTo(p2.getId());
    assertRequestedAction(listResponse.getItems().get(0));
}
Also used : ProcessorResponse(com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse) ProcessorListResponse(com.redhat.service.bridge.manager.api.models.responses.ProcessorListResponse) ProcessorRequest(com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest) BridgeResponse(com.redhat.service.bridge.manager.api.models.responses.BridgeResponse) TestSecurity(io.quarkus.test.security.TestSecurity) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 14 with BridgeResponse

use of com.redhat.service.bridge.manager.api.models.responses.BridgeResponse 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 ValuesIn("pepe", null)), null, createKafkaAction()));
    assertThat(response.getStatusCode()).isEqualTo(400);
}
Also used : ProcessorListResponse(com.redhat.service.bridge.manager.api.models.responses.ProcessorListResponse) BridgeResponse(com.redhat.service.bridge.manager.api.models.responses.BridgeResponse) ProcessorResponse(com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse) Response(io.restassured.response.Response) ProcessorRequest(com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest) ValuesIn(com.redhat.service.bridge.infra.models.filters.ValuesIn) BridgeResponse(com.redhat.service.bridge.manager.api.models.responses.BridgeResponse) TestSecurity(io.quarkus.test.security.TestSecurity) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 15 with BridgeResponse

use of com.redhat.service.bridge.manager.api.models.responses.BridgeResponse in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorAPITest method addProcessorToBridge_missingActionParameters.

@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void addProcessorToBridge_missingActionParameters() {
    BridgeResponse bridgeResponse = createAndDeployBridge();
    BaseAction action = createKafkaAction();
    action.getParameters().clear();
    action.getParameters().put("thisIsNotCorrect", "myTopic");
    Set<BaseFilter> filters = Collections.singleton(new StringEquals("json.key", "value"));
    Response response = TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor", filters, null, action));
    assertThat(response.getStatusCode()).isEqualTo(400);
}
Also used : StringEquals(com.redhat.service.bridge.infra.models.filters.StringEquals) ProcessorListResponse(com.redhat.service.bridge.manager.api.models.responses.ProcessorListResponse) BridgeResponse(com.redhat.service.bridge.manager.api.models.responses.BridgeResponse) ProcessorResponse(com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse) Response(io.restassured.response.Response) ProcessorRequest(com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest) BaseAction(com.redhat.service.bridge.infra.models.actions.BaseAction) BridgeResponse(com.redhat.service.bridge.manager.api.models.responses.BridgeResponse) BaseFilter(com.redhat.service.bridge.infra.models.filters.BaseFilter) TestSecurity(io.quarkus.test.security.TestSecurity) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Aggregations

BridgeResponse (com.redhat.service.bridge.manager.api.models.responses.BridgeResponse)30 QuarkusTest (io.quarkus.test.junit.QuarkusTest)24 TestSecurity (io.quarkus.test.security.TestSecurity)24 Test (org.junit.jupiter.api.Test)24 ProcessorRequest (com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest)20 ProcessorListResponse (com.redhat.service.bridge.manager.api.models.responses.ProcessorListResponse)16 ProcessorResponse (com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse)16 Response (io.restassured.response.Response)14 BridgeRequest (com.redhat.service.bridge.manager.api.models.requests.BridgeRequest)10 BridgeDTO (com.redhat.service.bridge.infra.models.dto.BridgeDTO)7 BaseFilter (com.redhat.service.bridge.infra.models.filters.BaseFilter)7 StringEquals (com.redhat.service.bridge.infra.models.filters.StringEquals)7 KafkaConnectionDTO (com.redhat.service.bridge.infra.models.dto.KafkaConnectionDTO)5 List (java.util.List)5 ProcessorDTO (com.redhat.service.bridge.infra.models.dto.ProcessorDTO)4 BaseAction (com.redhat.service.bridge.infra.models.actions.BaseAction)3 BridgeListResponse (com.redhat.service.bridge.manager.api.models.responses.BridgeListResponse)3 ErrorResponse (com.redhat.service.bridge.infra.api.models.responses.ErrorResponse)1 ManagedResourceStatus (com.redhat.service.bridge.infra.models.dto.ManagedResourceStatus)1 ValuesIn (com.redhat.service.bridge.infra.models.filters.ValuesIn)1