use of com.redhat.service.bridge.infra.exceptions.definitions.user.BridgeLifecycleException in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgesServiceImpl method deleteBridge.
@Transactional
@Override
public void deleteBridge(String id, String customerId) {
Long processorsCount = processorService.getProcessorsCount(id, customerId);
if (processorsCount > 0) {
// See https://issues.redhat.com/browse/MGDOBR-43
throw new BridgeLifecycleException("It is not possible to delete a Bridge instance with active Processors.");
}
Bridge bridge = findByIdAndCustomerId(id, customerId);
bridge.setStatus(ManagedResourceStatus.DEPROVISION);
LOGGER.info("Bridge with id '{}' for customer '{}' has been marked for deletion", bridge.getId(), bridge.getCustomerId());
}
use of com.redhat.service.bridge.infra.exceptions.definitions.user.BridgeLifecycleException in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class SendToBridgeActionTransformerTest method beforeEach.
@BeforeEach
void beforeEach() {
reset(bridgesServiceMock);
when(bridgesServiceMock.getReadyBridge(BRIDGE_ID, TEST_CUSTOMER_ID)).thenReturn(bridge);
when(bridgesServiceMock.getReadyBridge(OTHER_BRIDGE_ID, TEST_CUSTOMER_ID)).thenReturn(otherBridge);
when(bridgesServiceMock.getReadyBridge(UNAVAILABLE_BRIDGE_ID, TEST_CUSTOMER_ID)).thenThrow(new BridgeLifecycleException("Unavailable bridge"));
when(bridgesServiceMock.getReadyBridge(not(or(eq(UNAVAILABLE_BRIDGE_ID), or(eq(BRIDGE_ID), eq(OTHER_BRIDGE_ID)))), eq(TEST_CUSTOMER_ID))).thenThrow(new ItemNotFoundException("Bridge not found"));
when(bridgesServiceMock.getReadyBridge(any(), not(eq(TEST_CUSTOMER_ID)))).thenThrow(new ItemNotFoundException("Customer not found"));
}
Aggregations