use of com.redhat.service.smartevents.manager.TestConstants.DEFAULT_BRIDGE_NAME 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();
}
use of com.redhat.service.smartevents.manager.TestConstants.DEFAULT_BRIDGE_NAME in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ShardBridgesSyncAPITest method testNotifyDeployment.
@Test
@TestSecurity(user = DEFAULT_CUSTOMER_ID)
public void testNotifyDeployment() {
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);
bridge.setStatus(PROVISIONING);
TestUtils.updateBridge(bridge).then().statusCode(200);
await().atMost(5, SECONDS).untilAsserted(() -> {
bridgesToDeployOrDelete.clear();
bridgesToDeployOrDelete.addAll(TestUtils.getBridgesToDeployOrDelete().as(new TypeRef<List<BridgeDTO>>() {
}));
assertThat(bridgesToDeployOrDelete).isEmpty();
});
}
use of com.redhat.service.smartevents.manager.TestConstants.DEFAULT_BRIDGE_NAME in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ShardBridgesSyncAPITest method testGetBridgesToDelete.
@Test
@TestSecurity(user = DEFAULT_CUSTOMER_ID)
public void testGetBridgesToDelete() {
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.size()).isEqualTo(1);
});
BridgeDTO bridge = bridgesToDeployOrDelete.get(0);
bridge.setStatus(READY);
TestUtils.updateBridge(bridge).then().statusCode(200);
TestUtils.deleteBridge(bridge.getId()).then().statusCode(202);
await().atMost(5, SECONDS).untilAsserted(() -> {
bridgesToDeployOrDelete.clear();
bridgesToDeployOrDelete.addAll(TestUtils.getBridgesToDeployOrDelete().as(new TypeRef<List<BridgeDTO>>() {
}));
assertThat(bridgesToDeployOrDelete.stream().filter(x -> x.getStatus().equals(ManagedResourceStatus.ACCEPTED)).count()).isZero();
assertThat(bridgesToDeployOrDelete.stream().filter(x -> x.getStatus().equals(DEPROVISION)).count()).isEqualTo(1);
});
}
Aggregations