Search in sources :

Example 1 with BaseParameters

use of alluxio.stress.BaseParameters in project alluxio by Alluxio.

the class IOTaskSummaryTest method json.

@Test
public void json() throws Exception {
    IOTaskResult result = new IOTaskResult();
    // Reading 200MB took 1s
    result.addPoint(new IOTaskResult.Point(IOTaskResult.IOMode.READ, 1L, 200 * 1024 * 1024));
    // Writing 50MB took 1s
    result.addPoint(new IOTaskResult.Point(IOTaskResult.IOMode.WRITE, 1L, 50 * 1024 * 1024));
    IOTaskSummary summary = new IOTaskSummary(result);
    // params
    BaseParameters baseParams = new BaseParameters();
    baseParams.mCluster = true;
    baseParams.mDistributed = true;
    baseParams.mId = "mock-id";
    baseParams.mStartMs = 0L;
    baseParams.mInProcess = false;
    summary.setBaseParameters(baseParams);
    UfsIOParameters workerParams = new UfsIOParameters();
    workerParams.mPath = "hdfs://path";
    summary.setParameters(workerParams);
    ObjectMapper mapper = new ObjectMapper();
    String json = mapper.writeValueAsString(summary);
    IOTaskSummary other = mapper.readValue(json, IOTaskSummary.class);
    checkEquality(summary, other);
}
Also used : ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) BaseParameters(alluxio.stress.BaseParameters) Test(org.junit.Test)

Aggregations

BaseParameters (alluxio.stress.BaseParameters)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Test (org.junit.Test)1