Search in sources :

Example 21 with BridgeResponse

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

the class BridgesAPITest method getBridge.

@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void getBridge() {
    Response bridgeCreateResponse = TestUtils.createBridge(new BridgeRequest(TestConstants.DEFAULT_BRIDGE_NAME));
    bridgeCreateResponse.then().statusCode(201);
    BridgeResponse bridge = bridgeCreateResponse.as(BridgeResponse.class);
    BridgeResponse retrievedBridge = TestUtils.getBridge(bridge.getId()).as(BridgeResponse.class);
    assertThat(retrievedBridge).isNotNull();
    assertThat(retrievedBridge.getId()).isEqualTo(bridge.getId());
    assertThat(retrievedBridge.getName()).isEqualTo(bridge.getName());
    assertThat(retrievedBridge.getEndpoint()).isEqualTo(bridge.getEndpoint());
}
Also used : ErrorResponse(com.redhat.service.bridge.infra.api.models.responses.ErrorResponse) BridgeResponse(com.redhat.service.bridge.manager.api.models.responses.BridgeResponse) Response(io.restassured.response.Response) BridgeListResponse(com.redhat.service.bridge.manager.api.models.responses.BridgeListResponse) BridgeRequest(com.redhat.service.bridge.manager.api.models.requests.BridgeRequest) 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 22 with BridgeResponse

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

the class BridgesAPITest method testCreateAndGetBridge.

@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void testCreateAndGetBridge() {
    TestUtils.createBridge(new BridgeRequest(TestConstants.DEFAULT_BRIDGE_NAME)).then().statusCode(201);
    BridgeListResponse bridgeListResponse = TestUtils.getBridges().as(BridgeListResponse.class);
    assertThat(bridgeListResponse.getItems().size()).isEqualTo(1);
    BridgeResponse bridgeResponse = bridgeListResponse.getItems().get(0);
    assertThat(bridgeResponse.getName()).isEqualTo(TestConstants.DEFAULT_BRIDGE_NAME);
    assertThat(bridgeResponse.getStatus()).isEqualTo(ManagedResourceStatus.ACCEPTED);
    assertThat(bridgeResponse.getHref()).isEqualTo(APIConstants.USER_API_BASE_PATH + bridgeResponse.getId());
    assertThat(bridgeResponse.getSubmittedAt()).isNotNull();
    assertThat(bridgeResponse.getEndpoint()).isNull();
}
Also used : BridgeRequest(com.redhat.service.bridge.manager.api.models.requests.BridgeRequest) BridgeListResponse(com.redhat.service.bridge.manager.api.models.responses.BridgeListResponse) 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 23 with BridgeResponse

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

the class BridgesAPITest method testDeleteBridge.

@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void testDeleteBridge() {
    BridgeResponse response = TestUtils.createBridge(new BridgeRequest(TestConstants.DEFAULT_BRIDGE_NAME)).as(BridgeResponse.class);
    TestUtils.deleteBridge(response.getId()).then().statusCode(202);
    response = TestUtils.getBridge(response.getId()).as(BridgeResponse.class);
    assertThat(response.getStatus()).isEqualTo(ManagedResourceStatus.DEPROVISION);
}
Also used : BridgeRequest(com.redhat.service.bridge.manager.api.models.requests.BridgeRequest) 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 24 with BridgeResponse

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

the class ProcessorAPITest method addProcessorToBridge_unrecognisedActionType.

@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void addProcessorToBridge_unrecognisedActionType() {
    BridgeResponse bridgeResponse = createAndDeployBridge();
    BaseAction action = createKafkaAction();
    action.setType("thisDoesNotExist");
    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)

Example 25 with BridgeResponse

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

the class ProcessorAPITest method addProcessorToBridgeAndRetrieve.

@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void addProcessorToBridgeAndRetrieve() {
    BridgeResponse bridgeResponse = createAndDeployBridge();
    Set<BaseFilter> filters = Collections.singleton(new StringEquals("json.key", "value"));
    Response response = TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor", filters, null, createKafkaAction()));
    assertThat(response.getStatusCode()).isEqualTo(201);
    ProcessorResponse retrieved = TestUtils.getProcessor(bridgeResponse.getId(), response.as(ProcessorResponse.class).getId()).as(ProcessorResponse.class);
    assertThat(retrieved.getName()).isEqualTo("myProcessor");
    assertThat(retrieved.getFilters().size()).isEqualTo(1);
    assertThat(retrieved.getTransformationTemplate()).isNull();
    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)

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