From: Alexandre Montplaisir Date: Tue, 30 Jul 2013 19:07:47 +0000 (-0400) Subject: tmf: Clean up constructors in TmfTraceStub X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=ff0960ac037b0ea461ac7827d9a9a483ecc9d05a;p=deliverable%2Ftracecompass.git tmf: Clean up constructors in TmfTraceStub It also fixes some of those constructors not behaving as expected, like having unused parameters and such. Change-Id: I1aec63d90427ea43fd4e9edb3f9eb499e79488e2 Signed-off-by: Alexandre Montplaisir Reviewed-on: https://git.eclipse.org/r/14995 Tested-by: Hudson CI --- diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/event/TmfEventTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/event/TmfEventTest.java index 5a22bc6b36..2f83a2f727 100644 --- a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/event/TmfEventTest.java +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/event/TmfEventTest.java @@ -96,7 +96,7 @@ public class TmfEventTest { try { final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null); final File test = new File(FileLocator.toFileURL(location).toURI()); - trace = new TmfTraceStub(test.toURI().getPath(), 500, false); + trace = new TmfTraceStub(test.toURI().getPath(), 500, false, null, null); } catch (final TmfTraceException e) { e.printStackTrace(); } catch (final URISyntaxException e) { diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/TmfCoalescedEventRequestTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/TmfCoalescedEventRequestTest.java index 88e291f832..8071171089 100644 --- a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/TmfCoalescedEventRequestTest.java +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/TmfCoalescedEventRequestTest.java @@ -403,7 +403,7 @@ public class TmfCoalescedEventRequestTest { try { URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null); File test = new File(FileLocator.toFileURL(location).toURI()); - fTrace = new TmfTraceStub(test.getPath(), 500); + fTrace = new TmfTraceStub(test.getPath(), 500, false, null, null); } catch (TmfTraceException e) { e.printStackTrace(); } catch (URISyntaxException e) { diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfExperimentTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfExperimentTest.java index 23e7327c8b..7f26716ff3 100644 --- a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfExperimentTest.java +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfExperimentTest.java @@ -84,7 +84,7 @@ public class TmfExperimentTest { try { final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null); final File test = new File(FileLocator.toFileURL(location).toURI()); - final TmfTraceStub trace = new TmfTraceStub(test.getPath(), 0, true); + final TmfTraceStub trace = new TmfTraceStub(test.getPath(), 0, true, null, null); fTestTraces[0] = trace; } catch (final TmfTraceException e) { e.printStackTrace(); diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfMultiTraceExperimentTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfMultiTraceExperimentTest.java index e497747249..356fadb598 100644 --- a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfMultiTraceExperimentTest.java +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfMultiTraceExperimentTest.java @@ -93,12 +93,12 @@ public class TmfMultiTraceExperimentTest { URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path1), null); File test = new File(FileLocator.toFileURL(location).toURI()); - final TmfTraceStub trace1 = new TmfTraceStub(test.getPath(), 0, true); + final TmfTraceStub trace1 = new TmfTraceStub(test.getPath(), 0, true, null, null); traces[0] = trace1; location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path2), null); test = new File(FileLocator.toFileURL(location).toURI()); - final TmfTraceStub trace2 = new TmfTraceStub(test.getPath(), 0, true); + final TmfTraceStub trace2 = new TmfTraceStub(test.getPath(), 0, true, null, null); traces[1] = trace2; return traces; diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfTraceTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfTraceTest.java index 6547f0f637..a0ea8694d5 100644 --- a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfTraceTest.java +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfTraceTest.java @@ -95,7 +95,7 @@ public class TmfTraceTest { try { final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null); final File test = new File(FileLocator.toFileURL(location).toURI()); - fTrace = new TmfTraceStub(test.toURI().getPath()); + fTrace = new TmfTraceStub(test.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null, null); fTrace.indexTrace(true); } catch (final TmfTraceException e) { e.printStackTrace(); @@ -120,7 +120,7 @@ public class TmfTraceTest { try { final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null); testfile = new File(FileLocator.toFileURL(location).toURI()); - trace = new TmfTraceStub(testfile.toURI().getPath()); + trace = new TmfTraceStub(testfile.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null, null); trace.indexTrace(true); } catch (final URISyntaxException e) { fail("URISyntaxException"); @@ -151,7 +151,7 @@ public class TmfTraceTest { try { final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null); testfile = new File(FileLocator.toFileURL(location).toURI()); - trace = new TmfTraceStub(testfile.toURI().getPath(), 0); + trace = new TmfTraceStub(testfile.toURI().getPath(), 0, false, null, null); trace.indexTrace(true); } catch (final URISyntaxException e) { fail("URISyntaxException"); @@ -176,7 +176,7 @@ public class TmfTraceTest { try { final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null); testfile = new File(FileLocator.toFileURL(location).toURI()); - trace = new TmfTraceStub(testfile.toURI().getPath()); + trace = new TmfTraceStub(testfile.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null, null); trace.indexTrace(true); } catch (final URISyntaxException e) { fail("URISyntaxException"); @@ -205,7 +205,7 @@ public class TmfTraceTest { try { final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null); testfile = new File(FileLocator.toFileURL(location).toURI()); - trace = new TmfTraceStub(testfile.toURI().getPath(), BLOCK_SIZE, null); + trace = new TmfTraceStub(testfile.toURI().getPath(), BLOCK_SIZE, false, null, null); trace.indexTrace(true); } catch (final URISyntaxException e) { fail("URISyntaxException"); @@ -267,7 +267,7 @@ public class TmfTraceTest { try { final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null); testfile = new File(FileLocator.toFileURL(location).toURI()); - original = new TmfTraceStub(testfile.toURI().getPath(), BLOCK_SIZE, new TmfCheckpointIndexer(null)); + original = new TmfTraceStub(testfile.toURI().getPath(), BLOCK_SIZE, false, new TmfCheckpointIndexer(null), null); trace = new TmfTraceStub(original); trace.indexTrace(true); } catch (final URISyntaxException e) { @@ -1451,7 +1451,7 @@ public class TmfTraceTest { try { final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null); testfile = new File(FileLocator.toFileURL(location).toURI()); - trace = new TmfTraceStub(testfile.toURI().getPath()); + trace = new TmfTraceStub(testfile.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null, null); // verify initial values TmfTimestamp defaultInitRange = new TmfTimestamp(DEFAULT_INITIAL_OFFSET_VALUE, ITmfTimestamp.NANOSECOND_SCALE); assertEquals("getInitialRangeOffset", defaultInitRange, trace.getInitialRangeOffset()); diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfCheckpointIndexTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfCheckpointIndexTest.java index 1cd80db103..9ff4898231 100644 --- a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfCheckpointIndexTest.java +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfCheckpointIndexTest.java @@ -93,7 +93,7 @@ public class TmfCheckpointIndexTest { private class TestTrace extends TmfTraceStub { public TestTrace(String path, int blockSize) throws TmfTraceException { - super(path, blockSize); + super(path, blockSize, false, null, null); setIndexer(new TestIndexer(this)); } @Override diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfCheckpointIndexTest2.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfCheckpointIndexTest2.java index 4d1460339e..2e5c2f6463 100644 --- a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfCheckpointIndexTest2.java +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfCheckpointIndexTest2.java @@ -95,7 +95,7 @@ public class TmfCheckpointIndexTest2 { private class TestTrace extends TmfTraceStub { public TestTrace(String path, int blockSize) throws TmfTraceException { - super(path, blockSize); + super(path, blockSize, false, null, null); setIndexer(new TestIndexer(this)); } @Override diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfExperimentCheckpointIndexTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfExperimentCheckpointIndexTest.java index 3352aea5b9..e02aa7e8ba 100644 --- a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfExperimentCheckpointIndexTest.java +++ b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/indexer/checkpoint/TmfExperimentCheckpointIndexTest.java @@ -89,11 +89,11 @@ public class TmfExperimentCheckpointIndexTest { try { URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path1), null); File test = new File(FileLocator.toFileURL(location).toURI()); - final TmfTraceStub trace1 = new TmfTraceStub(test.getPath(), 0, true); + final TmfTraceStub trace1 = new TmfTraceStub(test.getPath(), 0, true, null, null); fTestTraces[0] = trace1; location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path2), null); test = new File(FileLocator.toFileURL(location).toURI()); - final TmfTraceStub trace2 = new TmfTraceStub(test.getPath(), 0, true); + final TmfTraceStub trace2 = new TmfTraceStub(test.getPath(), 0, true, null, null); fTestTraces[1] = trace2; } catch (final TmfTraceException e) { e.printStackTrace(); @@ -143,11 +143,11 @@ public class TmfExperimentCheckpointIndexTest { try { URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM1), null); File test = new File(FileLocator.toFileURL(location).toURI()); - final TmfTraceStub trace1 = new TmfTraceStub(test.getPath(), 0, false); + final TmfTraceStub trace1 = new TmfTraceStub(test.getPath(), 0, false, null, null); testTraces[0] = trace1; location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM2), null); test = new File(FileLocator.toFileURL(location).toURI()); - final TmfTraceStub trace2 = new TmfTraceStub(test.getPath(), 0, false); + final TmfTraceStub trace2 = new TmfTraceStub(test.getPath(), 0, false, null, null); testTraces[1] = trace2; } catch (final TmfTraceException e) { e.printStackTrace(); diff --git a/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/component/TmfDataProviderStub.java b/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/component/TmfDataProviderStub.java index db9304c146..bb264f5e2e 100644 --- a/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/component/TmfDataProviderStub.java +++ b/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/component/TmfDataProviderStub.java @@ -46,7 +46,7 @@ public class TmfDataProviderStub extends TmfDataProvider { final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null); try { final File test = new File(FileLocator.toFileURL(location).toURI()); - fTrace = new TmfTraceStub(test.getPath(), 0, true); + fTrace = new TmfTraceStub(test.getPath(), 0, true, null, null); } catch (final TmfTraceException e) { e.printStackTrace(); } catch (final URISyntaxException e) { diff --git a/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/component/TmfEventProviderStub.java b/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/component/TmfEventProviderStub.java index bbcee8a8a9..2728caf1bb 100644 --- a/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/component/TmfEventProviderStub.java +++ b/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/component/TmfEventProviderStub.java @@ -46,7 +46,7 @@ public class TmfEventProviderStub extends TmfEventProvider { final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null); try { final File test = new File(FileLocator.toFileURL(location).toURI()); - fTrace = new TmfTraceStub(test.getPath(), 0, true); + fTrace = new TmfTraceStub(test.getPath(), 0, true, null, null); } catch (final TmfTraceException e) { e.printStackTrace(); } catch (final URISyntaxException e) { diff --git a/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfTraceStub.java b/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfTraceStub.java index 8b7b430fca..8eadfd7266 100644 --- a/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfTraceStub.java +++ b/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfTraceStub.java @@ -29,7 +29,6 @@ import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp; import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange; import org.eclipse.linuxtools.tmf.core.trace.ITmfContext; import org.eclipse.linuxtools.tmf.core.trace.ITmfEventParser; -import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace; import org.eclipse.linuxtools.tmf.core.trace.TmfContext; import org.eclipse.linuxtools.tmf.core.trace.TmfTrace; import org.eclipse.linuxtools.tmf.core.trace.indexer.ITmfTraceIndexer; @@ -41,7 +40,6 @@ import org.eclipse.linuxtools.tmf.core.trace.location.TmfLongLocation; *

* Dummy test trace. Use in conjunction with TmfEventParserStub. */ -@SuppressWarnings("javadoc") public class TmfTraceStub extends TmfTrace implements ITmfEventParser { // ------------------------------------------------------------------------ @@ -63,126 +61,92 @@ public class TmfTraceStub extends TmfTrace implements ITmfEventParser { // Constructors // ------------------------------------------------------------------------ + /** + * Default constructor + */ public TmfTraceStub() { super(); setParser(new TmfEventParserStub(this)); } /** + * Constructor with which you can specify a custom streaming interval. The + * parser and indexer won't be specified. + * * @param path - * @throws FileNotFoundException - */ - public TmfTraceStub(final String path) throws TmfTraceException { - this(path, ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false); - } - - /** - * @param path + * The path to the trace file * @param cacheSize - * @throws FileNotFoundException + * The cache size + * @param interval + * The trace streaming interval + * @throws TmfTraceException + * If an error occurred opening the trace */ - public TmfTraceStub(final String path, final int cacheSize) throws TmfTraceException { - this(path, cacheSize, false); - } - - /** - * @param path - * @param cacheSize - * @throws FileNotFoundException - */ - public TmfTraceStub(final String path, final int cacheSize, final long interval) throws TmfTraceException { + public TmfTraceStub(final String path, + final int cacheSize, + final long interval) throws TmfTraceException { super(null, ITmfEvent.class, path, cacheSize, interval, null, null); - try { - fTrace = new RandomAccessFile(path, "r"); //$NON-NLS-1$ - } catch (FileNotFoundException e) { - throw new TmfTraceException(e.getMessage()); - } + setupTrace(path); setParser(new TmfEventParserStub(this)); } /** + * Constructor to specify the parser and indexer. The streaming interval + * will be 0. + * * @param path + * The path to the trace file * @param cacheSize - * @throws FileNotFoundException - */ - public TmfTraceStub(final String path, final int cacheSize, final ITmfTraceIndexer indexer) throws TmfTraceException { - this(path, cacheSize, false, null, indexer); - } - - /** - * @param path - * @param waitForCompletion - * @throws FileNotFoundException - */ - public TmfTraceStub(final String path, final boolean waitForCompletion) throws TmfTraceException { - this(path, ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, waitForCompletion); - } - - /** - * @param path - * @param cacheSize + * The cache size * @param waitForCompletion - * @throws FileNotFoundException + * Do we block the caller until the trace is indexed, or not. + * @param indexer + * The trace indexer to use + * @param parser + * The trace parser. If left 'null', it will use a + * {@link TmfEventParserStub}. + * @throws TmfTraceException + * If an error occurred opening the trace */ - public TmfTraceStub(final String path, final int cacheSize, final boolean waitForCompletion) throws TmfTraceException { - super(null, ITmfEvent.class, path, cacheSize, 0, null, null); - try { - fTrace = new RandomAccessFile(path, "r"); //$NON-NLS-1$ - } catch (FileNotFoundException e) { - throw new TmfTraceException(e.getMessage()); - } - setParser(new TmfEventParserStub(this)); + public TmfTraceStub(final String path, + final int cacheSize, + final boolean waitForCompletion, + final ITmfTraceIndexer indexer, + final ITmfEventParser parser) throws TmfTraceException { + super(null, ITmfEvent.class, path, cacheSize, 0, indexer, null); + setupTrace(path); + setParser((parser != null) ? parser : new TmfEventParserStub(this)); if (waitForCompletion) { indexTrace(true); } } /** - * @param path - * @param cacheSize - * @param waitForCompletion - * @throws FileNotFoundException + * Copy constructor + * + * @param trace + * The trace to copy + * @throws TmfTraceException + * If an error occurred opening the trace */ - public TmfTraceStub(final IResource resource, final String path, final int cacheSize, final boolean waitForCompletion) throws TmfTraceException { - super(resource, ITmfEvent.class, path, cacheSize, 0, null, null); - try { - fTrace = new RandomAccessFile(path, "r"); //$NON-NLS-1$ - } catch (FileNotFoundException e) { - throw new TmfTraceException(e.getMessage()); - } + public TmfTraceStub(final TmfTraceStub trace) throws TmfTraceException { + super(trace); + setupTrace(getPath()); // fPath will be set by the super-constructor setParser(new TmfEventParserStub(this)); } - /** - * @param path - * @param cacheSize - * @param waitForCompletion - * @param parser - * @throws FileNotFoundException - */ - public TmfTraceStub(final String path, final int cacheSize, final boolean waitForCompletion, - final ITmfEventParser parser, final ITmfTraceIndexer indexer) throws TmfTraceException { - super(null, ITmfEvent.class, path, cacheSize, 0, indexer, null); + + private void setupTrace(String path) throws TmfTraceException { try { fTrace = new RandomAccessFile(path, "r"); //$NON-NLS-1$ } catch (FileNotFoundException e) { throw new TmfTraceException(e.getMessage()); } - setParser((parser != null) ? parser : new TmfEventParserStub(this)); } - /** - * Copy constructor - */ - public TmfTraceStub(final TmfTraceStub trace) throws TmfTraceException { - super(trace); - try { - fTrace = new RandomAccessFile(getPath(), "r"); //$NON-NLS-1$ - } catch (FileNotFoundException e) { - throw new TmfTraceException(e.getMessage()); - } - setParser(new TmfEventParserStub(this)); - } + // ------------------------------------------------------------------------ + // Initializers + // ------------------------------------------------------------------------ @Override public void initTrace(final IResource resource, final String path, final Class type) throws TmfTraceException { @@ -204,10 +168,19 @@ public class TmfTraceStub extends TmfTrace implements ITmfEventParser { // Accessors // ------------------------------------------------------------------------ + /** + * @return The file stream to the trace + */ public RandomAccessFile getStream() { return fTrace; } + /** + * Set the initial range offset. + * + * @param initOffset + * The new initial range offset + */ public void setInitialRangeOffset(ITmfTimestamp initOffset) { fInitialRangeOffset = initOffset; } diff --git a/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDTestFacility.java b/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDTestFacility.java index 5f460642d2..c342ae95e6 100644 --- a/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDTestFacility.java +++ b/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/views/uml2sd/loader/Uml2SDTestFacility.java @@ -134,7 +134,7 @@ public class Uml2SDTestFacility { // Create test trace object final URL location = FileLocator.find(FrameworkUtil.getBundle(this.getClass()), new Path("tracesets/sdEvents"), null); final File test = new File(FileLocator.toFileURL(location).toURI()); - return new TmfTraceStub(test.getPath(), 500, true, parser, null); + return new TmfTraceStub(test.getPath(), 500, true, null, parser); } catch (final TmfTraceException e) { e.printStackTrace(); throw new RuntimeException(e);