use of org.ovirt.engine.core.vdsbroker.vdsbroker.ServerConnectionStatusReturn in project ovirt-engine by oVirt.
the class JsonRpcVdsServer method disconnectStorageServer.
@Override
public ServerConnectionStatusReturn disconnectStorageServer(int serverType, String spUUID, Map<String, String>[] args) {
JsonRpcRequest request = new RequestBuilder("StoragePool.disconnectStorageServer").withParameter("storagepoolID", spUUID).withParameter("domainType", serverType).withParameter("connectionParams", args).build();
Map<String, Object> response = new FutureMap(this.client, request).withResponseKey("statuslist").withResponseType(Object[].class);
return new ServerConnectionStatusReturn(response);
}
use of org.ovirt.engine.core.vdsbroker.vdsbroker.ServerConnectionStatusReturn in project ovirt-engine by oVirt.
the class JsonRpcVdsServer method connectStorageServer.
@Override
public ServerConnectionStatusReturn connectStorageServer(int serverType, String spUUID, Map<String, String>[] args) {
JsonRpcRequest request = new RequestBuilder("StoragePool.connectStorageServer").withParameter("storagepoolID", spUUID).withParameter("domainType", serverType).withParameter("connectionParams", args).build();
Map<String, Object> response = new FutureMap(this.client, request).withResponseKey("statuslist").withResponseType(Object[].class);
return new ServerConnectionStatusReturn(response);
}
use of org.ovirt.engine.core.vdsbroker.vdsbroker.ServerConnectionStatusReturn in project ovirt-engine by oVirt.
the class MarshallingTestCase method testAddDomain.
@SuppressWarnings("unchecked")
@Test
public void testAddDomain() throws Exception {
// Given
String json = "{\"jsonrpc\": \"2.0\", \"id\": \"4b0838b3-f940-4780-b2f0-fd56c1fbc573\", \"result\": [{\"status\": 0, \"id\": \"00000000-0000-0000-0000-000000000000\"}]}";
ObjectMapper mapper = new ObjectMapper();
JsonRpcResponse response = JsonRpcResponse.fromJsonNode(mapper.readTree(json));
Future<JsonRpcResponse> future = mock(Future.class);
when(future.get()).thenReturn(response);
JsonRpcClient client = mock(JsonRpcClient.class);
JsonRpcRequest request = mock(JsonRpcRequest.class);
when(client.call(request)).thenReturn(future);
// When
Map<String, Object> map = new FutureMap(client, request).withResponseKey("statuslist").withResponseType(Object[].class);
// Then
ServerConnectionStatusReturn status = new ServerConnectionStatusReturn(map);
assertEquals("Done", status.getStatus().message);
assertEquals(0, status.getStatus().code);
assertEquals(1, status.statusList.length);
Map<String, Object> result = status.statusList[0];
assertEquals(0, result.get("status"));
assertEquals("00000000-0000-0000-0000-000000000000", result.get("id"));
}
Aggregations