Search in sources :

Example 6 with BridgeResponse

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

the class BridgesAPITest method testDeleteBridgeWithActiveProcessors.

@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void testDeleteBridgeWithActiveProcessors() {
    BridgeResponse bridgeResponse = TestUtils.createBridge(new BridgeRequest(TestConstants.DEFAULT_BRIDGE_NAME)).as(BridgeResponse.class);
    TestUtils.updateBridge(new BridgeDTO(bridgeResponse.getId(), bridgeResponse.getName(), bridgeResponse.getEndpoint(), TestConstants.DEFAULT_CUSTOMER_ID, ManagedResourceStatus.READY, new KafkaConnectionDTO()));
    TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest(TestConstants.DEFAULT_PROCESSOR_NAME, TestUtils.createKafkaAction())).then().statusCode(201);
    TestUtils.deleteBridge(bridgeResponse.getId()).then().statusCode(400);
}
Also used : BridgeRequest(com.redhat.service.bridge.manager.api.models.requests.BridgeRequest) BridgeDTO(com.redhat.service.bridge.infra.models.dto.BridgeDTO) KafkaConnectionDTO(com.redhat.service.bridge.infra.models.dto.KafkaConnectionDTO) 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 7 with BridgeResponse

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

the class ProcessorAPITest method createBridge.

private BridgeResponse createBridge() {
    BridgeRequest r = new BridgeRequest(TestConstants.DEFAULT_BRIDGE_NAME);
    BridgeResponse bridgeResponse = TestUtils.createBridge(r).as(BridgeResponse.class);
    return bridgeResponse;
}
Also used : BridgeRequest(com.redhat.service.bridge.manager.api.models.requests.BridgeRequest) BridgeResponse(com.redhat.service.bridge.manager.api.models.responses.BridgeResponse)

Example 8 with BridgeResponse

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

the class ProcessorAPITest method listProcessors.

@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void listProcessors() {
    BridgeResponse bridgeResponse = createAndDeployBridge();
    ProcessorResponse p = 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(), 0, 100).as(ProcessorListResponse.class);
    assertThat(listResponse.getPage()).isZero();
    assertThat(listResponse.getSize()).isEqualTo(2L);
    assertThat(listResponse.getTotal()).isEqualTo(2L);
    listResponse.getItems().forEach((i) -> assertThat(i.getId()).isIn(p.getId(), p2.getId()));
}
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 9 with BridgeResponse

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

the class ProcessorAPITest method getProcessor_processorDoesNotExist.

@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void getProcessor_processorDoesNotExist() {
    BridgeResponse bridgeResponse = createAndDeployBridge();
    Response response = TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor", createKafkaAction()));
    assertThat(response.getStatusCode()).isEqualTo(201);
    Response found = TestUtils.getProcessor(bridgeResponse.getId(), "doesNotExist");
    assertThat(found.getStatusCode()).isEqualTo(404);
}
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) 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 10 with BridgeResponse

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

the class ProcessorAPITest method addProcessorToBridge_bridgeNotInReadyStatus.

@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void addProcessorToBridge_bridgeNotInReadyStatus() {
    BridgeResponse bridgeResponse = createBridge();
    Response response = TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor", 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) 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)

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