use of org.ovirt.engine.core.utils.RandomUtils in project ovirt-engine by oVirt.
the class OvfManagerTest method createDisksAndDiskVmElements.
private static ArrayList<DiskImage> createDisksAndDiskVmElements(VM vm) {
ArrayList<DiskImage> disks = new ArrayList<>();
RandomUtils rnd = RandomUtils.instance();
for (int i = 0; i < rnd.nextInt(3, 10); i++) {
DiskImage disk = createVmDisk(vm);
disks.add(disk);
}
return disks;
}
use of org.ovirt.engine.core.utils.RandomUtils in project ovirt-engine by oVirt.
the class OvfManagerTest method initInterfaces.
private static void initInterfaces(VM vm) {
List<VmNetworkInterface> ifaces = new ArrayList<>();
RandomUtils rnd = RandomUtils.instance();
for (int i = 0; i < rnd.nextInt(2, 10); i++) {
VmNetworkInterface vmInterface = new VmNetworkInterface();
vmInterface.setStatistics(new VmNetworkStatistics());
vmInterface.setId(Guid.newGuid());
vmInterface.setVmId(vm.getId());
vmInterface.setName(generateRandomName());
vmInterface.setVnicProfileName(generateRandomName());
vmInterface.setNetworkName(generateRandomName());
vmInterface.setLinked(rnd.nextBoolean());
vmInterface.setSpeed(rnd.nextInt(1000));
vmInterface.setType(rnd.nextInt(10));
vmInterface.setMacAddress(rnd.nextMacAddress());
ifaces.add(vmInterface);
}
vm.setInterfaces(ifaces);
}
use of org.ovirt.engine.core.utils.RandomUtils in project ovirt-engine by oVirt.
the class JsonObjectSerializationEntitiesTest method randomRole.
private static Role randomRole() {
RandomUtils random = RandomUtils.instance();
Role role = new Role();
role.setDescription(random.nextString(10));
role.setId(Guid.newGuid());
role.setName(random.nextString(10));
return role;
}
use of org.ovirt.engine.core.utils.RandomUtils in project ovirt-engine by oVirt.
the class JsonObjectSerializationEntitiesTest method data.
@Parameterized.Parameters
public static Object[] data() {
RandomUtils random = RandomUtils.instance();
VdsStatic vdsStatic = new VdsStatic(random.nextString(10), random.nextString(10), random.nextInt(), random.nextInt(), random.nextString(10), Guid.newGuid(), Guid.newGuid(), random.nextString(10), random.nextBoolean(), random.nextEnum(VDSType.class), Guid.newGuid());
return new Object[] { vdsStatic, randomVdsDynamic(), randomVdsStatistics(), new VdsSpmIdMap(Guid.newGuid(), Guid.newGuid(), random.nextInt()), randomStorageDomainStatic(), new StorageDomainDynamic(random.nextInt(), Guid.newGuid(), random.nextInt()), randomStoragePool(), new StoragePoolIsoMap(Guid.newGuid(), Guid.newGuid(), random.nextEnum(StorageDomainStatus.class)), randomRole(), new IdContainerClass<>(new VdsSpmIdMap(Guid.newGuid(), Guid.newGuid(), random.nextInt())), new IdContainerClass<>(Guid.newGuid()) };
}
use of org.ovirt.engine.core.utils.RandomUtils in project ovirt-engine by oVirt.
the class OvfManagerTest method createVmDisk.
private static DiskImage createVmDisk(VM vm) {
RandomUtils rnd = RandomUtils.instance();
DiskImage disk = new DiskImage();
disk.setId(Guid.newGuid());
disk.setVmSnapshotId(Guid.newGuid());
disk.setSize(rnd.nextLong(1000));
disk.setActualSize(rnd.nextLong(1000));
disk.setVolumeFormat(rnd.nextEnum(VolumeFormat.class));
disk.setVolumeType(rnd.nextEnum(VolumeType.class));
disk.setWipeAfterDelete(rnd.nextBoolean());
disk.setDiskAlias(generateRandomName());
disk.setDescription(generateRandomName());
disk.setImageId(Guid.newGuid());
disk.setStoragePoolId(Guid.newGuid());
disk.setPlugged(true);
disk.setAppList(rnd.nextPropertyString(100));
Image image = new Image();
image.setActive(true);
image.setVolumeFormat(rnd.nextEnum(VolumeFormat.class));
image.setId(disk.getImageId());
image.setSnapshotId(disk.getSnapshotId());
image.setStatus(ImageStatus.OK);
disk.setImage(image);
DiskVmElement diskVmElement = new DiskVmElement(disk.getId(), vm.getId());
diskVmElement.setBoot(rnd.nextBoolean());
diskVmElement.setDiskInterface(rnd.nextEnum(DiskInterface.class));
diskVmElement.setReadOnly(false);
diskVmElement.setPlugged(true);
disk.setDiskVmElements(Collections.singletonList(diskVmElement));
return disk;
}
Aggregations