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();
}
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);
}
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;
}
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;
}
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());
}
Aggregations