本文整理了Java中org.ovirt.engine.core.compat.Guid.newGuid()
方法的一些代码示例,展示了Guid.newGuid()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Guid.newGuid()
方法的具体详情如下:
包路径:org.ovirt.engine.core.compat.Guid
类名称:Guid
方法名:newGuid
暂无
代码示例来源:origin: oVirt/ovirt-engine
private void setIdIfNeeded(DbUser user) {
if (Guid.isNullOrEmpty(user.getId())) {
user.setId(Guid.newGuid());
}
}
代码示例来源:origin: oVirt/ovirt-engine
public VmHostDevice(Guid vmId, HostDevice device) {
this();
setDeviceId(Guid.newGuid());
setVmId(vmId);
setDevice(device.getDeviceName());
}
代码示例来源:origin: oVirt/ovirt-engine
protected MapSqlParameterSource createNumaNodeCpusParametersMapper(NumaNode node, Integer cpuId) {
return getCustomMapSqlParameterSource()
.addValue("id", Guid.newGuid())
.addValue("numa_node_id", node.getId())
.addValue("cpu_core_id", cpuId);
}
}
代码示例来源:origin: oVirt/ovirt-engine
@Override
public void save(FenceAgent agent) {
MapSqlParameterSource params = getInsertOrUpdateParams(agent);
Guid id = Guid.newGuid();
params.addValue("id", id); // create random ID for the new agent.
agent.setId(id);
getCallsHandler().executeModification("InsertFenceAgent", params);
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void testGetByNameReturnsItemOfThatName() {
String itemName = "name";
TestItem item = new TestItem(Guid.newGuid(), itemName);
BusinessEntityMap<TestItem> map = new BusinessEntityMap<>(Collections.singletonList(item));
assertThat(map.get(itemName), is(item));
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void testContainsKeyReturnsTrueForExistingId() {
Guid itemId = Guid.newGuid();
List<TestItem> testItems = Collections.singletonList(new TestItem(itemId, null));
BusinessEntityMap<TestItem> map = new BusinessEntityMap<>(testItems);
assertThat(map.containsKey(itemId), is(true));
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void testGetByIdOrNameWhenIdIsNotSpecified() {
TestItem testItem = new TestItem(Guid.newGuid(), "name");
List<TestItem> testItems = Collections.singletonList(testItem);
BusinessEntityMap<TestItem> map = new BusinessEntityMap<>(testItems);
assertThat(map.get(null, "name"), is(testItem));
}
代码示例来源:origin: oVirt/ovirt-engine
/**
* Ensures that nothing is returned when the VM is invalid.
*/
@Test
public void testGetAllForVmWithInvalidVm() {
List<DbUser> result = dao.getAllForVm(Guid.newGuid());
assertTrue(result.isEmpty());
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void getZeroSnapshotsByMemory() {
Snapshot snapshot = new Snapshot();
snapshot.setMemoryDiskId(Guid.newGuid());
snapshot.setMetadataDiskId(Guid.newGuid());
assertEquals(0, dao.getNumOfSnapshotsByDisks(snapshot));
}
代码示例来源:origin: oVirt/ovirt-engine
/** Tests {@link AuditLogDao#getAllByVMTemplateId(Guid)} with a an ID of a VM Template that doesn't exist */
@Test
public void testGetAllByVMTemplateIdInvalidId() {
assertGetByNameInvalidResults(dao.getAllByVMTemplateId(Guid.newGuid()));
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void testGetAllIdsForNonExistingStoragePoolId() {
List<Guid> result = dao.getAllIds(Guid.newGuid(), StorageDomainStatus.Active);
assertNotNull(result);
assertTrue(result.isEmpty());
}
代码示例来源:origin: oVirt/ovirt-engine
/**
* Ensures that getting a permission with a bad id fails.
*/
@Test
public void testGetWithInvalidId() {
Permission result = dao.get(Guid.newGuid());
assertNull(result);
}
代码示例来源:origin: oVirt/ovirt-engine
/**
* Ensures that an empty collection is returned.
*/
@Test
public void testGetAllForAdElementWithInvalidId() {
List<Permission> result = dao.getAllForAdElement(Guid.newGuid());
assertInvalidGetPermissionList(result);
}
代码示例来源:origin: oVirt/ovirt-engine
/**
* Ensures that an empty collection is returned.
*/
@Test
public void testGetAllForAdElementOnlyWithInvalidId() {
List<Permission> result = dao.getAllDirectPermissionsForAdElement(Guid.newGuid());
assertInvalidGetPermissionList(result);
}
代码示例来源:origin: oVirt/ovirt-engine
/**
* Ensures that an empty collection is returned.
*/
@Test
public void testGetAllForRoleWithInvalidRole() {
List<Permission> result = dao.getAllForRole(Guid.newGuid());
assertInvalidGetPermissionList(result);
}
代码示例来源:origin: oVirt/ovirt-engine
/**
* Ensures that an empty collection is returned if the specified role doesn't have any permissions with the
* specified ad element.
*/
@Test
public void testGetAllForRoleAndAdElementWithInvalidRole() {
List<Permission> result = dao.getAllForRoleAndAdElement(
Guid.newGuid(), AD_ELEMENT_ID);
assertInvalidGetPermissionList(result);
}
代码示例来源:origin: oVirt/ovirt-engine
/**
* Ensures that trying to get a user using an invalid id fails.
*/
@Test
public void testGetWithInvalidId() {
DbUser result = dao.get(Guid.newGuid());
assertNull(result);
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void testGetImagesWithNoDiskReturnsEmptyList() {
List<DiskImage> result = dao.getImagesWithNoDisk(Guid.newGuid());
assertNotNull(result);
assertTrue(result.isEmpty());
}
代码示例来源:origin: oVirt/ovirt-engine
@ParameterizedTest
@ValueSource(strings = {"true", "false"})
public void testCopyOf(boolean boot) {
DiskVmElement dve = new DiskVmElement(Guid.newGuid(), Guid.newGuid());
dve.setBoot(boot);
DiskVmElement copy = DiskVmElement.copyOf(dve);
assertEquals(copy, dve);
assertNotSame(copy, dve);
}
}
代码示例来源:origin: oVirt/ovirt-engine
/**
* Ensures that if the id is invalid then no EngineSession is returned.
*/
@Test
public void testGetWithInvalidId() {
EngineSession result = dao.getBySessionId(Guid.newGuid().toString());
assertNull(result);
}
内容来源于网络,如有侵权,请联系作者删除!