use of org.ovirt.engine.api.model.StorageConnection in project ovirt-engine by oVirt.
the class BackendStorageDomainServerConnectionsResourceTest method testAttachFailure.
@Test
public void testAttachFailure() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpActionExpectations(ActionType.AttachStorageConnectionToStorageDomain, AttachDetachStorageConnectionParameters.class, new String[] {}, new Object[] {}, false, false);
StorageConnection connection = new StorageConnection();
connection.setId(GUIDS[3].toString());
try {
Response response = collection.add(connection);
} catch (WebApplicationException wae) {
assertNotNull(wae.getResponse());
assertEquals(400, wae.getResponse().getStatus());
}
}
use of org.ovirt.engine.api.model.StorageConnection in project ovirt-engine by oVirt.
the class BackendStorageServerConnectionResourceTest method getModel.
StorageConnection getModel(int index) {
StorageConnection model = new StorageConnection();
model.setType(STORAGE_TYPES[index]);
model.setAddress("1.122.10.125");
Host host = new Host();
host.setId(GUIDS[1].toString());
model.setHost(host);
if (index == 0) {
model.setPath("/data1");
}
if (index == 3) {
model.setPort(3260);
}
return model;
}
use of org.ovirt.engine.api.model.StorageConnection 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);
}
use of org.ovirt.engine.api.model.StorageConnection 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);
}
use of org.ovirt.engine.api.model.StorageConnection in project ovirt-engine by oVirt.
the class BackendIscsiBondStorageConnectionsResourceTest method getDummyStorageConnection.
protected StorageConnection getDummyStorageConnection() {
StorageConnection cnx = new StorageConnection();
cnx.setId(STORAGE_CONNECTION_ID.toString());
return cnx;
}
Aggregations