use of org.ovirt.engine.api.model.Host in project ovirt-engine by oVirt.
the class BackendVmResourceTest method testUpdateVmPolicyHostsNames.
@Test
public void testUpdateVmPolicyHostsNames() throws Exception {
setUpUdpateVm();
for (int i = 0; i < NAMES.length; i++) {
setUpGetHostByNameExpectations(i);
}
setUriInfo(setUpActionExpectations(ActionType.UpdateVm, VmManagementParametersBase.class, new String[] {}, new Object[] {}, true, true));
Vm model = getModel(0);
model.setPlacementPolicy(new VmPlacementPolicy());
Hosts hosts = new Hosts();
for (int i = 0; i < NAMES.length; i++) {
Host newHost = new Host();
newHost.setName(NAMES[i]);
hosts.getHosts().add(newHost);
}
model.getPlacementPolicy().setHosts(hosts);
verifyModel(resource.update(model), 0);
}
use of org.ovirt.engine.api.model.Host in project ovirt-engine by oVirt.
the class BackendVmResourceTest method testMigrateWithHostId.
@Test
public void testMigrateWithHostId() throws Exception {
setUriInfo(setUpActionExpectations(ActionType.MigrateVmToServer, MigrateVmToServerParameters.class, new String[] { "VmId", "VdsId", "ForceMigrationForNonMigratableVm" }, new Object[] { GUIDS[0], GUIDS[1], Boolean.FALSE }));
Action action = new Action();
action.setHost(new Host());
action.getHost().setId(GUIDS[1].toString());
verifyActionResponse(resource.migrate(action));
}
use of org.ovirt.engine.api.model.Host in project ovirt-engine by oVirt.
the class BackendVmResourceTest method testStartWithHostId.
@Test
public void testStartWithHostId() throws Exception {
Host host = new Host();
host.setId(GUIDS[1].toString());
testStartWithHost(host, GUIDS[1]);
}
use of org.ovirt.engine.api.model.Host in project ovirt-engine by oVirt.
the class BackendVmsResourceTest method testAddWithPlacementPolicySingleHostName.
@Test
public void testAddWithPlacementPolicySingleHostName() throws Exception {
setUpAddVm();
setUpGetHostByNameExpectations(1);
setUpGetConsoleExpectations(1);
setUpCreationExpectations(ActionType.AddVm, AddVmParameters.class, new String[] { "StorageDomainId" }, new Object[] { GUIDS[0] }, true, true, GUIDS[2], QueryType.GetVmByVmId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[2] }, getEntity(2));
Vm model = createModel(null);
model.setPlacementPolicy(new VmPlacementPolicy());
model.getPlacementPolicy().setHosts(new Hosts());
model.getPlacementPolicy().getHosts().getHosts().add(new Host());
model.getPlacementPolicy().getHosts().getHosts().get(0).setName(NAMES[1]);
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof Vm);
verifyModel((Vm) response.getEntity(), 2);
}
use of org.ovirt.engine.api.model.Host in project ovirt-engine by oVirt.
the class BackendVmResourceTest method testUpdateVmPolicySingleHostId.
@Test
public void testUpdateVmPolicySingleHostId() throws Exception {
setUpUdpateVm();
setUriInfo(setUpActionExpectations(ActionType.UpdateVm, VmManagementParametersBase.class, new String[] {}, new Object[] {}, true, true));
Vm model = getModel(0);
model.setPlacementPolicy(new VmPlacementPolicy());
model.getPlacementPolicy().setHosts(new Hosts());
model.getPlacementPolicy().getHosts().getHosts().add(new Host());
model.getPlacementPolicy().getHosts().getHosts().get(0).setId(GUIDS[1].toString());
verifyModel(resource.update(model), 0);
}
Aggregations