use of org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.inputoutput.IoTestCase.DiskActivity in project tracecompass by tracecompass.
the class InputOutputDataProviderTest method testDiskActivity.
/**
* Test the data provider
*/
@Test
public void testDiskActivity() {
DisksIODataProvider provider = getProvider();
Collection<@NonNull DiskActivity> diskActivity = fTestCase.getDiskActivity();
for (DiskActivity test : diskActivity) {
Map<@NonNull String, @NonNull Object> parameters = test.getTimeQuery();
TmfModelResponse<@NonNull TmfTreeModel<@NonNull TmfTreeDataModel>> response = provider.fetchTree(parameters, PROGRESS_MONITOR);
assertEquals(ITmfResponse.Status.COMPLETED, response.getStatus());
TmfTreeModel<@NonNull TmfTreeDataModel> model = response.getModel();
assertNotNull(model);
parameters = test.getTimeQueryForModel(model);
TmfModelResponse<@NonNull ITmfXyModel> yResponse = provider.fetchXY(parameters, PROGRESS_MONITOR);
assertEquals(ITmfResponse.Status.COMPLETED, yResponse.getStatus());
ITmfXyModel yModel = yResponse.getModel();
assertNotNull(yModel);
Collection<@NonNull ISeriesModel> data = yModel.getSeriesData();
assertEquals(1, data.size());
ISeriesModel ySeries = data.iterator().next();
double[] expected = test.getActivity();
double[] actual = ySeries.getData();
for (int i = 0; i < expected.length; i++) {
assertTrue(String.format("No actual value at position %d for %s", i, test), actual.length > i);
assertEquals(String.format("Value at position %d for %s", i, test), expected[i], actual[i], 0.001);
}
assertEquals(String.format("More values than expected for %s", test), expected.length, actual.length);
}
}
Aggregations