Search in sources :

Example 16 with RepoImage

use of org.ovirt.engine.core.common.businessentities.storage.RepoImage in project ovirt-engine by oVirt.

the class RepoFileMetaDataDaoTest method testPrimaryKeyValidation.

/**
 * Test primary key validity.
 */
@Test
public void testPrimaryKeyValidation() {
    RepoImage newRepoFileMap = getNewIsoRepoFile();
    repoFileMetaDataDao.addRepoFileMap(newRepoFileMap);
    expectedException.expect(DuplicateKeyException.class);
    // Should enter here since its a violation of primary key
    repoFileMetaDataDao.addRepoFileMap(newRepoFileMap);
}
Also used : RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage) Test(org.junit.Test)

Example 17 with RepoImage

use of org.ovirt.engine.core.common.businessentities.storage.RepoImage in project ovirt-engine by oVirt.

the class RepoFileMetaDataDaoTest method testFetchNotExistingRepoFileListById.

/**
 * Test that the list returns is not null, but is empty.
 */
@Test
public void testFetchNotExistingRepoFileListById() {
    Guid falseGuid = new Guid("11111111-1111-1111-1111-111111111111");
    List<RepoImage> listOfRepoFiles = repoFileMetaDataDao.getRepoListForStorageDomain(falseGuid, ImageFileType.ISO);
    assertNotNull(listOfRepoFiles);
    assertTrue(listOfRepoFiles.isEmpty());
}
Also used : RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage) Guid(org.ovirt.engine.core.compat.Guid) Test(org.junit.Test)

Example 18 with RepoImage

use of org.ovirt.engine.core.common.businessentities.storage.RepoImage in project ovirt-engine by oVirt.

the class RepoFileMetaDataDaoTest method testInsertRepoFileAndFetchItAgain.

/**
 * Test when insert row and fetching it later.
 */
@Test
public void testInsertRepoFileAndFetchItAgain() {
    RepoImage newRepoFileMap = getNewIsoRepoFile();
    repoFileMetaDataDao.addRepoFileMap(newRepoFileMap);
    List<RepoImage> listOfRepoFiles = repoFileMetaDataDao.getRepoListForStorageDomain(FixturesTool.STORAGE_DOMAIN_NFS_ISO, ImageFileType.ISO);
    assertNotNull(listOfRepoFiles);
    assertFalse(listOfRepoFiles.isEmpty());
    assertEquals(listOfRepoFiles.get(0).getRepoImageId(), newRepoFileMap.getRepoImageId());
    assertEquals(listOfRepoFiles.get(0).getLastRefreshed(), newRepoFileMap.getLastRefreshed());
    assertEquals(listOfRepoFiles.get(0).getSize(), newRepoFileMap.getSize());
    assertEquals(listOfRepoFiles.get(0).getRepoDomainId(), newRepoFileMap.getRepoDomainId());
}
Also used : RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage) Test(org.junit.Test)

Example 19 with RepoImage

use of org.ovirt.engine.core.common.businessentities.storage.RepoImage in project ovirt-engine by oVirt.

the class BackendOpenStackImageResourceTest method getEntity.

@Override
protected RepoImage getEntity(int index) {
    RepoImage image = mock(RepoImage.class);
    when(image.getRepoImageId()).thenReturn(GUIDS[index].toString());
    when(image.getRepoImageName()).thenReturn(NAMES[index]);
    return image;
}
Also used : RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage)

Example 20 with RepoImage

use of org.ovirt.engine.core.common.businessentities.storage.RepoImage in project ovirt-engine by oVirt.

the class BackendOpenStackImagesResourceTest method getEntity.

@Override
protected RepoImage getEntity(int index) {
    RepoImage image = mock(RepoImage.class);
    when(image.getRepoImageId()).thenReturn(GUIDS[index].toString());
    when(image.getRepoImageName()).thenReturn(NAMES[index]);
    return image;
}
Also used : RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage)

Aggregations

RepoImage (org.ovirt.engine.core.common.businessentities.storage.RepoImage)41 ArrayList (java.util.ArrayList)8 Test (org.junit.Test)5 Guid (org.ovirt.engine.core.compat.Guid)5 VmTemplate (org.ovirt.engine.core.common.businessentities.VmTemplate)4 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)4 InstanceType (org.ovirt.engine.core.common.businessentities.InstanceType)3 Quota (org.ovirt.engine.core.common.businessentities.Quota)3 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)3 NullSafeRenderer (org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Lock (java.util.concurrent.locks.Lock)2 ReentrantLock (java.util.concurrent.locks.ReentrantLock)2 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)2 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)2 StoragePoolIsoMap (org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap)2 ListModelTypeAheadChangeableListBoxEditor (org.ovirt.engine.ui.common.widget.editor.ListModelTypeAheadChangeableListBoxEditor)2 VncKeyMapRenderer (org.ovirt.engine.ui.common.widget.editor.VncKeyMapRenderer)2 EntityModelCheckBoxEditor (org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor)2