Search in sources :

Example 36 with DataCenter

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

the class BackendDataCentersResourceTest method doTestBadAddDataCenter.

private void doTestBadAddDataCenter(boolean valid, boolean success, String detail) throws Exception {
    setUriInfo(setUpActionExpectations(ActionType.AddEmptyStoragePool, StoragePoolManagementParameter.class, new String[] {}, new Object[] {}, valid, success));
    DataCenter model = getModel(0);
    try {
        collection.add(model);
        fail("expected WebApplicationException");
    } catch (WebApplicationException wae) {
        verifyFault(wae, detail);
    }
}
Also used : DataCenter(org.ovirt.engine.api.model.DataCenter) WebApplicationException(javax.ws.rs.WebApplicationException) StoragePoolManagementParameter(org.ovirt.engine.core.common.action.StoragePoolManagementParameter)

Example 37 with DataCenter

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

the class BackendDataCentersResourceTest method testAddDataCenter.

@Test
public void testAddDataCenter() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpVersionExpectations(0);
    setUpCreationExpectations(ActionType.AddEmptyStoragePool, StoragePoolManagementParameter.class, new String[] {}, new Object[] {}, true, true, GUIDS[0], QueryType.GetStoragePoolById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, getEntity(0));
    DataCenter model = getModel(0);
    Response response = collection.add(model);
    assertEquals(201, response.getStatus());
    assertTrue(response.getEntity() instanceof DataCenter);
    verifyModel((DataCenter) response.getEntity(), 0);
}
Also used : Response(javax.ws.rs.core.Response) DataCenter(org.ovirt.engine.api.model.DataCenter) Test(org.junit.Test)

Example 38 with DataCenter

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

the class BackendGroupAssignedPermissionsResourceTest method getModel.

@Override
protected Permission getModel() {
    Permission model = new Permission();
    model.setDataCenter(new DataCenter());
    model.getDataCenter().setId(GUIDS[2].toString());
    model.setRole(new Role());
    model.getRole().setId(GUIDS[3].toString());
    return model;
}
Also used : Role(org.ovirt.engine.api.model.Role) DataCenter(org.ovirt.engine.api.model.DataCenter) Permission(org.ovirt.engine.api.model.Permission)

Example 39 with DataCenter

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

the class BackendUserAssignedPermissionsResourceTest method getModel.

@Override
protected Permission getModel() {
    Permission model = new Permission();
    model.setDataCenter(new DataCenter());
    model.getDataCenter().setId(GUIDS[2].toString());
    model.setRole(new Role());
    model.getRole().setId(GUIDS[3].toString());
    return model;
}
Also used : Role(org.ovirt.engine.api.model.Role) DataCenter(org.ovirt.engine.api.model.DataCenter) Permission(org.ovirt.engine.api.model.Permission)

Example 40 with DataCenter

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

the class IscsiBondMapper method map.

@Mapping(from = org.ovirt.engine.core.common.businessentities.IscsiBond.class, to = IscsiBond.class)
public static IscsiBond map(org.ovirt.engine.core.common.businessentities.IscsiBond from, IscsiBond to) {
    IscsiBond iscsiBond = (to != null) ? to : new IscsiBond();
    DataCenter dataCenter = new DataCenter();
    dataCenter.setId(from.getStoragePoolId().toString());
    iscsiBond.setDataCenter(dataCenter);
    iscsiBond.setName(from.getName());
    iscsiBond.setDescription(from.getDescription());
    if (from.getId() != null) {
        iscsiBond.setId(from.getId().toString());
    }
    Networks networks = new Networks();
    for (Guid id : from.getNetworkIds()) {
        Network network = new Network();
        network.setId(id.toString());
        networks.getNetworks().add(network);
    }
    iscsiBond.setNetworks(networks);
    StorageConnections connections = new StorageConnections();
    for (String id : from.getStorageConnectionIds()) {
        StorageConnection conn = new StorageConnection();
        conn.setId(id);
        connections.getStorageConnections().add(conn);
    }
    iscsiBond.setStorageConnections(connections);
    return iscsiBond;
}
Also used : Networks(org.ovirt.engine.api.model.Networks) DataCenter(org.ovirt.engine.api.model.DataCenter) Network(org.ovirt.engine.api.model.Network) IscsiBond(org.ovirt.engine.api.model.IscsiBond) Guid(org.ovirt.engine.core.compat.Guid) StorageConnection(org.ovirt.engine.api.model.StorageConnection) StorageConnections(org.ovirt.engine.api.model.StorageConnections)

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