use of com.redhat.service.smartevents.manager.api.models.requests.BridgeRequest 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());
}
use of com.redhat.service.smartevents.manager.api.models.requests.BridgeRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgesServiceTest method testGetBridges.
@Test
public void testGetBridges() {
BridgeRequest request = new BridgeRequest(DEFAULT_BRIDGE_NAME);
bridgesService.createBridge(DEFAULT_CUSTOMER_ID, DEFAULT_ORGANISATION_ID, DEFAULT_USER_NAME, request);
ListResult<Bridge> bridges = bridgesService.getBridges(DEFAULT_CUSTOMER_ID, new QueryResourceInfo(DEFAULT_PAGE, DEFAULT_PAGE_SIZE));
assertThat(bridges.getSize()).isEqualTo(1);
assertThat(bridges.getTotal()).isEqualTo(1);
assertThat(bridges.getPage()).isZero();
// filter by customer id not implemented yet
bridges = bridgesService.getBridges("not-the-id", new QueryResourceInfo(DEFAULT_PAGE, DEFAULT_PAGE_SIZE));
assertThat(bridges.getSize()).isZero();
assertThat(bridges.getTotal()).isZero();
assertThat(bridges.getPage()).isZero();
}
use of com.redhat.service.smartevents.manager.api.models.requests.BridgeRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgesServiceTest method testGetBridgeWithWrongCustomerId.
@Test
public void testGetBridgeWithWrongCustomerId() {
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);
assertThatExceptionOfType(ItemNotFoundException.class).isThrownBy(() -> bridgesService.getBridge(bridge.getId(), "not-the-customerId"));
}
use of com.redhat.service.smartevents.manager.api.models.requests.BridgeRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgesServiceTest method testGetBridge.
@Test
public void testGetBridge() {
BridgeRequest request = new BridgeRequest(DEFAULT_BRIDGE_NAME);
Bridge bridge = bridgesService.createBridge(DEFAULT_CUSTOMER_ID, DEFAULT_ORGANISATION_ID, DEFAULT_USER_NAME, request);
// Wait for Workers to complete
TestUtils.waitForBridgeToBeReady(bridgesService);
Bridge retrievedBridge = bridgesService.getBridge(bridge.getId(), DEFAULT_CUSTOMER_ID);
assertThat(retrievedBridge).isNotNull();
assertThat(retrievedBridge.getName()).isEqualTo(bridge.getName());
assertThat(retrievedBridge.getCustomerId()).isEqualTo(bridge.getCustomerId());
// Bridges are moved to the PREPARING status by Workers
assertThat(retrievedBridge.getStatus()).isEqualTo(ManagedResourceStatus.PREPARING);
assertThat(retrievedBridge.getShardId()).isEqualTo(SHARD_ID);
}
use of com.redhat.service.smartevents.manager.api.models.requests.BridgeRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ShardBridgesSyncAPITest method testGetBridgesToDeploy.
@Test
@TestSecurity(user = DEFAULT_CUSTOMER_ID)
public void testGetBridgesToDeploy() {
TestUtils.createBridge(new BridgeRequest(DEFAULT_BRIDGE_NAME));
final List<BridgeDTO> bridgesToDeployOrDelete = new ArrayList<>();
await().atMost(5, SECONDS).untilAsserted(() -> {
bridgesToDeployOrDelete.clear();
bridgesToDeployOrDelete.addAll(TestUtils.getBridgesToDeployOrDelete().as(new TypeRef<List<BridgeDTO>>() {
}));
assertThat(bridgesToDeployOrDelete.stream().filter(x -> x.getStatus().equals(PREPARING)).count()).isEqualTo(1);
});
BridgeDTO bridge = bridgesToDeployOrDelete.get(0);
assertThat(bridge.getName()).isEqualTo(DEFAULT_BRIDGE_NAME);
assertThat(bridge.getCustomerId()).isEqualTo(DEFAULT_CUSTOMER_ID);
assertThat(bridge.getStatus()).isEqualTo(PREPARING);
assertThat(bridge.getEndpoint()).isNull();
}
Aggregations