use of com.sequenceiq.freeipa.entity.ImageEntity in project cloudbreak by hortonworks.
the class StackToCloudStackConverter method buildInstances.
public List<CloudInstance> buildInstances(Stack stack) {
ImageEntity imageEntity = imageService.getByStack(stack);
Optional<CloudFileSystemView> fileSystemView = buildFileSystemView(stack);
List<Group> groups = buildInstanceGroups(stack, Lists.newArrayList(stack.getInstanceGroups()), Collections.emptySet(), imageEntity.getImageName(), fileSystemView);
List<CloudInstance> cloudInstances = new ArrayList<>();
for (Group group : groups) {
cloudInstances.addAll(group.getInstances());
}
return cloudInstances;
}
use of com.sequenceiq.freeipa.entity.ImageEntity in project cloudbreak by hortonworks.
the class ImageToImageEntityConverter method convert.
public ImageEntity convert(Image source) {
ImageEntity imageEntity = new ImageEntity();
imageEntity.setImageId(source.getUuid());
imageEntity.setOs(source.getOs());
imageEntity.setOsType(source.getOsType());
return imageEntity;
}
use of com.sequenceiq.freeipa.entity.ImageEntity in project cloudbreak by hortonworks.
the class FreeIpaDescribeServiceTest method describeAll.
@Test
void describeAll() {
DescribeFreeIpaResponse describeResponse = mock(DescribeFreeIpaResponse.class);
ImageEntity image = mock(ImageEntity.class);
FreeIpa freeIpa = mock(FreeIpa.class);
UserSyncStatus userSyncStatus = mock(UserSyncStatus.class);
when(stackService.findMultipleByEnvironmentCrnAndAccountIdEvenIfTerminatedWithList(eq(ENVIRONMENT_CRN), eq(ACCOUNT_ID))).thenReturn(Collections.singletonList(stack));
when(imageService.getByStack(any())).thenReturn(image);
when(freeIpaService.findByStackId(any())).thenReturn(freeIpa);
when(userSyncStatusService.findByStack(any())).thenReturn(Optional.of(userSyncStatus));
when(stackToDescribeFreeIpaResponseConverter.convert(any(), any(), any(), any(), any())).thenReturn(describeResponse);
when(entitlementService.isFreeIpaRebuildEnabled(eq(ACCOUNT_ID))).thenReturn(true);
assertEquals(List.of(describeResponse), underTest.describeAll(ENVIRONMENT_CRN, ACCOUNT_ID));
}
use of com.sequenceiq.freeipa.entity.ImageEntity in project cloudbreak by hortonworks.
the class ImageServiceTest method testRevert.
@Test
public void testRevert() {
ImageEntity originalImage = new ImageEntity();
originalImage.setImageName(EXISTING_ID);
originalImage.setImageId(IMAGE_UUID);
originalImage.setImageCatalogName(IMAGE_CATALOG);
originalImage.setImageCatalogUrl(IMAGE_CATALOG_URL);
when(auditReader.find(ImageEntity.class, 2L, 3L)).thenReturn(originalImage);
ImageEntity currentImage = new ImageEntity();
currentImage.setId(2L);
when(imageRepository.findById(2L)).thenReturn(Optional.of(currentImage));
underTest.revertImageToRevision(2L, 3L);
ArgumentCaptor<ImageEntity> captor = ArgumentCaptor.forClass(ImageEntity.class);
verify(imageRepository).save(captor.capture());
ImageEntity revertedImage = captor.getValue();
assertEquals(2L, revertedImage.getId());
assertEquals(IMAGE_UUID, revertedImage.getImageId());
assertEquals(IMAGE_CATALOG, revertedImage.getImageCatalogName());
assertEquals(IMAGE_CATALOG_URL, revertedImage.getImageCatalogUrl());
assertEquals(EXISTING_ID, revertedImage.getImageName());
}
use of com.sequenceiq.freeipa.entity.ImageEntity in project cloudbreak by hortonworks.
the class UserDataServiceTest method updateJumpgateFlagOnly.
@Test
void updateJumpgateFlagOnly() {
ImageEntity image = new ImageEntity();
image.setUserdata("FLAG=foo\nIS_CCM_V2_JUMPGATE_ENABLED=false\nOTHER_FLAG=bar");
when(imageService.getByStackId(STACK_ID)).thenReturn(image);
underTest.updateJumpgateFlagOnly(STACK_ID);
ArgumentCaptor<ImageEntity> imageCaptor = ArgumentCaptor.forClass(ImageEntity.class);
verify(imageService, times(1)).save(imageCaptor.capture());
assertThat(imageCaptor.getValue().getUserdata()).isEqualTo("FLAG=foo\nIS_CCM_V2_JUMPGATE_ENABLED=true\nOTHER_FLAG=bar");
}
Aggregations