use of com.sequenceiq.cloudbreak.domain.CustomConfigurations in project cloudbreak by hortonworks.
the class StackToStackDetailsConverterTest method testConversionWithCustomConfigsAndClusterInstalled.
@Test
public void testConversionWithCustomConfigsAndClusterInstalled() {
// GIVEN
Stack stack = createStack();
Cluster cluster = new Cluster();
CustomConfigurations customConfigurations = new CustomConfigurations();
cluster.setCustomConfigurations(customConfigurations);
stack.setCluster(cluster);
CustomConfigurationsDetails customConfigurationsDetails = new CustomConfigurationsDetails();
Mockito.when(customConfigurationsToCustomConfigurationsDetailsConverter.convert(any(CustomConfigurations.class))).thenReturn(customConfigurationsDetails);
// WHEN
StackDetails actual = underTest.convert(stack);
// THEN
Assertions.assertNotNull(actual.getCustomConfigurations());
Assertions.assertEquals(customConfigurationsDetails, actual.getCustomConfigurations());
}
use of com.sequenceiq.cloudbreak.domain.CustomConfigurations in project cloudbreak by hortonworks.
the class CustomConfigurationsService method deleteByName.
public CustomConfigurations deleteByName(String name, String accountId) {
CustomConfigurations customConfigurationsByName = getByName(name, accountId);
prepareDeletion(customConfigurationsByName);
customConfigurationPropertyRepository.deleteAll(customConfigurationsByName.getConfigurations());
ownerAssignmentService.notifyResourceDeleted(customConfigurationsByName.getCrn(), MDCUtils.getRequestId());
return customConfigurationsByName;
}
use of com.sequenceiq.cloudbreak.domain.CustomConfigurations in project cloudbreak by hortonworks.
the class CustomConfigurationsServiceTest method testCustomConfigurationsAreDeletedByName.
@Test
void testCustomConfigurationsAreDeletedByName() {
when(customConfigurationsRepository.findByNameAndAccountId(TEST_NAME, TEST_ACCOUNT_ID_1)).thenReturn(Optional.of(customConfigurations));
doNothing().when(ownerAssignmentService).notifyResourceDeleted(anyString(), any());
ThreadBasedUserCrnProvider.doAs(TEST_USER_CRN_1, () -> {
CustomConfigurations result = underTest.deleteByName(TEST_NAME, TEST_ACCOUNT_ID_1);
verify(customConfigurationPropertyRepository, times(1)).deleteAll(result.getConfigurations());
});
}
use of com.sequenceiq.cloudbreak.domain.CustomConfigurations in project cloudbreak by hortonworks.
the class CustomConfigurationsServiceTest method testCustomConfigurationsAreDeletedByCrn.
@Test
void testCustomConfigurationsAreDeletedByCrn() {
when(customConfigurationsRepository.findByCrn(TEST_CRN_1)).thenReturn(Optional.of(customConfigurations));
doNothing().when(ownerAssignmentService).notifyResourceDeleted(anyString(), any());
ThreadBasedUserCrnProvider.doAs(TEST_USER_CRN_1, () -> {
CustomConfigurations result = underTest.deleteByCrn(TEST_CRN_1);
verify(customConfigurationPropertyRepository, times(1)).deleteAll(result.getConfigurations());
});
}
use of com.sequenceiq.cloudbreak.domain.CustomConfigurations in project cloudbreak by hortonworks.
the class CustomConfigurationsV4RequestToCustomConfigurationsConverter method convert.
public CustomConfigurations convert(CustomConfigurationsV4Request source) {
CustomConfigurations customConfigurations = new CustomConfigurations();
customConfigurations.setName(source.getName());
customConfigurations.setConfigurations(source.getConfigurations().stream().map(c -> customConfigurationPropertyConverter.convertFromRequestJson(c)).collect(Collectors.toSet()));
customConfigurations.setRuntimeVersion(source.getRuntimeVersion());
return customConfigurations;
}
Aggregations