Search in sources :

Example 16 with DataCenter

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

the class BackendDataCentersResourceTest method testAddIncompleteParameters.

@Test
public void testAddIncompleteParameters() throws Exception {
    DataCenter model = new DataCenter();
    setUriInfo(setUpBasicUriExpectations());
    try {
        collection.add(model);
        fail("expected WebApplicationException on incomplete parameters");
    } catch (WebApplicationException wae) {
        verifyIncompleteException(wae, "DataCenter", "add", "name");
    }
}
Also used : DataCenter(org.ovirt.engine.api.model.DataCenter) WebApplicationException(javax.ws.rs.WebApplicationException) Test(org.junit.Test)

Example 17 with DataCenter

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

the class BackendDataCentersResourceTest method getModel.

static DataCenter getModel(int index) {
    DataCenter model = new DataCenter();
    model.setName(NAMES[index]);
    model.setDescription(DESCRIPTIONS[index]);
    model.setLocal(false);
    return model;
}
Also used : DataCenter(org.ovirt.engine.api.model.DataCenter)

Example 18 with DataCenter

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

the class QuotaMapper method map.

private static void map(QuotaStorageLimit model, QuotaStorage quotaStorage, String storageDomainId, String dataCenterId, String quotaId) {
    model.setQuota(new Quota());
    model.getQuota().setId(quotaId);
    model.getQuota().setDataCenter(new DataCenter());
    model.getQuota().getDataCenter().setId(dataCenterId);
    if (storageDomainId != null) {
        model.setStorageDomain(new StorageDomain());
        model.getStorageDomain().setId(storageDomainId);
    }
    if (quotaStorage.getStorageSizeGB() != null) {
        model.setLimit(quotaStorage.getStorageSizeGB());
    }
    if (quotaStorage.getStorageSizeGBUsage() != null) {
        model.setUsage(quotaStorage.getStorageSizeGBUsage());
    }
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) DataCenter(org.ovirt.engine.api.model.DataCenter) Quota(org.ovirt.engine.api.model.Quota)

Example 19 with DataCenter

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

the class V3DataCenterInAdapter method adapt.

@Override
public DataCenter adapt(V3DataCenter from) {
    DataCenter to = new DataCenter();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetLocal()) {
        to.setLocal(from.isLocal());
    }
    if (from.isSetMacPool()) {
        to.setMacPool(adaptIn(from.getMacPool()));
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetQuotaMode()) {
        to.setQuotaMode(QuotaModeType.fromValue(from.getQuotaMode()));
    }
    if (from.isSetStatus() && from.getStatus().isSetState()) {
        to.setStatus(DataCenterStatus.fromValue(from.getStatus().getState()));
    }
    if (from.isSetStorageFormat()) {
        to.setStorageFormat(StorageFormat.fromValue(from.getStorageFormat()));
    }
    if (from.isSetSupportedVersions()) {
        to.setSupportedVersions(new Versions());
        to.getSupportedVersions().getVersions().addAll(adaptIn(from.getSupportedVersions().getVersions()));
    }
    if (from.isSetVersion()) {
        to.setVersion(adaptIn(from.getVersion()));
    }
    // attribute "local":
    if (from.isSetStorageType() && !to.isSetLocal()) {
        boolean local = "localfs".equalsIgnoreCase(from.getStorageType());
        to.setLocal(local);
    }
    return to;
}
Also used : DataCenter(org.ovirt.engine.api.model.DataCenter) V3DataCenter(org.ovirt.engine.api.v3.types.V3DataCenter) Versions(org.ovirt.engine.api.model.Versions)

Example 20 with DataCenter

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

the class LinkHelperTest method testClusterLinks.

@Test
public void testClusterLinks() throws Exception {
    Cluster cluster = new Cluster();
    cluster.setId(CLUSTER_ID);
    cluster.setDataCenter(new DataCenter());
    cluster.getDataCenter().setId(DATA_CENTER_ID);
    LinkHelper.addLinks(cluster);
    assertEquals(CLUSTER_HREF, cluster.getHref());
    assertEquals(DATA_CENTER_HREF, cluster.getDataCenter().getHref());
}
Also used : DataCenter(org.ovirt.engine.api.model.DataCenter) Cluster(org.ovirt.engine.api.model.Cluster) Test(org.junit.Test)

Aggregations

DataCenter (org.ovirt.engine.api.model.DataCenter)42 Test (org.junit.Test)10 WebApplicationException (javax.ws.rs.WebApplicationException)6 Network (org.ovirt.engine.api.model.Network)6 StorageDomain (org.ovirt.engine.api.model.StorageDomain)5 Response (javax.ws.rs.core.Response)4 Qos (org.ovirt.engine.api.model.Qos)4 Quota (org.ovirt.engine.api.model.Quota)4 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)4 Guid (org.ovirt.engine.core.compat.Guid)4 Cluster (org.ovirt.engine.api.model.Cluster)3 Permission (org.ovirt.engine.api.model.Permission)3 Role (org.ovirt.engine.api.model.Role)3 AddNetworkStoragePoolParameters (org.ovirt.engine.core.common.action.AddNetworkStoragePoolParameters)3 QosBase (org.ovirt.engine.core.common.businessentities.qos.QosBase)3 QosQueryParameterBase (org.ovirt.engine.core.common.queries.QosQueryParameterBase)3 Cpu (org.ovirt.engine.api.model.Cpu)2 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1