Search in sources :

Example 6 with RandomUtils

use of org.ovirt.engine.core.utils.RandomUtils in project ovirt-engine by oVirt.

the class RefreshLunsSizeCommandTest method createLunMap.

private Map<String, List<Pair<VDS, LUNs>>> createLunMap(boolean sameLunSizesPerHost) {
    RandomUtils rnd = RandomUtils.instance();
    String lunId = rnd.nextString(34);
    int lunSize = rnd.nextInt();
    List<Pair<VDS, LUNs>> lunList = new ArrayList<>();
    for (int i = 0; i < 10; i++) {
        LUNs lun = new LUNs();
        if (!sameLunSizesPerHost) {
            lunSize++;
        }
        lun.setDeviceSize(lunSize);
        lunList.add(new Pair<>(new VDS(), lun));
    }
    return Collections.singletonMap(lunId, lunList);
}
Also used : RandomUtils(org.ovirt.engine.core.utils.RandomUtils) VDS(org.ovirt.engine.core.common.businessentities.VDS) ArrayList(java.util.ArrayList) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) Pair(org.ovirt.engine.core.common.utils.Pair)

Example 7 with RandomUtils

use of org.ovirt.engine.core.utils.RandomUtils in project ovirt-engine by oVirt.

the class JsonObjectSerializationEntitiesTest method randomStorageDomainStatic.

private static StorageDomainStatic randomStorageDomainStatic() {
    RandomUtils random = RandomUtils.instance();
    StorageDomainStatic sds = new StorageDomainStatic();
    sds.setId(Guid.newGuid());
    sds.setStorage(random.nextString(10));
    sds.setStorageType(random.nextEnum(StorageType.class));
    sds.setStorageName(random.nextString(10));
    sds.setDescription(random.nextString(10));
    sds.setWarningLowSpaceIndicator(5);
    sds.setCriticalSpaceActionBlocker(10);
    return sds;
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) RandomUtils(org.ovirt.engine.core.utils.RandomUtils)

Example 8 with RandomUtils

use of org.ovirt.engine.core.utils.RandomUtils in project ovirt-engine by oVirt.

the class JsonObjectSerializationEntitiesTest method randomStoragePool.

private static StoragePool randomStoragePool() {
    RandomUtils random = RandomUtils.instance();
    StoragePool sp = new StoragePool();
    sp.setdescription(random.nextString(10));
    sp.setComment(random.nextString(10));
    sp.setName(random.nextString(10));
    sp.setId(Guid.newGuid());
    sp.setIsLocal(random.nextBoolean());
    sp.setStatus(random.nextEnum(StoragePoolStatus.class));
    return sp;
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) RandomUtils(org.ovirt.engine.core.utils.RandomUtils) StoragePoolStatus(org.ovirt.engine.core.common.businessentities.StoragePoolStatus)

Example 9 with RandomUtils

use of org.ovirt.engine.core.utils.RandomUtils in project ovirt-engine by oVirt.

the class JsonObjectSerializationEntitiesTest method randomVdsDynamic.

private static VdsDynamic randomVdsDynamic() {
    RandomUtils random = RandomUtils.instance();
    VdsDynamic vdsDynamic = new VdsDynamic();
    vdsDynamic.setCpuCores(random.nextInt());
    vdsDynamic.setCpuThreads(random.nextInt());
    vdsDynamic.setCpuModel(random.nextString(10));
    vdsDynamic.setCpuSpeedMh(random.nextDouble());
    vdsDynamic.setIfTotalSpeed(random.nextString(10));
    vdsDynamic.setKvmEnabled(random.nextBoolean());
    vdsDynamic.setMemCommited(random.nextInt());
    vdsDynamic.setPhysicalMemMb(random.nextInt());
    vdsDynamic.setStatus(random.nextEnum(VDSStatus.class));
    vdsDynamic.setId(Guid.newGuid());
    vdsDynamic.setVmActive(random.nextInt());
    vdsDynamic.setVmCount(random.nextInt());
    vdsDynamic.setVmMigrating(random.nextInt());
    vdsDynamic.setReservedMem(random.nextInt());
    vdsDynamic.setGuestOverhead(random.nextInt());
    vdsDynamic.setPreviousStatus(random.nextEnum(VDSStatus.class));
    vdsDynamic.setSoftwareVersion(random.nextNumericString(5) + '.' + random.nextNumericString(5));
    vdsDynamic.setVersionName(random.nextString(10));
    vdsDynamic.setPendingVcpusCount(random.nextInt());
    vdsDynamic.setPendingVmemSize(random.nextInt());
    vdsDynamic.setNetConfigDirty(random.nextBoolean());
    vdsDynamic.setTransparentHugePagesState(random.nextEnum(VdsTransparentHugePagesState.class));
    vdsDynamic.setHardwareUUID(Guid.newGuid().toString());
    vdsDynamic.setHardwareFamily(random.nextString(10));
    vdsDynamic.setHardwareSerialNumber(random.nextString(10));
    vdsDynamic.setHardwareVersion(random.nextString(10));
    vdsDynamic.setHardwareProductName(random.nextString(10));
    vdsDynamic.setHardwareManufacturer(random.nextString(10));
    return vdsDynamic;
}
Also used : VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) RandomUtils(org.ovirt.engine.core.utils.RandomUtils) VdsDynamic(org.ovirt.engine.core.common.businessentities.VdsDynamic) VdsTransparentHugePagesState(org.ovirt.engine.core.common.businessentities.VdsTransparentHugePagesState)

Example 10 with RandomUtils

use of org.ovirt.engine.core.utils.RandomUtils in project ovirt-engine by oVirt.

the class JsonObjectSerializationEntitiesTest method randomVdsStatistics.

private static VdsStatistics randomVdsStatistics() {
    RandomUtils random = RandomUtils.instance();
    VdsStatistics vdsStatistics = new VdsStatistics();
    vdsStatistics.setCpuIdle(random.nextDouble());
    vdsStatistics.setCpuLoad(random.nextDouble());
    vdsStatistics.setCpuSys(random.nextDouble());
    vdsStatistics.setCpuUser(random.nextDouble());
    vdsStatistics.setMemAvailable(random.nextLong());
    vdsStatistics.setMemFree(random.nextLong());
    vdsStatistics.setMemShared(random.nextLong());
    vdsStatistics.setUsageCpuPercent(random.nextInt());
    vdsStatistics.setUsageMemPercent(random.nextInt());
    vdsStatistics.setUsageNetworkPercent(random.nextInt());
    vdsStatistics.setCpuOverCommitTimeStamp(new Date(random.nextLong()));
    return vdsStatistics;
}
Also used : RandomUtils(org.ovirt.engine.core.utils.RandomUtils) VdsStatistics(org.ovirt.engine.core.common.businessentities.VdsStatistics) Date(java.util.Date)

Aggregations

RandomUtils (org.ovirt.engine.core.utils.RandomUtils)10 ArrayList (java.util.ArrayList)3 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)2 Date (java.util.Date)1 Role (org.ovirt.engine.core.common.businessentities.Role)1 StorageDomainDynamic (org.ovirt.engine.core.common.businessentities.StorageDomainDynamic)1 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)1 StorageDomainStatus (org.ovirt.engine.core.common.businessentities.StorageDomainStatus)1 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)1 StoragePoolIsoMap (org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap)1 StoragePoolStatus (org.ovirt.engine.core.common.businessentities.StoragePoolStatus)1 VDS (org.ovirt.engine.core.common.businessentities.VDS)1 VDSStatus (org.ovirt.engine.core.common.businessentities.VDSStatus)1 VDSType (org.ovirt.engine.core.common.businessentities.VDSType)1 VdsDynamic (org.ovirt.engine.core.common.businessentities.VdsDynamic)1 VdsSpmIdMap (org.ovirt.engine.core.common.businessentities.VdsSpmIdMap)1 VdsStatic (org.ovirt.engine.core.common.businessentities.VdsStatic)1 VdsStatistics (org.ovirt.engine.core.common.businessentities.VdsStatistics)1 VdsTransparentHugePagesState (org.ovirt.engine.core.common.businessentities.VdsTransparentHugePagesState)1 VmNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)1