Search in sources :

Example 21 with Cluster

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

the class BackendGlusterHooksResourceTest method setupListExpectations.

private void setupListExpectations() {
    Cluster cluster = new Cluster();
    cluster.setName(defaultClusterName);
    cluster.setId(clusterId.toString());
    parentMock = mock(ClusterResource.class);
    when(parentMock.get()).thenReturn(cluster);
}
Also used : Cluster(org.ovirt.engine.api.model.Cluster) ClusterResource(org.ovirt.engine.api.resource.ClusterResource) BackendClusterResource(org.ovirt.engine.api.restapi.resource.BackendClusterResource)

Example 22 with Cluster

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

the class BackendGlusterHooksResourceTest method init.

/**
 * Override init to perform additional mocking required
 * for the "list" method of the collection resource.
 */
@Override
protected void init() {
    super.init();
    parentMock = mock(BackendClusterResource.class);
    Cluster cluster = new Cluster();
    cluster.setId(clusterId.toString());
    when(parentMock.get()).thenReturn(cluster);
    collection.setParent(parentMock);
    setupListExpectations();
}
Also used : Cluster(org.ovirt.engine.api.model.Cluster) BackendClusterResource(org.ovirt.engine.api.restapi.resource.BackendClusterResource)

Example 23 with Cluster

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

the class V3ClusterInAdapter method adapt.

@Override
public Cluster adapt(V3Cluster from) {
    Cluster to = new Cluster();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetBallooningEnabled()) {
        to.setBallooningEnabled(from.isBallooningEnabled());
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetCpu()) {
        to.setCpu(adaptIn(from.getCpu()));
    }
    if (from.isSetDataCenter()) {
        to.setDataCenter(adaptIn(from.getDataCenter()));
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetDisplay()) {
        to.setDisplay(adaptIn(from.getDisplay()));
    }
    if (from.isSetErrorHandling()) {
        to.setErrorHandling(adaptIn(from.getErrorHandling()));
    }
    if (from.isSetFencingPolicy()) {
        to.setFencingPolicy(adaptIn(from.getFencingPolicy()));
    }
    if (from.isSetGlusterService()) {
        to.setGlusterService(from.isGlusterService());
    }
    if (from.isSetHaReservation()) {
        to.setHaReservation(from.isHaReservation());
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetKsm()) {
        to.setKsm(adaptIn(from.getKsm()));
    }
    if (from.isSetMaintenanceReasonRequired()) {
        to.setMaintenanceReasonRequired(from.isMaintenanceReasonRequired());
    }
    if (from.isSetManagementNetwork()) {
        to.setManagementNetwork(adaptIn(from.getManagementNetwork()));
    }
    if (from.isSetMemoryPolicy()) {
        to.setMemoryPolicy(adaptIn(from.getMemoryPolicy()));
    }
    if (from.isSetMigration()) {
        to.setMigration(adaptIn(from.getMigration()));
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetOptionalReason()) {
        to.setOptionalReason(from.isOptionalReason());
    }
    if (from.isSetRequiredRngSources()) {
        to.setRequiredRngSources(new Cluster.RequiredRngSourcesList());
        to.getRequiredRngSources().getRequiredRngSources().addAll(adaptRngSources(from));
    }
    if (from.isSetSchedulingPolicy()) {
        to.setSchedulingPolicy(adaptIn(from.getSchedulingPolicy()));
    }
    if (from.isSetSerialNumber()) {
        to.setSerialNumber(adaptIn(from.getSerialNumber()));
    }
    if (from.isSetSupportedVersions()) {
        to.setSupportedVersions(new Versions());
        to.getSupportedVersions().getVersions().addAll(adaptIn(from.getSupportedVersions().getVersions()));
    }
    if (from.isSetThreadsAsCores()) {
        to.setThreadsAsCores(from.isThreadsAsCores());
    }
    if (from.isSetTrustedService()) {
        to.setTrustedService(from.isTrustedService());
    }
    if (from.isSetTunnelMigration()) {
        to.setTunnelMigration(from.isTunnelMigration());
    }
    if (from.isSetVersion()) {
        to.setVersion(adaptIn(from.getVersion()));
    }
    if (from.isSetVirtService()) {
        to.setVirtService(from.isVirtService());
    }
    return to;
}
Also used : Versions(org.ovirt.engine.api.model.Versions) V3Cluster(org.ovirt.engine.api.v3.types.V3Cluster) Cluster(org.ovirt.engine.api.model.Cluster)

Example 24 with Cluster

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

the class V3ClusterServer method update.

@PUT
@Consumes({ "application/xml", "application/json" })
public V3Cluster update(V3Cluster v3Cluster) {
    Cluster v4Cluster = adaptIn(v3Cluster);
    assignCompatiblePolicy(v3Cluster, v4Cluster);
    try {
        return adaptOut(getDelegate().update(v4Cluster));
    } catch (WebApplicationException exception) {
        throw adaptException(exception);
    }
}
Also used : WebApplicationException(javax.ws.rs.WebApplicationException) Cluster(org.ovirt.engine.api.model.Cluster) V3Cluster(org.ovirt.engine.api.v3.types.V3Cluster) Consumes(javax.ws.rs.Consumes) PUT(javax.ws.rs.PUT)

Example 25 with Cluster

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

the class V3ClustersServer method add.

@POST
@Consumes({ "application/xml", "application/json" })
public Response add(V3Cluster v3Cluster) {
    Cluster v4Cluster = adaptIn(v3Cluster);
    assignCompatiblePolicy(v3Cluster, v4Cluster);
    try {
        return adaptResponse(getDelegate().add(v4Cluster));
    } catch (WebApplicationException exception) {
        throw adaptException(exception);
    }
}
Also used : WebApplicationException(javax.ws.rs.WebApplicationException) Cluster(org.ovirt.engine.api.model.Cluster) V3Cluster(org.ovirt.engine.api.v3.types.V3Cluster) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes)

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