private static void random(Method m, Object model) throws Exception { Object value = null; if (takesString(m)) { value = garble(m); } else if (takesShort(m)) { value = (short) rand(100); } else if (takesInteger(m)) { value = rand(100); } else if (takesLong(m)) { value = (long) rand(1000000000); } else if (takesBoolean(m)) { value = RandomUtils.instance().nextBoolean(); } else if (takesDouble(m)) { value = RandomUtils.instance().nextDouble(); } if (value != null) { m.invoke(model, value); } }
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; }
public static Stream<BusinessEntity<?>> 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 Stream.of( 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()) ); }
vdsDynamic.setCpuSpeedMh(random.nextDouble()); vdsDynamic.setIfTotalSpeed(random.nextString(10)); vdsDynamic.setKvmEnabled(random.nextBoolean()); vdsDynamic.setMemCommited(random.nextInt()); vdsDynamic.setPhysicalMemMb(random.nextInt()); vdsDynamic.setPendingVcpusCount(random.nextInt()); vdsDynamic.setPendingVmemSize(random.nextInt()); vdsDynamic.setNetConfigDirty(random.nextBoolean()); vdsDynamic.setTransparentHugePagesState(random.nextEnum(VdsTransparentHugePagesState.class)); vdsDynamic.setHardwareUUID(Guid.newGuid().toString());