use of org.ovirt.engine.core.common.businessentities.CommandAssociatedEntity in project ovirt-engine by oVirt.
the class CommandEntityDaoTest method testGetAllInsertAsyncTaskEntitities.
@Test
public void testGetAllInsertAsyncTaskEntitities() {
CommandEntity cmdEntity = generateNewEntity();
dao.save(cmdEntity);
Set<CommandAssociatedEntity> cocoCmdEntities = new HashSet<>();
cocoCmdEntities.add(new CommandAssociatedEntity(cmdEntity.getId(), VdcObjectType.Storage, Guid.newGuid()));
cocoCmdEntities.add(new CommandAssociatedEntity(cmdEntity.getId(), VdcObjectType.Disk, Guid.newGuid()));
dao.insertCommandAssociatedEntities(cocoCmdEntities);
List<CommandAssociatedEntity> entities = dao.getAllCommandAssociatedEntities(cmdEntity.getId());
assertNotNull(entities);
assertEquals(2, entities.size());
assertThat(entities, hasItems(cocoCmdEntities.toArray(new CommandAssociatedEntity[cocoCmdEntities.size()])));
}
use of org.ovirt.engine.core.common.businessentities.CommandAssociatedEntity in project ovirt-engine by oVirt.
the class CommandEntityDaoTest method testGetCommandIdsByEntity.
@Test
public void testGetCommandIdsByEntity() {
Guid storageId = Guid.newGuid();
CommandEntity cmdEntity1 = generateNewEntity();
dao.save(cmdEntity1);
Set<CommandAssociatedEntity> cocoCmdEntities1 = new HashSet<>();
cocoCmdEntities1.add(new CommandAssociatedEntity(cmdEntity1.getId(), VdcObjectType.Storage, storageId));
cocoCmdEntities1.add(new CommandAssociatedEntity(cmdEntity1.getId(), VdcObjectType.Disk, Guid.newGuid()));
dao.insertCommandAssociatedEntities(cocoCmdEntities1);
CommandEntity cmdEntity2 = generateNewEntity();
dao.save(cmdEntity2);
Set<CommandAssociatedEntity> cocoCmdEntities2 = new HashSet<>();
cocoCmdEntities2.add(new CommandAssociatedEntity(cmdEntity2.getId(), VdcObjectType.Storage, storageId));
cocoCmdEntities2.add(new CommandAssociatedEntity(cmdEntity2.getId(), VdcObjectType.Disk, Guid.newGuid()));
dao.insertCommandAssociatedEntities(cocoCmdEntities2);
List<Guid> cmIds = dao.getCommandIdsByEntity(storageId);
assertNotNull(cmIds);
assertThat(cmIds, hasSize(2));
assertThat(cmIds, hasItems(cmdEntity1.getId(), cmdEntity2.getId()));
}
Aggregations