use of org.ovirt.engine.core.common.job.StepSubjectEntity in project ovirt-engine by oVirt.
the class StepDaoTest method startedStepsByStepSubjectEntityOtherEntityTYpe.
@Test
public void startedStepsByStepSubjectEntityOtherEntityTYpe() {
StepSubjectEntity subjectEntity = prepareStartedStepsByStepSubjectEntityTest();
subjectEntity.setEntityType(VdcObjectType.AdElements);
assertNoStartedStepsForSubjectEntity(subjectEntity);
}
use of org.ovirt.engine.core.common.job.StepSubjectEntity in project ovirt-engine by oVirt.
the class StepSubjectEntityDaoTest method saveStepSubjectEntities.
@Test
public void saveStepSubjectEntities() {
VdcObjectType type = VdcObjectType.VmPool;
Guid entityId = Guid.newGuid();
StepSubjectEntity stepSubjectEntity = new StepSubjectEntity(FixturesTool.STEP_ID, type, entityId, 50);
Guid entityId2 = Guid.newGuid();
StepSubjectEntity stepSubjectEntity2 = new StepSubjectEntity(FixturesTool.STEP_ID, type, entityId2, 50);
dao.saveAll(Arrays.asList(stepSubjectEntity, stepSubjectEntity2));
List<StepSubjectEntity> entities = dao.getStepSubjectEntitiesByStepId(FixturesTool.STEP_ID);
assertEquals("StepSubjectEntity list not in the expected size", 4, entities.size());
assertSubjectEntityPresence(stepSubjectEntity, entities, true);
assertSubjectEntityPresence(stepSubjectEntity2, entities, true);
}
use of org.ovirt.engine.core.common.job.StepSubjectEntity in project ovirt-engine by oVirt.
the class VdsCommandsHelper method chooseHostForExecution.
private void chooseHostForExecution(VdsIdVDSCommandParametersBase parametersBase, Guid storagePoolId, CommandBase<?> cmd, Collection<Guid> executedHosts) {
Guid vdsForExecution = getHostForExecution(storagePoolId, executedHosts);
parametersBase.setVdsId(vdsForExecution);
if (cmd != null) {
if (cmd.getCommandStep() != null && cmd.getExecutionContext().getStep() != null) {
Guid stepId = cmd.getExecutionContext().getStep().getId();
if (cmd.getParameters().getVdsRunningOn() != null) {
stepSubjectEntityDao.remove(cmd.getParameters().getVdsRunningOn(), stepId);
}
if (vdsForExecution != null) {
stepSubjectEntityDao.saveAll(Collections.singletonList(new StepSubjectEntity(stepId, VdcObjectType.EXECUTION_HOST, vdsForExecution)));
updateStepMessage(cmd, vdsForExecution);
}
}
cmd.getParameters().setVdsRunningOn(vdsForExecution);
cmd.persistCommand(cmd.getParameters().getParentCommand(), cmd.getCallback() != null);
}
}
use of org.ovirt.engine.core.common.job.StepSubjectEntity in project ovirt-engine by oVirt.
the class StepDaoTest method startedStepsByStepSubjectEntityOtherId.
@Test
public void startedStepsByStepSubjectEntityOtherId() {
StepSubjectEntity subjectEntity = prepareStartedStepsByStepSubjectEntityTest();
subjectEntity.setEntityId(Guid.Empty);
assertNoStartedStepsForSubjectEntity(subjectEntity);
}
use of org.ovirt.engine.core.common.job.StepSubjectEntity in project ovirt-engine by oVirt.
the class StepDaoTest method startedStepsByStepSubjectEntityNoStepsHaveStep.
@Test
public void startedStepsByStepSubjectEntityNoStepsHaveStep() {
StepSubjectEntity subjectEntity = prepareStartedStepsByStepSubjectEntityTest();
List<Step> steps = dao.getStartedStepsByStepSubjectEntity(subjectEntity);
assertEquals(1, steps.size());
assertEquals(subjectEntity.getStepId(), steps.get(0).getId());
}
Aggregations