diff options
Diffstat (limited to 'lttng/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfTraceStub.java')
-rw-r--r-- | lttng/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfTraceStub.java | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfTraceStub.java b/lttng/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfTraceStub.java index 8eadfd7266..a2edc417d7 100644 --- a/lttng/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfTraceStub.java +++ b/lttng/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/trace/TmfTraceStub.java @@ -16,6 +16,7 @@ package org.eclipse.linuxtools.tmf.tests.stubs.trace; import java.io.FileNotFoundException; import java.io.IOException; import java.io.RandomAccessFile; +import java.nio.ByteBuffer; import java.util.concurrent.locks.ReentrantLock; import org.eclipse.core.resources.IProject; @@ -27,11 +28,15 @@ import org.eclipse.linuxtools.tmf.core.event.ITmfEvent; import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException; import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp; import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange; +import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp; import org.eclipse.linuxtools.tmf.core.trace.ITmfContext; import org.eclipse.linuxtools.tmf.core.trace.ITmfEventParser; import org.eclipse.linuxtools.tmf.core.trace.TmfContext; import org.eclipse.linuxtools.tmf.core.trace.TmfTrace; +import org.eclipse.linuxtools.tmf.core.trace.indexer.ITmfPersistentlyIndexable; import org.eclipse.linuxtools.tmf.core.trace.indexer.ITmfTraceIndexer; +import org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint.ITmfCheckpoint; +import org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint.TmfCheckpoint; import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation; import org.eclipse.linuxtools.tmf.core.trace.location.TmfLongLocation; @@ -40,7 +45,7 @@ import org.eclipse.linuxtools.tmf.core.trace.location.TmfLongLocation; * <p> * Dummy test trace. Use in conjunction with TmfEventParserStub. */ -public class TmfTraceStub extends TmfTrace implements ITmfEventParser { +public class TmfTraceStub extends TmfTrace implements ITmfEventParser, ITmfPersistentlyIndexable { // ------------------------------------------------------------------------ // Attributes @@ -347,4 +352,23 @@ public class TmfTraceStub extends TmfTrace implements ITmfEventParser { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "File does not exist: " + path); } + private static int fCheckpointSize = -1; + + @Override + public synchronized int getCheckpointSize() { + if (fCheckpointSize == -1) { + TmfCheckpoint c = new TmfCheckpoint(new TmfTimestamp(0L), new TmfLongLocation(0L), 0); + ByteBuffer b = ByteBuffer.allocate(ITmfCheckpoint.MAX_SERIALIZE_SIZE); + b.clear(); + c.serialize(b); + fCheckpointSize = b.position(); + } + + return fCheckpointSize; + } + + @Override + public ITmfLocation restoreLocation(ByteBuffer bufferIn) { + return new TmfLongLocation(bufferIn); + } } |