Search in sources :

Example 1 with StorageFormat

use of org.ovirt.engine.api.model.StorageFormat in project ovirt-engine by oVirt.

the class StorageFormatMapperTest method testMapping.

@Test
public void testMapping() {
    StorageFormat storageFormat = StorageFormatMapper.map(StorageFormatType.V1, null);
    assertEquals(StorageFormat.V1, storageFormat);
    StorageFormatType storageFormatType = StorageFormatMapper.map(storageFormat, null);
    assertEquals(StorageFormatType.V1, storageFormatType);
    storageFormat = StorageFormatMapper.map(StorageFormatType.V2, null);
    assertEquals(StorageFormat.V2, storageFormat);
    storageFormatType = StorageFormatMapper.map(storageFormat, null);
    assertEquals(StorageFormatType.V2, storageFormatType);
}
Also used : StorageFormatType(org.ovirt.engine.core.common.businessentities.StorageFormatType) StorageFormat(org.ovirt.engine.api.model.StorageFormat) Test(org.junit.Test)

Example 2 with StorageFormat

use of org.ovirt.engine.api.model.StorageFormat in project ovirt-engine by oVirt.

the class DataCenterMapper method map.

@Mapping(from = StoragePool.class, to = DataCenter.class)
public static DataCenter map(StoragePool entity, DataCenter template) {
    DataCenter model = template != null ? template : new DataCenter();
    model.setId(entity.getId().toString());
    model.setName(entity.getName());
    model.setLocal(entity.isLocal());
    if (!StringUtils.isEmpty(entity.getdescription())) {
        model.setDescription(entity.getdescription());
    }
    if (!StringUtils.isEmpty(entity.getComment())) {
        model.setComment(entity.getComment());
    }
    if (entity.getStatus() != null) {
        model.setStatus(mapDataCenterStatus(entity.getStatus()));
    }
    if (entity.getCompatibilityVersion() != null) {
        model.setVersion(VersionMapper.map(entity.getCompatibilityVersion()));
    }
    if (entity.getStoragePoolFormatType() != null) {
        StorageFormat storageFormat = StorageFormatMapper.map(entity.getStoragePoolFormatType(), null);
        if (storageFormat != null) {
            model.setStorageFormat(storageFormat);
        }
    }
    if (entity.getMacPoolId() != null) {
        model.setMacPool(new MacPool());
        model.getMacPool().setId(entity.getMacPoolId().toString());
    }
    if (entity.getQuotaEnforcementType() != null) {
        model.setQuotaMode(map(entity.getQuotaEnforcementType()));
    }
    return model;
}
Also used : DataCenter(org.ovirt.engine.api.model.DataCenter) MacPool(org.ovirt.engine.api.model.MacPool) StorageFormat(org.ovirt.engine.api.model.StorageFormat)

Aggregations

StorageFormat (org.ovirt.engine.api.model.StorageFormat)2 Test (org.junit.Test)1 DataCenter (org.ovirt.engine.api.model.DataCenter)1 MacPool (org.ovirt.engine.api.model.MacPool)1 StorageFormatType (org.ovirt.engine.core.common.businessentities.StorageFormatType)1