Commit | Line | Data |
---|---|---|
101bcc65 MK |
1 | /******************************************************************************* |
2 | * Copyright (c) 2016 Ericsson | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are made | |
5 | * available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | *******************************************************************************/ | |
9 | package org.eclipse.tracecompass.analysis.timing.ui.swtbot.tests.table; | |
10 | ||
11 | import static org.junit.Assert.assertEquals; | |
12 | import static org.junit.Assert.assertNotNull; | |
13 | import static org.junit.Assert.assertNull; | |
14 | import static org.junit.Assert.assertTrue; | |
15 | ||
16 | import java.io.BufferedReader; | |
17 | import java.io.ByteArrayOutputStream; | |
18 | import java.io.File; | |
19 | import java.io.FileReader; | |
20 | import java.io.IOException; | |
21 | import java.lang.reflect.InvocationTargetException; | |
22 | import java.lang.reflect.Method; | |
23 | import java.util.ArrayList; | |
24 | import java.util.Arrays; | |
25 | import java.util.Collections; | |
26 | import java.util.List; | |
27 | import java.util.Random; | |
28 | import java.util.stream.Collectors; | |
29 | ||
30 | import org.apache.log4j.ConsoleAppender; | |
31 | import org.apache.log4j.Logger; | |
32 | import org.apache.log4j.SimpleLayout; | |
33 | import org.eclipse.jdt.annotation.NonNull; | |
34 | import org.eclipse.jdt.annotation.Nullable; | |
35 | import org.eclipse.jface.viewers.TableViewer; | |
36 | import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; | |
37 | import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; | |
38 | import org.eclipse.swtbot.swt.finder.SWTBot; | |
39 | import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; | |
1ee63dfc | 40 | import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; |
101bcc65 MK |
41 | import org.eclipse.swtbot.swt.finder.results.Result; |
42 | import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; | |
43 | import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; | |
44 | import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable; | |
45 | import org.eclipse.tracecompass.analysis.timing.core.segmentstore.IAnalysisProgressListener; | |
46 | import org.eclipse.tracecompass.analysis.timing.core.segmentstore.ISegmentStoreProvider; | |
47 | import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.table.AbstractSegmentStoreTableView; | |
48 | import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.table.AbstractSegmentStoreTableViewer; | |
49 | import org.eclipse.tracecompass.segmentstore.core.BasicSegment; | |
50 | import org.eclipse.tracecompass.segmentstore.core.ISegment; | |
51 | import org.eclipse.tracecompass.segmentstore.core.ISegmentStore; | |
52 | import org.eclipse.tracecompass.segmentstore.core.SegmentStoreFactory; | |
53 | import org.eclipse.tracecompass.segmentstore.core.SegmentStoreFactory.SegmentStoreType; | |
54 | import org.eclipse.tracecompass.tmf.core.segment.ISegmentAspect; | |
55 | import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; | |
56 | import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager; | |
57 | import org.eclipse.tracecompass.tmf.ui.dialog.TmfFileDialogFactory; | |
58 | import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers; | |
59 | import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils; | |
60 | import org.eclipse.tracecompass.tmf.ui.tests.shared.WaitUtils; | |
61 | import org.eclipse.ui.IViewPart; | |
62 | import org.eclipse.ui.IWorkbench; | |
63 | import org.eclipse.ui.PartInitException; | |
64 | import org.eclipse.ui.PlatformUI; | |
65 | import org.junit.After; | |
66 | import org.junit.Before; | |
67 | import org.junit.BeforeClass; | |
68 | import org.junit.Test; | |
1ee63dfc | 69 | import org.junit.runner.RunWith; |
101bcc65 MK |
70 | |
71 | /** | |
72 | * Tests of the latency table to extend it to custom tables, 4 steps are needed. | |
73 | * <ol> | |
74 | * <li>Override {@link #createSegment(long, long)}</li> | |
75 | * <li>Override {@link #openTable()} to open the desired table view</li> | |
76 | * <li>Override {@link #getSegStoreProvider()} to retrieve the segment store | |
77 | * provider with the desirable aspects</li> | |
78 | * <li>Override {@link #testTsv(String[])} to test the content of the output to | |
79 | * TSV</li> | |
80 | * </ol> | |
81 | * | |
82 | * Feel free to override any test and add additional tests but remember to call | |
83 | * <code>super.test()</code> before. | |
84 | * | |
85 | * @author Matthew Khouzam | |
86 | */ | |
1ee63dfc | 87 | @RunWith(SWTBotJunit4ClassRunner.class) |
101bcc65 MK |
88 | public class SegmentTableTest { |
89 | ||
90 | /** | |
91 | * Test table | |
92 | * | |
93 | * @author Matthew Khouzam | |
94 | */ | |
95 | public static final class TestSegmentStoreTableView extends AbstractSegmentStoreTableView { | |
96 | /** | |
97 | * ID of this view | |
98 | */ | |
99 | public static final String ID = "org.eclipse.tracecompass.analysis.timing.ui.swtbot.tests.table.TestSegmentStoreTableView"; //$NON-NLS-1$ | |
100 | ||
101 | /** | |
102 | * Constructor | |
103 | */ | |
104 | public TestSegmentStoreTableView() { | |
105 | } | |
106 | ||
107 | SegmentTableTest fTest; | |
108 | ||
109 | /** | |
110 | * Set the parent test | |
111 | * | |
112 | * @param test | |
113 | * the test | |
114 | */ | |
115 | public void setTest(SegmentTableTest test) { | |
116 | fTest = test; | |
117 | } | |
118 | ||
119 | @Override | |
120 | protected @NonNull AbstractSegmentStoreTableViewer createSegmentStoreViewer(@NonNull TableViewer tableViewer) { | |
121 | return new AbstractSegmentStoreTableViewer(tableViewer) { | |
122 | ||
123 | @Override | |
124 | protected @Nullable ISegmentStoreProvider getSegmentStoreProvider(@NonNull ITmfTrace trace) { | |
125 | return fTest.getSegStoreProvider(); | |
126 | } | |
127 | }; | |
128 | } | |
129 | } | |
130 | ||
131 | private final class SimpleSegmentStoreProvider implements ISegmentStoreProvider { | |
132 | @Override | |
133 | public void removeListener(@NonNull IAnalysisProgressListener listener) { | |
134 | // do nothing | |
135 | } | |
136 | ||
137 | @Override | |
138 | public @Nullable ISegmentStore<@NonNull ISegment> getSegmentStore() { | |
139 | return fSs; | |
140 | } | |
141 | ||
142 | @Override | |
143 | public @NonNull Iterable<@NonNull ISegmentAspect> getSegmentAspects() { | |
144 | return Collections.emptyList(); | |
145 | } | |
146 | ||
147 | @Override | |
148 | public void addListener(@NonNull IAnalysisProgressListener listener) { | |
149 | // do nothing | |
150 | } | |
151 | } | |
152 | ||
153 | private AbstractSegmentStoreTableView fTableView; | |
154 | private AbstractSegmentStoreTableViewer fTable; | |
155 | private ISegmentStoreProvider fSsp; | |
156 | private final ISegmentStore<@NonNull ISegment> fSs = SegmentStoreFactory.createSegmentStore(SegmentStoreType.Fast); | |
157 | ||
158 | /** The Log4j logger instance. */ | |
159 | private static final Logger fLogger = Logger.getRootLogger(); | |
160 | ||
161 | /** | |
162 | * Before class, call by all subclassed | |
163 | */ | |
164 | @BeforeClass | |
165 | public static void beforeClass() { | |
166 | ||
167 | SWTBotUtils.initialize(); | |
168 | Thread.currentThread().setName("SWTBotTest"); | |
169 | /* set up for swtbot */ | |
170 | SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */ | |
171 | SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; | |
172 | fLogger.removeAllAppenders(); | |
173 | fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT)); | |
174 | SWTWorkbenchBot bot = new SWTWorkbenchBot(); | |
175 | final List<SWTBotView> openViews = bot.views(); | |
176 | for (SWTBotView view : openViews) { | |
177 | if (view.getTitle().equals("Welcome")) { | |
178 | view.close(); | |
179 | bot.waitUntil(ConditionHelpers.ViewIsClosed(view)); | |
180 | } | |
181 | } | |
182 | /* Switch perspectives */ | |
183 | SWTBotUtils.switchToTracingPerspective(); | |
184 | /* Finish waiting for eclipse to load */ | |
185 | WaitUtils.waitForJobs(); | |
186 | } | |
187 | ||
188 | /** | |
189 | * Opens a latency table | |
190 | */ | |
191 | @Before | |
192 | public void init() { | |
193 | setTableView(openTable()); | |
194 | assertNotNull(getTableView()); | |
195 | setTable(getTableView().getSegmentStoreViewer()); | |
196 | assertNotNull(getTable()); | |
197 | ISegmentStoreProvider segStoreProvider = getSegStoreProvider(); | |
198 | assertNotNull(segStoreProvider); | |
199 | UIThreadRunnable.syncExec(() -> getTable().setSegmentProvider(segStoreProvider)); | |
200 | } | |
201 | ||
202 | /** | |
203 | * Close the table | |
204 | */ | |
205 | @After | |
206 | public void finish() { | |
207 | new SWTWorkbenchBot().viewById(getTableView().getSite().getId()).close(); | |
208 | } | |
209 | ||
210 | /** | |
211 | * Create the table viewer to test | |
212 | * | |
213 | * @return the table viewer bot | |
214 | */ | |
215 | protected AbstractSegmentStoreTableView openTable() { | |
216 | AbstractSegmentStoreTableView tableView = getTableView(); | |
217 | if (tableView != null) { | |
218 | return tableView; | |
219 | } | |
220 | IViewPart vp = null; | |
221 | final IWorkbench workbench = PlatformUI.getWorkbench(); | |
222 | vp = UIThreadRunnable.syncExec((Result<IViewPart>) () -> { | |
223 | try { | |
224 | return workbench.getActiveWorkbenchWindow().getActivePage().showView(TestSegmentStoreTableView.ID); | |
225 | } catch (PartInitException e) { | |
226 | return null; | |
227 | } | |
228 | }); | |
229 | assertNotNull(vp); | |
230 | assertTrue(vp instanceof TestSegmentStoreTableView); | |
231 | TestSegmentStoreTableView testSegmentStoreTableView = (TestSegmentStoreTableView) vp; | |
232 | testSegmentStoreTableView.setTest(this); | |
233 | fTableView = testSegmentStoreTableView; | |
234 | ||
235 | return fTableView; | |
236 | } | |
237 | ||
238 | /** | |
239 | * Create a segment of the type supported by the table under test, with the | |
240 | * requested start and end time | |
241 | * | |
242 | * @param start | |
243 | * start time | |
244 | * @param end | |
245 | * end time | |
246 | * @return the segment | |
247 | */ | |
248 | protected @NonNull ISegment createSegment(long start, long end) { | |
249 | return new BasicSegment(start, end); | |
250 | } | |
251 | ||
252 | /** | |
253 | * Test a climbing data structure. | |
254 | * <p> | |
255 | * Create segments that are progressively larger and start later. Test that | |
256 | * the "duration" column sorts well | |
257 | */ | |
258 | @Test | |
259 | public void climbTest() { | |
260 | List<@NonNull ISegment> fixture = new ArrayList<>(); | |
261 | for (int i = 0; i < 100; i++) { | |
262 | fixture.add(createSegment(i, 2 * i)); | |
263 | } | |
264 | ||
265 | assertNotNull(getTable()); | |
266 | getTable().updateModel(fixture); | |
267 | SWTBotTable tableBot = new SWTBotTable(getTable().getTableViewer().getTable()); | |
268 | SWTBot bot = new SWTBot(); | |
269 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2)); | |
270 | tableBot.header("Duration").click(); | |
271 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2)); | |
272 | tableBot.header("Duration").click(); | |
273 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "99", 0, 2)); | |
274 | } | |
275 | ||
276 | /** | |
277 | * Test a decrementing data structure. | |
278 | * <p> | |
279 | * Create segments that are progressively shorter and start sooner, | |
280 | * effectively the inverse sorted {@link #climbTest()} datastructure. Test | |
281 | * that the "duration" column sorts well | |
282 | */ | |
283 | @Test | |
284 | public void decrementingTest() { | |
285 | List<@NonNull ISegment> fixture = new ArrayList<>(); | |
286 | for (int i = 100; i >= 0; i--) { | |
287 | fixture.add(createSegment(i, 2 * i)); | |
288 | } | |
289 | assertNotNull(getTable()); | |
290 | getTable().updateModel(fixture); | |
291 | SWTBotTable tableBot = new SWTBotTable(getTable().getTableViewer().getTable()); | |
292 | SWTBot bot = new SWTBot(); | |
293 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "100", 0, 2)); | |
294 | tableBot.header("Duration").click(); | |
295 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2)); | |
296 | tableBot.header("Duration").click(); | |
297 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "100", 0, 2)); | |
298 | } | |
299 | ||
300 | /** | |
301 | * Test small table | |
302 | * <p> | |
303 | * Test table with 2 segments. Duration sort is tested. | |
304 | */ | |
305 | @Test | |
306 | public void smallTest() { | |
307 | List<@NonNull ISegment> fixture = new ArrayList<>(); | |
308 | for (int i = 1; i >= 0; i--) { | |
309 | fixture.add(createSegment(i, 2 * i)); | |
310 | } | |
311 | assertNotNull(getTable()); | |
312 | getTable().updateModel(fixture); | |
313 | SWTBotTable tableBot = new SWTBotTable(getTable().getTableViewer().getTable()); | |
314 | SWTBot bot = new SWTBot(); | |
315 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "1", 0, 2)); | |
316 | tableBot.header("Duration").click(); | |
317 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2)); | |
318 | tableBot.header("Duration").click(); | |
319 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "1", 0, 2)); | |
320 | } | |
321 | ||
322 | /** | |
323 | * Test large table | |
324 | * <p> | |
325 | * Test table with over 9000 segments. Duration sort is tested. | |
326 | */ | |
327 | @Test | |
328 | public void largeTest() { | |
329 | final int size = 1000000; | |
330 | ISegment[] fixture = new ISegment[size]; | |
331 | for (int i = 0; i < size; i++) { | |
332 | fixture[i] = createSegment(i, 2 * i); | |
333 | } | |
334 | assertNotNull(getTable()); | |
335 | getTable().updateModel(fixture); | |
336 | SWTBotTable tableBot = new SWTBotTable(getTable().getTableViewer().getTable()); | |
337 | SWTBot bot = new SWTBot(); | |
338 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2)); | |
339 | tableBot.header("Duration").click(); | |
340 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2)); | |
341 | tableBot.header("Duration").click(); | |
342 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "999,999", 0, 2)); | |
343 | } | |
344 | ||
345 | /** | |
346 | * Test table with segments that have durations spread into a random (white | |
347 | * noise) distribution | |
348 | * <p> | |
349 | * Test table with a random distribution of segments. Duration sort is | |
350 | * tested. | |
351 | */ | |
352 | @Test | |
353 | public void noiseTest() { | |
354 | Random rnd = new Random(); | |
355 | rnd.setSeed(1234); | |
356 | final int size = 1000000; | |
357 | ISegment[] fixture = new ISegment[size]; | |
358 | for (int i = 0; i < size; i++) { | |
359 | int start = Math.abs(rnd.nextInt(100000000)); | |
360 | int end = start + Math.abs(rnd.nextInt(1000000)); | |
361 | fixture[i] = (createSegment(start, end)); | |
362 | } | |
363 | assertNotNull(getTable()); | |
364 | getTable().updateModel(fixture); | |
365 | SWTBotTable tableBot = new SWTBotTable(getTable().getTableViewer().getTable()); | |
366 | SWTBot bot = new SWTBot(); | |
367 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "894,633", 0, 2)); | |
368 | tableBot.header("Duration").click(); | |
369 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2)); | |
370 | tableBot.header("Duration").click(); | |
371 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "999,999", 0, 2)); | |
372 | } | |
373 | ||
374 | /** | |
375 | * Test table with segments that have durations spread into a gaussian | |
376 | * (normal) distribution | |
377 | * <p> | |
378 | * Test table with a gaussian distribution of segments. Duration sort is | |
379 | * tested. | |
380 | */ | |
381 | @Test | |
382 | public void gaussianNoiseTest() { | |
383 | Random rnd = new Random(); | |
384 | rnd.setSeed(1234); | |
385 | List<@NonNull ISegment> fixture = new ArrayList<>(); | |
386 | for (int i = 1; i <= 1000000; i++) { | |
387 | int start = Math.abs(rnd.nextInt(100000000)); | |
388 | final int delta = Math.abs(rnd.nextInt(1000)); | |
389 | int end = start + delta * delta; | |
390 | fixture.add(createSegment(start, end)); | |
391 | } | |
392 | assertNotNull(getTable()); | |
393 | getTable().updateModel(fixture); | |
394 | SWTBotTable tableBot = new SWTBotTable(getTable().getTableViewer().getTable()); | |
395 | SWTBot bot = new SWTBot(); | |
396 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "400,689", 0, 2)); | |
397 | tableBot.header("Duration").click(); | |
398 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2)); | |
399 | tableBot.header("Duration").click(); | |
400 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "998,001", 0, 2)); | |
401 | } | |
402 | ||
403 | /** | |
404 | * Test creating a tsv | |
405 | * | |
406 | * @throws NoSuchMethodException | |
407 | * Error creating the tsv | |
408 | * @throws IOException | |
409 | * no such file or the file is locked. | |
410 | */ | |
411 | @Test | |
412 | public void testWriteToTsv() throws NoSuchMethodException, IOException { | |
413 | ||
414 | List<@NonNull ISegment> fixture = new ArrayList<>(); | |
415 | for (int i = 1; i <= 20; i++) { | |
416 | int start = i; | |
417 | final int delta = i; | |
418 | int end = start + delta * delta; | |
419 | fixture.add(createSegment(start, end)); | |
420 | } | |
421 | assertNotNull(getTable()); | |
422 | getTable().updateModel(fixture); | |
423 | SWTBotTable tableBot = new SWTBotTable(getTable().getTableViewer().getTable()); | |
424 | SWTBot bot = new SWTBot(); | |
425 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "1", 0, 2)); | |
426 | SWTWorkbenchBot swtWorkbenchBot = new SWTWorkbenchBot(); | |
427 | SWTBotView viewBot = swtWorkbenchBot.viewById(getTableView().getSite().getId()); | |
428 | String[] lines = extractTsv(viewBot); | |
429 | testTsv(lines); | |
430 | List<String> actionResult = Arrays.asList(lines); | |
431 | String absolutePath = TmfTraceManager.getTemporaryDirPath() + File.separator + "syscallLatencyTest.testWriteToTsv.tsv"; | |
432 | TmfFileDialogFactory.setOverrideFiles(absolutePath); | |
433 | SWTBotMenu menuBot = viewBot.viewMenu().menu("Export to TSV"); | |
434 | try { | |
435 | assertTrue(menuBot.isEnabled()); | |
436 | assertTrue(menuBot.isVisible()); | |
437 | menuBot.click(); | |
438 | ||
439 | try (BufferedReader br = new BufferedReader(new FileReader(absolutePath))) { | |
440 | List<String> actual = br.lines().collect(Collectors.toList()); | |
441 | assertEquals("Both reads", actionResult, actual); | |
442 | } | |
443 | } finally { | |
444 | new File(absolutePath).delete(); | |
445 | } | |
446 | ||
447 | } | |
448 | ||
449 | private String[] extractTsv(SWTBotView viewBot) throws NoSuchMethodException, SecurityException { | |
450 | ByteArrayOutputStream os = new ByteArrayOutputStream(); | |
451 | assertNotNull(os); | |
452 | Class<@NonNull AbstractSegmentStoreTableView> clazz = AbstractSegmentStoreTableView.class; | |
453 | Method method = clazz.getDeclaredMethod("exportToTsv", java.io.OutputStream.class); | |
454 | method.setAccessible(true); | |
455 | final Exception[] except = new Exception[1]; | |
456 | UIThreadRunnable.syncExec(() -> { | |
457 | try { | |
458 | method.invoke(getTableView(), os); | |
459 | } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { | |
460 | except[0] = e; | |
461 | } | |
462 | }); | |
463 | assertNull(except[0]); | |
464 | @SuppressWarnings("null") | |
465 | String[] lines = String.valueOf(os).split(System.getProperty("line.separator")); | |
466 | return lines; | |
467 | } | |
468 | ||
469 | /** | |
470 | * Test the TSV generated. For each line, including the header, it should be | |
471 | * asserted that it is equal to the expected line | |
472 | * | |
473 | * @param lines | |
474 | * every entry, starting with the header | |
475 | */ | |
476 | protected void testTsv(String[] lines) { | |
477 | assertNotNull(lines); | |
478 | assertEquals("number of lines", 21, lines.length); | |
479 | assertEquals("header", "Start Time\tEnd Time\tDuration", lines[0]); | |
480 | // not a straight up string compare due to time zones. Kathmandu and | |
481 | // Eucla have 15 minute time zones. | |
482 | assertTrue("line 1", lines[1].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s001\\t\\d\\d:\\d\\d:00.000 000 002\\t1")); | |
483 | assertTrue("line 2", lines[2].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s002\\t\\d\\d:\\d\\d:00.000 000 006\\t4")); | |
484 | assertTrue("line 3", lines[3].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s003\\t\\d\\d:\\d\\d:00.000 000 012\\t9")); | |
485 | assertTrue("line 4", lines[4].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s004\\t\\d\\d:\\d\\d:00.000 000 020\\t16")); | |
486 | assertTrue("line 5", lines[5].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s005\\t\\d\\d:\\d\\d:00.000 000 030\\t25")); | |
487 | assertTrue("line 6", lines[6].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s006\\t\\d\\d:\\d\\d:00.000 000 042\\t36")); | |
488 | assertTrue("line 7", lines[7].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s007\\t\\d\\d:\\d\\d:00.000 000 056\\t49")); | |
489 | assertTrue("line 8", lines[8].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s008\\t\\d\\d:\\d\\d:00.000 000 072\\t64")); | |
490 | assertTrue("line 9", lines[9].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s009\\t\\d\\d:\\d\\d:00.000 000 090\\t81")); | |
491 | assertTrue("line 10", lines[10].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s010\\t\\d\\d:\\d\\d:00.000 000 110\\t100")); | |
492 | assertTrue("line 11", lines[11].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s011\\t\\d\\d:\\d\\d:00.000 000 132\\t121")); | |
493 | assertTrue("line 12", lines[12].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s012\\t\\d\\d:\\d\\d:00.000 000 156\\t144")); | |
494 | assertTrue("line 13", lines[13].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s013\\t\\d\\d:\\d\\d:00.000 000 182\\t169")); | |
495 | assertTrue("line 14", lines[14].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s014\\t\\d\\d:\\d\\d:00.000 000 210\\t196")); | |
496 | assertTrue("line 15", lines[15].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s015\\t\\d\\d:\\d\\d:00.000 000 240\\t225")); | |
497 | assertTrue("line 16", lines[16].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s016\\t\\d\\d:\\d\\d:00.000 000 272\\t256")); | |
498 | assertTrue("line 17", lines[17].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s017\\t\\d\\d:\\d\\d:00.000 000 306\\t289")); | |
499 | assertTrue("line 18", lines[18].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s018\\t\\d\\d:\\d\\d:00.000 000 342\\t324")); | |
500 | assertTrue("line 19", lines[19].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s019\\t\\d\\d:\\d\\d:00.000 000 380\\t361")); | |
501 | assertTrue("line 20", lines[20].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s020\\t\\d\\d:\\d\\d:00.000 000 420\\t400")); | |
502 | } | |
503 | ||
504 | /** | |
505 | * Gets the table view | |
506 | * | |
507 | * @return the table view | |
508 | */ | |
509 | protected AbstractSegmentStoreTableView getTableView() { | |
510 | return fTableView; | |
511 | } | |
512 | ||
513 | /** | |
514 | * Sets the table view | |
515 | * | |
516 | * @param tableView | |
517 | * the table view | |
518 | */ | |
519 | protected void setTableView(AbstractSegmentStoreTableView tableView) { | |
520 | fTableView = tableView; | |
521 | } | |
522 | ||
523 | /** | |
524 | * Gets the table viewer | |
525 | * | |
526 | * @return the table viewer | |
527 | */ | |
528 | protected AbstractSegmentStoreTableViewer getTable() { | |
529 | return fTable; | |
530 | } | |
531 | ||
532 | /** | |
533 | * Set the table viewer | |
534 | * | |
535 | * @param table | |
536 | * the table viewer | |
537 | */ | |
538 | protected void setTable(AbstractSegmentStoreTableViewer table) { | |
539 | fTable = table; | |
540 | } | |
541 | ||
542 | /** | |
543 | * get the segment store provider | |
544 | * | |
545 | * @return the segment store provider | |
546 | */ | |
547 | protected ISegmentStoreProvider getSegStoreProvider() { | |
548 | ISegmentStoreProvider ssp = fSsp; | |
549 | if (ssp == null) { | |
550 | ssp = new SimpleSegmentStoreProvider(); | |
551 | fSsp = ssp; | |
552 | } | |
553 | return ssp; | |
554 | } | |
555 | } |