Search in sources :

Example 6 with DataCenter

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

the class BackendNetworksResourceTest method testAddNetwork.

@Test
public void testAddNetwork() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpCreationExpectations(ActionType.AddNetwork, AddNetworkStoragePoolParameters.class, new String[] { "StoragePoolId" }, new Object[] { DATA_CENTER_ID }, true, true, // GUIDS[0],
    null, QueryType.GetAllNetworks, IdQueryParameters.class, new String[] { "Id" }, new Object[] { Guid.Empty }, asList(getEntity(0)));
    Network model = getModel(0);
    model.setDataCenter(new DataCenter());
    model.getDataCenter().setId(DATA_CENTER_ID.toString());
    Response response = collection.add(model);
    assertEquals(201, response.getStatus());
    assertTrue(response.getEntity() instanceof Network);
    verifyModel((Network) response.getEntity(), 0);
}
Also used : Response(javax.ws.rs.core.Response) DataCenter(org.ovirt.engine.api.model.DataCenter) Network(org.ovirt.engine.api.model.Network) Test(org.junit.Test)

Example 7 with DataCenter

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

the class BackendNetworksResourceTest method testAddNetworkWithNamedDataCenter.

@Test
public void testAddNetworkWithNamedDataCenter() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpEntityQueryExpectations(QueryType.GetStoragePoolByDatacenterName, NameQueryParameters.class, new String[] { "Name" }, new Object[] { NAMES[1] }, setUpStoragePool(DATA_CENTER_ID));
    setUpCreationExpectations(ActionType.AddNetwork, AddNetworkStoragePoolParameters.class, new String[] { "StoragePoolId" }, new Object[] { DATA_CENTER_ID }, true, true, // GUIDS[0],
    null, QueryType.GetAllNetworks, IdQueryParameters.class, new String[] { "Id" }, new Object[] { Guid.Empty }, asList(getEntity(0)));
    Network model = getModel(0);
    model.setDataCenter(new DataCenter());
    model.getDataCenter().setName(NAMES[1]);
    Response response = collection.add(model);
    assertEquals(201, response.getStatus());
    assertTrue(response.getEntity() instanceof Network);
    verifyModel((Network) response.getEntity(), 0);
}
Also used : Response(javax.ws.rs.core.Response) DataCenter(org.ovirt.engine.api.model.DataCenter) Network(org.ovirt.engine.api.model.Network) Test(org.junit.Test)

Example 8 with DataCenter

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

the class BackendDataCenterClustersResource method getDataCenter.

@Override
protected StoragePool getDataCenter(org.ovirt.engine.api.model.Cluster cluster) {
    DataCenter dataCenter = new DataCenter();
    dataCenter.setId(dataCenterId.toString());
    cluster.setDataCenter(dataCenter);
    StoragePool pool = getStoragePool(cluster.getDataCenter(), this);
    return pool;
}
Also used : DataCenter(org.ovirt.engine.api.model.DataCenter) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) BackendDataCenterResource.getStoragePool(org.ovirt.engine.api.restapi.resource.BackendDataCenterResource.getStoragePool)

Example 9 with DataCenter

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

the class BackendQuotasResource method addParents.

@Override
protected Quota addParents(Quota quota) {
    quota.setDataCenter(new DataCenter());
    quota.getDataCenter().setId(dataCenterId.toString());
    return quota;
}
Also used : DataCenter(org.ovirt.engine.api.model.DataCenter)

Example 10 with DataCenter

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

the class BackendQossResource method addParents.

@Override
protected Qos addParents(Qos qos) {
    qos.setDataCenter(new DataCenter());
    qos.getDataCenter().setId(dataCenterId.toString());
    return qos;
}
Also used : DataCenter(org.ovirt.engine.api.model.DataCenter)

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