use of com.sequenceiq.cloudbreak.domain.ImageCatalog in project cloudbreak by hortonworks.
the class ImageCatalogServiceTest method testGetWhenEnvDefault.
@Test
public void testGetWhenEnvDefault() {
String name = "cloudbreak-default";
ImageCatalog actual = underTest.get(name);
verify(imageCatalogRepository, times(0)).findByName(name, USER_ID, ACCOUNT);
Assert.assertEquals(actual.getImageCatalogName(), name);
Assert.assertNull(actual.getId());
}
use of com.sequenceiq.cloudbreak.domain.ImageCatalog in project cloudbreak by hortonworks.
the class ImageCatalogServiceTest method testDeleteImageCatalog.
@Test
public void testDeleteImageCatalog() {
String name = "img-name";
IdentityUser user = getIdentityUser();
UserProfile userProfile = new UserProfile();
ImageCatalog imageCatalog = new ImageCatalog();
imageCatalog.setImageCatalogName(name);
imageCatalog.setArchived(false);
when(authenticatedUserService.getCbUser()).thenReturn(user);
when(imageCatalogRepository.findByName(name, user.getUserId(), user.getAccount())).thenReturn(imageCatalog);
when(userProfileService.get(user.getAccount(), user.getUserId(), user.getUsername())).thenReturn(userProfile);
underTest.delete(name);
verify(imageCatalogRepository, times(1)).save(imageCatalog);
Assert.assertTrue(imageCatalog.isArchived());
Assert.assertTrue(imageCatalog.getImageCatalogName().startsWith(name) && imageCatalog.getImageCatalogName().indexOf("_") == name.length());
}
use of com.sequenceiq.cloudbreak.domain.ImageCatalog in project cloudbreak by hortonworks.
the class ImageCatalogV1Controller method createImageCatalog.
private ImageCatalogResponse createImageCatalog(ImageCatalogRequest imageCatalogRequest, boolean publicInAccount) {
IdentityUser identityUser = authenticatedUserService.getCbUser();
ImageCatalog imageCatalog = conversionService.convert(imageCatalogRequest, ImageCatalog.class);
imageCatalog.setAccount(identityUser.getAccount());
imageCatalog.setOwner(identityUser.getUserId());
imageCatalog.setPublicInAccount(publicInAccount);
imageCatalog = imageCatalogService.create(imageCatalog);
return convert(imageCatalog);
}
use of com.sequenceiq.cloudbreak.domain.ImageCatalog in project cloudbreak by hortonworks.
the class ImageCatalogServiceTest method testGetImagesWhenCustomImageCatalogExists.
@Test
public void testGetImagesWhenCustomImageCatalogExists() throws Exception {
ImageCatalog ret = new ImageCatalog();
ret.setImageCatalogUrl("");
when(imageCatalogRepository.findByName("name", "userId", "account")).thenReturn(ret);
when(imageCatalogProvider.getImageCatalogV2("")).thenReturn(null);
underTest.getImages("name", "aws");
verify(imageCatalogProvider, times(1)).getImageCatalogV2("");
}
use of com.sequenceiq.cloudbreak.domain.ImageCatalog in project cloudbreak by hortonworks.
the class ImageCatalogServiceTest method testGet.
@Test
public void testGet() {
String name = "img-name";
ImageCatalog imageCatalog = new ImageCatalog();
IdentityUser user = getIdentityUser();
when(authenticatedUserService.getCbUser()).thenReturn(user);
when(imageCatalogRepository.findByName(name, user.getUserId(), user.getAccount())).thenReturn(imageCatalog);
ImageCatalog actual = underTest.get(name);
Assert.assertEquals(actual, imageCatalog);
}
Aggregations