本文整理了Java中org.ovirt.engine.core.compat.Guid.compareTo()
方法的一些代码示例,展示了Guid.compareTo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Guid.compareTo()
方法的具体详情如下:
包路径:org.ovirt.engine.core.compat.Guid
类名称:Guid
方法名:compareTo
暂无
代码示例来源:origin: oVirt/ovirt-engine
@Override
public int compareTo(UnregisteredDiskId o) {
int idComparison = diskId.compareTo(o.diskId);
if (idComparison == 0) {
return storageDomainId.compareTo(o.storageDomainId);
}
return idComparison;
}
}
代码示例来源:origin: oVirt/ovirt-engine
@Override
public int compareTo(VmBase other) {
return id.compareTo(other.id);
}
代码示例来源:origin: oVirt/ovirt-engine
@Override
public int compareTo(HostDeviceId other) {
int idComparison = hostId.compareTo(other.hostId);
if (idComparison == 0) {
return deviceName.compareTo(other.deviceName);
} else {
return idComparison;
}
}
}
代码示例来源:origin: oVirt/ovirt-engine
@Override
public int compareTo(VmDeviceId other) {
int vmComparsion = getVmId().compareTo(other.getVmId());
if (vmComparsion == 0) {
return getDeviceId().compareTo(other.getDeviceId());
} else {
return vmComparsion;
}
}
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void testCompareTo() {
Guid guid1 = new Guid("5b411bc1-c220-4421-9abd-cfa484aecb6e");
Guid guid2 = new Guid("5b411bc1-c220-4421-9abd-cfa484aecb6f");
assertTrue(guid1.compareTo(guid2) < 0);
assertEquals(0, guid1.compareTo(guid1));
assertTrue(guid2.compareTo(guid1) > 0);
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void testSaveDiskWithAliasAndDescription() {
ArrayList<VmBase> vms = new ArrayList<>();
UnregisteredDisk unregisteredDisk = initUnregisteredDisks(vms);
dao.saveUnregisteredDisk(unregisteredDisk);
List<UnregisteredDisk> fetchedUnregisteredDisk =
dao.getByDiskIdAndStorageDomainId(unregisteredDisk.getDiskId(),
FixturesTool.STORAGE_DOMAIN_NFS2_1);
assertTrue(!fetchedUnregisteredDisk.isEmpty(), "Disk should exists in the UnregisteredDisks table");
assertTrue(fetchedUnregisteredDisk.get(0).getVms().isEmpty(), "Disk should not have multiple vms attached");
assertEquals("Disk Alias", fetchedUnregisteredDisk.get(0).getDiskAlias(), "Disk alias should be the same as initialized");
assertEquals("Disk Description", fetchedUnregisteredDisk.get(0).getDiskDescription(), "Disk description should be the same as initialized");
assertEquals(0,
fetchedUnregisteredDisk.get(0).getStorageDomainId().compareTo(FixturesTool.STORAGE_DOMAIN_NFS2_1),
"Storage Domain id should be the same as initialized");
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void testSaveAttachedDiskWithoutAliasAndDescription() {
VmBase vm1 = new VmBase();
vm1.setId(Guid.newGuid());
vm1.setName("First VM");
ArrayList<VmBase> vms = new ArrayList<>();
vms.add(vm1);
// Set new disk image.
DiskImage diskImage = new DiskImage();
diskImage.setId(Guid.newGuid());
diskImage.setStorageIds(new ArrayList<>(Collections.singletonList(FixturesTool.STORAGE_DOMAIN_NFS2_1)));
UnregisteredDiskId id = new UnregisteredDiskId(diskImage.getId(), diskImage.getStorageIds().get(0));
UnregisteredDisk unregDisk = new UnregisteredDisk(id, diskImage, vms);
dao.saveUnregisteredDisk(unregDisk);
List<UnregisteredDisk> fetchedUnregisteredDisk =
dao.getByDiskIdAndStorageDomainId(unregDisk.getDiskId(), FixturesTool.STORAGE_DOMAIN_NFS2_1);
assertTrue(!fetchedUnregisteredDisk.isEmpty(), "Disk should exists in the UnregisteredDisks table");
assertEquals(1, fetchedUnregisteredDisk.get(0).getVms().size(), "Disk should have vm attached");
assertTrue(fetchedUnregisteredDisk.get(0).getDiskAlias().isEmpty(), "Disk alias should not be initialized");
assertTrue(StringUtils.isEmpty(fetchedUnregisteredDisk.get(0).getDiskDescription()),
"Disk description should not be initialized");
assertEquals(0,
fetchedUnregisteredDisk.get(0).getStorageDomainId().compareTo(FixturesTool.STORAGE_DOMAIN_NFS2_1),
"Storage Domain id should be the same as initialized");
}
}
内容来源于网络,如有侵权,请联系作者删除!