use of com.sequenceiq.cloudbreak.reactor.api.event.resource.CmSyncRequest in project cloudbreak by hortonworks.
the class CmSyncHandlerTest method testAcceptWhenStackNotFound.
@Test
void testAcceptWhenStackNotFound() {
Set<String> candidateImageUuids = Set.of(IMAGE_UUID_1);
HandlerEvent<CmSyncRequest> event = getCmSyncRequestHandlerEvent(candidateImageUuids);
Exception exception = new CloudbreakServiceException("errordetail");
when(stackService.getByIdWithListsInTransaction(STACK_ID)).thenThrow(exception);
CmSyncResult result = (CmSyncResult) underTest.doAccept(event);
assertEquals("CMSYNCRESULT_ERROR", result.selector());
assertThat(result.getErrorDetails(), instanceOf(CloudbreakServiceException.class));
assertEquals("unexpected error: errordetail", result.getErrorDetails().getMessage());
assertEquals("unexpected error: errordetail", result.getStatusReason());
verify(stackService).getByIdWithListsInTransaction(STACK_ID);
verify(cmSyncImageCollectorService, never()).collectImages(anyString(), any(), any());
verify(cmSyncerService, never()).syncFromCmToDb(any(), any());
}
Aggregations