use of org.ovirt.engine.core.common.businessentities.gluster.StorageDevice in project ovirt-engine by oVirt.
the class StorageDeviceReturn method getStorageDevice.
protected StorageDevice getStorageDevice(Map<String, Object> map) {
StorageDevice storageDevice = new StorageDevice();
storageDevice.setName(map.get(NAME).toString());
storageDevice.setSize((long) (map.containsKey(SIZE) ? Double.valueOf(map.get(SIZE).toString()) : 0));
storageDevice.setDevPath(map.containsKey(DEV_PATH) ? map.get(DEV_PATH).toString() : null);
storageDevice.setCanCreateBrick(map.containsKey(CREATE_BRICK) ? Boolean.valueOf(map.get(CREATE_BRICK).toString()) : Boolean.FALSE);
storageDevice.setFsType(map.containsKey(FILE_SYSTEM_TYPE) && StringUtils.isNotBlank(map.get(FILE_SYSTEM_TYPE).toString()) ? map.get(FILE_SYSTEM_TYPE).toString() : null);
storageDevice.setMountPoint(map.containsKey(MOUNT_POINT) && StringUtils.isNotBlank(map.get(MOUNT_POINT).toString()) ? map.get(MOUNT_POINT).toString() : null);
storageDevice.setDevUuid(map.containsKey(DEV_UUID) && StringUtils.isNotBlank(map.get(DEV_UUID).toString()) ? map.get(DEV_UUID).toString() : null);
storageDevice.setFsUuid(map.containsKey(UUID) && StringUtils.isNotBlank(map.get(UUID).toString()) ? map.get(UUID).toString() : null);
storageDevice.setDescription(map.containsKey(MODEL) ? map.get(MODEL).toString() : null);
storageDevice.setDevType(map.containsKey(BUS) && StringUtils.isNotBlank(map.get(BUS).toString()) ? map.get(BUS).toString() : null);
return storageDevice;
}
use of org.ovirt.engine.core.common.businessentities.gluster.StorageDevice in project ovirt-engine by oVirt.
the class StoageDeviceDaoTest method getStorageDevice.
private StorageDevice getStorageDevice() {
StorageDevice storageDevice = new StorageDevice();
storageDevice.setId(NEW_STORAGE_DEVICE_ID);
storageDevice.setCanCreateBrick(true);
storageDevice.setDescription("Test Device");
storageDevice.setDevPath("/dev/sdc");
storageDevice.setDevType("SCSI");
storageDevice.setDevUuid("ocIYJv-Ej8x-vDPm-kcGr-sHqy-jjeo-Jt2hTj");
storageDevice.setName("sdc");
storageDevice.setSize(10000L);
storageDevice.setVdsId(FixturesTool.GLUSTER_BRICK_SERVER1);
return storageDevice;
}
use of org.ovirt.engine.core.common.businessentities.gluster.StorageDevice in project ovirt-engine by oVirt.
the class StoageDeviceDaoTest method testRemove.
@Test
public void testRemove() {
StorageDevice storageDevice = dao.get(EXISTING_STORAGE_DEVICE_ID_2);
assertNotNull("storage device doesn't exists", storageDevice);
dao.remove(EXISTING_STORAGE_DEVICE_ID_2);
storageDevice = dao.get(EXISTING_STORAGE_DEVICE_ID_2);
assertNull("Failed to remove storage device", storageDevice);
}
use of org.ovirt.engine.core.common.businessentities.gluster.StorageDevice in project ovirt-engine by oVirt.
the class StoageDeviceDaoTest method testSave.
@Test
public void testSave() {
StorageDevice storageDevice = getStorageDevice();
dao.save(storageDevice);
StorageDevice storageDeviceFromDB = dao.get(storageDevice.getId());
assertEquals("Storage device is not saved correctly", storageDevice, storageDeviceFromDB);
}
use of org.ovirt.engine.core.common.businessentities.gluster.StorageDevice in project ovirt-engine by oVirt.
the class StoageDeviceDaoTest method testGetById.
@Test
public void testGetById() {
StorageDevice storageDevice = dao.get(EXISTING_STORAGE_DEVICE_ID_1);
assertNotNull("Failed to retrive storage device", storageDevice);
assertEquals("Failed to retrive corrective storage device", EXISTING_STORAGE_DEVICE_ID_1, storageDevice.getId());
storageDevice = dao.get(NON_EXISTING_STORAGE_DEVICE_ID);
assertNull(storageDevice);
}
Aggregations