use of com.redhat.service.smartevents.manager.models.Bridge in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgesServiceTest method testGetEmptyBridges.
@Test
public void testGetEmptyBridges() {
ListResult<Bridge> bridges = bridgesService.getBridges(DEFAULT_CUSTOMER_ID, new QueryResourceInfo(DEFAULT_PAGE, DEFAULT_PAGE_SIZE));
assertThat(bridges.getPage()).isZero();
assertThat(bridges.getTotal()).isZero();
assertThat(bridges.getSize()).isZero();
}
use of com.redhat.service.smartevents.manager.models.Bridge 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.models.Bridge 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.models.Bridge 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.models.Bridge in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceConnectorTest method createConnectorFailureOnExternalConnectorCreation.
@Test
void createConnectorFailureOnExternalConnectorCreation() {
Bridge b = createPersistBridge(READY);
Action slackAction = createSlackAction();
ProcessorRequest processorRequest = new ProcessorRequest("ManagedConnectorProcessor", slackAction);
doThrow(new InternalPlatformException(RhoasServiceImpl.createFailureErrorMessageFor("errorDeletingConnector"), new RuntimeException("error"))).when(connectorsApiClient).deleteConnector(anyString());
Processor processor = processorService.createProcessor(b.getId(), b.getCustomerId(), b.getOwner(), processorRequest);
waitForProcessorAndConnectorToFail(processor);
}
Aggregations