use of com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException in project cloudbreak by hortonworks.
the class NodeServicesCheckerConclusionStepTest method checkShouldBeSuccessfulIfNodeStatusReportFailsForOlderImageVersions.
@Test
public void checkShouldBeSuccessfulIfNodeStatusReportFailsForOlderImageVersions() {
when(nodeStatusService.getServicesReport(eq(1L))).thenThrow(new CloudbreakServiceException("error"));
Conclusion stepResult = underTest.check(1L);
assertFalse(stepResult.isFailureFound());
assertNull(stepResult.getConclusion());
assertNull(stepResult.getDetails());
assertEquals(NodeServicesCheckerConclusionStep.class, stepResult.getConclusionStepClass());
verify(nodeStatusService, times(1)).getServicesReport(eq(1L));
}
use of com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException in project cloudbreak by hortonworks.
the class ResourceEncryptionInitializationHandler method initializeEncryptionResources.
private void initializeEncryptionResources(EnvironmentDto environmentDto, Environment environment) {
String environmentName = environment.getName();
LOGGER.info("Initializing encryption resources for environment \"{}\".", environmentName);
try {
CreatedDiskEncryptionSet createdDiskEncryptionSet = environmentEncryptionService.createEncryptionResources(environmentDto);
LOGGER.info("Created Disk Encryption Set resource for environment \"{}\": {}", environmentName, createdDiskEncryptionSet);
AzureParameters azureParameters = (AzureParameters) environment.getParameters();
azureParameters.setDiskEncryptionSetId(createdDiskEncryptionSet.getDiskEncryptionSetId());
environment.setStatus(EnvironmentStatus.ENVIRONMENT_ENCRYPTION_RESOURCES_INITIALIZED);
environment.setStatusReason(null);
environmentService.save(environment);
LOGGER.info("Finished initializing encryption resources for environment \"{}\".", environmentName);
} catch (Exception e) {
LOGGER.error(String.format("Failed to initialize encryption resources for environment \"%s\"", environmentName), e);
throw new CloudbreakServiceException("Error occurred while initializing encryption resources: " + e.getMessage(), e);
}
}
use of com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException in project cloudbreak by hortonworks.
the class Flow2HandlerTest method testNewFlowButNotHandled.
@Test
public void testNewFlowButNotHandled() {
Event<Payload> event = new Event<>(payload);
event.setKey("KEY");
CloudbreakServiceException exception = assertThrows(CloudbreakServiceException.class, () -> underTest.accept(event));
assertEquals("Couldn't start process.", exception.getMessage());
verify(flowConfigurationMap, times(1)).get(anyString());
verify(runningFlows, never()).put(any(Flow.class), isNull(String.class));
verify(flowLogService, never()).save(any(FlowParameters.class), anyString(), anyString(), any(Payload.class), anyMap(), any(), any(FlowState.class));
}
use of com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException in project cloudbreak by hortonworks.
the class AdlsGen2ConfigGeneratorTest method testGenerateStorageConfigWhenNoAccountIdInThePath.
@Test
public void testGenerateStorageConfigWhenNoAccountIdInThePath() {
String loc = "abfs://logs@.dfs.core.windows.net";
CloudbreakServiceException actual = Assertions.assertThrows(CloudbreakServiceException.class, () -> underTest.generateStorageConfig(loc));
Assertions.assertEquals("Invalid ADLS storage location: " + loc, actual.getMessage());
}
use of com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException in project cloudbreak by hortonworks.
the class ClusterBootstrapper method saveSaltComponent.
private void saveSaltComponent(Stack stack) {
LOGGER.info("Save salt component for stack: {}", stack.getName());
ClusterComponent saltComponent = clusterComponentProvider.getComponent(stack.getCluster().getId(), ComponentType.SALT_STATE);
if (saltComponent == null) {
try {
byte[] stateConfigZip = hostOrchestrator.getStateConfigZip();
saltComponent = createSaltComponent(stack, stateConfigZip);
clusterComponentProvider.store(saltComponent);
} catch (IOException e) {
throw new CloudbreakServiceException(e);
}
}
}
Aggregations