Skip to content

Commit 9e5ae20

Browse files
committed
server.tests: Regenerate Java TSP client and XY fix tests
Fix for #236 required a regeneration of the Java TSP client and caused changes in the API that required the XY tests to be fixed. Remove SamplingSerializer and SamplingSerializerTest because it's part of SeriesModelSerializer and SeriesModelSerializerTest respectively. Set flag failOnUnknownProperties when generating Java TSP client which helps with detecting correct class for deserialization especially for oneOf cases, e.g. oneOf AxisDomainCategorical, AxisDomainRange. Set hideGenerationTimestamp flag to true since generation timestamp can be derived from the git history. Signed-off-by: Bernd Hufmann <[email protected]>
1 parent c10714c commit 9e5ae20

File tree

248 files changed

+838
-1825
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

248 files changed

+838
-1825
lines changed

trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core.tests/src/org/eclipse/tracecompass/incubator/trace/server/jersey/rest/core/tests/services/GenericXYDataProviderServiceTest.java

Lines changed: 72 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@
3131
import org.eclipse.tracecompass.incubator.tsp.client.core.model.GenericTimeRange;
3232
import org.eclipse.tracecompass.incubator.tsp.client.core.model.GenericXYQueryParameters;
3333
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;
3635
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;
3837
import org.eclipse.tracecompass.incubator.tsp.client.core.model.TimeRange;
3938
import org.eclipse.tracecompass.incubator.tsp.client.core.model.TreeParameters;
4039
import org.eclipse.tracecompass.incubator.tsp.client.core.model.TreeQueryParameters;
4140
import org.eclipse.tracecompass.incubator.tsp.client.core.model.XYAxisDescription;
41+
import org.eclipse.tracecompass.incubator.tsp.client.core.model.XYAxisDescription.DataTypeEnum;
4242
import org.eclipse.tracecompass.incubator.tsp.client.core.model.XYAxisDescriptionAxisDomain;
4343
import org.eclipse.tracecompass.incubator.tsp.client.core.model.XYModel;
4444
import org.eclipse.tracecompass.incubator.tsp.client.core.model.XYResponse;
@@ -202,85 +202,79 @@ public void testCallStackFunctionDensityDataProvider() throws InterruptedExcepti
202202
.requestedTimerange(new GenericTimeRange().start(TRACE_START_TIME).end(TRACE_END_TIME).nbSamples(5));
203203

204204
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);
211212
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+
}
220215

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));
282238
}
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());
283276
}
277+
284278
/**
285279
* Tests error cases when querying arrows for a time graph data provider
286280
*/

trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core.tests/src/org/eclipse/tracecompass/incubator/trace/server/jersey/rest/core/tests/services/XyDataProviderServiceTest.java

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.eclipse.tracecompass.incubator.tsp.client.core.model.Experiment;
2929
import org.eclipse.tracecompass.incubator.tsp.client.core.model.RequestedParameters;
3030
import org.eclipse.tracecompass.incubator.tsp.client.core.model.RequestedQueryParameters;
31-
import org.eclipse.tracecompass.incubator.tsp.client.core.model.Sampling;
3231
import org.eclipse.tracecompass.incubator.tsp.client.core.model.SeriesModel;
3332
import org.eclipse.tracecompass.incubator.tsp.client.core.model.TimeRange;
3433
import org.eclipse.tracecompass.incubator.tsp.client.core.model.TreeColumnHeader;
@@ -201,31 +200,23 @@ public void testHistogramDataProvider() throws InterruptedException, ApiExceptio
201200

202201
RequestedQueryParameters reqQueryParameters = new RequestedQueryParameters().parameters(reqParams);
203202

204-
/*
205-
* FIXME: Remove try/catch after fixing issue:
206-
* https://github.com/eclipse-tracecompass-incubator/org.eclipse.tracecompass.incubator/issues/236
207-
*/
208-
try {
209-
XYResponse xyModelResponse = sfxyApi.getXY(exp.getUUID(), XY_HISTOGRAM_DATAPROVIDER_ID, reqQueryParameters);
210-
assertNotNull(xyModelResponse);
203+
XYResponse xyModelResponse = sfxyApi.getXY(exp.getUUID(), XY_HISTOGRAM_DATAPROVIDER_ID, reqQueryParameters);
204+
assertNotNull(xyModelResponse);
211205

212-
XYModel xyModel = xyModelResponse.getModel();
213-
List<SeriesModel> xySeries = xyModel.getSeries();
214-
assertFalse(xySeries.isEmpty());
215-
SeriesModel series = xySeries.get(0);
206+
XYModel xyModel = xyModelResponse.getModel();
207+
List<SeriesModel> xySeries = xyModel.getSeries();
208+
assertFalse(xySeries.isEmpty());
209+
SeriesModel series = xySeries.get(0);
216210

217-
Sampling xValues = series.getxValues();
218-
assertFalse(xValues.getTimestampSampling().getSampling().isEmpty());
211+
List<Long> xValues = series.getxValues();
212+
assertFalse(xValues.isEmpty());
219213

220-
for (XYTreeEntry entry : entries) {
221-
if (entry.getParentId() == -1) {
222-
assertTrue(entry.getIsDefault() == null || !entry.getIsDefault());
223-
} else {
224-
assertTrue(entry.getIsDefault() != null && entry.getIsDefault());
225-
}
214+
for (XYTreeEntry entry : entries) {
215+
if (entry.getParentId() == -1) {
216+
assertTrue(entry.getIsDefault() == null || !entry.getIsDefault());
217+
} else {
218+
assertTrue(entry.getIsDefault() != null && entry.getIsDefault());
226219
}
227-
} catch (Exception ex) {
228-
229220
}
230221
}
231222

trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core.tests/src/org/eclipse/tracecompass/incubator/trace/server/jersey/rest/core/tests/webapp/SamplingSerializerTest.java

Lines changed: 0 additions & 139 deletions
This file was deleted.

0 commit comments

Comments
 (0)