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);
}
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);
}
Aggregations