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");
}
}
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;
}
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());
}
}
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;
}
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());
}
Aggregations