Search in sources :

Example 6 with Host

use of org.ovirt.engine.api.model.Host in project ovirt-engine by oVirt.

the class BackendStorageDomainsResourceTest method testAddIscsiStorageDomain.

@Test
public void testAddIscsiStorageDomain() throws Exception {
    StorageDomain model = getIscsi();
    Host host = new Host();
    host.setId(GUIDS[0].toString());
    model.setHost(host);
    setUriInfo(setUpActionExpectations(ActionType.ConnectStorageToVds, StorageServerConnectionParametersBase.class, new String[] { "StorageServerConnection.Connection", "VdsId" }, new Object[] { ADDRESSES[0], GUIDS[0] }, true, true, GUIDS[0].toString()));
    setUpGetEntityExpectations(QueryType.GetDeviceList, GetDeviceListQueryParameters.class, new String[] { "Id", "StorageType" }, new Object[] { GUIDS[0], org.ovirt.engine.core.common.businessentities.storage.StorageType.ISCSI }, "this return value isn't used");
    setUpGetEntityExpectations(QueryType.GetLunsByVgId, GetLunsByVgIdParameters.class, new String[] { "VgId" }, new Object[] { GUIDS[GUIDS.length - 1].toString() }, setUpLuns());
    setUpCreationExpectations(ActionType.AddSANStorageDomain, AddSANStorageDomainParameters.class, new String[] { "VdsId" }, new Object[] { GUIDS[0] }, true, true, GUIDS[0], QueryType.GetStorageDomainById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, getIscsiEntity());
    Response response = collection.add(model);
    assertEquals(201, response.getStatus());
    assertTrue(response.getEntity() instanceof StorageDomain);
    verifyIscsi((StorageDomain) response.getEntity());
}
Also used : Response(javax.ws.rs.core.Response) StorageDomain(org.ovirt.engine.api.model.StorageDomain) Host(org.ovirt.engine.api.model.Host) StorageServerConnectionParametersBase(org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase) Test(org.junit.Test)

Example 7 with Host

use of org.ovirt.engine.api.model.Host in project ovirt-engine by oVirt.

the class BackendHostResourceTest method testUpdateWithClusterId.

@Test
public void testUpdateWithClusterId() throws Exception {
    setUpGetEntityExpectations(3);
    setUriInfo(setUpActionExpectations(ActionType.ChangeVDSCluster, ChangeVDSClusterParameters.class, new String[] { "ClusterId", "VdsId" }, new Object[] { GUIDS[1], GUIDS[0] }, true, true, new ActionReturnValue(), false));
    setUriInfo(setUpActionExpectations(ActionType.UpdateVds, UpdateVdsActionParameters.class, new String[] { "RootPassword" }, new Object[] { ROOT_PASSWORD }, true, true));
    org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster();
    cluster.setId(GUIDS[1].toString());
    Host host = getModel(0);
    host.setCluster(cluster);
    verifyModel(resource.update(host), 0);
}
Also used : Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Host(org.ovirt.engine.api.model.Host) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) UpdateVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.UpdateVdsActionParameters) ChangeVDSClusterParameters(org.ovirt.engine.core.common.action.ChangeVDSClusterParameters) Test(org.junit.Test)

Example 8 with Host

use of org.ovirt.engine.api.model.Host in project ovirt-engine by oVirt.

the class BackendHostResourceTest method testStatisticalQuery.

@Test
public void testStatisticalQuery() throws Exception {
    VDS entity = setUpStatisticalExpectations();
    @SuppressWarnings("unchecked") BackendStatisticsResource<Host, VDS> statisticsResource = (BackendStatisticsResource<Host, VDS>) resource.getStatisticsResource();
    assertNotNull(statisticsResource);
    verifyQuery(statisticsResource.getQuery(), entity);
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) Host(org.ovirt.engine.api.model.Host) Test(org.junit.Test)

Example 9 with Host

use of org.ovirt.engine.api.model.Host in project ovirt-engine by oVirt.

the class BackendHostsResourceTest method testAddHostClusterById.

@Test
public void testAddHostClusterById() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpCreationExpectations(ActionType.AddVds, AddVdsActionParameters.class, new String[] { "RootPassword" }, new Object[] { ROOT_PASSWORD }, true, true, GUIDS[0], QueryType.GetVdsByVdsId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, getEntity(0));
    Host model = getModel(0);
    model.setCluster(new Cluster());
    model.getCluster().setId(GUIDS[1].toString());
    Response response = collection.add(model);
    assertEquals(201, response.getStatus());
    assertTrue(response.getEntity() instanceof Host);
    verifyModel((Host) response.getEntity(), 0);
}
Also used : Response(javax.ws.rs.core.Response) Cluster(org.ovirt.engine.api.model.Cluster) Host(org.ovirt.engine.api.model.Host) Test(org.junit.Test)

Example 10 with Host

use of org.ovirt.engine.api.model.Host in project ovirt-engine by oVirt.

the class BackendHostsResourceTest method testAddHostClusterByName.

@Test
public void testAddHostClusterByName() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpEntityQueryExpectations(QueryType.GetClusterByName, NameQueryParameters.class, new String[] { "Name" }, new Object[] { NAMES[1] }, setUpCluster(GUIDS[1]));
    setUpCreationExpectations(ActionType.AddVds, AddVdsActionParameters.class, new String[] { "RootPassword" }, new Object[] { ROOT_PASSWORD }, true, true, GUIDS[0], QueryType.GetVdsByVdsId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, getEntity(0));
    Host model = getModel(0);
    model.setCluster(new Cluster());
    model.getCluster().setName(NAMES[1]);
    Response response = collection.add(model);
    assertEquals(201, response.getStatus());
    assertTrue(response.getEntity() instanceof Host);
    verifyModel((Host) response.getEntity(), 0);
}
Also used : Response(javax.ws.rs.core.Response) Cluster(org.ovirt.engine.api.model.Cluster) Host(org.ovirt.engine.api.model.Host) Test(org.junit.Test)

Aggregations

Host (org.ovirt.engine.api.model.Host)114 Test (org.junit.Test)58 Vm (org.ovirt.engine.api.model.Vm)21 Response (javax.ws.rs.core.Response)15 Hosts (org.ovirt.engine.api.model.Hosts)15 StorageDomain (org.ovirt.engine.api.model.StorageDomain)13 WebApplicationException (javax.ws.rs.WebApplicationException)12 VDS (org.ovirt.engine.core.common.businessentities.VDS)12 VmPlacementPolicy (org.ovirt.engine.api.model.VmPlacementPolicy)11 Guid (org.ovirt.engine.core.compat.Guid)10 Cluster (org.ovirt.engine.api.model.Cluster)7 HostNic (org.ovirt.engine.api.model.HostNic)6 StorageServerConnectionParametersBase (org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase)5 StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)5 HashSet (java.util.HashSet)4 ArrayList (java.util.ArrayList)3 AffinityGroup (org.ovirt.engine.api.model.AffinityGroup)3 HostStorage (org.ovirt.engine.api.model.HostStorage)3 HostType (org.ovirt.engine.api.model.HostType)3 Spm (org.ovirt.engine.api.model.Spm)3