Search in sources :

Example 31 with Cluster

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

the class BackendResourceTest method testBadGuidValidation.

@Test(expected = MalformedIdException.class)
public void testBadGuidValidation() throws Exception {
    setUpGetEntityExpectations(false);
    Host host = new Host();
    host.setCluster(new Cluster());
    host.getCluster().setId("!!!");
    resource.update(host);
}
Also used : Cluster(org.ovirt.engine.api.model.Cluster) Host(org.ovirt.engine.api.model.Host) Test(org.junit.Test)

Example 32 with Cluster

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

the class AbstractBackendCpuProfilesResourceTest method doTestBadAddCpuProfile.

private void doTestBadAddCpuProfile(boolean valid, boolean success, String detail) throws Exception {
    setUriInfo(setUpActionExpectations(ActionType.AddCpuProfile, CpuProfileParameters.class, new String[] {}, new Object[] {}, valid, success));
    CpuProfile model = getModel(0);
    model.setCluster(new Cluster());
    model.getCluster().setId(CLUSTER_ID.toString());
    try {
        collection.add(model);
        fail("expected WebApplicationException");
    } catch (WebApplicationException wae) {
        verifyFault(wae, detail);
    }
}
Also used : WebApplicationException(javax.ws.rs.WebApplicationException) CpuProfile(org.ovirt.engine.api.model.CpuProfile) Cluster(org.ovirt.engine.api.model.Cluster) CpuProfileParameters(org.ovirt.engine.core.common.action.CpuProfileParameters)

Example 33 with Cluster

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

the class BackendAffinityGroupResourceTest method getModel.

static AffinityGroup getModel(int index) {
    AffinityGroup model = new AffinityGroup();
    model.setId(GUIDS[0].toString());
    model.setName(NAMES[index]);
    model.setDescription(DESCRIPTIONS[index]);
    model.setCluster(new Cluster());
    model.getCluster().setId(CLUSTER_ID.toString());
    model.setEnforcing((GUIDS[index].hashCode() & 1) == 0);
    model.setPositive((GUIDS[index].hashCode() & 1) == 1);
    return model;
}
Also used : Cluster(org.ovirt.engine.api.model.Cluster) AffinityGroup(org.ovirt.engine.api.model.AffinityGroup)

Aggregations

Cluster (org.ovirt.engine.api.model.Cluster)33 Host (org.ovirt.engine.api.model.Host)7 Test (org.junit.Test)6 GlusterVolume (org.ovirt.engine.api.model.GlusterVolume)5 CpuProfile (org.ovirt.engine.api.model.CpuProfile)4 Vm (org.ovirt.engine.api.model.Vm)4 VmPool (org.ovirt.engine.api.model.VmPool)4 ClusterResource (org.ovirt.engine.api.resource.ClusterResource)4 WebApplicationException (javax.ws.rs.WebApplicationException)3 Response (javax.ws.rs.core.Response)3 DataCenter (org.ovirt.engine.api.model.DataCenter)3 V3Cluster (org.ovirt.engine.api.v3.types.V3Cluster)3 Consumes (javax.ws.rs.Consumes)2 AffinityGroup (org.ovirt.engine.api.model.AffinityGroup)2 Display (org.ovirt.engine.api.model.Display)2 GlusterBrick (org.ovirt.engine.api.model.GlusterBrick)2 Quota (org.ovirt.engine.api.model.Quota)2 StorageDomain (org.ovirt.engine.api.model.StorageDomain)2 Template (org.ovirt.engine.api.model.Template)2 BackendClusterResource (org.ovirt.engine.api.restapi.resource.BackendClusterResource)2