Search in sources :

Example 66 with Bridge

use of com.redhat.service.smartevents.manager.models.Bridge in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class BridgeDAOTest method testFindByNameAndCustomerId.

@Test
public void testFindByNameAndCustomerId() {
    Bridge bridge = buildBridge(DEFAULT_BRIDGE_ID, DEFAULT_BRIDGE_NAME);
    bridgeDAO.persist(bridge);
    Bridge retrievedBridge = bridgeDAO.findByNameAndCustomerId("not-the-id", DEFAULT_CUSTOMER_ID);
    assertThat(retrievedBridge).isNull();
    retrievedBridge = bridgeDAO.findByNameAndCustomerId(DEFAULT_BRIDGE_NAME, "not-the-customer-id");
    assertThat(retrievedBridge).isNull();
    retrievedBridge = bridgeDAO.findByNameAndCustomerId(DEFAULT_BRIDGE_NAME, DEFAULT_CUSTOMER_ID);
    assertThat(retrievedBridge).isNotNull();
}
Also used : Bridge(com.redhat.service.smartevents.manager.models.Bridge) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 67 with Bridge

use of com.redhat.service.smartevents.manager.models.Bridge in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class BridgeDAOTest method testListByCustomerIdPagination.

@Test
public void testListByCustomerIdPagination() {
    for (int i = 0; i < 10; i++) {
        String id = String.valueOf(i);
        Bridge bridge = buildBridge(id, id);
        bridgeDAO.persist(bridge);
    }
    ListResult<Bridge> retrievedBridges = bridgeDAO.findByCustomerId(DEFAULT_CUSTOMER_ID, new QueryResourceInfo(0, 2));
    assertThat(retrievedBridges).isNotNull();
    assertThat(retrievedBridges.getSize()).isEqualTo(2);
    assertThat(retrievedBridges.getTotal()).isEqualTo(10);
    assertThat(retrievedBridges.getPage()).isZero();
    assertThat(retrievedBridges.getItems().get(0).getId()).isEqualTo("9");
    assertThat(retrievedBridges.getItems().get(1).getId()).isEqualTo("8");
    retrievedBridges = bridgeDAO.findByCustomerId(DEFAULT_CUSTOMER_ID, new QueryResourceInfo(1, 2));
    assertThat(retrievedBridges).isNotNull();
    assertThat(retrievedBridges.getSize()).isEqualTo(2);
    assertThat(retrievedBridges.getTotal()).isEqualTo(10);
    assertThat(retrievedBridges.getPage()).isEqualTo(1);
    assertThat(retrievedBridges.getItems().get(0).getId()).isEqualTo("7");
    assertThat(retrievedBridges.getItems().get(1).getId()).isEqualTo("6");
    retrievedBridges = bridgeDAO.findByCustomerId(DEFAULT_CUSTOMER_ID, new QueryResourceInfo(4, 2));
    assertThat(retrievedBridges).isNotNull();
    assertThat(retrievedBridges.getSize()).isEqualTo(2);
    assertThat(retrievedBridges.getTotal()).isEqualTo(10);
    assertThat(retrievedBridges.getPage()).isEqualTo(4);
    assertThat(retrievedBridges.getItems().get(0).getId()).isEqualTo("1");
    assertThat(retrievedBridges.getItems().get(1).getId()).isEqualTo("0");
    retrievedBridges = bridgeDAO.findByCustomerId(DEFAULT_CUSTOMER_ID, new QueryResourceInfo(5, 2));
    assertThat(retrievedBridges).isNotNull();
    assertThat(retrievedBridges.getSize()).isZero();
    assertThat(retrievedBridges.getTotal()).isEqualTo(10);
    assertThat(retrievedBridges.getPage()).isEqualTo(5);
}
Also used : QueryResourceInfo(com.redhat.service.smartevents.infra.models.QueryResourceInfo) Bridge(com.redhat.service.smartevents.manager.models.Bridge) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 68 with Bridge

use of com.redhat.service.smartevents.manager.models.Bridge in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ConnectorsDAOTest method createPersistBridge.

private Bridge createPersistBridge() {
    Bridge b = Fixtures.createBridge();
    bridgeDAO.persist(b);
    return b;
}
Also used : Bridge(com.redhat.service.smartevents.manager.models.Bridge)

Example 69 with Bridge

use of com.redhat.service.smartevents.manager.models.Bridge in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class BridgesServiceTest method createPersistBridge.

private Bridge createPersistBridge(ManagedResourceStatus status) {
    Bridge b = Fixtures.createBridge();
    b.setStatus(status);
    bridgeDAO.persist(b);
    return b;
}
Also used : Bridge(com.redhat.service.smartevents.manager.models.Bridge)

Example 70 with Bridge

use of com.redhat.service.smartevents.manager.models.Bridge in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class BridgesServiceTest method getBridge.

@Test
public void getBridge() {
    BridgeRequest request = new BridgeRequest(DEFAULT_BRIDGE_NAME);
    bridgesService.createBridge(DEFAULT_CUSTOMER_ID, DEFAULT_ORGANISATION_ID, DEFAULT_USER_NAME, request);
    // Wait for Workers to complete
    Bridge bridge = TestUtils.waitForBridgeToBeReady(bridgesService);
    Bridge found = bridgesService.getBridge(bridge.getId());
    assertThat(found).isNotNull();
    assertThat(found.getId()).isEqualTo(bridge.getId());
}
Also used : BridgeRequest(com.redhat.service.smartevents.manager.api.models.requests.BridgeRequest) Bridge(com.redhat.service.smartevents.manager.models.Bridge) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Aggregations

Bridge (com.redhat.service.smartevents.manager.models.Bridge)99 QuarkusTest (io.quarkus.test.junit.QuarkusTest)68 Test (org.junit.jupiter.api.Test)68 Processor (com.redhat.service.smartevents.manager.models.Processor)45 Transactional (javax.transaction.Transactional)27 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)16 TestSecurity (io.quarkus.test.security.TestSecurity)14 BridgeResponse (com.redhat.service.smartevents.manager.api.models.responses.BridgeResponse)13 Work (com.redhat.service.smartevents.manager.models.Work)13 QueryProcessorResourceInfo (com.redhat.service.smartevents.infra.models.QueryProcessorResourceInfo)12 QueryResourceInfo (com.redhat.service.smartevents.infra.models.QueryResourceInfo)11 ProcessorRequest (com.redhat.service.smartevents.manager.api.models.requests.ProcessorRequest)11 ProcessorResponse (com.redhat.service.smartevents.manager.api.models.responses.ProcessorResponse)10 InternalPlatformException (com.redhat.service.smartevents.infra.exceptions.definitions.platform.InternalPlatformException)9 BridgeRequest (com.redhat.service.smartevents.manager.api.models.requests.BridgeRequest)8 ProcessorListResponse (com.redhat.service.smartevents.manager.api.models.responses.ProcessorListResponse)8 Response (io.restassured.response.Response)8 Connector (com.openshift.cloud.api.connector.models.Connector)7 Action (com.redhat.service.smartevents.infra.models.gateways.Action)7 ConnectorEntity (com.redhat.service.smartevents.manager.models.ConnectorEntity)7