Search in sources :

Example 11 with StorageServerConnections

use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.

the class BackendStorageDomainServerConnectionResourceTest method getEntity.

@Override
protected StorageServerConnections getEntity(int index) {
    StorageServerConnections entity = new StorageServerConnections();
    entity.setId(GUIDS[index].toString());
    return entity;
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections)

Example 12 with StorageServerConnections

use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.

the class BackendStorageDomainsResourceTest method setUpLuns.

protected List<LUNs> setUpLuns() {
    StorageServerConnections cnx = new StorageServerConnections();
    cnx.setConnection(ADDRESSES[0]);
    cnx.setIqn(TARGET);
    cnx.setPort(Integer.toString(PORT));
    LUNs lun = new LUNs();
    lun.setLUNId(LUN);
    lun.setLunConnections(new ArrayList<>());
    lun.getLunConnections().add(cnx);
    List<LUNs> luns = new ArrayList<>();
    luns.add(lun);
    return luns;
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) ArrayList(java.util.ArrayList) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs)

Example 13 with StorageServerConnections

use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.

the class BackendStorageServerConnectionsResourceTest method testAddFailure.

@Test
public void testAddFailure() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    Host host = new Host();
    host.setId(GUIDS[1].toString());
    StorageServerConnections connection = new StorageServerConnections();
    connection.setConnection("1.1.1.1:/data1");
    connection.setStorageType(STORAGE_TYPES_MAPPED[0]);
    setUpCreationExpectations(ActionType.AddStorageServerConnection, StorageServerConnectionParametersBase.class, new String[] { "StorageServerConnection.Connection", "StorageServerConnection.StorageType", "VdsId" }, new Object[] { connection.getConnection(), STORAGE_TYPES_MAPPED[0], GUIDS[1] }, false, false, GUIDS[0].toString(), QueryType.GetStorageServerConnectionById, StorageServerConnectionQueryParametersBase.class, new String[] { "ServerConnectionId" }, new Object[] { GUIDS[0].toString() }, getEntity(0));
    Response response = null;
    try {
        response = collection.add(getModel(0));
    } catch (WebApplicationException e) {
        assertNotNull(e.getResponse());
        assertEquals(400, e.getResponse().getStatus());
    }
}
Also used : Response(javax.ws.rs.core.Response) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) WebApplicationException(javax.ws.rs.WebApplicationException) Host(org.ovirt.engine.api.model.Host) Test(org.junit.Test)

Example 14 with StorageServerConnections

use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.

the class BackendStorageServerConnectionsResourceTest method testAddLocal.

@Test
public void testAddLocal() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    Host host = new Host();
    host.setId(GUIDS[1].toString());
    StorageServerConnections connection = new StorageServerConnections();
    connection.setConnection("/data1");
    connection.setStorageType(STORAGE_TYPES_MAPPED[1]);
    setUpCreationExpectations(ActionType.AddStorageServerConnection, StorageServerConnectionParametersBase.class, new String[] { "StorageServerConnection.Connection", "StorageServerConnection.StorageType", "VdsId" }, new Object[] { connection.getConnection(), STORAGE_TYPES_MAPPED[1], GUIDS[1] }, true, true, GUIDS[1].toString(), QueryType.GetStorageServerConnectionById, StorageServerConnectionQueryParametersBase.class, new String[] { "ServerConnectionId" }, new Object[] { GUIDS[1].toString() }, getEntity(1));
    Response response = collection.add(getModel(1));
    assertEquals(201, response.getStatus());
    assertTrue(response.getEntity() instanceof StorageConnection);
    verifyModel((StorageConnection) response.getEntity(), 1);
}
Also used : Response(javax.ws.rs.core.Response) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) Host(org.ovirt.engine.api.model.Host) StorageConnection(org.ovirt.engine.api.model.StorageConnection) Test(org.junit.Test)

Example 15 with StorageServerConnections

use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.

the class BackendStorageServerConnectionsResourceTest method testAdd.

@Test
public void testAdd() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    Host host = new Host();
    host.setId(GUIDS[1].toString());
    StorageServerConnections connection = new StorageServerConnections();
    connection.setConnection("1.1.1.1:/data1");
    connection.setStorageType(STORAGE_TYPES_MAPPED[0]);
    setUpCreationExpectations(ActionType.AddStorageServerConnection, StorageServerConnectionParametersBase.class, new String[] { "StorageServerConnection.Connection", "StorageServerConnection.StorageType", "VdsId" }, new Object[] { connection.getConnection(), STORAGE_TYPES_MAPPED[0], GUIDS[1] }, true, true, GUIDS[0].toString(), QueryType.GetStorageServerConnectionById, StorageServerConnectionQueryParametersBase.class, new String[] { "ServerConnectionId" }, new Object[] { GUIDS[0].toString() }, getEntity(0));
    Response response = collection.add(getModel(0));
    assertEquals(201, response.getStatus());
    assertTrue(response.getEntity() instanceof StorageConnection);
    verifyModel((StorageConnection) response.getEntity(), 0);
}
Also used : Response(javax.ws.rs.core.Response) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) Host(org.ovirt.engine.api.model.Host) StorageConnection(org.ovirt.engine.api.model.StorageConnection) Test(org.junit.Test)

Aggregations

StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)181 Test (org.junit.Test)83 ArrayList (java.util.ArrayList)43 Guid (org.ovirt.engine.core.compat.Guid)39 LUNs (org.ovirt.engine.core.common.businessentities.storage.LUNs)33 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)32 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)19 List (java.util.List)18 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)17 VDS (org.ovirt.engine.core.common.businessentities.VDS)16 StorageServerConnectionParametersBase (org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase)15 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)15 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)14 HashSet (java.util.HashSet)13 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)11 ActionType (org.ovirt.engine.core.common.action.ActionType)11 Set (java.util.Set)10 StorageConnection (org.ovirt.engine.api.model.StorageConnection)10 StorageDomainType (org.ovirt.engine.core.common.businessentities.StorageDomainType)10 QueryType (org.ovirt.engine.core.common.queries.QueryType)10