Search in sources :

Example 61 with Bridge

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

the class BridgeDAOTest method buildBridge.

private Bridge buildBridge(String id, String name) {
    Bridge bridge = new Bridge();
    bridge.setId(id);
    bridge.setCustomerId(DEFAULT_CUSTOMER_ID);
    bridge.setOrganisationId(TestConstants.DEFAULT_ORGANISATION_ID);
    bridge.setOwner(TestConstants.DEFAULT_USER_NAME);
    bridge.setName(name);
    bridge.setStatus(ACCEPTED);
    bridge.setSubmittedAt(ZonedDateTime.now());
    bridge.setShardId(TestConstants.SHARD_ID);
    bridge.setDefinition(new BridgeDefinition());
    return bridge;
}
Also used : BridgeDefinition(com.redhat.service.smartevents.infra.models.bridges.BridgeDefinition) Bridge(com.redhat.service.smartevents.manager.models.Bridge)

Example 62 with Bridge

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

the class BridgeDAOTest method testListByCustomerIdFilterByNameWildcard.

@Test
public void testListByCustomerIdFilterByNameWildcard() {
    Bridge bridge1 = buildBridge(DEFAULT_BRIDGE_ID, DEFAULT_BRIDGE_NAME);
    bridgeDAO.persist(bridge1);
    Bridge bridge2 = buildBridge("mySecondBridgeId", "mySecondBridgeName");
    bridgeDAO.persist(bridge2);
    ListResult<Bridge> retrievedBridges = bridgeDAO.findByCustomerId(DEFAULT_CUSTOMER_ID, new QueryResourceInfo(DEFAULT_PAGE, DEFAULT_PAGE_SIZE, filter().by(DEFAULT_BRIDGE_NAME.substring(0, 5)).build()));
    assertThat(retrievedBridges).isNotNull();
    assertThat(retrievedBridges.getSize()).isEqualTo(1);
    assertThat(retrievedBridges.getTotal()).isEqualTo(1);
    assertThat(retrievedBridges.getPage()).isZero();
    assertThat(retrievedBridges.getItems().get(0).getId()).isEqualTo(bridge1.getId());
}
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 63 with Bridge

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

the class BridgeDAOTest method testListByCustomerId.

@Test
public void testListByCustomerId() {
    Bridge firstBridge = buildBridge(DEFAULT_BRIDGE_ID, DEFAULT_BRIDGE_NAME);
    bridgeDAO.persist(firstBridge);
    Bridge secondBridge = buildBridge("mySecondBridgeId", "mySecondBridgeName");
    bridgeDAO.persist(secondBridge);
    ListResult<Bridge> retrievedBridges = bridgeDAO.findByCustomerId(DEFAULT_CUSTOMER_ID, new QueryResourceInfo(DEFAULT_PAGE, DEFAULT_PAGE_SIZE));
    assertThat(retrievedBridges).isNotNull();
    assertThat(retrievedBridges.getSize()).isEqualTo(2);
    assertThat(retrievedBridges.getTotal()).isEqualTo(2);
    assertThat(retrievedBridges.getPage()).isZero();
    // Newest instances come first
    assertThat(retrievedBridges.getItems().get(1).getId()).isEqualTo(firstBridge.getId());
    assertThat(retrievedBridges.getItems().get(0).getId()).isEqualTo(secondBridge.getId());
}
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 64 with Bridge

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

the class BridgeDAOTest method testListByCustomerIdFilterByNameAndStatus.

@Test
public void testListByCustomerIdFilterByNameAndStatus() {
    Bridge bridge1 = buildBridge(DEFAULT_BRIDGE_ID, DEFAULT_BRIDGE_NAME);
    bridge1.setStatus(ACCEPTED);
    bridgeDAO.persist(bridge1);
    Bridge bridge2 = buildBridge("mySecondBridgeId", "mySecondBridgeName");
    bridge2.setStatus(READY);
    bridgeDAO.persist(bridge2);
    ListResult<Bridge> retrievedBridges = bridgeDAO.findByCustomerId(DEFAULT_CUSTOMER_ID, new QueryResourceInfo(DEFAULT_PAGE, DEFAULT_PAGE_SIZE, filter().by(DEFAULT_BRIDGE_NAME).by(ACCEPTED).build()));
    assertThat(retrievedBridges).isNotNull();
    assertThat(retrievedBridges.getSize()).isEqualTo(1);
    assertThat(retrievedBridges.getTotal()).isEqualTo(1);
    assertThat(retrievedBridges.getPage()).isZero();
    assertThat(retrievedBridges.getItems().get(0).getId()).isEqualTo(bridge1.getId());
}
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 65 with Bridge

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

the class BridgeDAOTest method testListByCustomerIdFilterByMoreStatuses.

@Test
public void testListByCustomerIdFilterByMoreStatuses() {
    Bridge bridge1 = buildBridge(DEFAULT_BRIDGE_ID, DEFAULT_BRIDGE_NAME);
    bridge1.setStatus(ACCEPTED);
    bridgeDAO.persist(bridge1);
    Bridge bridge2 = buildBridge("mySecondBridgeId", "mySecondBridgeName");
    bridge2.setStatus(READY);
    bridgeDAO.persist(bridge2);
    ListResult<Bridge> retrievedBridges = bridgeDAO.findByCustomerId(DEFAULT_CUSTOMER_ID, new QueryResourceInfo(DEFAULT_PAGE, DEFAULT_PAGE_SIZE, filter().by(ACCEPTED).by(READY).build()));
    assertThat(retrievedBridges).isNotNull();
    assertThat(retrievedBridges.getSize()).isEqualTo(2);
    assertThat(retrievedBridges.getTotal()).isEqualTo(2);
    assertThat(retrievedBridges.getPage()).isZero();
    assertThat(retrievedBridges.getItems().get(0).getId()).isEqualTo(bridge2.getId());
    assertThat(retrievedBridges.getItems().get(1).getId()).isEqualTo(bridge1.getId());
}
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)

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