|
31 | 31 | import org.eclipse.tracecompass.incubator.tsp.client.core.model.GenericTimeRange; |
32 | 32 | import org.eclipse.tracecompass.incubator.tsp.client.core.model.GenericXYQueryParameters; |
33 | 33 | import org.eclipse.tracecompass.incubator.tsp.client.core.model.GenericXYRequestedParameters; |
34 | | -import org.eclipse.tracecompass.incubator.tsp.client.core.model.RangeSampling; |
35 | | -import org.eclipse.tracecompass.incubator.tsp.client.core.model.Sampling; |
| 34 | +import org.eclipse.tracecompass.incubator.tsp.client.core.model.Range; |
36 | 35 | import org.eclipse.tracecompass.incubator.tsp.client.core.model.SeriesModel; |
37 | | -import org.eclipse.tracecompass.incubator.tsp.client.core.model.StartEndRange; |
| 36 | +import org.eclipse.tracecompass.incubator.tsp.client.core.model.StyleValue; |
38 | 37 | import org.eclipse.tracecompass.incubator.tsp.client.core.model.TimeRange; |
39 | 38 | import org.eclipse.tracecompass.incubator.tsp.client.core.model.TreeParameters; |
40 | 39 | import org.eclipse.tracecompass.incubator.tsp.client.core.model.TreeQueryParameters; |
41 | 40 | import org.eclipse.tracecompass.incubator.tsp.client.core.model.XYAxisDescription; |
| 41 | +import org.eclipse.tracecompass.incubator.tsp.client.core.model.XYAxisDescription.DataTypeEnum; |
42 | 42 | import org.eclipse.tracecompass.incubator.tsp.client.core.model.XYAxisDescriptionAxisDomain; |
43 | 43 | import org.eclipse.tracecompass.incubator.tsp.client.core.model.XYModel; |
44 | 44 | import org.eclipse.tracecompass.incubator.tsp.client.core.model.XYResponse; |
@@ -202,85 +202,79 @@ public void testCallStackFunctionDensityDataProvider() throws InterruptedExcepti |
202 | 202 | .requestedTimerange(new GenericTimeRange().start(TRACE_START_TIME).end(TRACE_END_TIME).nbSamples(5)); |
203 | 203 |
|
204 | 204 | GenericXYQueryParameters xyQueryParams = new GenericXYQueryParameters().parameters(xyParams); |
205 | | - /* |
206 | | - * FIXME: Remove try/catch after fixing issue: |
207 | | - * https://github.com/eclipse-tracecompass-incubator/org.eclipse.tracecompass.incubator/issues/236 |
208 | | - */ |
209 | | - try { |
210 | | - XYResponse xyModelResponse = sfXyApi.getGenericXY(exp.getUUID(), CALL_STACK_FUNCTION_DENSITY_DATAPROVIDER_ID, xyQueryParams); |
| 205 | + XYResponse xyModelResponse = sfXyApi.getGenericXY(exp.getUUID(), CALL_STACK_FUNCTION_DENSITY_DATAPROVIDER_ID, xyQueryParams); |
| 206 | + assertNotNull(xyModelResponse); |
| 207 | + // Make sure the analysis ran enough and we have a fully executed model |
| 208 | + iteration = 0; |
| 209 | + while (xyModelResponse.getStatus().equals(XYResponse.StatusEnum.RUNNING) && iteration < MAX_ITER) { |
| 210 | + Thread.sleep(100); |
| 211 | + xyModelResponse = sfXyApi.getGenericXY(exp.getUUID(), CALL_STACK_FUNCTION_DENSITY_DATAPROVIDER_ID, xyQueryParams); |
211 | 212 | assertNotNull(xyModelResponse); |
212 | | - // Make sure the analysis ran enough and we have a fully executed model |
213 | | - iteration = 0; |
214 | | - while (xyModelResponse.getStatus().equals(XYResponse.StatusEnum.RUNNING) && iteration < MAX_ITER) { |
215 | | - Thread.sleep(100); |
216 | | - xyModelResponse = sfXyApi.getGenericXY(exp.getUUID(), CALL_STACK_FUNCTION_DENSITY_DATAPROVIDER_ID, xyQueryParams); |
217 | | - assertNotNull(xyModelResponse); |
218 | | - iteration++; |
219 | | - } |
| 213 | + iteration++; |
| 214 | + } |
220 | 215 |
|
221 | | - XYModel xyModel = xyModelResponse.getModel(); |
222 | | - List<SeriesModel> xySeries = xyModel.getSeries(); |
223 | | - assertFalse(xySeries.isEmpty()); |
224 | | - assertEquals("Number of series mismatch", 1, xySeries.size()); |
225 | | - SeriesModel seriesStub = xySeries.iterator().next(); |
226 | | - |
227 | | - // Validate fields |
228 | | - assertEquals("Name mismatch", "UNKNOWN_PID", seriesStub.getSeriesName()); |
229 | | - |
230 | | - // Validate xValues |
231 | | - Sampling xValues = seriesStub.getxValues(); |
232 | | - assertTrue("xValues should be a RangesStub", xValues.getActualInstance() instanceof RangeSampling); |
233 | | - List<StartEndRange> expectedRanges = Arrays.asList( |
234 | | - new StartEndRange().start(0L).end(1195708549L), |
235 | | - new StartEndRange().start(1195708550L).end(2391417098L), |
236 | | - new StartEndRange().start(2391417099L).end(3587125647L), |
237 | | - new StartEndRange().start(3587125648L).end(4782834196L), |
238 | | - new StartEndRange().start(4782834197L).end(5978542746L)); |
239 | | - List<StartEndRange> actualRanges = ((RangeSampling) xValues.getActualInstance()).getSampling(); |
240 | | - assertEquals("Range size mismatch", expectedRanges.size(), actualRanges.size()); |
241 | | - assertEquals("Range size mismatch", expectedRanges.size(), actualRanges.size()); |
242 | | - for (int i = 0; i < expectedRanges.size(); i++) { |
243 | | - assertEquals("Range mismatch at index " + i, expectedRanges.get(i), actualRanges.get(i)); |
244 | | - } |
245 | | - |
246 | | - // Validate yValues |
247 | | - List<Double> actualYValues = seriesStub.getyValues(); |
248 | | - List<Double> expectedYValues = Arrays.asList(1943.0, 1.0, 2.0, 1.0, 1.0); |
249 | | - assertEquals("Y values size mismatch", expectedYValues.size(), actualYValues.size()); |
250 | | - assertEquals("Y values size mismatch", expectedYValues.size(), actualYValues.size()); |
251 | | - for (int i = 0; i < expectedYValues.size(); i++) { |
252 | | - assertEquals("Y value mismatch at index " + i, expectedYValues.get(i), actualYValues.get(i), 0.000001); |
253 | | - } |
254 | | - |
255 | | - // Validate axis descriptions (fully) |
256 | | - XYAxisDescription xAxis = seriesStub.getxValuesDescription(); |
257 | | - XYAxisDescription yAxis = seriesStub.getyValuesDescription(); |
258 | | - |
259 | | - assertNotNull("X axis description should not be null", xAxis); |
260 | | - assertNotNull("Y axis description should not be null", yAxis); |
261 | | - |
262 | | - // X axis |
263 | | - assertEquals("X axis label mismatch", "Execution Time", xAxis.getLabel()); |
264 | | - assertEquals("X axis unit mismatch", "ns", xAxis.getUnit()); |
265 | | - assertEquals("X axis data type mismatch", "DURATION", xAxis.getDataType()); |
266 | | - XYAxisDescriptionAxisDomain xDomain = xAxis.getAxisDomain(); |
267 | | - assertNotNull("X axis domain should not be null", xDomain); |
268 | | - assertTrue("X axis domain should be TimeRange", xDomain.getActualInstance() instanceof AxisDomainRange); |
269 | | - |
270 | | - // Y axis |
271 | | - assertEquals("Y axis label mismatch", "Number of Executions", yAxis.getLabel()); |
272 | | - assertEquals("Y axis unit mismatch", "", yAxis.getUnit()); |
273 | | - assertEquals("Y axis data type mismatch", "NUMBER", yAxis.getDataType()); |
274 | | - XYAxisDescriptionAxisDomain yDomain = yAxis.getAxisDomain(); |
275 | | - assertNull("Y axis domain should be null", yDomain); |
276 | | - |
277 | | - // Validate style |
278 | | - assertNotNull("Style should not be null", seriesStub.getStyle()); |
279 | | - assertEquals("Series type should be bar", "bar", |
280 | | - seriesStub.getStyle().getValues().get(StyleProperties.SERIES_TYPE)); |
281 | | - } catch (Exception ex) { |
| 216 | + XYModel xyModel = xyModelResponse.getModel(); |
| 217 | + List<SeriesModel> xySeries = xyModel.getSeries(); |
| 218 | + assertFalse(xySeries.isEmpty()); |
| 219 | + assertEquals("Number of series mismatch", 1, xySeries.size()); |
| 220 | + SeriesModel seriesStub = xySeries.iterator().next(); |
| 221 | + |
| 222 | + // Validate fields |
| 223 | + assertEquals("Name mismatch", "UNKNOWN_PID", seriesStub.getSeriesName()); |
| 224 | + |
| 225 | + // Validate xValues |
| 226 | + List<Range> actualRanges = seriesStub.getxRanges(); |
| 227 | + assertFalse("xValues should be not empty", actualRanges.isEmpty()); |
| 228 | + List<Range> expectedRanges = Arrays.asList( |
| 229 | + new Range().start(0L).end(1195708549L), |
| 230 | + new Range().start(1195708550L).end(2391417098L), |
| 231 | + new Range().start(2391417099L).end(3587125647L), |
| 232 | + new Range().start(3587125648L).end(4782834196L), |
| 233 | + new Range().start(4782834197L).end(5978542746L)); |
| 234 | + assertEquals("Range size mismatch", expectedRanges.size(), actualRanges.size()); |
| 235 | + assertEquals("Range size mismatch", expectedRanges.size(), actualRanges.size()); |
| 236 | + for (int i = 0; i < expectedRanges.size(); i++) { |
| 237 | + assertEquals("Range mismatch at index " + i, expectedRanges.get(i), actualRanges.get(i)); |
282 | 238 | } |
| 239 | + |
| 240 | + // Validate yValues |
| 241 | + List<Double> actualYValues = seriesStub.getyValues(); |
| 242 | + List<Double> expectedYValues = Arrays.asList(1943.0, 1.0, 2.0, 1.0, 1.0); |
| 243 | + assertEquals("Y values size mismatch", expectedYValues.size(), actualYValues.size()); |
| 244 | + assertEquals("Y values size mismatch", expectedYValues.size(), actualYValues.size()); |
| 245 | + for (int i = 0; i < expectedYValues.size(); i++) { |
| 246 | + assertEquals("Y value mismatch at index " + i, expectedYValues.get(i), actualYValues.get(i), 0.000001); |
| 247 | + } |
| 248 | + |
| 249 | + // Validate axis descriptions (fully) |
| 250 | + XYAxisDescription xAxis = seriesStub.getxValuesDescription(); |
| 251 | + XYAxisDescription yAxis = seriesStub.getyValuesDescription(); |
| 252 | + |
| 253 | + assertNotNull("X axis description should not be null", xAxis); |
| 254 | + assertNotNull("Y axis description should not be null", yAxis); |
| 255 | + |
| 256 | + // X axis |
| 257 | + assertEquals("X axis label mismatch", "Execution Time", xAxis.getLabel()); |
| 258 | + assertEquals("X axis unit mismatch", "ns", xAxis.getUnit()); |
| 259 | + assertEquals("X axis data type mismatch", DataTypeEnum.DURATION, xAxis.getDataType()); |
| 260 | + XYAxisDescriptionAxisDomain xDomain = xAxis.getAxisDomain(); |
| 261 | + assertNotNull("X axis domain should not be null", xDomain); |
| 262 | + assertTrue("X axis domain should be TimeRange", xDomain.getActualInstance() instanceof AxisDomainRange); |
| 263 | + |
| 264 | + // Y axis |
| 265 | + assertEquals("Y axis label mismatch", "Number of Executions", yAxis.getLabel()); |
| 266 | + assertEquals("Y axis unit mismatch", "", yAxis.getUnit()); |
| 267 | + assertEquals("Y axis data type mismatch", DataTypeEnum.NUMBER, yAxis.getDataType()); |
| 268 | + XYAxisDescriptionAxisDomain yDomain = yAxis.getAxisDomain(); |
| 269 | + assertNull("Y axis domain should be null", yDomain); |
| 270 | + |
| 271 | + // Validate style |
| 272 | + assertNotNull("Style should not be null", seriesStub.getStyle()); |
| 273 | + StyleValue styleValue = seriesStub.getStyle().getValues().get(StyleProperties.SERIES_TYPE); |
| 274 | + assertNotNull(styleValue); |
| 275 | + assertEquals("Series type should be bar", "bar", styleValue.getString()); |
283 | 276 | } |
| 277 | + |
284 | 278 | /** |
285 | 279 | * Tests error cases when querying arrows for a time graph data provider |
286 | 280 | */ |
|
0 commit comments