use of com.redhat.service.smartevents.manager.api.models.requests.BridgeRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorAPITest method createBridge.
private BridgeResponse createBridge() {
BridgeRequest r = new BridgeRequest(TestConstants.DEFAULT_BRIDGE_NAME);
BridgeResponse bridgeResponse = TestUtils.createBridge(r).as(BridgeResponse.class);
return bridgeResponse;
}
use of com.redhat.service.smartevents.manager.api.models.requests.BridgeRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgesServiceTest method testCreateBridge.
@Test
public void testCreateBridge() {
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);
assertThat(bridge.getStatus()).isEqualTo(ManagedResourceStatus.PREPARING);
assertThat(bridge.getEndpoint()).isNull();
ListResult<Bridge> bridges = bridgesService.getBridges(DEFAULT_CUSTOMER_ID, new QueryResourceInfo(DEFAULT_PAGE, DEFAULT_PAGE_SIZE));
assertThat(bridges.getSize()).isEqualTo(1);
assertThat(bridges.getItems().get(0).getOrganisationId()).isEqualTo(DEFAULT_ORGANISATION_ID);
}
use of com.redhat.service.smartevents.manager.api.models.requests.BridgeRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgesServiceTest method testUpdateBridgeStatusReadyPublishedAt.
@Test
public void testUpdateBridgeStatusReadyPublishedAt() {
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);
// Emulate Shard setting Bridge status to PROVISIONING
bridge.setStatus(PROVISIONING);
bridgesService.updateBridge(bridgesService.toDTO(bridge));
Bridge retrievedBridge = bridgesService.getBridge(bridge.getId(), DEFAULT_CUSTOMER_ID);
assertThat(retrievedBridge.getStatus()).isEqualTo(PROVISIONING);
assertThat(retrievedBridge.getPublishedAt()).isNull();
// Once ready it should have its published date set
bridge.setStatus(READY);
bridgesService.updateBridge(bridgesService.toDTO(bridge));
Bridge publishedBridge = bridgesService.getBridge(bridge.getId(), DEFAULT_CUSTOMER_ID);
assertThat(publishedBridge.getStatus()).isEqualTo(READY);
ZonedDateTime publishedAt = publishedBridge.getPublishedAt();
assertThat(publishedAt).isNotNull();
// Check calls to set PublishedAt at idempotent
bridgesService.updateBridge(bridgesService.toDTO(bridge));
Bridge publishedBridge2 = bridgesService.getBridge(bridge.getId(), DEFAULT_CUSTOMER_ID);
assertThat(publishedBridge2.getStatus()).isEqualTo(READY);
assertThat(publishedBridge2.getPublishedAt()).isEqualTo(publishedAt);
}
use of com.redhat.service.smartevents.manager.api.models.requests.BridgeRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgesServiceTest method testUpdateBridgeStatus.
@Test
public void testUpdateBridgeStatus() {
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);
assertThat(bridge.getStatus()).isEqualTo(ManagedResourceStatus.PREPARING);
// Emulate Shard setting Bridge status to PROVISIONING
bridge.setStatus(PROVISIONING);
bridgesService.updateBridge(bridgesService.toDTO(bridge));
assertThat(bridgesService.findByShardIdWithReadyDependencies(SHARD_ID)).isEmpty();
Bridge retrievedBridge = bridgesService.getBridge(bridge.getId(), DEFAULT_CUSTOMER_ID);
assertThat(retrievedBridge.getStatus()).isEqualTo(PROVISIONING);
}
use of com.redhat.service.smartevents.manager.api.models.requests.BridgeRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ShardBridgesSyncAPITest method testNotifyDeletion.
@Test
@TestSecurity(user = DEFAULT_CUSTOMER_ID)
public void testNotifyDeletion() {
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);
BridgeResponse bridgeResponse = TestUtils.getBridge(bridge.getId()).as(BridgeResponse.class);
assertThat(bridgeResponse.getStatus()).isEqualTo(DEPROVISION);
bridge.setStatus(DELETED);
TestUtils.updateBridge(bridge).then().statusCode(200);
TestUtils.getBridge(bridge.getId()).then().statusCode(404);
}
Aggregations