Search in sources :

Example 11 with StepSubjectEntity

use of org.ovirt.engine.core.common.job.StepSubjectEntity in project ovirt-engine by oVirt.

the class StepMapperTest method testSubjectEntities.

@Test
public void testSubjectEntities() {
    org.ovirt.engine.core.common.job.Step bllStep = createBLLStep();
    Guid executionHostId = Guid.newGuid();
    bllStep.setSubjectEntities(Arrays.asList(new StepSubjectEntity(bllStep.getId(), VdcObjectType.EXECUTION_HOST, executionHostId), new StepSubjectEntity(bllStep.getId(), VdcObjectType.Disk, Guid.Empty)));
    Step model = StepMapper.map(bllStep, null);
    assertNotNull(model.getExecutionHost());
    assertEquals(executionHostId.toString(), model.getExecutionHost().getId());
    bllStep = StepMapper.map(model, null);
    assertNull("subject entities shouldn't be mapped back to the model", bllStep.getSubjectEntities());
}
Also used : Guid(org.ovirt.engine.core.compat.Guid) Step(org.ovirt.engine.api.model.Step) StepSubjectEntity(org.ovirt.engine.core.common.job.StepSubjectEntity) Test(org.junit.Test)

Aggregations

StepSubjectEntity (org.ovirt.engine.core.common.job.StepSubjectEntity)11 Test (org.junit.Test)8 Guid (org.ovirt.engine.core.compat.Guid)5 VdcObjectType (org.ovirt.engine.core.common.VdcObjectType)4 Step (org.ovirt.engine.core.common.job.Step)3 BaseDisk (org.ovirt.engine.core.common.businessentities.storage.BaseDisk)2 Arrays (java.util.Arrays)1 Date (java.util.Date)1 List (java.util.List)1 Matchers.emptyCollectionOf (org.hamcrest.Matchers.emptyCollectionOf)1 Assert.assertEquals (org.junit.Assert.assertEquals)1 Assert.assertFalse (org.junit.Assert.assertFalse)1 Assert.assertNotEquals (org.junit.Assert.assertNotEquals)1 Assert.assertNotNull (org.junit.Assert.assertNotNull)1 Assert.assertThat (org.junit.Assert.assertThat)1 Assert.assertTrue (org.junit.Assert.assertTrue)1 Before (org.junit.Before)1 Step (org.ovirt.engine.api.model.Step)1 SubjectEntity (org.ovirt.engine.core.common.businessentities.SubjectEntity)1 ExternalSystemType (org.ovirt.engine.core.common.job.ExternalSystemType)1