Search in sources :

Example 41 with BridgeResponse

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

the class ShardBridgesSyncAPITest method updateProcessorStatus.

@Test
@TestSecurity(user = DEFAULT_CUSTOMER_ID)
public void updateProcessorStatus() {
    BridgeResponse bridgeResponse = TestUtils.createBridge(new BridgeRequest(DEFAULT_BRIDGE_NAME)).as(BridgeResponse.class);
    BridgeDTO bridge = new BridgeDTO(bridgeResponse.getId(), bridgeResponse.getName(), TEST_BRIDGE_ENDPOINT, DEFAULT_CUSTOMER_ID, DEFAULT_USER_NAME, READY, new KafkaConnectionDTO());
    TestUtils.updateBridge(bridge);
    TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest(DEFAULT_PROCESSOR_NAME, TestUtils.createKafkaAction()));
    final List<ProcessorDTO> processors = new ArrayList<>();
    await().atMost(5, SECONDS).untilAsserted(() -> {
        processors.clear();
        processors.addAll(TestUtils.getProcessorsToDeployOrDelete().as(new TypeRef<List<ProcessorDTO>>() {
        }));
        assertThat(processors.size()).isEqualTo(1);
    });
    ProcessorDTO processor = processors.get(0);
    processor.setStatus(READY);
    TestUtils.updateProcessor(processor);
    await().atMost(5, SECONDS).untilAsserted(() -> {
        processors.clear();
        processors.addAll(TestUtils.getProcessorsToDeployOrDelete().as(new TypeRef<List<ProcessorDTO>>() {
        }));
        assertThat(processors).isEmpty();
    });
}
Also used : BridgeRequest(com.redhat.service.smartevents.manager.api.models.requests.BridgeRequest) BridgeDTO(com.redhat.service.smartevents.infra.models.dto.BridgeDTO) KafkaConnectionDTO(com.redhat.service.smartevents.infra.models.dto.KafkaConnectionDTO) ProcessorDTO(com.redhat.service.smartevents.infra.models.dto.ProcessorDTO) TypeRef(io.restassured.common.mapper.TypeRef) ProcessorRequest(com.redhat.service.smartevents.manager.api.models.requests.ProcessorRequest) ArrayList(java.util.ArrayList) BridgeResponse(com.redhat.service.smartevents.manager.api.models.responses.BridgeResponse) TestSecurity(io.quarkus.test.security.TestSecurity) Test(org.junit.jupiter.api.Test) QuarkusTest(io.quarkus.test.junit.QuarkusTest)

Example 42 with BridgeResponse

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

the class BridgesAPITest method testCreateAndGetBridge.

@Test
@TestSecurity(user = DEFAULT_CUSTOMER_ID)
public void testCreateAndGetBridge() {
    TestUtils.createBridge(new BridgeRequest(DEFAULT_BRIDGE_NAME)).then().statusCode(202);
    BridgeListResponse bridgeListResponse = TestUtils.getBridges().as(BridgeListResponse.class);
    assertThat(bridgeListResponse.getItems().size()).isEqualTo(1);
    BridgeResponse bridgeResponse = bridgeListResponse.getItems().get(0);
    assertThat(bridgeResponse.getName()).isEqualTo(DEFAULT_BRIDGE_NAME);
    assertThat(bridgeResponse.getStatus()).isEqualTo(ACCEPTED);
    assertThat(bridgeResponse.getHref()).isEqualTo(USER_API_BASE_PATH + bridgeResponse.getId());
    assertThat(bridgeResponse.getSubmittedAt()).isNotNull();
    assertThat(bridgeResponse.getEndpoint()).isNull();
}
Also used : BridgeRequest(com.redhat.service.smartevents.manager.api.models.requests.BridgeRequest) BridgeListResponse(com.redhat.service.smartevents.manager.api.models.responses.BridgeListResponse) BridgeResponse(com.redhat.service.smartevents.manager.api.models.responses.BridgeResponse) TestSecurity(io.quarkus.test.security.TestSecurity) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 43 with BridgeResponse

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

the class BridgesAPITest method testGetBridgesFilterByName.

@Test
@TestSecurity(user = DEFAULT_CUSTOMER_ID)
public void testGetBridgesFilterByName() {
    Bridge bridge1 = Fixtures.createBridge();
    bridge1.setName(DEFAULT_BRIDGE_NAME + "1");
    bridge1.setStatus(ACCEPTED);
    bridgeDAO.persist(bridge1);
    Bridge bridge2 = Fixtures.createBridge();
    bridge2.setName(DEFAULT_BRIDGE_NAME + "2");
    bridge2.setStatus(ACCEPTED);
    bridgeDAO.persist(bridge2);
    BridgeListResponse bridgeListResponse = TestUtils.getBridgesFilterByName(DEFAULT_BRIDGE_NAME + "1").as(BridgeListResponse.class);
    assertThat(bridgeListResponse.getItems().size()).isEqualTo(1);
    BridgeResponse bridgeResponse = bridgeListResponse.getItems().get(0);
    assertThat(bridgeResponse.getName()).isEqualTo(bridge1.getName());
    assertThat(bridgeResponse.getStatus()).isEqualTo(bridge1.getStatus());
    assertThat(bridgeResponse.getHref()).isEqualTo(USER_API_BASE_PATH + bridgeResponse.getId());
    assertThat(bridgeResponse.getSubmittedAt()).isNotNull();
    assertThat(bridgeResponse.getEndpoint()).isNotNull();
}
Also used : BridgeListResponse(com.redhat.service.smartevents.manager.api.models.responses.BridgeListResponse) BridgeResponse(com.redhat.service.smartevents.manager.api.models.responses.BridgeResponse) Bridge(com.redhat.service.smartevents.manager.models.Bridge) TestSecurity(io.quarkus.test.security.TestSecurity) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 44 with BridgeResponse

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

the class BridgesAPITest method testGetBridgesFilterByStatus.

@Test
@TestSecurity(user = DEFAULT_CUSTOMER_ID)
public void testGetBridgesFilterByStatus() {
    Bridge bridge1 = Fixtures.createBridge();
    bridge1.setName(DEFAULT_BRIDGE_NAME + "1");
    bridge1.setStatus(READY);
    bridgeDAO.persist(bridge1);
    Bridge bridge2 = Fixtures.createBridge();
    bridge2.setName(DEFAULT_BRIDGE_NAME + "2");
    bridge2.setStatus(ACCEPTED);
    bridgeDAO.persist(bridge2);
    BridgeListResponse bridgeListResponse = TestUtils.getBridgesFilterByStatus(ACCEPTED).as(BridgeListResponse.class);
    assertThat(bridgeListResponse.getItems().size()).isEqualTo(1);
    BridgeResponse bridgeResponse = bridgeListResponse.getItems().get(0);
    assertThat(bridgeResponse.getName()).isEqualTo(bridge2.getName());
    assertThat(bridgeResponse.getStatus()).isEqualTo(bridge2.getStatus());
    assertThat(bridgeResponse.getHref()).isEqualTo(USER_API_BASE_PATH + bridgeResponse.getId());
    assertThat(bridgeResponse.getSubmittedAt()).isNotNull();
    assertThat(bridgeResponse.getEndpoint()).isNotNull();
}
Also used : BridgeListResponse(com.redhat.service.smartevents.manager.api.models.responses.BridgeListResponse) BridgeResponse(com.redhat.service.smartevents.manager.api.models.responses.BridgeResponse) Bridge(com.redhat.service.smartevents.manager.models.Bridge) TestSecurity(io.quarkus.test.security.TestSecurity) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 45 with BridgeResponse

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

the class BridgesAPITest method getBridge.

@Test
@TestSecurity(user = DEFAULT_CUSTOMER_ID)
public void getBridge() {
    Response bridgeCreateResponse = TestUtils.createBridge(new BridgeRequest(DEFAULT_BRIDGE_NAME));
    bridgeCreateResponse.then().statusCode(202);
    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.smartevents.infra.api.models.responses.ErrorResponse) BridgeResponse(com.redhat.service.smartevents.manager.api.models.responses.BridgeResponse) BridgeListResponse(com.redhat.service.smartevents.manager.api.models.responses.BridgeListResponse) Response(io.restassured.response.Response) BridgeRequest(com.redhat.service.smartevents.manager.api.models.requests.BridgeRequest) BridgeResponse(com.redhat.service.smartevents.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.smartevents.manager.api.models.responses.BridgeResponse)48 QuarkusTest (io.quarkus.test.junit.QuarkusTest)42 TestSecurity (io.quarkus.test.security.TestSecurity)42 Test (org.junit.jupiter.api.Test)42 ProcessorRequest (com.redhat.service.smartevents.manager.api.models.requests.ProcessorRequest)29 ProcessorListResponse (com.redhat.service.smartevents.manager.api.models.responses.ProcessorListResponse)27 ProcessorResponse (com.redhat.service.smartevents.manager.api.models.responses.ProcessorResponse)26 Response (io.restassured.response.Response)19 BridgeRequest (com.redhat.service.smartevents.manager.api.models.requests.BridgeRequest)10 BridgeListResponse (com.redhat.service.smartevents.manager.api.models.responses.BridgeListResponse)8 BridgeDTO (com.redhat.service.smartevents.infra.models.dto.BridgeDTO)7 BaseFilter (com.redhat.service.smartevents.infra.models.filters.BaseFilter)7 StringEquals (com.redhat.service.smartevents.infra.models.filters.StringEquals)7 Action (com.redhat.service.smartevents.infra.models.gateways.Action)6 TypeRef (io.restassured.common.mapper.TypeRef)6 ArrayList (java.util.ArrayList)6 KafkaConnectionDTO (com.redhat.service.smartevents.infra.models.dto.KafkaConnectionDTO)5 Bridge (com.redhat.service.smartevents.manager.models.Bridge)5 KafkaTopicAction (com.redhat.service.smartevents.processor.actions.kafkatopic.KafkaTopicAction)5 SendToBridgeAction (com.redhat.service.smartevents.processor.actions.sendtobridge.SendToBridgeAction)5