Search in sources :

Example 1 with StorageStatusReturn

use of org.ovirt.engine.core.vdsbroker.irsbroker.StorageStatusReturn in project ovirt-engine by oVirt.

the class JsonRpcIIrsServer method activateStorageDomain.

@Override
public StorageStatusReturn activateStorageDomain(String sdUUID, String spUUID) {
    JsonRpcRequest request = new RequestBuilder("StorageDomain.activate").withParameter("storagedomainID", sdUUID).withParameter("storagepoolID", spUUID).build();
    Map<String, Object> response = new FutureMap(this.client, request).withResponseKey("storageStatus").withResponseType(String.class);
    return new StorageStatusReturn(response);
}
Also used : StorageStatusReturn(org.ovirt.engine.core.vdsbroker.irsbroker.StorageStatusReturn) JsonRpcRequest(org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest) RequestBuilder(org.ovirt.vdsm.jsonrpc.client.RequestBuilder)

Example 2 with StorageStatusReturn

use of org.ovirt.engine.core.vdsbroker.irsbroker.StorageStatusReturn in project ovirt-engine by oVirt.

the class MarshallingTestCase method testActivateDomain.

@SuppressWarnings("unchecked")
@Test
public void testActivateDomain() throws Exception {
    // Given
    String json = "{\"jsonrpc\": \"2.0\", \"id\": \"5ba8294b-afd7-4810-968d-607703a7bd93\", \"result\": true}";
    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("storageStatus").withResponseType(String.class);
    // Then
    StorageStatusReturn storageStatus = new StorageStatusReturn(map);
    assertEquals("Done", storageStatus.getStatus().message);
    assertEquals(0, storageStatus.getStatus().code);
    assertEquals("true", storageStatus.storageStatus);
}
Also used : JsonRpcResponse(org.ovirt.vdsm.jsonrpc.client.JsonRpcResponse) StorageStatusReturn(org.ovirt.engine.core.vdsbroker.irsbroker.StorageStatusReturn) JsonRpcRequest(org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest) JsonRpcClient(org.ovirt.vdsm.jsonrpc.client.JsonRpcClient) ObjectMapper(org.codehaus.jackson.map.ObjectMapper) Test(org.junit.Test)

Aggregations

StorageStatusReturn (org.ovirt.engine.core.vdsbroker.irsbroker.StorageStatusReturn)2 JsonRpcRequest (org.ovirt.vdsm.jsonrpc.client.JsonRpcRequest)2 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)1 Test (org.junit.Test)1 JsonRpcClient (org.ovirt.vdsm.jsonrpc.client.JsonRpcClient)1 JsonRpcResponse (org.ovirt.vdsm.jsonrpc.client.JsonRpcResponse)1 RequestBuilder (org.ovirt.vdsm.jsonrpc.client.RequestBuilder)1