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