Source:
public void testDiskView() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { IViewPart viewSite = fViewBotDisk.getViewReference().getView(true); assertTrue(viewSite instanceof DiskIOActivityView); final TmfCommonXLineChartViewer chartViewer = getChartViewer(viewSite); assertNotNull(chartViewer); try { final Chart chart = fChart; assertNotNull(chart); WaitUtils.waitUntil(c -> c.getSeriesSet().getSeries().length > 0, chart, "No data available"); chartViewer.setNbPoints(NUMBER_OF_POINT); fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer)); UIThreadRunnable.syncExec(chartViewer::refresh); String expected = FileUtils.read("resources/disk0-res50.json"); TmfCommonXAxisModel model = extractModelFromChart(chart); String current = fGson.toJson(model); assertEquals(expected, current); TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, new TmfTimeRange(START_TIME, END_TIME))); WaitUtils.waitUntil(c -> c.getSeriesSet().getSeries().length > 0, chart, "No data available"); fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer)); UIThreadRunnable.syncExec(chartViewer::refresh); verifyChartStyle(chart); expected = FileUtils.read("resources/disk1-res50.json"); model = extractModelFromChart(chart); current = fGson.toJson(model); assertEquals(expected, current); fBot.waitUntil(ConditionHelpers.windowRange(new TmfTimeRange(START_TIME, END_TIME))); chartViewer.setNbPoints(MORE_POINTS); fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer)); UIThreadRunnable.syncExec(chartViewer::refresh); verifyChartStyle(chart); expected = FileUtils.read("resources/disk2-res100.json"); model = extractModelFromChart(chart); current = fGson.toJson(model); assertEquals(expected, current); } finally { chartViewer.setNbPoints(0); } }

Target:
public void testDiskView() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { IViewPart viewSite = fViewBotDisk.getViewReference().getView(true); assertTrue(viewSite instanceof DiskIOActivityView); final TmfCommonXLineChartViewer chartViewer = getChartViewer(viewSite); assertNotNull(chartViewer); fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer)); final Chart chart = fChart; assertNotNull(chart); try { WaitUtils.waitUntil(c -> c.getSeriesSet().getSeries().length > 0, chart, "No data available"); chartViewer.setNbPoints(NUMBER_OF_POINT); WaitUtils.waitUntil(json -> isChartDataValid(chart, json), "resources/disk0-res50.json", "Chart data is not valid"); TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, new TmfTimeRange(START_TIME_WHERE_THERE_IS_DISK_ACTIVITY, END_TIME_WHERE_THERE_IS_DISK_ACTIVITY))); fBot.waitUntil(ConditionHelpers.windowRange(new TmfTimeRange(START_TIME_WHERE_THERE_IS_DISK_ACTIVITY, END_TIME_WHERE_THERE_IS_DISK_ACTIVITY))); fBot.waitUntil(ConditionHelpers.xyViewerIsReadyCondition(chartViewer)); verifyChartStyle(chart); WaitUtils.waitUntil(json -> isChartDataValid(chart, json), "resources/disk1-res50.json", "Chart data is not valid"); chartViewer.setNbPoints(MORE_POINTS); verifyChartStyle(chart); WaitUtils.waitUntil(json -> isChartDataValid(chart, json), "resources/disk2-res100.json", "Chart data is not valid"); } finally { } }