tmf: Split "CTF adaptor" into separate plugins/feature
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Tue, 8 Apr 2014 21:56:38 +0000 (17:56 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Wed, 16 Apr 2014 22:34:48 +0000 (18:34 -0400)
This allows using TMF without CTF, for more flexibility and
better separation of dependencies.

Change-Id: I5d84ebcf92014601eb293b95085ef1a046e7188e
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/24752
Tested-by: Hudson CI
192 files changed:
org.eclipse.linuxtools.lttng.alltests/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng.alltests/src/org/eclipse/linuxtools/lttng/alltests/RunAllTests.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/event/matchandsync/ExperimentSyncTest.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/event/matchandsync/MatchAndSyncTest.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/GenerateTestValues.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/LttngKernelStateProviderTest.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/PartialStateSystemTest.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/StateSystemFullHistoryTest.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/StateSystemInMemoryTest.java
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/StateSystemTest.java
org.eclipse.linuxtools.lttng2.kernel.core/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng2.kernel.core/plugin.xml
org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/internal/lttng2/kernel/core/stateprovider/LttngKernelStateProvider.java
org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/event/matching/TcpEventMatching.java
org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/event/matching/TcpLttngEventMatching.java
org.eclipse.linuxtools.lttng2.kernel.core/src/org/eclipse/linuxtools/lttng2/kernel/core/trace/LttngKernelTrace.java
org.eclipse.linuxtools.lttng2.kernel.ui.swtbot.tests/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng2.kernel.ui.swtbot.tests/src/org/eclipse/linuxtools/lttng2/kernel/ui/swtbot/tests/ImportAndReadKernelSmokeTest.java
org.eclipse.linuxtools.lttng2.ust.core.tests/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng2.ust.core.tests/src/org/eclipse/linuxtools/lttng2/ust/core/tests/trace/callstack/AbstractProviderTest.java
org.eclipse.linuxtools.lttng2.ust.core.tests/src/org/eclipse/linuxtools/lttng2/ust/core/tests/trace/callstack/LttngUstCallStackProviderFastTest.java
org.eclipse.linuxtools.lttng2.ust.core.tests/src/org/eclipse/linuxtools/lttng2/ust/core/tests/trace/callstack/LttngUstCallStackProviderTest.java
org.eclipse.linuxtools.lttng2.ust.core/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng2.ust.core/plugin.xml
org.eclipse.linuxtools.lttng2.ust.core/src/org/eclipse/linuxtools/internal/lttng2/ust/core/memoryusage/MemoryUsageStateProvider.java
org.eclipse.linuxtools.lttng2.ust.core/src/org/eclipse/linuxtools/internal/lttng2/ust/core/trace/callstack/LttngUstCallStackProvider.java
org.eclipse.linuxtools.lttng2.ust.core/src/org/eclipse/linuxtools/lttng2/ust/core/trace/LttngUstTrace.java
org.eclipse.linuxtools.lttng2.ust.ui/META-INF/MANIFEST.MF
org.eclipse.linuxtools.tmf.analysis.xml.core.tests/META-INF/MANIFEST.MF
org.eclipse.linuxtools.tmf.analysis.xml.core.tests/src/org/eclipse/linuxtools/tmf/analysis/xml/core/tests/stateprovider/StateProviderModuleTest.java
org.eclipse.linuxtools.tmf.analysis.xml.core.tests/src/org/eclipse/linuxtools/tmf/analysis/xml/core/tests/stateprovider/StateProviderTest.java
org.eclipse.linuxtools.tmf.core.tests/META-INF/MANIFEST.MF
org.eclipse.linuxtools.tmf.core.tests/plugin.xml
org.eclipse.linuxtools.tmf.core.tests/shared/org/eclipse/linuxtools/tmf/core/tests/shared/CtfTmfTestTrace.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/AllTmfCoreTests.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/AllTests.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfIteratorTest.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfLocationDataTest.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfLocationTest.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfContextTest.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventFieldTest.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventTest.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventTypeTest.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfLostEventsTest.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfTimestampTest.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfTraceTest.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/EventContextTest.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/FunkyTraceTest.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/headless/Benchmark.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/headless/RequestBenchmark.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/AllTests.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/TmfSchedulerBenchmark.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/TmfSchedulerTest.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statistics/AllTests.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statistics/TmfEventsStatisticsTest.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statistics/TmfLostEventStatisticsTest.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statistics/TmfStateStatisticsTest.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statistics/TmfStatisticsTest.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/AllTests.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfTraceManagerTest.java [deleted file]
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfTraceTest.java
org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/ctf/CtfTmfTraceStub.java [deleted file]
org.eclipse.linuxtools.tmf.core/META-INF/MANIFEST.MF
org.eclipse.linuxtools.tmf.core/plugin.properties
org.eclipse.linuxtools.tmf.core/plugin.xml
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/Messages.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/messages.properties
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfConstants.java [deleted file]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfEnumPair.java [deleted file]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java [deleted file]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIteratorManager.java [deleted file]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java [deleted file]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocationInfo.java [deleted file]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfCallsite.java [deleted file]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfContext.java [deleted file]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java [deleted file]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventFactory.java [deleted file]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java [deleted file]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventType.java [deleted file]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfLostEvent.java [deleted file]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTimestamp.java [deleted file]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTrace.java [deleted file]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/Messages.java [deleted file]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/messages.properties [deleted file]
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/event/matching/TmfEventMatching.java
org.eclipse.linuxtools.tmf.ctf.core.tests/.classpath [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/.gitignore [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/.project [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/.settings/org.eclipse.core.resources.prefs [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/.settings/org.eclipse.core.runtime.prefs [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/.settings/org.eclipse.jdt.ui.prefs [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/.settings/org.eclipse.pde.api.tools.prefs [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/.settings/org.eclipse.pde.prefs [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/META-INF/MANIFEST.MF [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/about.html [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/build.properties [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/plugin.properties [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/plugin.xml [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/pom.xml [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/shared/org/eclipse/linuxtools/tmf/ctf/core/tests/shared/CtfTmfTestTrace.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/AllTests.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfIteratorTest.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfLocationDataTest.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfLocationTest.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfContextTest.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfEventFieldTest.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfEventTest.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfEventTypeTest.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfLostEventStatisticsTest.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfLostEventsTest.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfTimestampTest.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfTraceTest.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/EventContextTest.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/FunkyTraceTest.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/headless/Benchmark.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/headless/RequestBenchmark.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/request/AllTests.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/request/TmfSchedulerBenchmark.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/request/TmfSchedulerTest.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/statistics/AllTests.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/statistics/TmfEventsStatisticsTest.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/statistics/TmfStateStatisticsTest.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/statistics/TmfStatisticsTest.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/tracemanager/AllTests.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/tracemanager/TmfTraceManagerTest.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core.tests/stubs/org/eclipse/linuxtools/tmf/ctf/core/tests/stubs/CtfTmfTraceStub.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/.classpath [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/.gitignore [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/.project [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/.settings/org.eclipse.core.resources.prefs [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/.settings/org.eclipse.core.runtime.prefs [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/.settings/org.eclipse.jdt.ui.prefs [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/.settings/org.eclipse.pde.api.tools.prefs [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/.settings/org.eclipse.pde.prefs [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/META-INF/MANIFEST.MF [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/about.html [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/build.properties [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/plugin.properties [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/plugin.xml [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/pom.xml [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/internal/tmf/ctf/core/Activator.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfConstants.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfEnumPair.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfIterator.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfIteratorManager.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfLocation.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfLocationInfo.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfCallsite.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfContext.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfEvent.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfEventFactory.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfEventField.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfEventType.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfLostEvent.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfTimestamp.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfTrace.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/Messages.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/messages.properties [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.classpath [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.gitignore [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.project [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.settings/org.eclipse.core.resources.prefs [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.settings/org.eclipse.core.runtime.prefs [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.settings/org.eclipse.jdt.ui.prefs [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.settings/org.eclipse.pde.api.tools.prefs [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.settings/org.eclipse.pde.prefs [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/META-INF/MANIFEST.MF [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/about.html [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/build.properties [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/plugin.properties [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/pom.xml [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/src/org/eclipse/linuxtools/tmf/ctf/ui/swtbot/tests/AllTests.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/src/org/eclipse/linuxtools/tmf/ctf/ui/swtbot/tests/ImportAndReadSmokeTest.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf/.gitignore [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf/.project [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf/.settings/org.eclipse.core.resources.prefs [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf/.settings/org.eclipse.core.runtime.prefs [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf/build.properties [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf/feature.properties [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf/feature.xml [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf/p2.inf [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ctf/pom.xml [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ui.swtbot.tests/src/org/eclipse/linuxtools/tmf/ui/swtbot/tests/AllTmfUISWTBotTests.java
org.eclipse.linuxtools.tmf.ui.swtbot.tests/src/org/eclipse/linuxtools/tmf/ui/swtbot/tests/ImportAndReadSmokeTest.java [deleted file]
org.eclipse.linuxtools.tmf.ui.tests/META-INF/MANIFEST.MF
org.eclipse.linuxtools.tmf.ui/META-INF/MANIFEST.MF
org.eclipse.linuxtools.tmf.ui/plugin.xml
pom.xml

index 62ef2c9641445cbf81f8aac04b42402510f7f8ad..559c89ea016693b3d79f7d2267750141e5a14d01 100644 (file)
@@ -18,6 +18,7 @@ Require-Bundle: org.junit;bundle-version="4.0.0",
  org.eclipse.linuxtools.lttng2.ust.core.tests;bundle-version="2.1.0",
  org.eclipse.linuxtools.lttng2.ust.ui.tests;bundle-version="2.1.0",
  org.eclipse.linuxtools.tmf.core.tests;bundle-version="2.1.0",
+ org.eclipse.linuxtools.tmf.ctf.core.tests;bundle-version="3.0.0",
  org.eclipse.linuxtools.tmf.ui.tests;bundle-version="2.1.0",
  org.eclipse.linuxtools.ctf.parser.tests;bundle-version="3.0.0"
 Export-Package: org.eclipse.linuxtools.lttng.alltests;x-internal:=true
index 9bb3125bcdb0b591b31ee12d6a6d0c83135fa5f2..e27a568d08b370adfaaa5c0b67ec124321e3304b 100644 (file)
@@ -32,6 +32,7 @@ import org.junit.runners.Suite;
     org.eclipse.linuxtools.lttng2.ust.ui.tests.AllTests.class,
     org.eclipse.linuxtools.tmf.core.tests.AllTmfCoreTests.class,
     org.eclipse.linuxtools.tmf.ui.tests.AllTmfUITests.class,
+    org.eclipse.linuxtools.tmf.ctf.core.tests.AllTests.class
 })
 public class RunAllTests {
 
index 226295154f96049c8127c825b633eeb13f6f42b7..a0556c12e65b5cbaa31fb9416e70db0242edb45d 100644 (file)
@@ -11,6 +11,8 @@ Require-Bundle: org.junit;bundle-version="4.0.0",
  org.eclipse.core.runtime,
  org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0",
  org.eclipse.linuxtools.tmf.core.tests;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.ctf.core,
+ org.eclipse.linuxtools.tmf.ctf.core.tests,
  org.eclipse.linuxtools.lttng2.kernel.core;bundle-version="3.0.0",
  org.eclipse.core.resources
 Export-Package: org.eclipse.linuxtools.lttng2.kernel.core.tests,
index 37284ada864c9331ba83b84f5fc6fc0b1e59e864..38354b68db1c672a87d2694480d293c103e23ae9 100644 (file)
@@ -18,15 +18,15 @@ import static org.junit.Assume.assumeTrue;
 
 import org.eclipse.linuxtools.lttng2.kernel.core.event.matching.TcpEventMatching;
 import org.eclipse.linuxtools.lttng2.kernel.core.event.matching.TcpLttngEventMatching;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
 import org.eclipse.linuxtools.tmf.core.event.matching.TmfEventMatching;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
 import org.eclipse.linuxtools.tmf.core.synchronization.ITmfTimestampTransform;
 import org.eclipse.linuxtools.tmf.core.synchronization.SynchronizationAlgorithm;
 import org.eclipse.linuxtools.tmf.core.synchronization.TmfTimestampTransform;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
 import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
index 1347e700a43c55f279ebba0d1cb599fd773bbcc6..c0d17dd7b9cd170543dffa3d9a864135b0f30f1b 100644 (file)
@@ -21,11 +21,11 @@ import java.util.List;
 
 import org.eclipse.linuxtools.lttng2.kernel.core.event.matching.TcpEventMatching;
 import org.eclipse.linuxtools.lttng2.kernel.core.event.matching.TcpLttngEventMatching;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
 import org.eclipse.linuxtools.tmf.core.event.matching.TmfEventMatching;
 import org.eclipse.linuxtools.tmf.core.event.matching.TmfNetworkEventMatching;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
 import org.junit.Test;
 
 /**
index c196d3344a5fa12c547f9943541743cf10a3a89a..9965e424f606c17bd011cff4ecdb5507b5f5138e 100644 (file)
@@ -18,13 +18,13 @@ import java.io.PrintWriter;
 import java.util.List;
 
 import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKernelStateProvider;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
 import org.eclipse.linuxtools.tmf.core.interval.ITmfStateInterval;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
 import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemAnalysisModule;
 import org.eclipse.linuxtools.tmf.core.statevalue.ITmfStateValue;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
 
 /**
  * Small program to regenerate the values used in "TestValues.java" from the
index a5e48548c0aaa86ef471850ef3a684c374036218..e6e8074ed0c841e2aa1a98f28f63d02d67017e47 100644 (file)
@@ -17,7 +17,7 @@ import static org.junit.Assume.assumeTrue;
 
 import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKernelStateProvider;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
index c5587a6366add319877398393e6c05161a04af1d..01713cfff77fd9af367f18a626f6646bc7776f4e 100644 (file)
@@ -20,13 +20,13 @@ import static org.junit.Assume.assumeTrue;
 import java.io.File;
 
 import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKernelStateProvider;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
 import org.eclipse.linuxtools.tmf.core.exceptions.TimeRangeException;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfAnalysisException;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
 import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemAnalysisModule;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
 import org.eclipse.linuxtools.tmf.core.trace.TmfTraceManager;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
index 22208ef262e1de4cf76f975df94f76718d61cbc8..974dec74df2a041e9e4533c8942a696a6e825ca9 100644 (file)
@@ -22,13 +22,13 @@ import static org.junit.Assume.assumeTrue;
 import java.io.File;
 
 import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKernelStateProvider;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfAnalysisException;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
 import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemAnalysisModule;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
 import org.eclipse.linuxtools.tmf.core.trace.TmfTraceManager;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
index 689bff9845826b80d9ff974fad7a33ec9e7775a8..8ed0d95a78207bde529bfc1715b54ff2cab9b293 100644 (file)
@@ -19,11 +19,11 @@ import static org.junit.Assert.fail;
 import static org.junit.Assume.assumeTrue;
 
 import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKernelStateProvider;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfAnalysisException;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
 import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemAnalysisModule;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
 import org.junit.BeforeClass;
 
 /**
index 8a3708a71af24b471be0da33050e65ca4fdfb76f..b8c6ed0027fd383cc5e8ee2036add5c53fb98d14 100644 (file)
@@ -26,7 +26,7 @@ import org.eclipse.linuxtools.tmf.core.exceptions.TimeRangeException;
 import org.eclipse.linuxtools.tmf.core.interval.ITmfStateInterval;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
 import org.eclipse.linuxtools.tmf.core.statevalue.ITmfStateValue;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
 import org.junit.Test;
 
 /**
index 209d112dec5382809edee2b22a66aeed7dd9911f..818d604f002e6a451ee7f755d0880bea6ea6855c 100644 (file)
@@ -11,7 +11,8 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.7
 Require-Bundle: org.eclipse.core.runtime,
  org.eclipse.core.resources,
  org.eclipse.linuxtools.ctf.core;bundle-version="3.0.0",
- org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0"
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.ctf.core
 Export-Package: org.eclipse.linuxtools.internal.lttng2.kernel.core;x-friends:="org.eclipse.linuxtools.lttng2.kernel.ui,org.eclipse.linuxtools.lttng2.kernel.core.tests",
  org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider;x-friends:="org.eclipse.linuxtools.lttng2.kernel.ui,org.eclipse.linuxtools.lttng2.kernel.core.tests",
  org.eclipse.linuxtools.lttng2.kernel.core.analysis,
index cc0b84e2b378c0182f431437dd2e91baaed5880a..f74134c622c8de6e208b4fff4d3392ff214ea477 100644 (file)
@@ -4,8 +4,8 @@
    <extension
          point="org.eclipse.linuxtools.tmf.core.tracetype">
       <type
-            category="org.eclipse.linuxtools.tmf.core.category.ctf"
-            event_type="org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent"
+            category="org.eclipse.linuxtools.tmf.ctf.core.category.ctf"
+            event_type="org.eclipse.linuxtools.tmf.ctf.core.CtfTmfEvent"
             id="org.eclipse.linuxtools.lttng2.kernel.tracetype"
             isDirectory="true"
             name="%tracetype.type.kernel"
index a6b079f46c03ba484f8d418cfd8a6fc352002ffb..1f34c5ce84cf927214827940d2dba55deb39c96e 100644 (file)
@@ -15,8 +15,6 @@ package org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider;
 import org.eclipse.linuxtools.internal.lttng2.kernel.core.Attributes;
 import org.eclipse.linuxtools.internal.lttng2.kernel.core.LttngStrings;
 import org.eclipse.linuxtools.internal.lttng2.kernel.core.StateValues;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
 import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
@@ -26,6 +24,8 @@ import org.eclipse.linuxtools.tmf.core.statesystem.AbstractTmfStateProvider;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystemBuilder;
 import org.eclipse.linuxtools.tmf.core.statevalue.ITmfStateValue;
 import org.eclipse.linuxtools.tmf.core.statevalue.TmfStateValue;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfEvent;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
 
 /**
  * This is the state change input plugin for TMF's state system which handles
index e53653c89748aee870fc286dce4f86866da50490..dba8b31f434283504f81f28ea5bfb5f345f813e6 100644 (file)
@@ -16,13 +16,13 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.eclipse.linuxtools.internal.lttng2.kernel.core.TcpEventStrings;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
 import org.eclipse.linuxtools.tmf.core.event.matching.ITmfNetworkMatchDefinition;
 import org.eclipse.linuxtools.tmf.core.event.matching.TmfEventMatching.MatchingType;
 import org.eclipse.linuxtools.tmf.core.event.matching.TmfNetworkEventMatching.Direction;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
 
 /**
  * Class to match tcp type events. This matching class applies to traces
index e047ffe606e8a726315b7423dba69e3eb86682f0..0d6fe3573c24a2211f76af69a8d155e77945a7b6 100644 (file)
@@ -16,7 +16,6 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.eclipse.linuxtools.internal.lttng2.kernel.core.TcpEventStrings;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
 import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
@@ -24,6 +23,7 @@ import org.eclipse.linuxtools.tmf.core.event.matching.TmfEventMatching.MatchingT
 import org.eclipse.linuxtools.tmf.core.event.matching.TmfNetworkEventMatching.Direction;
 import org.eclipse.linuxtools.tmf.core.event.matching.ITmfNetworkMatchDefinition;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
 
 /**
  * Class to match tcp type events. This class applies to traces obtained with
index a3d4a61f0cbe3cd56e3a12828ad8533b9091c3fc..136fdae34445ab6c22642fe9fb5f64b3f5c6df38 100644 (file)
@@ -21,8 +21,8 @@ import org.eclipse.core.runtime.Status;
 import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
 import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
 import org.eclipse.linuxtools.internal.lttng2.kernel.core.Activator;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
 import org.eclipse.linuxtools.tmf.core.trace.TraceValidationStatus;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
 
 /**
  * This is the specification of CtfTmfTrace for use with LTTng 2.x kernel
index a148620104fb8092cb0688aaf9fbec009e24f5db..91b979ab3001474f355c3ac5aa9317042d5d0a7a 100644 (file)
@@ -16,6 +16,8 @@ Require-Bundle: org.apache.log4j,
  org.eclipse.linuxtools.lttng2.ui,
  org.eclipse.linuxtools.tmf.core,
  org.eclipse.linuxtools.tmf.core.tests,
+ org.eclipse.linuxtools.tmf.ctf.core,
+ org.eclipse.linuxtools.tmf.ctf.core.tests,
  org.eclipse.linuxtools.tmf.ui,
  org.eclipse.linuxtools.tmf.ui.swtbot.tests,
  org.eclipse.swtbot.eclipse.finder,
index b61f4a641c05ce850120e761ac58b58e081a7e4f..b879f9d4441769912af9f4baf1add36361768ecd 100644 (file)
@@ -29,12 +29,12 @@ import org.eclipse.jface.viewers.SelectionChangedEvent;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.controlflow.ControlFlowView;
 import org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.resources.ResourcesView;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfEvent;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
 import org.eclipse.linuxtools.tmf.ui.editors.TmfEventsEditor;
 import org.eclipse.linuxtools.tmf.ui.project.model.TmfOpenTraceHelper;
 import org.eclipse.linuxtools.tmf.ui.swtbot.tests.SWTBotUtil;
index 7b73042027228d52769cf1f312411b09994ca772..599a4fae1f7e14e3d3246e47e4d4e4b27c299a0b 100644 (file)
@@ -12,6 +12,8 @@ Require-Bundle: org.junit;bundle-version="4.0.0",
  org.eclipse.core.runtime,
  org.eclipse.linuxtools.tmf.core,
  org.eclipse.linuxtools.tmf.core.tests;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.ctf.core,
+ org.eclipse.linuxtools.tmf.ctf.core.tests,
  org.eclipse.linuxtools.lttng2.ust.core
 Export-Package: org.eclipse.linuxtools.lttng2.ust.core.tests,
  org.eclipse.linuxtools.lttng2.ust.core.tests.trace.callstack
index 46cabafd065f5dd5eb6cb577ef803e23db3ae2f3..da9cf113bc5a45573fbf4347227fe7c80a42217a 100644 (file)
@@ -23,7 +23,6 @@ import java.io.File;
 import java.util.List;
 
 import org.eclipse.linuxtools.internal.lttng2.ust.core.trace.callstack.LttngUstCallStackProvider;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
 import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
 import org.eclipse.linuxtools.tmf.core.exceptions.StateSystemDisposedException;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfAnalysisException;
@@ -32,10 +31,11 @@ import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
 import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemAnalysisModule;
 import org.eclipse.linuxtools.tmf.core.statevalue.ITmfStateValue;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
 import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
 import org.eclipse.linuxtools.tmf.core.trace.TmfTraceManager;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
index 0f5ddaabb537bcf240d8d25f630863eef8b86f0e..8f45e00f24f4b9ce2c0f72b4237ce59a0074ca15 100644 (file)
@@ -12,7 +12,7 @@
 
 package org.eclipse.linuxtools.lttng2.ust.core.tests.trace.callstack;
 
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
 
 /**
  * Test suite for the UST callstack state provider, using the trace of a program
index cf0b756724b3ffdb5d2814fd21d175dd33b8313b..cbfa1198da0b9b7280057e12d08212ff92960b1e 100644 (file)
@@ -12,7 +12,7 @@
 
 package org.eclipse.linuxtools.lttng2.ust.core.tests.trace.callstack;
 
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
 
 /**
  * Test suite for the UST callstack state provider, using the trace of a program
index ef2d96c496c3f6ed6749811b0a86638bd44dee67..a07c7671ba4b7fc121a91bf730a46adb77a68527 100644 (file)
@@ -16,4 +16,5 @@ Export-Package: org.eclipse.linuxtools.internal.lttng2.ust.core;x-internal:=true
 Require-Bundle: org.eclipse.core.runtime,
  org.eclipse.core.resources,
  org.eclipse.linuxtools.ctf.core;bundle-version="3.0.0",
- org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0"
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.ctf.core
index 8be297fb10046c1faa66fbe1dee314b464a947f4..8d536c340e01e015878b4f570b710b83d065d6d0 100644 (file)
@@ -4,8 +4,8 @@
    <extension
          point="org.eclipse.linuxtools.tmf.core.tracetype">
       <type
-            category="org.eclipse.linuxtools.tmf.core.category.ctf"
-            event_type="org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent"
+            category="org.eclipse.linuxtools.tmf.ctf.core.category.ctf"
+            event_type="org.eclipse.linuxtools.tmf.ctf.core.CtfTmfEvent"
             id="org.eclipse.linuxtools.lttng2.ust.tracetype"
             isDirectory="true"
             name="%tracetype.type.ust"
index b17ca4277bd647d33597de94d83061b3a3c9096f..645c851e4828af7ddffe48cdc1e0e54d53c536c1 100644 (file)
@@ -17,7 +17,6 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.eclipse.linuxtools.lttng2.ust.core.trace.LttngUstTrace;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
 import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
@@ -27,6 +26,7 @@ import org.eclipse.linuxtools.tmf.core.statesystem.AbstractTmfStateProvider;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateProvider;
 import org.eclipse.linuxtools.tmf.core.statevalue.ITmfStateValue;
 import org.eclipse.linuxtools.tmf.core.statevalue.TmfStateValue;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfEvent;
 
 /**
  * State provider to track the memory of the threads using the UST libc wrapper
index 1218db377cb834fe5e95e8362f8b9b85cc1209b8..068b787b83396d37998a973a55ff8501879bba2f 100644 (file)
@@ -16,10 +16,10 @@ import java.util.HashSet;
 import java.util.Set;
 
 import org.eclipse.linuxtools.tmf.core.callstack.CallStackStateProvider;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfEvent;
 
 /**
  * Callstack provider for LTTng-UST traces.
index 9547717a25f0ae49fec434536363e74cefedba5f..2037ba3d9affdbacece0a8afdd0b35bbaee8bc7e 100644 (file)
@@ -22,8 +22,8 @@ import org.eclipse.core.runtime.Status;
 import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
 import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
 import org.eclipse.linuxtools.internal.lttng2.ust.core.Activator;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
 import org.eclipse.linuxtools.tmf.core.trace.TraceValidationStatus;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
 
 /**
  * Class to contain LTTng-UST traces
index 0b2c6871d8aeb6dd7590ab05141586068203a216..44cecfc812ea61793fc7269e92f17f7514df7b62 100644 (file)
@@ -13,7 +13,8 @@ Require-Bundle: org.eclipse.core.resources,
  org.eclipse.ui,
  org.eclipse.linuxtools.lttng2.ust.core;bundle-version="3.0.0",
  org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0",
- org.eclipse.linuxtools.tmf.ui;bundle-version="3.0.0"
+ org.eclipse.linuxtools.tmf.ui;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.ctf.core
 Export-Package: org.eclipse.linuxtools.internal.lttng2.ust.ui;x-friends:="org.eclipse.linuxtools.lttng2.ust.ui.tests",
  org.eclipse.linuxtools.internal.lttng2.ust.ui.views.memusage;x-friends:="org.eclipse.linuxtools.lttng2.ust.ui.tests",
  org.eclipse.linuxtools.lttng2.ust.ui.analysis.callstack
index b7463bde72bf533783074c6c9d79a322163b7b7f..2ea92d403f4760f689a35ff1e6d6a7837fa4ba6e 100644 (file)
@@ -10,7 +10,9 @@ Require-Bundle: org.junit,
  org.eclipse.core.resources,
  org.eclipse.linuxtools.tmf.analysis.xml.core,
  org.eclipse.linuxtools.tmf.core,
- org.eclipse.linuxtools.tmf.core.tests
+ org.eclipse.linuxtools.tmf.core.tests,
+ org.eclipse.linuxtools.tmf.ctf.core,
+ org.eclipse.linuxtools.tmf.ctf.core.tests
 Bundle-RequiredExecutionEnvironment: JavaSE-1.7
 Bundle-ActivationPolicy: lazy
 Import-Package: org.junit.runners
index c9647ab8a581c47fff6d2ebd4333d9c8c1c6b3f3..9b099223af6a4ebfd24745dc025f6879c0d6cea0 100644 (file)
@@ -32,8 +32,8 @@ import org.eclipse.linuxtools.tmf.analysis.xml.core.stateprovider.TmfXmlStrings;
 import org.eclipse.linuxtools.tmf.analysis.xml.core.stateprovider.XmlStateSystemModule;
 import org.eclipse.linuxtools.tmf.analysis.xml.core.tests.common.TmfXmlTestFiles;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfAnalysisException;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
 import org.junit.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
index abfb7cf5e25e6083499988abe7fc99a89ad25dc4..5ad37ff97acb88f99056272b2469c4ced1869385 100644 (file)
@@ -33,8 +33,8 @@ import org.eclipse.linuxtools.tmf.analysis.xml.core.stateprovider.XmlStateSystem
 import org.eclipse.linuxtools.tmf.analysis.xml.core.tests.common.TmfXmlTestFiles;
 import org.eclipse.linuxtools.tmf.core.exceptions.TmfAnalysisException;
 import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
 import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
index 3d01b73f664dc9234cf1a5e3fba2bd873b1e1156..39850b9a5b9fc154bc0fdbfb0954867bad1855f6 100644 (file)
@@ -11,11 +11,8 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.7
 Require-Bundle: org.junit;bundle-version="4.0.0",
  org.eclipse.core.runtime,
  org.eclipse.core.resources,
- org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0",
- org.eclipse.linuxtools.ctf.core;bundle-version="3.0.0",
- org.eclipse.linuxtools.ctf.core.tests;bundle-version="3.0.0"
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0"
 Export-Package: org.eclipse.linuxtools.tmf.core.tests,
  org.eclipse.linuxtools.tmf.core.tests.shared,
- org.eclipse.linuxtools.tmf.tests.stubs.trace;x-friends:="org.eclipse.linuxtools.tmf.ui.tests",
- org.eclipse.linuxtools.tmf.tests.stubs.ctf;x-friends:="org.eclipse.linuxtools.tmf.ui.tests"
+ org.eclipse.linuxtools.tmf.tests.stubs.trace
 Import-Package: com.google.common.collect
index d91a19a2059a6731ee9ab4ba2538e78f9869a01e..5859eb99ea60f7766ae8c94e70060e1c7f052ffa 100644 (file)
             name="TMF Tests"
             trace_type="org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub">
       </type>
-      <type
-            category="org.eclipse.linuxtools.tmf.core.tests.category"
-            event_type="org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent"
-            id="org.eclipse.linuxtools.tmf.core.tests.ctf.tracetype"
-            isDirectory="true"
-            name="CTF Tests"
-            trace_type="org.eclipse.linuxtools.tmf.tests.stubs.ctf.CtfTmfTraceStub">
-      </type>
       <experiment
             category="org.eclipse.linuxtools.tmf.core.tests.category"
             id="org.eclipse.linuxtools.tmf.core.tests.experimenttype"
diff --git a/org.eclipse.linuxtools.tmf.core.tests/shared/org/eclipse/linuxtools/tmf/core/tests/shared/CtfTmfTestTrace.java b/org.eclipse.linuxtools.tmf.core.tests/shared/org/eclipse/linuxtools/tmf/core/tests/shared/CtfTmfTestTrace.java
deleted file mode 100644 (file)
index b740478..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.shared;
-
-import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTrace;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
-import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.linuxtools.tmf.tests.stubs.ctf.CtfTmfTraceStub;
-
-/**
- * Available CTF TMF test traces. Kind-of-extends {@link CtfTestTrace}.
- *
- * To run tests using these, you first need to run the "get-traces.[xml|sh]"
- * script located under lttng/org.eclipse.linuxtools.ctf.core.tests/traces/ .
- *
- * @author Alexandre Montplaisir
- */
-public enum CtfTmfTestTrace {
-    /** Example kernel trace */
-    KERNEL,
-    /** Another kernel trace */
-    TRACE2,
-    /** Kernel trace with event contexts */
-    KERNEL_VM,
-    /** Trace synchronization: source trace */
-    SYNC_SRC,
-    /** Trace synchronization: destination trace */
-    SYNC_DEST,
-    /** UST trace with lots of lost events */
-    HELLO_LOST,
-    /** UST trace with lttng-ust-cyg-profile events (aka -finstrument-functions) */
-    CYG_PROFILE,
-    /** UST trace with lttng-ust-cyg-profile-fast events (no address in func_exit) */
-    CYG_PROFILE_FAST,
-    /** Autogenerated Syntetic trace */
-    SYNTHETIC_TRACE,
-    /** Trace with non-standard field sizes */
-    FUNKY_TRACE;
-
-
-    private final String fPath;
-    private CtfTmfTraceStub fTrace = null;
-
-    private CtfTmfTestTrace() {
-        /* This makes my head spin */
-        fPath = CtfTestTrace.valueOf(this.name()).getPath();
-    }
-
-    /**
-     * @return The path of this trace
-     */
-    public String getPath() {
-        return fPath;
-    }
-
-    /**
-     * Return a CtfTmfTraceStub object of this test trace. It will be already
-     * initTrace()'ed.
-     *
-     * Make sure you call {@link #exists()} before calling this!
-     *
-     * After being used by unit tests, traces must be properly disposed of by
-     * calling the {@link CtfTmfTestTrace#dispose()} method.
-     *
-     * @return A CtfTmfTrace reference to this trace
-     */
-    public synchronized CtfTmfTrace getTrace() {
-        if (fTrace != null) {
-            fTrace.dispose();
-        }
-        fTrace = new CtfTmfTraceStub();
-        try {
-            fTrace.initTrace(null, fPath, CtfTmfEvent.class);
-        } catch (TmfTraceException e) {
-            /* Should not happen if tracesExist() passed */
-            throw new RuntimeException(e);
-        }
-        return fTrace;
-    }
-
-    /**
-     * Check if the trace actually exists on disk or not.
-     *
-     * @return If the trace is present
-     */
-    public boolean exists() {
-        return CtfTestTrace.valueOf(this.name()).exists();
-    }
-
-    /**
-     * Dispose of the trace
-     */
-    public void dispose() {
-        if (fTrace != null) {
-            fTrace.dispose();
-            fTrace = null;
-        }
-    }
-}
index ad27320bd6d134890c91f8ec4d0a1f216b9aaed5..de2becb54ca8a45c03218c376aec798f1a091150 100644 (file)
@@ -24,7 +24,6 @@ import org.junit.runners.Suite;
     TmfCorePluginTest.class,
     org.eclipse.linuxtools.tmf.core.tests.analysis.AllTests.class,
     org.eclipse.linuxtools.tmf.core.tests.component.AllTests.class,
-    org.eclipse.linuxtools.tmf.core.tests.ctfadaptor.AllTests.class,
     org.eclipse.linuxtools.tmf.core.tests.event.AllTests.class,
     org.eclipse.linuxtools.tmf.core.tests.event.lookup.AllTests.class,
     org.eclipse.linuxtools.tmf.core.tests.request.AllTests.class,
@@ -32,7 +31,6 @@ import org.junit.runners.Suite;
     org.eclipse.linuxtools.tmf.core.tests.statesystem.AllTests.class,
     org.eclipse.linuxtools.tmf.core.tests.statesystem.backends.AllTests.class,
     org.eclipse.linuxtools.tmf.core.tests.statesystem.mipmap.AllTests.class,
-    org.eclipse.linuxtools.tmf.core.tests.statistics.AllTests.class,
     org.eclipse.linuxtools.tmf.core.tests.synchronization.AllTests.class,
     org.eclipse.linuxtools.tmf.core.tests.trace.AllTests.class,
     org.eclipse.linuxtools.tmf.core.tests.trace.indexer.AllTests.class,
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/AllTests.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/AllTests.java
deleted file mode 100644 (file)
index 5fc88a1..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial generation with CodePro tools
- *   Alexandre Montplaisir - Clean up, consolidate redundant tests
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * The class <code>TestAll</code> builds a suite that can be used to run all
- * of the tests within its package as well as within any subpackages of its
- * package.
- *
- * @author ematkho
- * @version 1.0
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
-    CtfIteratorTest.class,
-    CtfLocationDataTest.class,
-    CtfLocationTest.class,
-    CtfTmfContextTest.class,
-    CtfTmfEventFieldTest.class,
-    CtfTmfEventTest.class,
-    CtfTmfEventTypeTest.class,
-    CtfTmfLostEventsTest.class,
-    CtfTmfTimestampTest.class,
-    CtfTmfTraceTest.class,
-    EventContextTest.class,
-    FunkyTraceTest.class
-})
-public class AllTests {
-
-}
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfIteratorTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfIteratorTest.java
deleted file mode 100644 (file)
index 9e4e380..0000000
+++ /dev/null
@@ -1,237 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial generation with CodePro tools
- *   Alexandre Montplaisir - Clean up, consolidate redundant tests
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
-
-import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfLocation;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfLocationInfo;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>CtfIteratorTest</code> contains tests for the class
- * <code>{@link CtfIterator}</code>.
- *
- * @author ematkho
- * @version 1.0
- */
-public class CtfIteratorTest {
-
-    private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
-
-    private CtfTmfTrace trace;
-    private CtfIterator iterator;
-
-    /**
-     * Perform pre-test initialization.
-     * @throws CTFReaderException error
-     */
-    @Before
-    public void setUp() throws CTFReaderException {
-        assumeTrue(testTrace.exists());
-        trace = testTrace.getTrace();
-        iterator = new CtfIterator(trace);
-        CtfLocation ctfLocation = new CtfLocation(new CtfLocationInfo(1, 0));
-        iterator.setLocation(ctfLocation);
-        iterator.increaseRank();
-    }
-
-    /**
-     * Perform post-test clean-up.
-     */
-    @After
-    public void tearDown() {
-        if (iterator != null) {
-            iterator.dispose();
-        }
-    }
-
-    /**
-     * Run the CtfIterator(CtfTmfTrace) constructor on a non init'ed trace.
-     * @throws CTFReaderException error
-     */
-    @Test
-    public void testCtfIterator_noinit() throws CTFReaderException {
-        CtfIterator result = new CtfIterator(trace);
-        assertNotNull(result);
-    }
-
-    /**
-     * Run the CtfIterator(CtfTmfTrace) constructor on an init'ed trace.
-     * @throws CTFReaderException error
-     */
-    @Test
-    public void testCtfIterator_init() throws CTFReaderException {
-        trace.init("test");
-        CtfIterator result = new CtfIterator(trace);
-
-        assertNotNull(result);
-    }
-
-    /**
-     * Run the CtfIterator(CtfTmfTrace,long,long) constructor test, which
-     * specifies an initial position for the iterator.
-     * @throws CTFReaderException error
-     */
-    @Test
-    public void testCtfIterator_position() throws CTFReaderException {
-        long timestampValue = 1L;
-        long rank = 1L;
-        CtfIterator result = new CtfIterator(trace, new CtfLocationInfo(timestampValue, 0), rank);
-
-        assertNotNull(result);
-    }
-
-
-    /**
-     * Run the boolean advance() method test.
-     */
-    @Test
-    public void testAdvance() {
-        boolean result = iterator.advance();
-        assertTrue(result);
-    }
-
-    /**
-     * Run the int compareTo(CtfIterator) method test.
-     * @throws CTFReaderException error
-     */
-    @Test
-    public void testCompareTo() throws CTFReaderException {
-        CtfIterator o = new CtfIterator(trace);
-        int result = iterator.compareTo(o);
-
-        assertEquals(1L, result);
-    }
-
-    /**
-     * Run the boolean equals(Object) method test. Compare with another iterator
-     * on the same trace.
-     * @throws CTFReaderException error
-     */
-    @Test
-    public void testEquals_other() throws CTFReaderException {
-        CtfIterator obj = new CtfIterator(trace);
-        CtfLocation ctfLocation1 = new CtfLocation(new CtfLocationInfo(1, 0));
-        obj.setLocation(ctfLocation1);
-        obj.increaseRank();
-
-        boolean result = iterator.equals(obj);
-        assertTrue(result);
-    }
-
-    /**
-     * Run the boolean equals(Object) method test. Compare with an empty object.
-     */
-    @Test
-    public void testEquals_empty() {
-        Object obj = new Object();
-        boolean result = iterator.equals(obj);
-
-        assertFalse(result);
-    }
-
-    /**
-     * Run the CtfTmfTrace getCtfTmfTrace() method test.
-     */
-    @Test
-    public void testGetCtfTmfTrace() {
-        CtfTmfTrace result = iterator.getCtfTmfTrace();
-        assertNotNull(result);
-    }
-
-    /**
-     * Run the CtfTmfEvent getCurrentEvent() method test.
-     */
-    @Test
-    public void testGetCurrentEvent() {
-        CtfTmfEvent result = iterator.getCurrentEvent();
-        assertNotNull(result);
-    }
-
-    /**
-     * Run the CtfLocation getLocation() method test.
-     */
-    @Test
-    public void testGetLocation() {
-        CtfLocation result = iterator.getLocation();
-        assertNotNull(result);
-    }
-
-    /**
-     * Run the long getRank() method test.
-     */
-    @Test
-    public void testGetRank() {
-        long result = iterator.getRank();
-        assertEquals(1L, result);
-    }
-
-    /**
-     * Run the boolean hasValidRank() method test.
-     */
-    @Test
-    public void testHasValidRank() {
-        boolean result = iterator.hasValidRank();
-        assertTrue(result);
-    }
-
-    /**
-     * Run the int hashCode() method test.
-     */
-    @Test
-    public void testHashCode() {
-        int result = iterator.hashCode();
-        int result2 = iterator.hashCode();
-        assertEquals(result, result2);
-    }
-
-    /**
-     * Run the void increaseRank() method test.
-     */
-    @Test
-    public void testIncreaseRank() {
-        iterator.increaseRank();
-    }
-
-    /**
-     * Run the boolean seek(long) method test.
-     */
-    @Test
-    public void testSeek() {
-        long timestamp = 1L;
-        boolean result = iterator.seek(timestamp);
-        assertTrue(result);
-    }
-
-    /**
-     * Run the void setLocation(ITmfLocation<?>) method test.
-     */
-    @Test
-    public void testSetLocation() {
-        CtfLocation location = new CtfLocation(new CtfLocationInfo(1, 0));
-        iterator.setLocation(location);
-    }
-}
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfLocationDataTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfLocationDataTest.java
deleted file mode 100644 (file)
index c5cadab..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfLocationInfo;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Collection of tests for the {@link CtfLocationInfo}
- *
- * @author alexmont
- */
-public class CtfLocationDataTest {
-
-    private CtfLocationInfo fixture;
-
-    /**
-     * Perform pre-test initialization.
-     */
-    @Before
-    public void setUp() {
-        fixture = new CtfLocationInfo(1, 0);
-    }
-
-    /**
-     * Test for the .getTimestamp() and .getIndex() methods
-     */
-    @Test
-    public void testGetters() {
-        long timestamp = fixture.getTimestamp();
-        long index = fixture.getIndex();
-
-        assertEquals(1, timestamp);
-        assertEquals(0, index);
-    }
-
-    /**
-     * Test for the .hashCode() method
-     */
-    @Test
-    public void testHashCode() {
-        int code = fixture.hashCode();
-        assertEquals(962, code);
-    }
-
-    /**
-     * Test for the .equals() method
-     */
-    @Test
-    public void testEquals() {
-        CtfLocationInfo same = new CtfLocationInfo(1, 0);
-        CtfLocationInfo diff1 = new CtfLocationInfo(100, 0);
-        CtfLocationInfo diff2 = new CtfLocationInfo(1, 10);
-
-        assertTrue(fixture.equals(same));
-        assertFalse(fixture.equals(diff1));
-        assertFalse(fixture.equals(diff2));
-    }
-
-    /**
-     * Test for the .compareTo() method
-     */
-    @Test
-    public void testCompareTo() {
-        CtfLocationInfo same = new CtfLocationInfo(1, 0);
-        CtfLocationInfo smaller = new CtfLocationInfo(0, 0);
-        CtfLocationInfo bigger1 = new CtfLocationInfo(1000, 500);
-        CtfLocationInfo bigger2 = new CtfLocationInfo(1, 1);
-
-        assertEquals(0, same.compareTo(fixture));
-        assertEquals(-1, smaller.compareTo(fixture));
-        assertEquals(1, bigger1.compareTo(fixture));
-        assertEquals(1, bigger2.compareTo(fixture));
-    }
-
-    /**
-     * Test for the .toString() method
-     */
-    @Test
-    public void testToString() {
-        String expected = "Element [1/0]";
-        assertEquals(expected, fixture.toString());
-    }
-}
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfLocationTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfLocationTest.java
deleted file mode 100644 (file)
index 739cbc4..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial generation with CodePro tools
- *   Alexandre Montplaisir - Clean up, consolidate redundant tests
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfLocation;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfLocationInfo;
-import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>CtfLocationTest</code> contains tests for the class
- * <code>{@link CtfLocation}</code>.
- *
- * @author ematkho
- * @version 1.0
- */
-public class CtfLocationTest {
-
-    private CtfLocation fixture;
-
-    /**
-     * Perform pre-test initialization.
-     */
-    @Before
-    public void setUp() {
-        fixture = new CtfLocation(new CtfLocationInfo(1, 0));
-    }
-
-    /**
-     * Run the CtfLocation(Long) constructor test.
-     */
-    @Test
-    public void testCtfLocation_long() {
-        CtfLocationInfo location = new CtfLocationInfo(1, 0);
-        CtfLocation result = new CtfLocation(location);
-
-        assertNotNull(result);
-        assertEquals(1L, result.getLocationInfo().getTimestamp());
-    }
-
-    /**
-     * Run the CtfLocation(ITmfTimestamp) constructor test.
-     */
-    @Test
-    public void testCtfLocation_timestamp() {
-        ITmfTimestamp timestamp = new TmfTimestamp();
-        CtfLocation result = new CtfLocation(timestamp);
-
-        assertNotNull(result);
-        assertEquals(0L, result.getLocationInfo().getTimestamp());
-    }
-
-    /**
-     * Run the Long getLocation() method test.
-     */
-    @Test
-    public void testGetLocation() {
-        CtfLocationInfo location = fixture.getLocationInfo();
-        long result = location.getTimestamp();
-        assertEquals(1L, result);
-    }
-
-    /**
-     * Run the void setLocation(Long) method test.
-     */
-    @Test
-    public void testSetLocation() {
-        CtfLocationInfo location = new CtfLocationInfo(1337, 7331);
-        fixture = new CtfLocation(location);
-    }
-
-    /**
-     * Test the toString() method with a valid location.
-     */
-    @Test
-    public void testToString_valid(){
-        CtfLocation fixture2 = new CtfLocation(new CtfLocationInfo(1337, 7331));
-        assertEquals("CtfLocation [fLocationInfo=Element [1337/7331]]", fixture2.toString());
-    }
-
-    /**
-     * Test the toString() method with an invalid location.
-     */
-    @Test
-    public void testToString_invalid(){
-        CtfLocation fixture2 = new CtfLocation(new CtfLocationInfo(-1, -1));
-        assertEquals("CtfLocation [INVALID]", fixture2.toString());
-    }
-}
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfContextTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfContextTest.java
deleted file mode 100644 (file)
index b901a7f..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial implementation
- *   Alexandre Montplaisir
- *   Patrick Tasse - Updated for removal of context clone
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfContext;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
-import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Tests for the CtfTmfLightweightContext class
- *
- * @author Matthew Khouzam
- * @version 1.1
- */
-public class CtfTmfContextTest {
-
-    private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
-    private static final long begin = 1332170682440133097L; /* Trace start time */
-    private static final long end = 1332170692664579801L; /* Trace end time */
-
-    private CtfTmfTrace trace;
-
-    private class SeekerThread extends Thread {
-        long val;
-
-        public void setVal(long val) {
-            this.val = val;
-        }
-    }
-
-    /**
-     * Pre-test initialization
-     *
-     * @throws TmfTraceException
-     *             If the trace couldn't be init'ed, which shouldn't happen.
-     */
-    @Before
-    public void setUp() throws TmfTraceException {
-        assumeTrue(testTrace.exists());
-        trace = new CtfTmfTrace();
-        String path = testTrace.getPath();
-        trace.initTrace((IResource) null, path, CtfTmfEvent.class);
-    }
-
-    /**
-     * Index all the events in the test trace.
-     */
-    @Test
-    public void testIndexing() {
-        CtfTmfContext context = new CtfTmfContext(trace);
-        context.seek(0);
-
-        int count = 0;
-        while (trace.getNext(context) != null) {
-            count++;
-        }
-        assertTrue(count > 0);
-    }
-
-    /**
-     * Context fuzzer. Use an amount of contexts greater than the size of the
-     * iterator cache and have them access the trace in parallel.
-     *
-     * @throws InterruptedException
-     *             Would fail the test
-     */
-    @Test
-    public void testTooManyContexts() throws InterruptedException {
-        final int lwcCount = 101;
-        double increment = (end - begin) / lwcCount;
-        final ArrayList<Long> vals = new ArrayList<>();
-        final ArrayList<Thread> threads = new ArrayList<>();
-        final ArrayList<CtfTmfContext> tooManyContexts = new ArrayList<>();
-
-        for (double i = begin; i < end; i += increment) {
-            SeekerThread thread = new SeekerThread() {
-                @Override
-                public void run() {
-                    CtfTmfContext lwc = new CtfTmfContext(trace);
-                    lwc.seek(val);
-                    trace.getNext(lwc);
-                    synchronized(trace){
-                        if (lwc.getCurrentEvent() != null) {
-                            vals.add(lwc.getCurrentEvent().getTimestamp().getValue());
-                        }
-                        tooManyContexts.add(lwc);
-                    }
-                }
-            };
-            thread.setVal((long)i);
-            threads.add(thread);
-            thread.start();
-        }
-
-        for (Thread t: threads){
-            t.join();
-        }
-
-        for (long val : vals){
-            assertTrue(val >= begin);
-            assertTrue(val <= end);
-        }
-    }
-}
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventFieldTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventFieldTest.java
deleted file mode 100644 (file)
index 7498879..0000000
+++ /dev/null
@@ -1,327 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial generation with CodePro tools
- *   Alexandre Montplaisir - Clean up, consolidate redundant tests
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-
-import java.io.UnsupportedEncodingException;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-import org.eclipse.linuxtools.ctf.core.event.io.BitBuffer;
-import org.eclipse.linuxtools.ctf.core.event.types.ArrayDeclaration;
-import org.eclipse.linuxtools.ctf.core.event.types.Definition;
-import org.eclipse.linuxtools.ctf.core.event.types.Encoding;
-import org.eclipse.linuxtools.ctf.core.event.types.EnumDeclaration;
-import org.eclipse.linuxtools.ctf.core.event.types.FloatDeclaration;
-import org.eclipse.linuxtools.ctf.core.event.types.FloatDefinition;
-import org.eclipse.linuxtools.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.linuxtools.ctf.core.event.types.SequenceDeclaration;
-import org.eclipse.linuxtools.ctf.core.event.types.StringDeclaration;
-import org.eclipse.linuxtools.ctf.core.event.types.StructDeclaration;
-import org.eclipse.linuxtools.ctf.core.event.types.StructDefinition;
-import org.eclipse.linuxtools.ctf.core.event.types.VariantDeclaration;
-import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEventField;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>CtfTmfEventFieldTest</code> contains tests for the class
- * <code>{@link CtfTmfEventField}</code>.
- *
- * @author ematkho
- * @version 1.0
- */
-public class CtfTmfEventFieldTest {
-
-    private static final String ROOT = "root";
-    private static final String SEQ = "seq";
-    private static final String ARRAY_STR = "array_str";
-    private static final String ARRAY_FLOAT = "array_float";
-    private static final String ARRAY_INT = "array_int";
-    private static final String ARRAY_STRUCT = "array_struct";
-    private static final String ARRAY_VARIANT = "array_variant";
-    private static final String ARRAY_ENUM = "array_enum";
-    private static final String STR = "str";
-    private static final String FLOAT = "float";
-    private static final String LEN = "len";
-    private static final String INT = "int";
-    private static final String NAME = "test";
-    private static final String STRUCT = "struct";
-    private static final String VARIANT = "variant";
-    private static final String ENUM = "enum";
-
-    private static final byte TEST_NUMBER = 2;
-    private static final String TEST_STRING = "two";
-
-    private static final int ARRAY_SIZE = 2;
-
-    private StructDefinition fixture;
-
-    /**
-     * Perform pre-test initialization.
-     *
-     * @throws UnsupportedEncodingException
-     *             Thrown when UTF-8 encoding is not available.
-     * @throws CTFReaderException
-     *             error
-     */
-    @Before
-    public void setUp() throws UnsupportedEncodingException, CTFReaderException {
-        final byte[] testStringBytes = TEST_STRING.getBytes("UTF-8");
-
-        int capacity = 2048;
-        ByteBuffer bb = ByteBuffer.allocateDirect(capacity);
-
-        StructDeclaration sDec = new StructDeclaration(1l);
-        StringDeclaration strDec = new StringDeclaration();
-        IntegerDeclaration intDec = new IntegerDeclaration(8, false, 8,
-                ByteOrder.BIG_ENDIAN, Encoding.NONE, null, 8);
-        FloatDeclaration flDec = new FloatDeclaration(8, 24,
-                ByteOrder.BIG_ENDIAN, 8);
-        SequenceDeclaration seqDec = new SequenceDeclaration(LEN, intDec);
-        StructDeclaration structDec = new StructDeclaration(8);
-        EnumDeclaration enumDec = new EnumDeclaration(intDec);
-        VariantDeclaration varDec = new VariantDeclaration();
-        ArrayDeclaration arrStrDec = new ArrayDeclaration(ARRAY_SIZE, strDec);
-        ArrayDeclaration arrFloatDec = new ArrayDeclaration(ARRAY_SIZE, flDec);
-        ArrayDeclaration arrIntDec = new ArrayDeclaration(ARRAY_SIZE, intDec);
-        ArrayDeclaration arrStructDec = new ArrayDeclaration(ARRAY_SIZE, structDec);
-        ArrayDeclaration arrVariantDec = new ArrayDeclaration(ARRAY_SIZE, varDec);
-        ArrayDeclaration arrEnumDec = new ArrayDeclaration(ARRAY_SIZE, enumDec);
-
-        sDec.addField(INT, intDec);
-        bb.put(TEST_NUMBER);
-
-        sDec.addField(ARRAY_INT, arrIntDec);
-        for (int i = 0; i < ARRAY_SIZE; ++i) {
-            bb.put(TEST_NUMBER);
-        }
-
-        sDec.addField(LEN, intDec);
-        bb.put(TEST_NUMBER);
-
-        sDec.addField(FLOAT, flDec);
-        bb.putFloat(TEST_NUMBER);
-
-        sDec.addField(ARRAY_FLOAT, arrFloatDec);
-        for (int i = 0; i < ARRAY_SIZE; ++i) {
-            bb.putFloat(TEST_NUMBER);
-        }
-
-        sDec.addField(STR, strDec);
-        bb.put(testStringBytes);
-        bb.put((byte) 0);
-
-        sDec.addField(ARRAY_STR, arrStrDec);
-        for (int i = 0; i < ARRAY_SIZE; ++i) {
-            bb.put(testStringBytes);
-            bb.put((byte) 0);
-        }
-
-        sDec.addField(SEQ, seqDec);
-        bb.put(TEST_NUMBER);
-        bb.put(TEST_NUMBER);
-
-        structDec.addField(STR, strDec);
-        structDec.addField(INT, intDec);
-        sDec.addField(STRUCT, structDec);
-        bb.put(testStringBytes);
-        bb.put((byte) 0);
-        bb.put(TEST_NUMBER);
-
-        sDec.addField(ARRAY_STRUCT, arrStructDec);
-        for (int i = 0; i < ARRAY_SIZE; ++i) {
-            bb.put(testStringBytes);
-            bb.put((byte) 0);
-            bb.put(TEST_NUMBER);
-        }
-
-        enumDec.add(0, 1, LEN);
-        enumDec.add(2, 3, FLOAT);
-        sDec.addField(ENUM, enumDec);
-        bb.put(TEST_NUMBER);
-
-        sDec.addField(ARRAY_ENUM, arrEnumDec);
-        for (int i = 0; i < ARRAY_SIZE; ++i) {
-            bb.put(TEST_NUMBER);
-        }
-
-        varDec.addField(LEN, intDec);
-        varDec.addField(FLOAT, flDec);
-        varDec.setTag(ENUM);
-        sDec.addField(VARIANT, varDec);
-        bb.putFloat(TEST_NUMBER);
-
-        sDec.addField(ARRAY_VARIANT, arrVariantDec);
-        for (int i = 0; i < ARRAY_SIZE; ++i) {
-            bb.putFloat(TEST_NUMBER);
-        }
-
-        fixture = sDec.createDefinition(fixture, ROOT);
-
-        bb.position(0);
-        fixture.read(new BitBuffer(bb));
-    }
-
-    /**
-     * Run the CtfTmfEventField parseField(Definition,String) method test.
-     */
-    @Test
-    public void testParseField_float() {
-        FloatDefinition fieldDef = (FloatDefinition) fixture.lookupDefinition(FLOAT);
-        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, "_" + NAME);
-        assertEquals("test=2.0", result.toString());
-    }
-
-    /**
-     * Run the CtfTmfEventField parseField(Definition,String) method test for an
-     * array of floats field.
-     */
-    @Test
-    public void testParseField_array_float() {
-        Definition fieldDef = fixture.lookupArray(ARRAY_FLOAT);
-        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
-        assertEquals("test=[2.0, 2.0]", result.toString());
-    }
-
-    /**
-     * Run the CtfTmfEventField parseField(Definition,String) method test.
-     */
-    @Test
-    public void testParseField_int() {
-        Definition fieldDef = fixture.lookupDefinition(INT);
-        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
-        assertEquals("test=02", result.toString());
-    }
-
-    /**
-     * Run the CtfTmfEventField parseField(Definition,String) method test for an
-     * array of integers field.
-     */
-    @Test
-    public void testParseField_array_int() {
-        Definition fieldDef = fixture.lookupArray(ARRAY_INT);
-        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
-        assertEquals("test=[02, 02]", result.toString());
-    }
-
-    /**
-     * Run the CtfTmfEventField parseField(Definition,String) method test.
-     */
-    @Test
-    public void testParseField_sequence() {
-        Definition fieldDef = fixture.lookupDefinition(SEQ);
-        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
-        assertEquals("test=[02, 02]", result.toString());
-    }
-
-    /**
-     * Run the CtfTmfEventField parseField(Definition,String) method test.
-     */
-    @Test
-    public void testParseField_sequence_value() {
-        Definition fieldDef = fixture.lookupDefinition(SEQ);
-        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
-        long[] values = (long[]) result.getValue();
-        long[] expected = new long[] { 2, 2 };
-        assertArrayEquals(expected, values);
-    }
-
-    /**
-     * Run the CtfTmfEventField parseField(Definition,String) method test.
-     */
-    @Test
-    public void testParseField_string() {
-        Definition fieldDef = fixture.lookupDefinition(STR);
-        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
-        assertEquals("test=two", result.toString());
-    }
-
-    /**
-     * Run the CtfTmfEventField parseField(Definition,String) method test for an
-     * array of strings field.
-     */
-    @Test
-    public void testParseField_array_string() {
-        Definition fieldDef = fixture.lookupArray(ARRAY_STR);
-        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
-        assertEquals("test=[two, two]", result.toString());
-    }
-
-    /**
-     * Run the CtfTmfEventField parseField(Definition,String) method test.
-     */
-    @Test
-    public void testParseField_struct() {
-        Definition fieldDef = fixture.lookupDefinition(STRUCT);
-        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
-        assertEquals("test=[str=two, int=02]", result.toString());
-    }
-
-    /**
-     * Run the CtfTmfEventField parseField(Definition,String) method test for an
-     * array of structs field.
-     */
-    @Test
-    public void testParseField_array_struct() {
-        Definition fieldDef = fixture.lookupArray(ARRAY_STRUCT);
-        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
-        assertEquals("test=[[str=two, int=02], [str=two, int=02]]", result.toString());
-    }
-
-    /**
-     * Run the CtfTmfEventField parseField(Definition,String) method test.
-     */
-    @Test
-    public void testParseField_enum() {
-        Definition fieldDef = fixture.lookupDefinition(ENUM);
-        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
-        assertEquals("test=float", result.toString());
-    }
-
-    /**
-     * Run the CtfTmfEventField parseField(Definition,String) method test for an
-     * array of enums field.
-     */
-    @Test
-    public void testParseField_array_enum() {
-        Definition fieldDef = fixture.lookupArray(ARRAY_ENUM);
-        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
-        assertEquals("test=[float, float]", result.toString());
-    }
-
-    /**
-     * Run the CtfTmfEventField parseField(Definition,String) method test.
-     */
-    @Test
-    public void testParseField_variant() {
-        Definition fieldDef = fixture.lookupDefinition(VARIANT);
-        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
-        assertEquals("test=float=2.0", result.toString());
-    }
-
-    /**
-     * Run the CtfTmfEventField parseField(Definition,String) method test for an
-     * array of variants field.
-     */
-    @Test
-    public void testParseField_array_variant() {
-        Definition fieldDef = fixture.lookupArray(ARRAY_VARIANT);
-        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
-        assertEquals("test=[float=2.0, float=2.0]", result.toString());
-    }
-}
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventTest.java
deleted file mode 100644 (file)
index 5ccb730..0000000
+++ /dev/null
@@ -1,223 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial generation with CodePro tools
- *   Alexandre Montplaisir - Clean up, consolidate redundant tests
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assume.assumeTrue;
-
-import java.util.Set;
-
-import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEventFactory;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEventType;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * The class <code>CtfTmfEventTest</code> contains tests for the class
- * <code>{@link CtfTmfEvent}</code>.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-public class CtfTmfEventTest {
-
-    private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
-
-    private static CtfTmfEvent nullEvent;
-    private CtfTmfEvent fixture;
-
-    /**
-     * Test class initialization
-     */
-    @BeforeClass
-    public static void initialize() {
-        nullEvent = CtfTmfEventFactory.getNullEvent();
-    }
-
-    /**
-     * Perform pre-test initialization.
-     * @throws CTFReaderException error
-     */
-    @Before
-    public void setUp() throws CTFReaderException {
-        assumeTrue(testTrace.exists());
-        CtfTmfTrace trace = testTrace.getTrace();
-        CtfIterator tr = new CtfIterator(trace);
-        tr.advance();
-        fixture = tr.getCurrentEvent();
-    }
-
-    /**
-     * Run the CTFEvent(EventDefinition,StreamInputReader) constructor test.
-     */
-    @Test
-    public void testCTFEvent_read() {
-        assertNotNull(fixture);
-    }
-
-    /**
-     * Run the int getCPU() method test.
-     */
-    @Test
-    public void testGetCPU() {
-        int result = nullEvent.getCPU();
-        assertEquals(-1, result);
-    }
-
-    /**
-     * Run the String getEventName() method test.
-     */
-    @Test
-    public void testGetEventName() {
-        String result = nullEvent.getType().getName();
-        assertEquals("Empty CTF event", result);
-    }
-
-    /**
-     * Run the ArrayList<String> getFieldNames() method test.
-     */
-    @Test
-    public void testGetFieldNames() {
-        String[] result = fixture.getContent().getFieldNames();
-        assertNotNull(result);
-    }
-
-    /**
-     * Run the Object getFieldValue(String) method test.
-     */
-    @Test
-    public void testGetFieldValue() {
-        String fieldName = "pid";
-        ITmfEventField result = fixture.getContent().getField(fieldName);
-
-        assertNotNull(result);
-        assertNotNull(result.getValue());
-    }
-
-    /**
-     * Run the HashMap<String, CTFEventField> getFields() method test.
-     */
-    @Test
-    public void testGetFields() {
-        ITmfEventField[] fields = nullEvent.getContent().getFields();
-        ITmfEventField[] fields2 = new ITmfEventField[0];
-        assertArrayEquals(fields2, fields);
-    }
-
-    /**
-     * Run the ITmfEventField getSubFieldValue(String[]) method test.
-     */
-    @Test
-    public void testGetSubFieldValue() {
-        /* Field exists */
-        String[] names = { "pid" };
-        assertNotNull(fixture.getContent().getSubField(names));
-
-        /* First field exists, not the second */
-        String[] names2 = { "pid", "abcd" };
-        assertNull(fixture.getContent().getSubField(names2));
-
-        /* Both field do not exist */
-        String[] names3 = { "pfid", "abcd" };
-        assertNull(fixture.getContent().getSubField(names3));
-
-        /* TODO Missing case of embedded field, need event for it */
-    }
-
-    /**
-     * Run the long getID() method test.
-     */
-    @Test
-    public void testGetID() {
-        long result = nullEvent.getID();
-        assertEquals(-1L, result);
-    }
-
-    /**
-     * Run the long getTimestamp() method test.
-     */
-    @Test
-    public void testGetTimestamp() {
-        long result = nullEvent.getTimestamp().getValue();
-        assertEquals(-1L, result);
-    }
-
-    /**
-     * Test the getters for the reference, source and type.
-     */
-    @Test
-    public void testGetters() {
-        long rank = fixture.getRank();
-        CtfTmfTrace trace = fixture.getTrace();
-        String reference = fixture.getReference();
-        String source = fixture.getSource();
-        ITmfEventType type = fixture.getType();
-        assertEquals(ITmfContext.UNKNOWN_RANK, rank);
-        assertEquals("kernel", trace.getName());
-        assertEquals("channel0_1", reference);
-        assertEquals("1", source);
-        assertEquals("lttng_statedump_vm_map", type.toString());
-    }
-
-    /**
-     * Test the custom CTF attributes methods. The test trace doesn't have any,
-     * so the list of attributes should be empty.
-     */
-    @Test
-    public void testCustomAttributes() {
-        Set<String> attributes = fixture.listCustomAttributes();
-        assertEquals(0, attributes.size());
-
-        String attrib = fixture.getCustomAttribute("bozo");
-        assertNull(attrib);
-    }
-
-    /**
-     * Test the toString() method
-     */
-    @Test
-    public void testToString() {
-        String s = fixture.getContent().toString();
-        assertEquals("pid=1922, start=0xb73ea000, end=0xb73ec000, flags=0x8000075, inode=917738, pgoff=0", s);
-    }
-
-    /**
-     * Test the {@link CtfTmfEventFactory#getNullEvent()} method, and the
-     * nullEvent's values.
-     */
-    @Test
-    public void testNullEvent() {
-        CtfTmfEvent nullEvent2 = CtfTmfEventFactory.getNullEvent();
-        assertSame(nullEvent2, nullEvent);
-        assertNotNull(nullEvent);
-        assertEquals(-1, nullEvent.getCPU());
-        assertEquals("Empty CTF event", nullEvent.getType().getName());
-        assertEquals("No stream", nullEvent.getReference());
-        assertArrayEquals(new ITmfEventField[0], nullEvent.getContent().getFields());
-        assertEquals(-1L, nullEvent.getID());
-        assertEquals(-1L, nullEvent.getTimestamp().getValue());
-    }
-}
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventTypeTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventTypeTest.java
deleted file mode 100644 (file)
index cbdf947..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial generation with CodePro tools
- *   Alexandre Montplaisir - Clean up, consolidate redundant tests
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEventType;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
-import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
-import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
-import org.junit.Test;
-
-/**
- * The class <code>CtfTmfEventTypeTest</code> contains tests for the class
- * <code>{@link CtfTmfEventType}</code>.
- *
- * @author ematkho
- * @version 1.0
- */
-public class CtfTmfEventTypeTest {
-
-    /**
-     * Run the CtfTmfEventType(String,String,ITmfEventField) constructor test.
-     */
-    @Test
-    public void testCtfTmfEventType() {
-        String eventName = "";
-        ITmfEventField content = new TmfEventField("", null, new ITmfEventField[] {});
-        CtfTmfEventType result = new CtfTmfEventType(eventName, new TmfTraceStub(), content);
-
-        assertNotNull(result);
-        assertEquals("", result.toString());
-        assertEquals("", result.getName());
-        assertEquals("Ctf Event/null", result.getContext());
-    }
-
-    /**
-     * Run the String toString() method test.
-     */
-    @Test
-    public void testToString() {
-        ITmfEventField emptyField = new TmfEventField("", null, new ITmfEventField[] {});
-        CtfTmfEventType fixture = new CtfTmfEventType("", new TmfTraceStub() , emptyField);
-
-        String result = fixture.toString();
-
-        assertEquals("", result);
-    }
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfLostEventsTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfLostEventsTest.java
deleted file mode 100644 (file)
index cc59951..0000000
+++ /dev/null
@@ -1,256 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
-
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfLostEvent;
-import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
-import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
-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.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Tests to verify that lost events are handled correctly.
- *
- * Be wary if you are using Babeltrace to cross-check those values. There could
- * be a bug in Babeltrace with regards to lost events. See
- * http://bugs.lttng.org/issues/589
- *
- * It's not 100% sure at this point which implementation is correct, so for now
- * these tests assume the Java implementation is the right one.
- *
- * @author Alexandre Montplaisir
- */
-public class CtfTmfLostEventsTest {
-
-    private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.HELLO_LOST;
-
-    private CtfTmfTrace fixture = null;
-
-    /**
-     * Class setup
-     */
-    @Before
-    public void setUp() {
-        assumeTrue(testTrace.exists());
-        fixture = testTrace.getTrace();
-        fixture.indexTrace(true);
-    }
-
-    /**
-     * Clean-up
-     */
-    @After
-    public void tearDown() {
-        if (fixture != null) {
-            fixture.dispose();
-        }
-    }
-
-    // ------------------------------------------------------------------------
-    // Test methods
-    // ------------------------------------------------------------------------
-
-    /**
-     * Test that the number of events is reported correctly (a range of lost
-     * events is counted as one event).
-     */
-    @Test
-    public void testNbEvents() {
-        final long expectedReal = 32300;
-        final long expectedLost = 562;
-
-        EventCountRequest req = new EventCountRequest();
-        fixture.sendRequest(req);
-        try {
-            req.waitForCompletion();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-
-        assertEquals(expectedReal, req.getReal());
-        assertEquals(expectedLost, req.getLost());
-    }
-
-    /**
-     * Test getting the first lost event from the trace.
-     */
-    @Test
-    public void testFirstLostEvent() {
-        final long rank = 153;
-        final ITmfTimestamp start = new CtfTmfTimestamp(1376592664828848222L);
-        final ITmfTimestamp end   = new CtfTmfTimestamp(1376592664828848540L);
-        final long nbLost = 859;
-
-        final CtfTmfEvent ev = getOneEventTime(start);
-        /* Make sure seeking by rank yields the same event */
-        final CtfTmfEvent ev2 = getOneEventRank(rank);
-        assertEquals(ev, ev2);
-
-        assertTrue(ev instanceof ITmfLostEvent);
-        ITmfLostEvent event = (ITmfLostEvent) ev;
-
-        assertEquals(start, event.getTimestamp());
-        assertEquals(start, event.getTimeRange().getStartTime());
-        assertEquals(end, event.getTimeRange().getEndTime());
-        assertEquals(nbLost, event.getNbLostEvents());
-    }
-
-    /**
-     * Test getting the second lost event from the trace.
-     */
-    @Test
-    public void testSecondLostEvent() {
-        final long rank = 191;
-        final ITmfTimestamp start = new CtfTmfTimestamp(1376592664829402521L);
-        final ITmfTimestamp end   = new CtfTmfTimestamp(1376592664829403076L);
-        final long nbLost = 488;
-
-        final CtfTmfEvent ev = getOneEventTime(start);
-        /* Make sure seeking by rank yields the same event */
-        final CtfTmfEvent ev2 = getOneEventRank(rank);
-        assertEquals(ev, ev2);
-
-        assertTrue(ev instanceof ITmfLostEvent);
-        ITmfLostEvent event = (ITmfLostEvent) ev;
-
-        assertEquals(start, event.getTimestamp());
-        assertEquals(start, event.getTimeRange().getStartTime());
-        assertEquals(end, event.getTimeRange().getEndTime());
-        assertEquals(nbLost, event.getNbLostEvents());
-    }
-
-    /**
-     * Test getting one normal event from the trace (lost events should not
-     * interfere).
-     */
-    @Test
-    public void testNormalEvent() {
-        final long rank = 200;
-        final ITmfTimestamp ts = new CtfTmfTimestamp(1376592664829423928L);
-
-        final CtfTmfEvent event = getOneEventTime(ts);
-        /* Make sure seeking by rank yields the same event */
-        final CtfTmfEvent event2 = getOneEventRank(rank);
-        assertEquals(event, event2);
-
-        assertFalse(event instanceof ITmfLostEvent);
-        assertEquals(ts, event.getTimestamp());
-    }
-
-    // ------------------------------------------------------------------------
-    // Event requests
-    // ------------------------------------------------------------------------
-
-    private CtfTmfEvent getOneEventRank(long rank) {
-        OneEventRequestPerRank req = new OneEventRequestPerRank(rank);
-        fixture.sendRequest(req);
-        try {
-            req.waitForCompletion();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-        return req.getEvent();
-    }
-
-    private CtfTmfEvent getOneEventTime(ITmfTimestamp ts) {
-        OneEventRequestPerTs req = new OneEventRequestPerTs(ts);
-        fixture.sendRequest(req);
-        try {
-            req.waitForCompletion();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-        return req.getEvent();
-    }
-
-    private class OneEventRequestPerRank extends TmfEventRequest {
-
-        private CtfTmfEvent event = null;
-
-        public OneEventRequestPerRank(long rank) {
-            super(CtfTmfEvent.class, TmfTimeRange.ETERNITY, rank, 1, ExecutionType.FOREGROUND);
-        }
-
-        @Override
-        public void handleData(ITmfEvent ev) {
-            /* Type is checked by the request, cast should be safe */
-            event = (CtfTmfEvent) ev;
-        }
-
-        public CtfTmfEvent getEvent() {
-            return event;
-        }
-    }
-
-    private class OneEventRequestPerTs extends TmfEventRequest {
-
-        private CtfTmfEvent event = null;
-
-        public OneEventRequestPerTs(ITmfTimestamp ts) {
-            super(CtfTmfEvent.class,
-                    new TmfTimeRange(ts, TmfTimestamp.PROJECT_IS_CANNED),
-                    0, 1, ExecutionType.FOREGROUND);
-        }
-
-        @Override
-        public void handleData(ITmfEvent ev) {
-            event = (CtfTmfEvent) ev;
-        }
-
-        public CtfTmfEvent getEvent() {
-            return event;
-        }
-    }
-
-    private class EventCountRequest extends TmfEventRequest {
-
-        private long nbReal = 0;
-        private long nbLost = 0;
-
-        public EventCountRequest() {
-            super(CtfTmfEvent.class, TmfTimeRange.ETERNITY, 0,
-                    ITmfEventRequest.ALL_DATA, ExecutionType.FOREGROUND);
-        }
-
-        @Override
-        public void handleData(ITmfEvent event) {
-            if (event instanceof ITmfLostEvent) {
-                nbLost++;
-            } else {
-                nbReal++;
-            }
-        }
-
-        public long getReal() {
-            return nbReal;
-        }
-
-        public long getLost() {
-            return nbLost;
-        }
-    }
-}
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfTimestampTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfTimestampTest.java
deleted file mode 100644 (file)
index 2f9b446..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial generation with CodePro tools
- *   Alexandre Montplaisir - Clean up, consolidate redundant tests
- *   Patrick Tasse - Fix for local time zone
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTimestamp;
-import org.junit.Test;
-
-/**
- * The class <code>CtfTmfTimestampTest</code> contains tests for the class
- * <code>{@link CtfTmfTimestamp}</code>.
- *
- * @author ematkho
- * @version 1.0
- */
-public class CtfTmfTimestampTest {
-
-    /**
-     * Run the CtfTmfTimestamp(long) constructor test.
-     */
-    @Test
-    public void testCtfTmfTimestamp() {
-        long timestamp = 1L;
-        DateFormat df = new SimpleDateFormat("HH:mm:ss.SSS");
-        Date d = new Date(timestamp / 1000000);
-
-        CtfTmfTimestamp result = new CtfTmfTimestamp(timestamp);
-
-        assertNotNull(result);
-        assertEquals(df.format(d) + " 000 001", result.toString());
-        assertEquals(0, result.getPrecision());
-        assertEquals(-9, result.getScale());
-        assertEquals(1L, result.getValue());
-    }
-}
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfTraceTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfTraceTest.java
deleted file mode 100644 (file)
index 602551c..0000000
+++ /dev/null
@@ -1,374 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial generation with CodePro tools
- *   Alexandre Montplaisir - Clean up, consolidate redundant tests
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfLocation;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfLocationInfo;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.linuxtools.tmf.core.signal.TmfEndSynchSignal;
-import org.eclipse.linuxtools.tmf.core.signal.TmfSignal;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
-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.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>CtfTmfTraceTest</code> contains tests for the class
- * <code>{@link CtfTmfTrace}</code>.
- *
- * @author ematkho
- * @version 1.0
- */
-public class CtfTmfTraceTest {
-
-    private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
-
-    private CtfTmfTrace fixture;
-
-    /**
-     * Perform pre-test initialization.
-     *
-     * @throws TmfTraceException
-     *             If the test trace is not found
-     */
-    @Before
-    public void setUp() throws TmfTraceException {
-        assumeTrue(testTrace.exists());
-        fixture = new CtfTmfTrace();
-        fixture.initTrace((IResource) null, testTrace.getPath(), CtfTmfEvent.class);
-    }
-
-    /**
-     * Perform post-test clean-up.
-     */
-    @After
-    public void tearDown() {
-        if (fixture != null) {
-            fixture.dispose();
-        }
-    }
-
-    /**
-     * Run the CtfTmfTrace() constructor test.
-     */
-    @Test
-    public void testCtfTmfTrace() {
-        CtfTmfTrace result = new CtfTmfTrace();
-
-        assertNotNull(result);
-        assertNull(result.getEventType());
-        assertEquals(1000, result.getCacheSize());
-        assertEquals(0L, result.getNbEvents());
-        assertEquals(0L, result.getStreamingInterval());
-        assertNull(result.getResource());
-        assertNull(result.getType());
-    }
-
-    /**
-     * Test the parseEvent() method
-     */
-    @Test
-    public void testParseEvent() {
-        ITmfContext ctx = fixture.seekEvent(0);
-        fixture.getNext(ctx);
-        CtfTmfEvent event = fixture.parseEvent(ctx);
-        assertNotNull(event);
-    }
-
-    /**
-     * Run the void broadcast(TmfSignal) method test.
-     */
-    @Test
-    public void testBroadcast() {
-        TmfSignal signal = new TmfEndSynchSignal(1);
-        fixture.broadcast(signal);
-    }
-
-
-    /**
-     * Run the void dispose() method test.
-     */
-    @Test
-    public void testDispose() {
-        CtfTmfTrace emptyFixture = new CtfTmfTrace();
-        emptyFixture.dispose();
-
-    }
-
-    /**
-     * Run the int getCacheSize() method test.
-     */
-    @Test
-    public void testGetCacheSize() {
-        CtfTmfTrace emptyFixture = new CtfTmfTrace();
-        int result = emptyFixture.getCacheSize();
-        assertEquals(1000, result);
-    }
-
-    /**
-     * Run the ITmfLocation<Comparable> getCurrentLocation() method test.
-     */
-    @Test
-    public void testGetCurrentLocation() {
-        CtfLocation result = (CtfLocation) fixture.getCurrentLocation();
-        assertNull(result);
-    }
-
-    /**
-     * Test the seekEvent() method with a null location.
-     */
-    @Test
-    public void testSeekEventLoc_null() {
-        CtfLocation loc = null;
-        fixture.seekEvent(loc);
-        assertNotNull(fixture);
-    }
-
-    /**
-     * Test the seekEvent() method with a location from a timestamp.
-     */
-    @Test
-    public void testSeekEventLoc_timetamp(){
-        CtfLocation loc = new CtfLocation(new CtfTmfTimestamp(0L));
-        fixture.seekEvent(loc);
-        assertNotNull(fixture);
-    }
-
-
-    /**
-     * Run the ITmfTimestamp getEndTime() method test.
-     */
-    @Test
-    public void testGetEndTime() {
-        ITmfTimestamp result = fixture.getEndTime();
-        assertNotNull(result);
-    }
-
-    /**
-     * Run the String getEnvironment method test.
-     */
-    @Test
-    public void testGetEnvValue() {
-        String key = "tracer_name";
-        String result = fixture.getTraceProperties().get(key);
-        assertEquals("\"lttng-modules\"",result);
-    }
-
-    /**
-     * Run the Class<CtfTmfEvent> getEventType() method test.
-     */
-    @Test
-    public void testGetEventType() {
-        Class<? extends ITmfEvent> result = fixture.getEventType();
-        assertNotNull(result);
-    }
-
-    /**
-     * Run the double getLocationRatio(ITmfLocation<?>) method test.
-     */
-    @Test
-    public void testGetLocationRatio() {
-        final CtfLocationInfo location2 = new CtfLocationInfo(1, 0);
-        CtfLocation location = new CtfLocation(location2);
-        double result = fixture.getLocationRatio(location);
-
-        assertEquals(Double.NEGATIVE_INFINITY, result, 0.1);
-    }
-
-    /**
-     * Run the String getName() method test.
-     */
-    @Test
-    public void testGetName() {
-        String result = fixture.getName();
-        assertNotNull(result);
-    }
-
-    /**
-     * Run the int getNbEnvVars() method test.
-     */
-    @Test
-    public void testGetNbEnvVars() {
-        int result = fixture.getTraceProperties().size();
-        assertEquals(8, result);
-    }
-
-    /**
-     * Run the long getNbEvents() method test.
-     */
-    @Test
-    public void testGetNbEvents() {
-        long result = fixture.getNbEvents();
-        assertEquals(1L, result);
-    }
-
-    /**
-     * Run the CtfTmfEvent getNext(ITmfContext) method test.
-     */
-    @Test
-    public void testGetNext() {
-        ITmfContext context = fixture.seekEvent(0);
-        CtfTmfEvent result = fixture.getNext(context);
-        assertNotNull(result);
-    }
-
-    /**
-     * Run the String getPath() method test.
-     */
-    @Test
-    public void testGetPath() {
-        String result = fixture.getPath();
-        assertNotNull(result);
-    }
-
-    /**
-     * Run the IResource getResource() method test.
-     */
-    @Test
-    public void testGetResource() {
-        IResource result = fixture.getResource();
-        assertNull(result);
-    }
-
-    /**
-     * Run the ITmfTimestamp getStartTime() method test.
-     */
-    @Test
-    public void testGetStartTime() {
-        ITmfTimestamp result = fixture.getStartTime();
-        assertNotNull(result);
-    }
-
-    /**
-     * Run the long getStreamingInterval() method test.
-     */
-    @Test
-    public void testGetStreamingInterval() {
-        long result = fixture.getStreamingInterval();
-        assertEquals(0L, result);
-    }
-
-    /**
-     * Run the TmfTimeRange getTimeRange() method test.
-     */
-    @Test
-    public void testGetTimeRange() {
-        TmfTimeRange result = fixture.getTimeRange();
-        assertNotNull(result);
-    }
-
-    /**
-     * Run the CtfTmfEvent readNextEvent(ITmfContext) method test.
-     */
-    @Test
-    public void testReadNextEvent() {
-        ITmfContext context = fixture.seekEvent(0);
-        CtfTmfEvent result = fixture.getNext(context);
-        assertNotNull(result);
-    }
-
-    /**
-     * Run the ITmfContext seekEvent(double) method test.
-     */
-    @Test
-    public void testSeekEvent_ratio() {
-        double ratio = 0.99;
-        ITmfContext result = fixture.seekEvent(ratio);
-        assertNotNull(result);
-    }
-
-    /**
-     * Run the ITmfContext seekEvent(long) method test.
-     */
-    @Test
-    public void testSeekEvent_rank() {
-        long rank = 1L;
-        ITmfContext result = fixture.seekEvent(rank);
-        assertNotNull(result);
-    }
-
-    /**
-     * Run the ITmfContext seekEvent(ITmfTimestamp) method test.
-     */
-    @Test
-    public void testSeekEvent_timestamp() {
-        ITmfTimestamp timestamp = new TmfTimestamp();
-        ITmfContext result = fixture.seekEvent(timestamp);
-        assertNotNull(result);
-    }
-
-    /**
-     * Run the ITmfContext seekEvent(ITmfLocation<?>) method test.
-     */
-    @Test
-    public void testSeekEvent_location() {
-        final CtfLocationInfo location2 = new CtfLocationInfo(1L, 0L);
-        CtfLocation ctfLocation = new CtfLocation(location2);
-        ITmfContext result = fixture.seekEvent(ctfLocation);
-        assertNotNull(result);
-    }
-
-    /**
-     * Run the boolean validate(IProject,String) method test.
-     */
-    @Test
-    public void testValidate() {
-        IProject project = null;
-        IStatus result = fixture.validate(project, testTrace.getPath());
-        assertTrue(result.isOK());
-    }
-
-    /**
-     * Run the boolean hasEvent(final String) method test
-     */
-    @Test
-    public void testEventLookup() {
-        assertTrue(fixture.hasEvent("sched_switch"));
-        assertFalse(fixture.hasEvent("Sched_switch"));
-        String[] events = { "sched_switch", "sched_wakeup", "timer_init" };
-        assertTrue(fixture.hasAllEvents(events));
-        assertTrue(fixture.hasAtLeastOneOfEvents(events));
-        String[] names = { "inexistent", "sched_switch", "SomeThing" };
-        assertTrue(fixture.hasAtLeastOneOfEvents(names));
-        assertFalse(fixture.hasAllEvents(names));
-    }
-
-    /**
-     * Run the String getHostId() method test
-     */
-    @Test
-    public void testCtfHostId() {
-        String a = fixture.getHostId();
-        assertEquals("\"84db105b-b3f4-4821-b662-efc51455106a\"", a);
-    }
-
-}
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/EventContextTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/EventContextTest.java
deleted file mode 100644 (file)
index 5786020..0000000
+++ /dev/null
@@ -1,241 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assume.assumeTrue;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
-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.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Tests for reading event contexts from a CtfTmfTrace.
- *
- * @author Alexandre Montplaisir
- */
-public class EventContextTest {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    /* We use test trace #2, kernel_vm, which has event contexts */
-    private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL_VM;
-
-    private CtfTmfTrace fixture;
-    private long startTime;
-    private long endTime;
-
-    // ------------------------------------------------------------------------
-    // Class  methods
-    // ------------------------------------------------------------------------
-
-    /**
-     * Perform pre-class initialization.
-     *
-     * @throws TmfTraceException
-     *             If the test trace is not found
-     */
-    @Before
-    public void setUp() throws TmfTraceException {
-        assumeTrue(testTrace.exists());
-        fixture = new CtfTmfTrace();
-        fixture.initTrace((IResource) null, testTrace.getPath(), CtfTmfEvent.class);
-        fixture.indexTrace(true);
-
-        startTime = fixture.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
-        endTime = fixture.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
-    }
-
-    /**
-     * Perform post-class clean-up.
-     */
-    @After
-    public void tearDown() {
-        if (fixture != null) {
-            fixture.dispose();
-        }
-    }
-
-    // ------------------------------------------------------------------------
-    // Test methods
-    // ------------------------------------------------------------------------
-
-    /**
-     * Make sure the trace is the correct one, and its timestamps are read
-     * correctly.
-     */
-    @Test
-    public void testTrace() {
-        assertEquals(1363700740555978750L, startTime);
-        assertEquals(1363700770550261288L, endTime);
-    }
-
-    /**
-     * Test the context of the very first event of the trace.
-     */
-    @Test
-    public void testContextStart() {
-        CtfTmfEvent firstEvent = getEventAt(startTime);
-        long perfPageFault = (Long) firstEvent.getContent().getField("context._perf_page_fault").getValue();
-        String procname = (String) firstEvent.getContent().getField("context._procname").getValue();
-        long tid = (Long) firstEvent.getContent().getField("context._tid").getValue();
-
-        assertEquals(613, perfPageFault);
-        assertEquals("lttng-sessiond", procname);
-        assertEquals(1230, tid);
-    }
-
-    /**
-     * Test the context of the event at 1363700745.559739078.
-     */
-    @Test
-    public void testContext1() {
-        long time = startTime + 5000000000L; // 1363700745.559739078
-        CtfTmfEvent event = getEventAt(time);
-        long perfPageFault = (Long) event.getContent().getField("context._perf_page_fault").getValue();
-        String procname = (String) event.getContent().getField("context._procname").getValue();
-        long tid = (Long) event.getContent().getField("context._tid").getValue();
-
-        assertEquals(6048, perfPageFault);
-        assertEquals("swapper/0", procname);
-        assertEquals(0, tid);
-    }
-
-    /**
-     * Test the context of the event at 1363700750.559707062.
-     */
-    @Test
-    public void testContext2() {
-        long time = startTime + 2 * 5000000000L; // 1363700750.559707062
-        CtfTmfEvent event = getEventAt(time);
-        long perfPageFault = (Long) event.getContent().getField("context._perf_page_fault").getValue();
-        String procname = (String) event.getContent().getField("context._procname").getValue();
-        long tid = (Long) event.getContent().getField("context._tid").getValue();
-
-        assertEquals(13258, perfPageFault);
-        assertEquals("swapper/0", procname);
-        assertEquals(0, tid);
-    }
-
-    /**
-     * Test the context of the event at 1363700755.555723128, which is roughly
-     * mid-way through the trace.
-     */
-    @Test
-    public void testContextMiddle() {
-        long midTime = startTime + (endTime - startTime) / 2L; // 1363700755.555723128
-        CtfTmfEvent midEvent = getEventAt(midTime);
-        long perfPageFault = (Long) midEvent.getContent().getField("context._perf_page_fault").getValue();
-        String procname = (String) midEvent.getContent().getField("context._procname").getValue();
-        long tid = (Long) midEvent.getContent().getField("context._tid").getValue();
-
-        assertEquals(19438, perfPageFault);
-        assertEquals("swapper/0", procname);
-        assertEquals(0, tid);
-    }
-
-    /**
-     * Test the context of the event at 1363700760.559719724.
-     */
-    @Test
-    public void testContext3() {
-        long time = startTime + 4 * 5000000000L; // 1363700760.559719724
-        CtfTmfEvent event = getEventAt(time);
-        long perfPageFault = (Long) event.getContent().getField("context._perf_page_fault").getValue();
-        String procname = (String) event.getContent().getField("context._procname").getValue();
-        long tid = (Long) event.getContent().getField("context._tid").getValue();
-
-        assertEquals(21507, perfPageFault);
-        assertEquals("swapper/0", procname);
-        assertEquals(0, tid);
-    }
-
-    /**
-     * Test the context of the event at 1363700765.559714634.
-     */
-    @Test
-    public void testContext4() {
-        long time = startTime + 5 * 5000000000L; // 1363700765.559714634
-        CtfTmfEvent event = getEventAt(time);
-        long perfPageFault = (Long) event.getContent().getField("context._perf_page_fault").getValue();
-        String procname = (String) event.getContent().getField("context._procname").getValue();
-        long tid = (Long) event.getContent().getField("context._tid").getValue();
-
-        assertEquals(21507, perfPageFault);
-        assertEquals("swapper/0", procname);
-        assertEquals(0, tid);
-    }
-
-    /**
-     * Test the context of the last event of the trace.
-     */
-    @Test
-    public void testContextEnd() {
-        CtfTmfEvent lastEvent = getEventAt(endTime);
-        long perfPageFault = (Long) lastEvent.getContent().getField("context._perf_page_fault").getValue();
-        String procname = (String) lastEvent.getContent().getField("context._procname").getValue();
-        long tid = (Long) lastEvent.getContent().getField("context._tid").getValue();
-
-        assertEquals(22117, perfPageFault);
-        assertEquals("lttng-sessiond", procname);
-        assertEquals(1230, tid);
-    }
-
-    // ------------------------------------------------------------------------
-    // Private stuff
-    // ------------------------------------------------------------------------
-
-    private synchronized CtfTmfEvent getEventAt(long timestamp) {
-        EventContextTestRequest req = new EventContextTestRequest(timestamp);
-        fixture.sendRequest(req);
-        try {
-            req.waitForCompletion();
-        } catch (InterruptedException e) {
-            return null;
-        }
-        return req.getEvent();
-    }
-
-    private class EventContextTestRequest extends TmfEventRequest {
-
-        private CtfTmfEvent retEvent = null;
-
-        public EventContextTestRequest(long timestamp) {
-            super(CtfTmfEvent.class,
-                    new TmfTimeRange(new CtfTmfTimestamp(timestamp), TmfTimestamp.BIG_CRUNCH),
-                    0, 1, ExecutionType.FOREGROUND);
-        }
-
-        @Override
-        public void handleData(ITmfEvent event) {
-            retEvent = (CtfTmfEvent) event;
-        }
-
-        public CtfTmfEvent getEvent() {
-            return retEvent;
-        }
-    }
-}
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/FunkyTraceTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/FunkyTraceTest.java
deleted file mode 100644 (file)
index a626c4c..0000000
+++ /dev/null
@@ -1,212 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assume.assumeTrue;
-
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfEnumPair;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
-import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
-import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
-import org.junit.rules.Timeout;
-
-/**
- * More advanced CTF tests using "funky_trace", a trace generated with the
- * Babeltrace CTF writer API, which has lots of fun things like different
- * integer/float sizes and non-standard struct alignments.
- *
- * @author Alexandre Montplaisir
- */
-public class FunkyTraceTest {
-
-    /** Time-out tests after 20 seconds */
-    @Rule
-    public TestRule globalTimeout= new Timeout(20000);
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.FUNKY_TRACE;
-    private static final double DELTA = 0.0000001;
-
-    private CtfTmfTrace fTrace;
-
-    // ------------------------------------------------------------------------
-    // Setup
-    // ------------------------------------------------------------------------
-
-    /**
-     * Test setup
-     */
-    @Before
-    public void setup() {
-        assumeTrue(testTrace.exists());
-        fTrace = testTrace.getTrace();
-        fTrace.indexTrace(true);
-    }
-
-    /**
-     * Clean-up
-     */
-    @After
-    public void tearDown() {
-        if (fTrace != null) {
-            fTrace.dispose();
-        }
-    }
-
-    // ------------------------------------------------------------------------
-    // Test methods
-    // ------------------------------------------------------------------------
-
-    /**
-     * Verify the contents of the first event
-     */
-    @Test
-    public void testFirstEvent() {
-        CtfTmfEvent event = getEvent(0);
-        assertEquals("Simple Event", event.getType().getName());
-        assertEquals(1234567, event.getTimestamp().getValue());
-        assertEquals(42, ((Long) event.getContent().getField("integer_field").getValue()).intValue());
-        assertEquals(3.1415, ((Double) event.getContent().getField("float_field").getValue()).doubleValue(), DELTA);
-    }
-
-    /**
-     * Verify the contents of the second event (the first "spammy event")
-     */
-    @Test
-    public void testSecondEvent() {
-        CtfTmfEvent event = getEvent(1);
-        assertEquals("Spammy_Event", event.getType().getName());
-        assertEquals(1234568, event.getTimestamp().getValue());
-        assertEquals(0, ((Long) event.getContent().getField("field_1").getValue()).intValue());
-        assertEquals("This is a test", event.getContent().getField("a_string").getValue());
-    }
-
-    /**
-     * Verify the contents of the last "spammy event"
-     */
-    @Test
-    public void testSecondToLastEvent() {
-        CtfTmfEvent event = getEvent(100000);
-        assertEquals("Spammy_Event", event.getType().getName());
-        assertEquals(1334567, event.getTimestamp().getValue());
-        assertEquals(99999, ((Long) event.getContent().getField("field_1").getValue()).intValue());
-        assertEquals("This is a test", event.getContent().getField("a_string").getValue());
-    }
-
-    /**
-     * Verify the contents of the last, complex event
-     */
-    @Test
-    public void testLastEvent() {
-        /*
-         * Last event as seen in Babeltrace:
-         * [19:00:00.001334568] (+0.000000001) Complex Test Event: { }, {
-         *     uint_35 = 0xDDF00D,
-         *     int_16 = -12345,
-         *     complex_structure = {
-         *         variant_selector = ( INT16_TYPE : container = 1 ),
-         *         a_string = "Test string",
-         *         variant_value = { INT16_TYPE = -200 },
-         *         inner_structure = {
-         *             seq_len = 0xA,
-         *             a_sequence = [ [0] = 4, [1] = 3, [2] = 2, [3] = 1, [4] = 0, [5] = -1, [6] = -2, [7] = -3, [8] = -4, [9] = -5 ]
-         *         }
-         *     }
-         * }
-         */
-
-        CtfTmfEvent event = getEvent(100001);
-        assertEquals("Complex Test Event", event.getType().getName());
-        assertEquals(1334568, event.getTimestamp().getValue());
-        assertEquals(0xddf00d, ((Long) event.getContent().getField("uint_35").getValue()).intValue());
-        assertEquals(-12345, ((Long) event.getContent().getField("int_16").getValue()).intValue());
-
-        ITmfEventField[] complexStruct =
-                (ITmfEventField[]) event.getContent().getField("complex_structure").getValue();
-
-        assertEquals("variant_selector", complexStruct[0].getName());
-        CtfEnumPair variant1 = (CtfEnumPair) complexStruct[0].getValue();
-        assertEquals("INT16_TYPE", variant1.getStringValue());
-        assertEquals(Long.valueOf(1), variant1.getLongValue());
-
-        assertEquals("a_string", complexStruct[1].getName());
-        assertEquals("Test string", complexStruct[1].getValue());
-
-        assertEquals("variant_value", complexStruct[2].getName());
-        ITmfEventField variantField = (ITmfEventField) complexStruct[2].getValue();
-        assertEquals("INT16_TYPE", variantField.getName());
-        assertEquals(Long.valueOf(-200), variantField.getValue());
-
-        ITmfEventField[] innerStruct = (ITmfEventField[]) complexStruct[3].getValue();
-
-        assertEquals("seq_len", innerStruct[0].getName());
-        assertEquals(Long.valueOf(10), innerStruct[0].getValue());
-
-        assertEquals("a_sequence", innerStruct[1].getName());
-        long[] seqValues = (long[]) innerStruct[1].getValue();
-        long[] expectedValues = { 4, 3, 2, 1, 0, -1, -2, -3, -4, -5 };
-        assertArrayEquals(expectedValues, seqValues);
-    }
-
-    // ------------------------------------------------------------------------
-    // Private stuff
-    // ------------------------------------------------------------------------
-
-    private synchronized CtfTmfEvent getEvent(long index) {
-        TestEventRequest req = new TestEventRequest(index);
-        fTrace.sendRequest(req);
-        try {
-            req.waitForCompletion();
-        } catch (InterruptedException e) {
-            return null;
-        }
-        return req.getEvent();
-    }
-
-    private class TestEventRequest extends TmfEventRequest {
-
-        private CtfTmfEvent fRetEvent = null;
-
-        public TestEventRequest(long index) {
-            super(CtfTmfEvent.class,
-                    TmfTimeRange.ETERNITY,
-                    index,
-                    1,
-                    ExecutionType.FOREGROUND);
-        }
-
-        @Override
-        public void handleData(ITmfEvent event) {
-            fRetEvent = (CtfTmfEvent) event;
-        }
-
-        public CtfTmfEvent getEvent() {
-            return fRetEvent;
-        }
-    }
-
-}
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/headless/Benchmark.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/headless/Benchmark.java
deleted file mode 100644 (file)
index 50c7f96..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor.headless;
-
-import java.util.Vector;
-
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfContext;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
-import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
-
-/**
- * Test and benchmark reading a CTF LTTng kernel trace.
- *
- * @author Matthew Khouzam
- */
-public class Benchmark {
-
-    /**
-     * Run the benchmark.
-     *
-     * @param args The command-line arguments
-     */
-    public static void main(final String[] args) {
-        final String TRACE_PATH = "testfiles/kernel";
-        final int NUM_LOOPS = 100;
-
-        // Change this to enable text output
-        final boolean USE_TEXT = true;
-
-        // Work variables
-        long nbEvent = 0L;
-        final Vector<Double> benchs = new Vector<>();
-        CtfTmfTrace trace = null;
-        long start, stop;
-        for (int loops = 0; loops < NUM_LOOPS; loops++) {
-            nbEvent = 0L;
-            trace = new CtfTmfTrace();
-            try {
-                trace.initTrace(null, TRACE_PATH, CtfTmfEvent.class);
-            } catch (final TmfTraceException e) {
-                loops = NUM_LOOPS +1;
-                break;
-            }
-
-            start = System.nanoTime();
-            if (nbEvent != -1) {
-                final CtfTmfContext traceReader = (CtfTmfContext) trace.seekEvent(0);
-
-                start = System.nanoTime();
-                CtfTmfEvent current = traceReader.getCurrentEvent();
-                while (current != null) {
-                    nbEvent++;
-                    if (USE_TEXT) {
-
-                        System.out.println("Event " + nbEvent + " Time "
-                                + current.getTimestamp().toString() + " type " + current.getType().getName()
-                                + " on CPU " + current.getSource() + " " + current.getContent().toString());
-                    }
-                    // advance the trace to the next event.
-                    boolean hasMore = traceReader.advance();
-                    if( hasMore ){
-                        // you can know the trace has more events.
-                    }
-                    current = traceReader.getCurrentEvent();
-                }
-            }
-            stop = System.nanoTime();
-            System.out.print('.');
-            final double time = (stop - start) / (double) nbEvent;
-            benchs.add(time);
-        }
-        System.out.println("");
-        double avg = 0;
-        for (final double val : benchs) {
-            avg += val;
-        }
-        avg /= benchs.size();
-        System.out.println("Time to read = " + avg + " events/ns");
-        for (final Double val : benchs) {
-            System.out.print(val);
-            System.out.print(", ");
-        }
-
-    }
-
-}
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/headless/RequestBenchmark.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/headless/RequestBenchmark.java
deleted file mode 100644 (file)
index 5701ac3..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   William Bourque <wbourque@gmail.com> - Initial API and implementation
- *   Matthew Khouzam - Update to CtfTmf trace and events
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor.headless;
-
-import java.util.Vector;
-
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
-import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
-
-/**
- * Benchmark the event request subsystem of TMF.
- */
-public class RequestBenchmark extends TmfEventRequest {
-
-    private RequestBenchmark(final Class<? extends ITmfEvent> dataType,
-            final TmfTimeRange range, final int nbRequested) {
-        super(dataType, range, 0, nbRequested, ExecutionType.FOREGROUND);
-    }
-
-    // Path of the trace
-    private static final String TRACE_PATH = "../org.eclipse.linuxtools.ctf.core.tests/traces/kernel";
-
-    // Change this to run several time over the same trace
-    private static final int NB_OF_PASS = 100;
-
-    // Work variables
-    private static int nbEvent = 0;
-    private static TmfExperiment fExperiment = null;
-    private static Vector<Double> benchs = new Vector<>();
-
-    /**
-     * Run the benchmark
-     *
-     * @param args
-     *            The command-line arguments
-     */
-    public static void main(final String[] args) {
-
-        try {
-            /* Our experiment will contains ONE trace */
-            final ITmfTrace[] traces = new ITmfTrace[1];
-            traces[0] = new CtfTmfTrace();
-            traces[0].initTrace(null, TRACE_PATH, CtfTmfEvent.class);
-            /* Create our new experiment */
-            fExperiment = new TmfExperiment(CtfTmfEvent.class, "Headless", traces);
-
-            /*
-             * We will issue a request for each "pass". TMF will then process
-             * them synchronously.
-             */
-            RequestBenchmark request = null;
-            for (int x = 0; x < NB_OF_PASS; x++) {
-                request = new RequestBenchmark(CtfTmfEvent.class,
-                        TmfTimeRange.ETERNITY, Integer.MAX_VALUE);
-                fExperiment.sendRequest(request);
-            }
-            prev = System.nanoTime();
-        } catch (final NullPointerException e) {
-            /*
-             * Silently dismiss Null pointer exception The only way to "finish"
-             * the threads in TMF is by crashing them with null.
-             */
-        } catch (final Exception e) {
-            e.printStackTrace();
-        }
-
-    }
-
-    @Override
-    public void handleData(final ITmfEvent event) {
-        super.handleData(event);
-        nbEvent++;
-
-    }
-
-    static long prev;
-    static long done = 0;
-    @Override
-    public void handleCompleted() {
-        final long next = System.nanoTime();
-        double val = next - prev;
-        final int nbEvent2 = nbEvent;
-        val /= nbEvent2;
-
-        nbEvent = 0;
-        prev = next;
-        benchs.add(val);
-        if (benchs.size() == NB_OF_PASS) {
-            try {
-                System.out.println("Nb events : " + nbEvent2);
-
-                for (final double value : benchs) {
-                    System.out.print(value + ", ");
-                }
-                fExperiment.sendRequest(null);
-
-            } catch (final Exception e) {
-            }
-        }
-    }
-
-    @Override
-    public void handleSuccess() {
-    }
-
-    @Override
-    public void handleFailure() {
-    }
-
-    @Override
-    public void handleCancel() {
-    }
-
-}
index 1dbe93d038b37f542dfb582537beb72dcc2d55c9..59c5dbef42da43bc4ffe0668b54c54c431f9d61a 100644 (file)
@@ -23,7 +23,6 @@ import org.junit.runners.Suite;
 @Suite.SuiteClasses({
     TmfCoalescedEventRequestTest.class,
     TmfEventRequestTest.class,
-    TmfSchedulerTest.class
 })
 public class AllTests {
 
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/TmfSchedulerBenchmark.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/TmfSchedulerBenchmark.java
deleted file mode 100644 (file)
index 952d1f1..0000000
+++ /dev/null
@@ -1,360 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Simon Delisle - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.request;
-
-import java.io.PrintWriter;
-
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
-import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
-import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
-
-/**
- * Benchmark for the request scheduler
- *
- * The benchmark has three tests. The first one is the latency (time between the
- * creation of the request and the beginning of its execution). The second one
- * is the average waiting time for a request. The last one is the total
- * completion time.
- */
-public class TmfSchedulerBenchmark {
-
-    // ------------------------------------------------------------------------
-    // Constants
-    // ------------------------------------------------------------------------
-
-    private static final int NUM_LOOPS = 10;
-    private static final int NANOSECONDS_IN_MILLISECONDS = 1000000;
-    private static final int NANOSECONDS_IN_SECONDS = 1000000000;
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    private static CtfTmfTrace trace = CtfTmfTestTrace.KERNEL.getTrace();
-    private static ForegroundRequest lastForegroundRequest = null;
-    private static BackgroundRequest lastBackgroundRequest = null;
-
-    private static PrintWriter pw = new PrintWriter(System.out, true);
-
-    /**
-     * Start the benchmark
-     *
-     * @param args
-     *            The command-line arguments
-     */
-    public static void main(final String[] args) {
-        trace.indexTrace(true);
-        pw.println("---------- Benchmark started ----------");
-        latencyBenchmark();
-        averageWaitingTime();
-        completedTime();
-        benchmarkResults();
-        trace.dispose();
-    }
-
-    private static void latencyBenchmark() {
-        long averageLatency = 0;
-
-        pw.println("----- Latency -----");
-        for (int i = 0; i < NUM_LOOPS; i++) {
-            try {
-                ForegroundRequest foreground1 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-                trace.sendRequest(foreground1);
-                foreground1.waitForCompletion();
-                averageLatency += foreground1.getLatency();
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-            }
-        }
-        pw.println((averageLatency / NUM_LOOPS) / NANOSECONDS_IN_MILLISECONDS + " ms");
-    }
-
-    private static void averageWaitingTime() {
-        long averageWaitingBackground = 0;
-        long averageWaitingForeground1 = 0;
-        long averageWaitingForeground2 = 0;
-
-        pw.println("----- Average waiting time with 3 requests -----");
-        for (int i = 0; i < NUM_LOOPS; i++) {
-            ForegroundRequest foreground1 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-            ForegroundRequest foreground2 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-            BackgroundRequest background1 = new BackgroundRequest(TmfTimeRange.ETERNITY);
-            trace.sendRequest(background1);
-            trace.sendRequest(foreground1);
-            trace.sendRequest(foreground2);
-            try {
-                foreground1.waitForCompletion();
-                foreground2.waitForCompletion();
-                background1.waitForCompletion();
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-            }
-            averageWaitingBackground += background1.getAverageWaitingTime();
-            averageWaitingForeground1 += foreground1.getAverageWaitingTime();
-            averageWaitingForeground2 += foreground2.getAverageWaitingTime();
-        }
-        pw.print("-- Background : ");
-        pw.println((averageWaitingBackground / NUM_LOOPS) / NANOSECONDS_IN_MILLISECONDS + " ms");
-
-        pw.print("-- First foreground : ");
-        pw.println((averageWaitingForeground1 / NUM_LOOPS) / NANOSECONDS_IN_MILLISECONDS + " ms");
-
-        pw.print("-- Second foreground : ");
-        pw.println((averageWaitingForeground2 / NUM_LOOPS) / NANOSECONDS_IN_MILLISECONDS + " ms");
-    }
-
-    private static void completedTime() {
-        long averageCompletedTime1 = 0;
-        long averageCompletedTime2 = 0;
-        long averageCompletedTime3 = 0;
-        long averageCompletedTime4 = 0;
-        long averageCompletedTime5 = 0;
-        long averageCompletedTime6 = 0;
-
-        pw.println("----- Time to complete request -----");
-        for (int i = 0; i < NUM_LOOPS; i++) {
-            try {
-                ForegroundRequest foreground1 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-                trace.sendRequest(foreground1);
-                foreground1.waitForCompletion();
-                averageCompletedTime1 += foreground1.getCompletedTime();
-
-                ForegroundRequest foreground2 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-                ForegroundRequest foreground3 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-                trace.sendRequest(foreground2);
-                trace.sendRequest(foreground3);
-                foreground2.waitForCompletion();
-                foreground3.waitForCompletion();
-                averageCompletedTime2 += (foreground2.getCompletedTime() + foreground3.getCompletedTime());
-
-                ForegroundRequest foreground4 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-                BackgroundRequest background1 = new BackgroundRequest(TmfTimeRange.ETERNITY);
-                trace.sendRequest(foreground4);
-                trace.sendRequest(background1);
-                foreground4.waitForCompletion();
-                background1.waitForCompletion();
-                averageCompletedTime3 += (foreground4.getCompletedTime() + background1.getCompletedTime());
-
-                ForegroundRequest foreground5 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-                ForegroundRequest foreground6 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-                BackgroundRequest background2 = new BackgroundRequest(TmfTimeRange.ETERNITY);
-                trace.sendRequest(foreground5);
-                trace.sendRequest(foreground6);
-                trace.sendRequest(background2);
-                foreground5.waitForCompletion();
-                foreground6.waitForCompletion();
-                background2.waitForCompletion();
-                averageCompletedTime4 += (foreground5.getCompletedTime() + foreground6.getCompletedTime() + background2.getCompletedTime());
-
-                ForegroundRequest foreground7 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-                ForegroundRequest foreground8 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-                ForegroundRequest foreground9 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-                BackgroundRequest background3 = new BackgroundRequest(TmfTimeRange.ETERNITY);
-                trace.sendRequest(foreground7);
-                trace.sendRequest(foreground8);
-                trace.sendRequest(foreground9);
-                trace.sendRequest(background3);
-                foreground7.waitForCompletion();
-                foreground8.waitForCompletion();
-                foreground9.waitForCompletion();
-                background3.waitForCompletion();
-                averageCompletedTime5 += (foreground7.getCompletedTime() + foreground8.getCompletedTime() + foreground9.getCompletedTime() + background3.getCompletedTime());
-
-                ForegroundRequest foreground10 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-                ForegroundRequest foreground11 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-                ForegroundRequest foreground12 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-                ForegroundRequest foreground13 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-                BackgroundRequest background4 = new BackgroundRequest(TmfTimeRange.ETERNITY);
-                trace.sendRequest(foreground10);
-                trace.sendRequest(foreground11);
-                trace.sendRequest(foreground12);
-                trace.sendRequest(foreground13);
-                trace.sendRequest(background4);
-                foreground10.waitForCompletion();
-                foreground11.waitForCompletion();
-                foreground12.waitForCompletion();
-                foreground13.waitForCompletion();
-                background4.waitForCompletion();
-                averageCompletedTime6 += (foreground10.getCompletedTime() + foreground11.getCompletedTime() + foreground12.getCompletedTime() + foreground13.getCompletedTime() + background4.getCompletedTime());
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-            }
-        }
-
-        pw.print("-- Time to complete one request : ");
-        pw.println((averageCompletedTime1 / NUM_LOOPS) / NANOSECONDS_IN_SECONDS + " s");
-
-        pw.print("-- Time to complete 2 requests (2 foreground) : ");
-        pw.println((averageCompletedTime2 / NUM_LOOPS) / NANOSECONDS_IN_SECONDS + " s");
-
-        pw.print("-- Time to complete 2 requests (1 foreground, 1 background) : ");
-        pw.println((averageCompletedTime3 / NUM_LOOPS) / NANOSECONDS_IN_SECONDS + " s");
-
-        pw.print("-- Time to complete 3 requests (2 foreground, 1 background) : ");
-        pw.println((averageCompletedTime4 / NUM_LOOPS) / NANOSECONDS_IN_SECONDS + " s");
-
-        pw.print("-- Time to complete 4 requests (3 foreground, 1 background) : ");
-        pw.println((averageCompletedTime5 / NUM_LOOPS) / NANOSECONDS_IN_SECONDS + " s");
-
-        pw.print("-- Time to complete 5 requests (4 foreground, 1 background) : ");
-        pw.println((averageCompletedTime6 / NUM_LOOPS) / NANOSECONDS_IN_SECONDS + " s");
-    }
-
-    /**
-     * The benchmark results
-     */
-    public static void benchmarkResults() {
-        pw.println("---------- Benchmark completed ----------");
-    }
-
-    // ------------------------------------------------------------------------
-    // Helper methods
-    // ------------------------------------------------------------------------
-
-    private static class BackgroundRequest extends TmfEventRequest {
-        private long startTime;
-        private long endTimeLatency = -1;
-        private long completedTime = 0;
-        private long waitingTimeStart = 0;
-        private long waitingTimeEnd = 0;
-        private long waitingTime = 0;
-        private int waitingCounter = 0;
-        private boolean isWaiting = false;
-
-        BackgroundRequest(TmfTimeRange timeRange) {
-            super(trace.getEventType(),
-                    timeRange,
-                    0,
-                    ITmfEventRequest.ALL_DATA,
-                    ExecutionType.BACKGROUND);
-            startTime = System.nanoTime();
-        }
-
-        @Override
-        public void handleData(final ITmfEvent event) {
-            if (endTimeLatency == -1) {
-                endTimeLatency = System.nanoTime();
-            }
-            super.handleData(event);
-            if (lastForegroundRequest == null && lastBackgroundRequest == null) {
-                lastBackgroundRequest = this;
-            }
-            if (isWaiting) {
-                waitingTimeEnd = System.nanoTime();
-                waitingTime += waitingTimeEnd - waitingTimeStart;
-                ++waitingCounter;
-                isWaiting = false;
-            }
-            if (lastForegroundRequest != null) {
-                lastForegroundRequest.waitingTimeStart = System.nanoTime();
-                lastForegroundRequest.isWaiting = true;
-                lastForegroundRequest = null;
-                lastBackgroundRequest = this;
-            }
-            if (lastBackgroundRequest != this) {
-                lastBackgroundRequest.waitingTimeStart = System.nanoTime();
-                lastBackgroundRequest.isWaiting = true;
-                lastBackgroundRequest = this;
-            }
-        }
-
-        @Override
-        public void handleCompleted() {
-            completedTime = System.nanoTime();
-            super.handleCompleted();
-        }
-
-        public long getCompletedTime() {
-            return completedTime - startTime;
-        }
-
-        public long getAverageWaitingTime() {
-            if (waitingCounter == 0) {
-                return 0;
-            }
-            return waitingTime / waitingCounter;
-        }
-    }
-
-    private static class ForegroundRequest extends TmfEventRequest {
-        private long startTime = 0;
-        private long endTimeLatency = -1;
-        private long completedTime = 0;
-        private long waitingTimeStart = 0;
-        private long waitingTimeEnd = 0;
-        private long waitingTime = 0;
-        private int waitingCounter = 0;
-        private boolean isWaiting = false;
-
-        ForegroundRequest(TmfTimeRange timeRange) {
-            super(trace.getEventType(),
-                    timeRange,
-                    0,
-                    ITmfEventRequest.ALL_DATA,
-                    ExecutionType.FOREGROUND);
-            startTime = System.nanoTime();
-        }
-
-        @Override
-        public void handleData(final ITmfEvent event) {
-            if (endTimeLatency == -1) {
-                endTimeLatency = System.nanoTime();
-            }
-            super.handleData(event);
-            if (lastBackgroundRequest == null && lastForegroundRequest == null) {
-                lastForegroundRequest = this;
-            }
-            if (isWaiting) {
-                waitingTimeEnd = System.nanoTime();
-                waitingTime += waitingTimeEnd - waitingTimeStart;
-                ++waitingCounter;
-                isWaiting = false;
-            }
-            if (lastBackgroundRequest != null) {
-                lastBackgroundRequest.waitingTimeStart = System.nanoTime();
-                lastBackgroundRequest.isWaiting = true;
-                lastBackgroundRequest = null;
-                lastForegroundRequest = this;
-            }
-            if (lastForegroundRequest != this) {
-                lastForegroundRequest.waitingTimeStart = System.nanoTime();
-                lastForegroundRequest.isWaiting = true;
-                lastForegroundRequest = this;
-            }
-        }
-
-        @Override
-        public void handleCompleted() {
-            completedTime = System.nanoTime();
-            super.handleCompleted();
-        }
-
-        public long getLatency() {
-            return endTimeLatency - startTime;
-        }
-
-        public long getCompletedTime() {
-            return completedTime - startTime;
-        }
-
-        public long getAverageWaitingTime() {
-            if (waitingCounter == 0) {
-                return 0;
-            }
-            return waitingTime / waitingCounter;
-        }
-    }
-}
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/TmfSchedulerTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/TmfSchedulerTest.java
deleted file mode 100644 (file)
index 3ea70bc..0000000
+++ /dev/null
@@ -1,451 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Simon Delisle - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.request;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
-import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
-import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
-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.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
-import org.junit.rules.Timeout;
-
-/**
- * Test suite for the scheduler.
- */
-public class TmfSchedulerTest {
-
-    /** Time-out tests after 60 seconds */
-    @Rule
-    public TestRule globalTimeout= new Timeout(60000);
-
-    // ------------------------------------------------------------------------
-    // Constants
-    // ------------------------------------------------------------------------
-
-    private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
-    private static final int NB_EVENTS_TRACE = 695319;
-    private static final int NB_EVENTS_TIME_RANGE = 155133;
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    private CtfTmfTrace fixture;
-
-    private long fStartTime;
-    private long fEndTime;
-    private TmfTimeRange fForegroundTimeRange;
-
-    private final List<String> fOrderList = new ArrayList<>();
-    private int fForegroundId = 0;
-    private int fBackgroundId = 0;
-
-    /**
-     * Perform pre-test initialization.
-     *
-     * @throws TmfTraceException
-     *             If the test trace is not found
-     */
-    @Before
-    public void setUp() throws TmfTraceException {
-        assumeTrue(testTrace.exists());
-        fixture = new CtfTmfTrace();
-        fixture.initTrace((IResource) null, testTrace.getPath(), CtfTmfEvent.class);
-        fixture.indexTrace(true);
-        fStartTime = fixture.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
-        fEndTime = fixture.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
-
-        long foregroundStartTime = fStartTime + ((fEndTime - fStartTime) / 4);
-        long foregroundEndTime = fStartTime + ((fEndTime - fStartTime) / 2);
-        fForegroundTimeRange = new TmfTimeRange(new TmfTimestamp(foregroundStartTime, ITmfTimestamp.NANOSECOND_SCALE, 0), new TmfTimestamp(foregroundEndTime, ITmfTimestamp.NANOSECOND_SCALE, 0));
-    }
-
-    /**
-     * Perform post-test clean-up.
-     */
-    @After
-    public void tearDown() {
-        if (fixture != null) {
-            fixture.dispose();
-        }
-    }
-
-    // ------------------------------------------------------------------------
-    // Tests cases
-    // ------------------------------------------------------------------------
-
-    /**
-     * Test one background request
-     */
-    @Test
-    public void backgroundRequest() {
-        BackgroundRequest background = new BackgroundRequest(TmfTimeRange.ETERNITY);
-        fixture.sendRequest(background);
-        try {
-            background.waitForCompletion();
-        } catch (InterruptedException e) {
-            fail();
-        }
-        assertEquals(NB_EVENTS_TRACE, background.getNbEvents());
-    }
-
-    /**
-     * Test one foreground request
-     */
-    @Test
-    public void foregroundRequest() {
-        ForegroundRequest foreground = new ForegroundRequest(TmfTimeRange.ETERNITY);
-        fixture.sendRequest(foreground);
-        try {
-            foreground.waitForCompletion();
-        } catch (InterruptedException e) {
-            fail();
-        }
-        assertEquals(NB_EVENTS_TRACE, foreground.getNbEvents());
-    }
-
-    /**
-     * Test one foreground and one background request for the entire trace at
-     * the same time
-     */
-    @Test
-    public void TestMultiRequest1() {
-        BackgroundRequest background = new BackgroundRequest(TmfTimeRange.ETERNITY);
-        ForegroundRequest foreground = new ForegroundRequest(TmfTimeRange.ETERNITY);
-
-        fixture.sendRequest(background);
-        fixture.sendRequest(foreground);
-        try {
-            background.waitForCompletion();
-            foreground.waitForCompletion();
-        } catch (InterruptedException e) {
-            fail();
-        }
-
-        assertEquals(NB_EVENTS_TRACE, background.getNbEvents());
-        assertEquals(NB_EVENTS_TRACE, foreground.getNbEvents());
-    }
-
-    /**
-     * Test one background request for the entire trace and one foreground
-     * request for smaller time range
-     */
-    @Test
-    public void TestMultiRequest2() {
-        BackgroundRequest background2 = new BackgroundRequest(TmfTimeRange.ETERNITY);
-        ForegroundRequest foreground2 = new ForegroundRequest(fForegroundTimeRange);
-
-        fixture.sendRequest(background2);
-        fixture.sendRequest(foreground2);
-        try {
-            background2.waitForCompletion();
-            foreground2.waitForCompletion();
-        } catch (InterruptedException e) {
-            fail();
-        }
-
-        assertEquals(NB_EVENTS_TRACE, background2.getNbEvents());
-        assertEquals(NB_EVENTS_TIME_RANGE, foreground2.getNbEvents());
-    }
-
-    /**
-     * Test two foreground request, one to select a time range and one to select
-     * an event in this time range
-     */
-    @Test
-    public void TestMultiRequest3() {
-        ForegroundRequest foreground3 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-        fixture.sendRequest(foreground3);
-
-        TmfTimeSynchSignal signal3 = new TmfTimeSynchSignal(this, new TmfTimestamp(fForegroundTimeRange.getStartTime()));
-        fixture.broadcast(signal3);
-
-        try {
-            foreground3.waitForCompletion();
-        } catch (InterruptedException e) {
-            fail();
-        }
-
-        assertEquals(NB_EVENTS_TRACE, foreground3.getNbEvents());
-    }
-
-    /**
-     * Test two foreground request, one to select a time range and one to select
-     * an event before this time range
-     */
-    @Test
-    public void TestMultiRequest4() {
-        ForegroundRequest foreground4 = new ForegroundRequest(fForegroundTimeRange);
-        fixture.sendRequest(foreground4);
-        TmfTimeSynchSignal signal4 = new TmfTimeSynchSignal(this, new TmfTimestamp(fStartTime + ((fEndTime - fStartTime) / 8)));
-        fixture.broadcast(signal4);
-
-        try {
-            foreground4.waitForCompletion();
-        } catch (InterruptedException e) {
-            fail();
-        }
-
-        assertEquals(NB_EVENTS_TIME_RANGE, foreground4.getNbEvents());
-    }
-
-    /**
-     * Test two foreground request, one to select a time range and one to select
-     * an event after this time range
-     */
-    @Test
-    public void TestMultiRequest5() {
-        ForegroundRequest foreground5 = new ForegroundRequest(fForegroundTimeRange);
-        fixture.sendRequest(foreground5);
-        TmfTimeSynchSignal signal5 = new TmfTimeSynchSignal(this, new TmfTimestamp(fEndTime - ((fEndTime - fStartTime) / 4)));
-        fixture.broadcast(signal5);
-
-        try {
-            foreground5.waitForCompletion();
-        } catch (InterruptedException e) {
-            fail();
-        }
-
-        assertEquals(NB_EVENTS_TIME_RANGE, foreground5.getNbEvents());
-    }
-
-    /**
-     * Test one background and one foreground request for the entire trace and
-     * one foreground request to select an event
-     */
-    @Test
-    public void TestMultiRequest6() {
-        BackgroundRequest background6 = new BackgroundRequest(TmfTimeRange.ETERNITY);
-        ForegroundRequest foreground6 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-
-        fixture.sendRequest(background6);
-        fixture.sendRequest(foreground6);
-
-        TmfTimeSynchSignal signal6 = new TmfTimeSynchSignal(this, new TmfTimestamp(fStartTime + ((fEndTime - fStartTime) / 8)));
-        fixture.broadcast(signal6);
-
-        try {
-            background6.waitForCompletion();
-            foreground6.waitForCompletion();
-        } catch (InterruptedException e) {
-            fail();
-        }
-
-        assertEquals(NB_EVENTS_TRACE, background6.getNbEvents());
-        assertEquals(NB_EVENTS_TRACE, foreground6.getNbEvents());
-    }
-
-    /**
-     * Four request, two foreground and two background
-     */
-    @Test
-    public void TestMultiRequest7() {
-        ForegroundRequest foreground7 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-        ForegroundRequest foreground8 = new ForegroundRequest(fForegroundTimeRange);
-        BackgroundRequest background7 = new BackgroundRequest(TmfTimeRange.ETERNITY);
-        BackgroundRequest background8 = new BackgroundRequest(TmfTimeRange.ETERNITY);
-        fixture.sendRequest(foreground7);
-        fixture.sendRequest(foreground8);
-        fixture.sendRequest(background7);
-        fixture.sendRequest(background8);
-        try {
-            foreground7.waitForCompletion();
-            foreground8.waitForCompletion();
-            background7.waitForCompletion();
-            background8.waitForCompletion();
-        } catch (InterruptedException e) {
-            fail();
-        }
-        assertEquals(NB_EVENTS_TRACE, foreground7.getNbEvents());
-        assertEquals(NB_EVENTS_TIME_RANGE, foreground8.getNbEvents());
-        assertEquals(NB_EVENTS_TRACE, background7.getNbEvents());
-        assertEquals(NB_EVENTS_TRACE, background8.getNbEvents());
-    }
-
-    /**
-     * One long foreground request and one short foreground request, the short
-     * one should finish first
-     */
-    @Test
-    public void preemptedForegroundRequest() {
-        ForegroundRequest foreground9 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-        TmfTimeRange shortTimeRange = new TmfTimeRange(new TmfTimestamp(fStartTime, ITmfTimestamp.NANOSECOND_SCALE, 0), new TmfTimestamp(fStartTime + ((fEndTime - fStartTime) / 16), ITmfTimestamp.NANOSECOND_SCALE, 0));
-        ForegroundRequest shortForeground = new ForegroundRequest(shortTimeRange);
-        fixture.sendRequest(foreground9);
-        try {
-            foreground9.waitForStart();
-        } catch (InterruptedException e) {
-            fail();
-        }
-        fixture.sendRequest(shortForeground);
-        try {
-            shortForeground.waitForCompletion();
-        } catch (InterruptedException e) {
-            fail();
-        }
-        assertFalse(foreground9.isCompleted());
-    }
-
-    /**
-     * One long background request and one short foreground request, the
-     * foreground request should finish first
-     */
-    @Test
-    public void preemptedBackgroundRequest() {
-        BackgroundRequest background9 = new BackgroundRequest(TmfTimeRange.ETERNITY);
-        ForegroundRequest foreground10 = new ForegroundRequest(fForegroundTimeRange);
-        fixture.sendRequest(background9);
-        fixture.sendRequest(foreground10);
-        try {
-            foreground10.waitForCompletion();
-        } catch (InterruptedException e) {
-            fail();
-        }
-        assertTrue(foreground10.isCompleted());
-        assertFalse(background9.isCompleted());
-    }
-
-    /**
-     * Test if the scheduler is working as expected
-     */
-    @Ignore
-    @Test
-    public void executionOrder() {
-        List<String> expectedOrder = new LinkedList<>();
-        expectedOrder.add("FOREGROUND1");
-        expectedOrder.add("FOREGROUND2");
-        expectedOrder.add("FOREGROUND3");
-        expectedOrder.add("FOREGROUND4");
-        expectedOrder.add("BACKGROUND1");
-        expectedOrder.add("FOREGROUND1");
-        expectedOrder.add("FOREGROUND2");
-        expectedOrder.add("FOREGROUND3");
-        expectedOrder.add("FOREGROUND4");
-        expectedOrder.add("BACKGROUND2");
-
-        fOrderList.clear();
-        fForegroundId = 0;
-        fBackgroundId = 0;
-
-        BackgroundRequest background1 = new BackgroundRequest(TmfTimeRange.ETERNITY);
-        BackgroundRequest background2 = new BackgroundRequest(TmfTimeRange.ETERNITY);
-
-        ForegroundRequest foreground1 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-        ForegroundRequest foreground2 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-        ForegroundRequest foreground3 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-        ForegroundRequest foreground4 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-
-        fixture.sendRequest(foreground1);
-        fixture.sendRequest(foreground2);
-        fixture.sendRequest(foreground3);
-        fixture.sendRequest(foreground4);
-        fixture.sendRequest(background1);
-        fixture.sendRequest(background2);
-        try {
-            foreground1.waitForCompletion();
-            foreground2.waitForCompletion();
-            foreground3.waitForCompletion();
-            foreground4.waitForCompletion();
-            background1.waitForCompletion();
-            background2.waitForCompletion();
-        } catch (InterruptedException e) {
-            fail();
-        }
-        assertEquals(expectedOrder, fOrderList.subList(0, expectedOrder.size()));
-    }
-
-    // ------------------------------------------------------------------------
-    // Helper methods
-    // ------------------------------------------------------------------------
-
-    private class BackgroundRequest extends TmfEventRequest {
-        private int nbEvents = 0;
-        private String backgroundName;
-
-        BackgroundRequest(TmfTimeRange timeRange) {
-            super(fixture.getEventType(),
-                    timeRange,
-                    0,
-                    ITmfEventRequest.ALL_DATA,
-                    ExecutionType.BACKGROUND);
-            backgroundName = getExecType().toString() + ++fBackgroundId;
-        }
-
-        @Override
-        public void handleData(final ITmfEvent event) {
-            super.handleData(event);
-            synchronized (fOrderList) {
-                if (fOrderList.isEmpty() || !fOrderList.get(fOrderList.size() - 1).equals(backgroundName)) {
-                    fOrderList.add(backgroundName);
-                }
-            }
-            ++nbEvents;
-        }
-
-        public int getNbEvents() {
-            return nbEvents;
-        }
-    }
-
-    private class ForegroundRequest extends TmfEventRequest {
-        private int nbEvents = 0;
-        private String foregroundName;
-
-        ForegroundRequest(TmfTimeRange timeRange) {
-            super(fixture.getEventType(),
-                    timeRange,
-                    0,
-                    ITmfEventRequest.ALL_DATA,
-                    ExecutionType.FOREGROUND);
-            foregroundName = getExecType().toString() + ++fForegroundId;
-        }
-
-        @Override
-        public void handleData(final ITmfEvent event) {
-            super.handleData(event);
-            synchronized (fOrderList) {
-                if (fOrderList.isEmpty() || !fOrderList.get(fOrderList.size() - 1).equals(foregroundName)) {
-                    fOrderList.add(foregroundName);
-                }
-            }
-            ++nbEvents;
-        }
-
-        public int getNbEvents() {
-            return nbEvents;
-        }
-    }
-}
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statistics/AllTests.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statistics/AllTests.java
deleted file mode 100644 (file)
index 8baa5a6..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Alexandre Montplaisir - Initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.statistics;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * Test suite for org.eclipse.linuxtools.tmf.core.statistics
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
-    TmfEventsStatisticsTest.class,
-    TmfLostEventStatisticsTest.class,
-    TmfStateStatisticsTest.class
-})
-public class AllTests {}
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statistics/TmfEventsStatisticsTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statistics/TmfEventsStatisticsTest.java
deleted file mode 100644 (file)
index e841a2a..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Alexandre Montplaisir - Initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.statistics;
-
-import static org.junit.Assume.assumeTrue;
-
-import org.eclipse.linuxtools.tmf.core.statistics.TmfEventsStatistics;
-import org.junit.BeforeClass;
-
-/**
- * Unit tests for the {@link TmfEventsStatistics}
- *
- * @author Alexandre Montplaisir
- */
-public class TmfEventsStatisticsTest extends TmfStatisticsTest {
-
-    /**
-     * Set up the fixture once for all tests.
-     */
-    @BeforeClass
-    public static void setUpClass() {
-        assumeTrue(testTrace.exists());
-        backend = new TmfEventsStatistics(testTrace.getTrace());
-    }
-}
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statistics/TmfLostEventStatisticsTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statistics/TmfLostEventStatisticsTest.java
deleted file mode 100644 (file)
index e639ba5..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Alexandre Montplaisir - Initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.statistics;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
-
-import java.util.Map;
-
-import org.eclipse.linuxtools.ctf.core.CTFStrings;
-import org.eclipse.linuxtools.tmf.core.exceptions.TmfAnalysisException;
-import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
-import org.eclipse.linuxtools.tmf.core.statistics.ITmfStatistics;
-import org.eclipse.linuxtools.tmf.core.statistics.TmfStateStatistics;
-import org.eclipse.linuxtools.tmf.core.statistics.TmfStatisticsEventTypesModule;
-import org.eclipse.linuxtools.tmf.core.statistics.TmfStatisticsTotalsModule;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
-import org.junit.rules.Timeout;
-
-/**
- * Unit tests for handling of lost events by the statistics backends.
- *
- * @author Alexandre Montplaisir
- */
-public class TmfLostEventStatisticsTest {
-
-    /** Time-out tests after 30 seconds */
-    @Rule
-    public TestRule globalTimeout= new Timeout(30000);
-
-    /**Test trace with lost events */
-    private static final CtfTmfTestTrace lostEventsTrace = CtfTmfTestTrace.HELLO_LOST;
-
-    private ITmfTrace fTrace;
-
-    /** The statistics back-end object for the trace with lost events */
-    private ITmfStatistics fStats;
-
-    // ------------------------------------------------------------------------
-    // Maintenance
-    // ------------------------------------------------------------------------
-
-    /**
-     * Class setup
-     */
-    @BeforeClass
-    public static void setUpClass() {
-        assumeTrue(lostEventsTrace.exists());
-    }
-
-    /**
-     * Test setup
-     */
-    @Before
-    public void setUp() {
-        fTrace = lostEventsTrace.getTrace();
-
-        /* Prepare the two analysis-backed state systems */
-        TmfStatisticsTotalsModule totalsMod = new TmfStatisticsTotalsModule();
-        TmfStatisticsEventTypesModule eventTypesMod = new TmfStatisticsEventTypesModule();
-        try {
-            totalsMod.setTrace(fTrace);
-            eventTypesMod.setTrace(fTrace);
-        } catch (TmfAnalysisException e) {
-            fail();
-        }
-
-        totalsMod.schedule();
-        eventTypesMod.schedule();
-        assertTrue(totalsMod.waitForCompletion());
-        assertTrue(eventTypesMod.waitForCompletion());
-
-        ITmfStateSystem totalsSS = totalsMod.getStateSystem();
-        ITmfStateSystem eventTypesSS = eventTypesMod.getStateSystem();
-        assertNotNull(totalsSS);
-        assertNotNull(eventTypesSS);
-
-        fStats = new TmfStateStatistics(totalsSS, eventTypesSS);
-    }
-
-    /**
-     * Test cleanup
-     */
-    @After
-    public void tearDown() {
-        fTrace.dispose();
-    }
-
-    // ------------------------------------------------------------------------
-    // Test methods
-    // ------------------------------------------------------------------------
-
-    /*
-     * Trace start = 1376592664828559410
-     * Trace end   = 1376592665108210547
-     */
-
-    private static final long rangeStart = 1376592664900000000L;
-    private static final long rangeEnd =   1376592665000000000L;
-
-    /**
-     * Test the total number of "real" events. Make sure the lost events aren't
-     * counted in the total.
-     */
-    @Test
-    public void testLostEventsTotals() {
-        long realEvents = fStats.getEventsTotal();
-        assertEquals(32300, realEvents);
-    }
-
-    /**
-     * Test the number of real events in a given range. Lost events shouldn't be
-     * counted.
-     */
-    @Test
-    public void testLostEventsTotalInRange() {
-        long realEventsInRange = fStats.getEventsInRange(rangeStart, rangeEnd);
-        assertEquals(11209L, realEventsInRange);
-    }
-
-    /**
-     * Test the total number of lost events reported in the trace.
-     */
-    @Test
-    public void testLostEventsTypes() {
-        Map<String, Long> events = fStats.getEventTypesTotal();
-        Long lostEvents = events.get(CTFStrings.LOST_EVENT_NAME);
-        assertEquals(Long.valueOf(967700L), lostEvents);
-    }
-
-    /**
-     * Test the number of lost events reported in a given range.
-     */
-    @Test
-    public void testLostEventsTypesInRange() {
-        Map<String, Long> eventsInRange = fStats.getEventTypesInRange(rangeStart, rangeEnd);
-        long lostEventsInRange = eventsInRange.get(CTFStrings.LOST_EVENT_NAME);
-        assertEquals(363494L, lostEventsInRange);
-    }
-}
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statistics/TmfStateStatisticsTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statistics/TmfStateStatisticsTest.java
deleted file mode 100644 (file)
index e6b8c64..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Alexandre Montplaisir - Initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.statistics;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
-
-import org.eclipse.linuxtools.tmf.core.exceptions.TmfAnalysisException;
-import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
-import org.eclipse.linuxtools.tmf.core.statistics.TmfStateStatistics;
-import org.eclipse.linuxtools.tmf.core.statistics.TmfStatisticsEventTypesModule;
-import org.eclipse.linuxtools.tmf.core.statistics.TmfStatisticsTotalsModule;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-
-/**
- * Unit tests for the {@link TmfStateStatistics}
- *
- * @author Alexandre Montplaisir
- */
-public class TmfStateStatisticsTest extends TmfStatisticsTest {
-
-    private ITmfTrace fTrace;
-
-    /**
-     * Class setup
-     */
-    @BeforeClass
-    public static void setUpClass() {
-        assumeTrue(testTrace.exists());
-    }
-
-    /**
-     * Test setup
-     */
-    @Before
-    public void setUp() {
-        fTrace = testTrace.getTrace();
-
-        /* Prepare the two analysis-backed state systems */
-        TmfStatisticsTotalsModule totalsMod = new TmfStatisticsTotalsModule();
-        TmfStatisticsEventTypesModule eventTypesMod = new TmfStatisticsEventTypesModule();
-        try {
-            totalsMod.setTrace(fTrace);
-            eventTypesMod.setTrace(fTrace);
-        } catch (TmfAnalysisException e) {
-            fail();
-        }
-
-        totalsMod.schedule();
-        eventTypesMod.schedule();
-        assertTrue(totalsMod.waitForCompletion());
-        assertTrue(eventTypesMod.waitForCompletion());
-
-        ITmfStateSystem totalsSS = totalsMod.getStateSystem();
-        ITmfStateSystem eventTypesSS = eventTypesMod.getStateSystem();
-        assertNotNull(totalsSS);
-        assertNotNull(eventTypesSS);
-
-        backend = new TmfStateStatistics(totalsSS, eventTypesSS);
-    }
-
-    /**
-     * Test cleanup
-     */
-    @After
-    public void tearDown() {
-        fTrace.dispose();
-    }
-}
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statistics/TmfStatisticsTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/statistics/TmfStatisticsTest.java
deleted file mode 100644 (file)
index f0e37c9..0000000
+++ /dev/null
@@ -1,364 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Alexandre Montplaisir - Initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.statistics;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.linuxtools.tmf.core.statistics.ITmfStatistics;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
-import org.junit.rules.Timeout;
-
-/**
- * Base unit test class for any type of ITmfStatistics. Sub-classes should
- * implement a "@BeforeClass" method to setup the 'backend' fixture accordingly.
- *
- * @author Alexandre Montplaisir
- */
-public abstract class TmfStatisticsTest {
-
-    /** Time-out tests after 30 seconds */
-    @Rule public TestRule globalTimeout= new Timeout(30000);
-
-    /** Test trace used for these tests */
-    protected static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
-
-    /** The statistics back-end object */
-    protected static ITmfStatistics backend;
-
-    /* Known values about the trace */
-    private static final int totalNbEvents = 695319;
-    private static final long tStart = 1332170682440133097L; /* Timestamp of first event */
-    private static final long tEnd   = 1332170692664579801L; /* Timestamp of last event */
-
-    /* Timestamps of interest */
-    private static final long t1 = 1332170682490946000L;
-    private static final long t2 = 1332170682490947524L; /* event exactly here */
-    private static final long t3 = 1332170682490948000L;
-    private static final long t4 = 1332170682490949000L;
-    private static final long t5 = 1332170682490949270L; /* following event here */
-    private static final long t6 = 1332170682490949300L;
-
-    private static final String eventType = "lttng_statedump_process_state";
-
-
-    // ------------------------------------------------------------------------
-    // Tests for histogramQuery()
-    // ------------------------------------------------------------------------
-
-    /**
-     * Test the {@link ITmfStatistics#histogramQuery} method for the small known
-     * interval.
-     */
-    @Test
-    public void testHistogramQuerySmall() {
-        final int NB_REQ = 10;
-        List<Long> results = backend.histogramQuery(t1, t6, NB_REQ);
-
-        /* Make sure the returned array has the right size */
-        assertEquals(NB_REQ, results.size());
-
-        /* Check the contents of each "bucket" */
-        assertEquals(0, results.get(0).longValue());
-        assertEquals(0, results.get(1).longValue());
-        assertEquals(0, results.get(2).longValue());
-        assertEquals(0, results.get(3).longValue());
-        assertEquals(1, results.get(4).longValue());
-        assertEquals(0, results.get(5).longValue());
-        assertEquals(0, results.get(6).longValue());
-        assertEquals(0, results.get(7).longValue());
-        assertEquals(0, results.get(8).longValue());
-        assertEquals(1, results.get(9).longValue());
-
-    }
-
-    /**
-     * Test the {@link ITmfStatistics#histogramQuery} method over the whole
-     * trace.
-     */
-    @Test
-    public void testHistogramQueryFull() {
-        final int NB_REQ = 10;
-        List<Long> results = backend.histogramQuery(tStart, tEnd, NB_REQ);
-
-        /* Make sure the returned array has the right size */
-        assertEquals(NB_REQ, results.size());
-
-        /* Check the total number of events */
-        long count = 0;
-        for (long val : results) {
-            count += val;
-        }
-        assertEquals(totalNbEvents, count);
-
-        /* Check the contents of each "bucket" */
-        assertEquals(94161, results.get(0).longValue());
-        assertEquals(87348, results.get(1).longValue());
-        assertEquals(58941, results.get(2).longValue());
-        assertEquals(59879, results.get(3).longValue());
-        assertEquals(66941, results.get(4).longValue());
-        assertEquals(68939, results.get(5).longValue());
-        assertEquals(72746, results.get(6).longValue());
-        assertEquals(60749, results.get(7).longValue());
-        assertEquals(61208, results.get(8).longValue());
-        assertEquals(64407, results.get(9).longValue());
-    }
-
-    // ------------------------------------------------------------------------
-    // Test for getEventsTotal()
-    // ------------------------------------------------------------------------
-
-    /**
-     * Basic test for {@link ITmfStatistics#getEventsTotal}
-     */
-    @Test
-    public void testGetEventsTotal() {
-        long count = backend.getEventsTotal();
-        assertEquals(totalNbEvents, count);
-    }
-
-    // ------------------------------------------------------------------------
-    // Test for getEventTypesTotal()
-    // ------------------------------------------------------------------------
-
-    /**
-     * Basic test for {@link ITmfStatistics#getEventTypesTotal}
-     */
-    @Test
-    public void testEventTypesTotal() {
-        Map<String, Long> res = backend.getEventTypesTotal();
-        assertEquals(126, res.size()); /* Number of different event types in the trace */
-
-        long count = sumOfEvents(res);
-        assertEquals(totalNbEvents, count);
-    }
-
-    // ------------------------------------------------------------------------
-    // Tests for getEventsInRange(ITmfTimestamp start, ITmfTimestamp end)
-    // ------------------------------------------------------------------------
-
-    /**
-     * Test for {@link ITmfStatistics#getEventsInRange} over the whole trace.
-     */
-    @Test
-    public void testGetEventsInRangeWholeRange() {
-        long count = backend.getEventsInRange(tStart, tEnd);
-        assertEquals(totalNbEvents, count);
-    }
-
-    /**
-     * Test for {@link ITmfStatistics#getEventsInRange} for the whole range,
-     * except the start time (there is only one event at the start time).
-     */
-    @Test
-    public void testGetEventsInRangeMinusStart() {
-        long count = backend.getEventsInRange(tStart + 1, tEnd);
-        assertEquals(totalNbEvents - 1, count);
-    }
-
-    /**
-     * Test for {@link ITmfStatistics#getEventsInRange} for the whole range,
-     * except the end time (there is only one event at the end time).
-     */
-    @Test
-    public void testGetEventsInRangeMinusEnd() {
-        long count = backend.getEventsInRange(tStart, tEnd - 1);
-        assertEquals(totalNbEvents - 1, count);
-    }
-
-    /**
-     * Test for {@link ITmfStatistics#getEventsInRange} when both the start and
-     * end times don't match an event.
-     */
-    @Test
-    public void testGetEventsInRangeNoEventsAtEdges() {
-        long count = backend.getEventsInRange(t1, t6);
-        assertEquals(2, count);
-    }
-
-    /**
-     * Test for {@link ITmfStatistics#getEventsInRange} when the *start* of the
-     * interval is exactly on an event (that event should be included).
-     */
-    @Test
-    public void testGetEventsInRangeEventAtStart() {
-        long count = backend.getEventsInRange(t2, t3);
-        assertEquals(1, count);
-
-        count = backend.getEventsInRange(t2, t6);
-        assertEquals(2, count);
-    }
-
-    /**
-     * Test for {@link ITmfStatistics#getEventsInRange} when the *end* of the
-     * interval is exactly on an event (that event should be included).
-     */
-    @Test
-    public void testGetEventsInRangeEventAtEnd() {
-        long count = backend.getEventsInRange(t4, t5);
-        assertEquals(1, count);
-
-        count = backend.getEventsInRange(t1, t5);
-        assertEquals(2, count);
-    }
-
-    /**
-     * Test for {@link ITmfStatistics#getEventsInRange} when there are events
-     * matching exactly both the start and end times of the range (both should
-     * be included).
-     */
-    @Test
-    public void testGetEventsInRangeEventAtBoth() {
-        long count = backend.getEventsInRange(t2, t5);
-        assertEquals(2, count);
-    }
-
-    /**
-     * Test for {@link ITmfStatistics#getEventsInRange} when there are no events
-     * in a given range.
-     */
-    @Test
-    public void testGetEventsInRangeNoEvents() {
-        long count = backend.getEventsInRange(t3, t4);
-        assertEquals(0, count);
-    }
-
-    // ------------------------------------------------------------------------
-    // Tests for getEventTypesInRange(ITmfTimestamp start, ITmfTimestamp end)
-    // ------------------------------------------------------------------------
-
-    /**
-     * Test for {@link ITmfStatistics#getEventTypesInRange} over the whole trace.
-     */
-    @Test
-    public void testGetEventTypesInRangeWholeRange() {
-        Map<String, Long> result = backend.getEventTypesInRange(tStart, tEnd);
-        /* Number of events of that type in the whole trace */
-        assertEquals(new Long(464L), result.get(eventType));
-
-        long count = sumOfEvents(result);
-        assertEquals(totalNbEvents, count);
-    }
-
-    /**
-     * Test for {@link ITmfStatistics#getEventTypesInRange} for the whole range,
-     * except the start time (there is only one event at the start time).
-     */
-    @Test
-    public void testGetEventTypesInRangeMinusStart() {
-        Map<String, Long> result = backend.getEventTypesInRange(tStart + 1, tEnd);
-
-        long count = sumOfEvents(result);
-        assertEquals(totalNbEvents - 1, count);
-    }
-
-    /**
-     * Test for {@link ITmfStatistics#getEventTypesInRange} for the whole range,
-     * except the end time (there is only one event at the end time).
-     */
-    @Test
-    public void testGetEventTypesInRangeMinusEnd() {
-        Map<String, Long> result = backend.getEventTypesInRange(tStart, tEnd - 1);
-
-        long count = sumOfEvents(result);
-        assertEquals(totalNbEvents - 1, count);
-    }
-
-    /**
-     * Test for {@link ITmfStatistics#getEventTypesInRange} when both the start
-     * and end times don't match an event.
-     */
-    @Test
-    public void testGetEventTypesInRangeNoEventsAtEdges() {
-        Map<String, Long> result = backend.getEventTypesInRange(t1, t6);
-        assertEquals(new Long(2L), result.get(eventType));
-
-        long count = sumOfEvents(result);
-        assertEquals(2, count);
-    }
-
-    /**
-     * Test for {@link ITmfStatistics#getEventTypesInRange} when the *start* of
-     * the interval is exactly on an event (that event should be included).
-     */
-    @Test
-    public void testGetEventTypesInRangeEventAtStart() {
-        Map<String, Long> result = backend.getEventTypesInRange(t2, t3);
-        assertEquals(new Long(1L), result.get(eventType));
-        long count = sumOfEvents(result);
-        assertEquals(1, count);
-
-        result = backend.getEventTypesInRange(t2, t6);
-        assertEquals(new Long(2L), result.get(eventType));
-        count = sumOfEvents(result);
-        assertEquals(2, count);
-    }
-
-    /**
-     * Test for {@link ITmfStatistics#getEventTypesInRange} when the *end* of
-     * the interval is exactly on an event (that event should be included).
-     */
-    @Test
-    public void testGetEventTypesInRangeEventAtEnd() {
-        Map<String, Long> result = backend.getEventTypesInRange(t4, t5);
-        assertEquals(new Long(1L), result.get(eventType));
-        long count = sumOfEvents(result);
-        assertEquals(1, count);
-
-        result = backend.getEventTypesInRange(t1, t5);
-        assertEquals(new Long(2L), result.get(eventType));
-        count = sumOfEvents(result);
-        assertEquals(2, count);
-    }
-
-    /**
-     * Test for {@link ITmfStatistics#getEventTypesInRange} when there are
-     * events matching exactly both the start and end times of the range (both
-     * should be included).
-     */
-    @Test
-    public void testGetEventTypesInRangeEventAtBoth() {
-        Map<String, Long> result = backend.getEventTypesInRange(t2, t5);
-        assertEquals(new Long(2L), result.get(eventType));
-        long count = sumOfEvents(result);
-        assertEquals(2, count);
-    }
-
-    /**
-     * Test for {@link ITmfStatistics#getEventTypesInRange} when there are no
-     * events in a given range.
-     */
-    @Test
-    public void testGetEventTypesInRangeNoEvents() {
-        Map<String, Long> result = backend.getEventTypesInRange(t3, t4);
-        long count = sumOfEvents(result);
-        assertEquals(0, count);
-    }
-
-    // ------------------------------------------------------------------------
-    // Convenience methods
-    // ------------------------------------------------------------------------
-
-    private static long sumOfEvents(Map<String, Long> map) {
-        long count = 0;
-        for (long val : map.values()) {
-            count += val;
-        }
-        return count;
-    }
-}
index 8317efe92b8faba2a047a98ab772692c06cfdacd..657ce1b7613837c0fd652e4a753f8a0f2a6e37d9 100644 (file)
@@ -25,7 +25,6 @@ import org.junit.runners.Suite;
     TmfContextTest.class,
     TmfExperimentTest.class,
     TmfMultiTraceExperimentTest.class,
-    TmfTraceManagerTest.class,
     TmfTraceTest.class
 })
 public class AllTests {}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfTraceManagerTest.java b/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfTraceManagerTest.java
deleted file mode 100644 (file)
index b22cb77..0000000
+++ /dev/null
@@ -1,692 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Alexandre Montplaisir - Initial API and implementation
- *   Patrick Tasse - Support selection range
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.trace;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assume.assumeTrue;
-
-import java.io.File;
-
-import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.signal.TmfRangeSynchSignal;
-import org.eclipse.linuxtools.tmf.core.signal.TmfSignalManager;
-import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;
-import org.eclipse.linuxtools.tmf.core.signal.TmfTraceClosedSignal;
-import org.eclipse.linuxtools.tmf.core.signal.TmfTraceOpenedSignal;
-import org.eclipse.linuxtools.tmf.core.signal.TmfTraceSelectedSignal;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
-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.ITmfTrace;
-import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
-import org.eclipse.linuxtools.tmf.core.trace.TmfTraceManager;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Test suite for the {@link TmfTraceManager}.
- *
- * @author Alexandre Montplaisir
- */
-public class TmfTraceManagerTest {
-
-    private static final int SCALE = ITmfTimestamp.NANOSECOND_SCALE;
-
-    private static ITmfTrace trace1;
-    private static final long t1start = 1331668247314038062L;
-    private static final long t1end =   1331668259054285979L;
-
-    private static ITmfTrace trace2;
-    private static final long t2start = 1332170682440133097L;
-    private static final long t2end =   1332170692664579801L;
-
-    private static final long ONE_SECOND = 1000000000L;
-
-    private TmfTraceManager tm;
-
-
-    /**
-     * Test class initialization
-     */
-    @BeforeClass
-    public static void setUpClass() {
-        assumeTrue(CtfTmfTestTrace.TRACE2.exists());
-        assumeTrue(CtfTmfTestTrace.KERNEL.exists());
-        trace1 = CtfTmfTestTrace.TRACE2.getTrace();
-        trace2 = CtfTmfTestTrace.KERNEL.getTrace();
-
-        trace1.indexTrace(true);
-        trace2.indexTrace(true);
-
-        // Deregister traces from signal manager so that they don't
-        // interfere with the TmfTraceManager tests
-        TmfSignalManager.deregister(trace1);
-        TmfSignalManager.deregister(trace2);
-    }
-
-    /**
-     * Test initialization
-     */
-    @Before
-    public void setUp() {
-        tm = TmfTraceManager.getInstance();
-    }
-
-    /**
-     * Test clean-up
-     */
-    @After
-    public void tearDown() {
-        while (tm.getActiveTrace() != null) {
-            closeTrace(tm.getActiveTrace());
-        }
-    }
-
-    /**
-     * Test class clean-up
-     */
-    @AfterClass
-    public static void tearDownClass() {
-        CtfTmfTestTrace.TRACE2.dispose();
-        CtfTmfTestTrace.KERNEL.dispose();
-    }
-
-    // ------------------------------------------------------------------------
-    // Dummy actions (fake signals)
-    // ------------------------------------------------------------------------
-
-    private void openTrace(ITmfTrace trace) {
-        TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(this, trace, null));
-        selectTrace(trace);
-    }
-
-    private void closeTrace(ITmfTrace trace) {
-        TmfSignalManager.dispatchSignal(new TmfTraceClosedSignal(this, trace));
-        /*
-         * In TMF, the next tab would now be selected (if there are some), which
-         * would select another trace automatically.
-         */
-        if (tm.getOpenedTraces().size() > 0) {
-            selectTrace(tm.getOpenedTraces().toArray(new ITmfTrace[0])[0]);
-        }
-    }
-
-    private void selectTrace(ITmfTrace trace) {
-        TmfSignalManager.dispatchSignal(new TmfTraceSelectedSignal(this, trace));
-    }
-
-    private void selectTimestamp(ITmfTimestamp ts) {
-        TmfSignalManager.dispatchSignal(new TmfTimeSynchSignal(this, ts));
-    }
-
-    private void selectTimeRange(TmfTimeRange tr) {
-        TmfSignalManager.dispatchSignal(new TmfRangeSynchSignal(this, tr));
-    }
-
-    // ------------------------------------------------------------------------
-    // General tests
-    // ------------------------------------------------------------------------
-
-    /**
-     * Test that the manager is correctly initialized
-     */
-    @Test
-    public void testInitialize() {
-        TmfTraceManager mgr = TmfTraceManager.getInstance();
-        assertNotNull(mgr);
-        assertSame(tm, mgr);
-    }
-
-    /**
-     * Test the contents of a trace set with one trace.
-     */
-    @Test
-    public void testTraceSet() {
-        openTrace(trace1);
-        openTrace(trace2);
-        selectTrace(trace2);
-
-        ITmfTrace[] expected = new ITmfTrace[] { trace2 };
-        ITmfTrace[] actual = tm.getActiveTraceSet();
-
-        assertEquals(1, actual.length);
-        assertArrayEquals(expected, actual);
-    }
-
-    /**
-     * Test the contents of a trace set with an experiment.
-     */
-    @Test
-    public void testTraceSetExperiment() {
-        TmfExperiment exp = createExperiment(trace1, trace2);
-        openTrace(trace1);
-        openTrace(exp);
-
-        ITmfTrace[] expected = new ITmfTrace[] { trace1, trace2 };
-        ITmfTrace[] actual = tm.getActiveTraceSet();
-
-        assertEquals(2, actual.length);
-        assertArrayEquals(expected, actual);
-    }
-
-    /**
-     * Test the {@link TmfTraceManager#getSupplementaryFileDir} method.
-     */
-    @Test
-    public void testSupplementaryFileDir() {
-        String name1 = trace1.getName();
-        String name2 = trace2.getName();
-        String basePath = System.getProperty("java.io.tmpdir") + File.separator;
-
-        String expected1 = basePath + name1 + File.separator;
-        String expected2 = basePath + name2 + File.separator;
-
-        assertEquals(expected1, TmfTraceManager.getSupplementaryFileDir(trace1));
-        assertEquals(expected2, TmfTraceManager.getSupplementaryFileDir(trace2));
-    }
-
-    // ------------------------------------------------------------------------
-    // Test a single trace
-    // ------------------------------------------------------------------------
-
-    /**
-     * Test the initial range of a single trace.
-     */
-    @Test
-    public void testTraceInitialRange() {
-        openTrace(trace2);
-        final TmfTimeRange expectedRange = new TmfTimeRange(
-                trace2.getStartTime(),
-                calculateOffset(trace2.getStartTime(), trace2.getInitialRangeOffset()));
-        TmfTimeRange actualRange = tm.getCurrentRange();
-        assertEquals(expectedRange, actualRange);
-    }
-
-    /**
-     * Try selecting a timestamp contained inside the trace's range. The trace's
-     * current time should get updated correctly.
-     */
-    @Test
-    public void testNewTimestamp() {
-        openTrace(trace2);
-        ITmfTimestamp ts = new TmfTimestamp(t2start + ONE_SECOND, SCALE);
-        selectTimestamp(ts);
-
-        ITmfTimestamp afterTs = tm.getSelectionBeginTime();
-        assertEquals(ts, afterTs);
-        afterTs = tm.getSelectionEndTime();
-        assertEquals(ts, afterTs);
-    }
-
-    /**
-     * Try selecting a timestamp happening before the trace's start. The change
-     * should be ignored.
-     */
-    @Test
-    public void testTimestampBefore() {
-        openTrace(trace2);
-        ITmfTimestamp beforeTs = tm.getSelectionBeginTime();
-        ITmfTimestamp ts = new TmfTimestamp(t2start - ONE_SECOND, SCALE);
-        selectTimestamp(ts);
-
-        ITmfTimestamp curTs = tm.getSelectionBeginTime();
-        assertEquals(beforeTs, curTs);
-        curTs = tm.getSelectionEndTime();
-        assertEquals(beforeTs, curTs);
-    }
-
-    /**
-     * Try selecting a timestamp happening after the trace's end. The change
-     * should be ignored.
-     */
-    @Test
-    public void testTimestampAfter() {
-        openTrace(trace2);
-        ITmfTimestamp beforeTs = tm.getSelectionBeginTime();
-        ITmfTimestamp ts = new TmfTimestamp(t2end + ONE_SECOND, SCALE);
-        selectTimestamp(ts);
-
-        ITmfTimestamp curTs = tm.getSelectionBeginTime();
-        assertEquals(beforeTs, curTs);
-        curTs = tm.getSelectionEndTime();
-        assertEquals(beforeTs, curTs);
-    }
-
-    /**
-     * Test selecting a normal sub-range of a single trace.
-     */
-    @Test
-    public void testTraceNewTimeRange() {
-        openTrace(trace2);
-        TmfTimeRange range = new TmfTimeRange(
-                new TmfTimestamp(t2start + ONE_SECOND, SCALE),
-                new TmfTimestamp(t2end - ONE_SECOND, SCALE));
-        selectTimeRange(range);
-
-        TmfTimeRange curRange = tm.getCurrentRange();
-        assertEquals(range.getStartTime(), curRange.getStartTime());
-        assertEquals(range.getEndTime(), curRange.getEndTime());
-    }
-
-    /**
-     * Test selecting a range whose start time is before the trace's start time.
-     * The selected range should get clamped to the trace's range.
-     */
-    @Test
-    public void testTraceTimeRangeClampingStart() {
-        openTrace(trace2);
-        TmfTimeRange range = new TmfTimeRange(
-                new TmfTimestamp(t2start - ONE_SECOND, SCALE), // minus here
-                new TmfTimestamp(t2end - ONE_SECOND, SCALE));
-        selectTimeRange(range);
-
-        TmfTimeRange curRange = tm.getCurrentRange();
-        assertEquals(t2start, curRange.getStartTime().getValue());
-        assertEquals(range.getEndTime(), curRange.getEndTime());
-    }
-
-    /**
-     * Test selecting a range whose end time is after the trace's end time.
-     * The selected range should get clamped to the trace's range.
-     */
-    @Test
-    public void testTraceTimeRangeClampingEnd() {
-        openTrace(trace2);
-        TmfTimeRange range = new TmfTimeRange(
-                new TmfTimestamp(t2start + ONE_SECOND, SCALE),
-                new TmfTimestamp(t2end + ONE_SECOND, SCALE)); // plus here
-        selectTimeRange(range);
-
-        TmfTimeRange curRange = tm.getCurrentRange();
-        assertEquals(range.getStartTime(), curRange.getStartTime());
-        assertEquals(t2end, curRange.getEndTime().getValue());
-    }
-
-    /**
-     * Test selecting a range whose both start and end times are outside of the
-     * trace's range. The selected range should get clamped to the trace's
-     * range.
-     */
-    @Test
-    public void testTraceTimeRangeClampingBoth() {
-        openTrace(trace2);
-        TmfTimeRange range = new TmfTimeRange(
-                new TmfTimestamp(t2start - ONE_SECOND, SCALE), // minus here
-                new TmfTimestamp(t2end + ONE_SECOND, SCALE)); // plus here
-        selectTimeRange(range);
-
-        TmfTimeRange curRange = tm.getCurrentRange();
-        assertEquals(t2start, curRange.getStartTime().getValue());
-        assertEquals(t2end, curRange.getEndTime().getValue());
-    }
-
-    // ------------------------------------------------------------------------
-    // Test multiple, non-overlapping traces in parallel
-    // ------------------------------------------------------------------------
-
-    /**
-     * Test, with two traces in parallel, when we select a timestamp that is
-     * part of the first trace.
-     *
-     * The first trace's timestamp should be updated, but the second trace's one
-     * should not change.
-     */
-    @Test
-    public void testTwoTracesTimestampValid() {
-        openTrace(trace1);
-        openTrace(trace2);
-        selectTrace(trace1);
-        TmfTimestamp ts = new TmfTimestamp(t1start + ONE_SECOND, SCALE);
-        selectTimestamp(ts);
-
-        /* Timestamp of trace1 should have been updated */
-        assertEquals(ts, tm.getSelectionBeginTime());
-        assertEquals(ts, tm.getSelectionEndTime());
-
-        /* Timestamp of trace2 should not have changed */
-        selectTrace(trace2);
-        assertEquals(trace2.getStartTime(), tm.getSelectionBeginTime());
-        assertEquals(trace2.getStartTime(), tm.getSelectionEndTime());
-    }
-
-    /**
-     * Test, with two traces in parallel, when we select a timestamp that is
-     * between two traces.
-     *
-     * None of the trace's timestamps should be updated (we are not in an
-     * experiment!)
-     */
-    @Test
-    public void testTwoTracesTimestampInBetween() {
-        openTrace(trace1);
-        openTrace(trace2);
-        selectTrace(trace1);
-        TmfTimestamp ts = new TmfTimestamp(t1end + ONE_SECOND, SCALE);
-        selectTimestamp(ts);
-
-        /* Timestamp of trace1 should not have changed */
-        assertEquals(trace1.getStartTime(), tm.getSelectionBeginTime());
-        assertEquals(trace1.getStartTime(), tm.getSelectionEndTime());
-
-        /* Timestamp of trace2 should not have changed */
-        selectTrace(trace2);
-        assertEquals(trace2.getStartTime(), tm.getSelectionBeginTime());
-        assertEquals(trace2.getStartTime(), tm.getSelectionEndTime());
-    }
-
-    /**
-     * Test, with two traces in parallel, when we select a timestamp that is
-     * completely out of the trace's range.
-     *
-     * None of the trace's timestamps should be updated.
-     */
-    @Test
-    public void testTwoTracesTimestampInvalid() {
-        openTrace(trace1);
-        openTrace(trace2);
-        selectTrace(trace1);
-        TmfTimestamp ts = new TmfTimestamp(t2end + ONE_SECOND, SCALE);
-        selectTimestamp(ts);
-
-        /* Timestamp of trace1 should not have changed */
-        assertEquals(trace1.getStartTime(), tm.getSelectionBeginTime());
-        assertEquals(trace1.getStartTime(), tm.getSelectionEndTime());
-
-        /* Timestamp of trace2 should not have changed */
-        selectTrace(trace2);
-        assertEquals(trace2.getStartTime(), tm.getSelectionBeginTime());
-        assertEquals(trace2.getStartTime(), tm.getSelectionEndTime());
-    }
-
-    /**
-     * Test, with two traces opened in parallel (not in an experiment), if we
-     * select a time range valid in one of them. That trace's time range should
-     * be updated, but not the other one.
-     */
-    @Test
-    public void testTwoTracesTimeRangeAllInOne() {
-        openTrace(trace1);
-        openTrace(trace2);
-        selectTrace(trace1);
-        TmfTimeRange range = new TmfTimeRange(
-                new TmfTimestamp(t1start + ONE_SECOND, SCALE),
-                new TmfTimestamp(t1end - ONE_SECOND, SCALE));
-        selectTimeRange(range);
-
-        /* Range of trace1 should be equal to the requested one */
-        assertEquals(range, tm.getCurrentRange());
-
-        /* The range of trace 2 should not have changed */
-        selectTrace(trace2);
-        assertEquals(getInitialRange(trace2), tm.getCurrentRange());
-    }
-
-    /**
-     * Test, with two traces in parallel, when we select a time range that is
-     * only partially valid for one of the traces.
-     *
-     * The first trace's time range should be clamped to a valid range, and the
-     * second one's should not change.
-     */
-    @Test
-    public void testTwoTracesTimeRangePartiallyInOne() {
-        openTrace(trace1);
-        openTrace(trace2);
-        selectTrace(trace1);
-        TmfTimeRange range = new TmfTimeRange(
-                new TmfTimestamp(t1start + ONE_SECOND, SCALE),
-                new TmfTimestamp(t1end + ONE_SECOND, SCALE));
-        selectTimeRange(range);
-
-        /* Range of trace1 should get clamped to its end time */
-        TmfTimeRange expectedRange = new TmfTimeRange(
-                new TmfTimestamp(t1start + ONE_SECOND, SCALE),
-                new TmfTimestamp(t1end, SCALE));
-        assertEquals(expectedRange, tm.getCurrentRange());
-
-        /* Range of trace2 should not have changed */
-        selectTrace(trace2);
-        assertEquals(getInitialRange(trace2), tm.getCurrentRange());
-    }
-
-    /**
-     * Test, with two traces in parallel, when we select a time range that is
-     * only partially valid for both traces.
-     *
-     * Each trace's time range should get clamped to respectively valid ranges.
-     */
-    @Test
-    public void testTwoTracesTimeRangeInBoth() {
-        openTrace(trace1);
-        openTrace(trace2);
-        selectTrace(trace1);
-        TmfTimeRange range = new TmfTimeRange(
-                new TmfTimestamp(t1end - ONE_SECOND, SCALE),
-                new TmfTimestamp(t2start + ONE_SECOND, SCALE));
-        selectTimeRange(range);
-
-        /* Range of trace1 should be clamped to its end time */
-        TmfTimeRange expectedRange = new TmfTimeRange(
-                new TmfTimestamp(t1end - ONE_SECOND, SCALE),
-                new TmfTimestamp(t1end, SCALE));
-        assertEquals(expectedRange, tm.getCurrentRange());
-
-        /* Range of trace2 should be clamped to its start time */
-        selectTrace(trace2);
-        expectedRange = new TmfTimeRange(
-                new TmfTimestamp(t2start, SCALE),
-                new TmfTimestamp(t2start + ONE_SECOND, SCALE));
-        assertEquals(expectedRange, tm.getCurrentRange());
-    }
-
-    /**
-     * Test, with two traces in parallel, when we select a time range that is
-     * not valid for any trace.
-     *
-     * Each trace's time range should not be modified.
-     */
-    @Test
-    public void testTwoTracesTimeRangeInBetween() {
-        openTrace(trace1);
-        openTrace(trace2);
-        selectTrace(trace1);
-        TmfTimeRange range = new TmfTimeRange(
-                new TmfTimestamp(t1end + ONE_SECOND, SCALE),
-                new TmfTimestamp(t1end - ONE_SECOND, SCALE));
-        selectTimeRange(range);
-
-        /* Range of trace1 should not have changed */
-        TmfTimeRange expectedRange = getInitialRange(trace1);
-        TmfTimeRange curRange = tm.getCurrentRange();
-        assertEquals(expectedRange.getStartTime(), curRange.getStartTime());
-        assertEquals(expectedRange.getEndTime(), curRange.getEndTime());
-
-        /* Range of trace2 should not have changed */
-        selectTrace(trace2);
-        expectedRange = getInitialRange(trace2);
-        curRange = tm.getCurrentRange();
-        assertEquals(expectedRange.getStartTime(), curRange.getStartTime());
-        assertEquals(expectedRange.getEndTime(), curRange.getEndTime());
-    }
-
-    // ------------------------------------------------------------------------
-    // Test an experiment
-    // ------------------------------------------------------------------------
-
-    /**
-     * Test in an experiment when we select a timestamp that is part of one of
-     * the experiment's traces.
-     *
-     * The experiment's current time should be correctly updated.
-     */
-    @Test
-    public void testExperimentTimestampInTrace() {
-        TmfExperiment exp = createExperiment(trace1, trace2);
-        openTrace(exp);
-        TmfTimestamp ts = new TmfTimestamp(t1start + ONE_SECOND, SCALE);
-        selectTimestamp(ts);
-
-        /* The experiment's current time should be updated. */
-        assertEquals(ts, tm.getSelectionBeginTime());
-        assertEquals(ts, tm.getSelectionEndTime());
-    }
-
-    /**
-     * Test in an experiment when we select a timestamp that is between two
-     * traces in the experiment.
-     *
-     * The experiment's current time should still be updated, since the
-     * timestamp is valid in the experiment itself.
-     */
-    @Test
-    public void testExperimentTimestampInBetween() {
-        TmfExperiment exp = createExperiment(trace1, trace2);
-        openTrace(exp);
-        TmfTimestamp ts = new TmfTimestamp(t1end + ONE_SECOND, SCALE);
-        selectTimestamp(ts);
-
-        /* The experiment's current time should be updated. */
-        assertEquals(ts, tm.getSelectionBeginTime());
-        assertEquals(ts, tm.getSelectionEndTime());
-    }
-
-    /**
-     * Test in an experiment when we select a timestamp that is outside of the
-     * total range of the experiment.
-     *
-     * The experiment's current time should not be updated.
-     */
-    @Test
-    public void testExperimentTimestampInvalid() {
-        TmfExperiment exp = createExperiment(trace1, trace2);
-        openTrace(exp);
-        TmfTimestamp ts = new TmfTimestamp(t2end + ONE_SECOND, SCALE);
-        selectTimestamp(ts);
-
-        /* The experiment's current time should NOT be updated. */
-        assertEquals(trace1.getStartTime(), tm.getSelectionBeginTime());
-        assertEquals(trace1.getStartTime(), tm.getSelectionEndTime());
-    }
-
-    /**
-     * Test the initial range of an experiment.
-     */
-    @Test
-    public void testExperimentInitialRange() {
-        TmfExperiment exp = createExperiment(trace1, trace2);
-        openTrace(exp);
-        /*
-         * The initial range should be == to the initial range of the earliest
-         * trace (here trace1).
-         */
-        final TmfTimeRange actualRange = tm.getCurrentRange();
-
-        assertEquals(getInitialRange(trace1), actualRange);
-        assertEquals(getInitialRange(exp), actualRange);
-    }
-
-    /**
-     * Test the range clamping with the start time of the range outside of the
-     * earliest trace's range. Only that start time should get clamped.
-     */
-    @Test
-    public void testExperimentRangeClampingOne() {
-        TmfExperiment exp = createExperiment(trace1, trace2);
-        openTrace(exp);
-
-        final TmfTimeRange range = new TmfTimeRange(
-                new TmfTimestamp(t1start - ONE_SECOND, SCALE),
-                new TmfTimestamp(t1end - ONE_SECOND, SCALE));
-        selectTimeRange(range);
-
-        TmfTimeRange actualRange = tm.getCurrentRange();
-        assertEquals(t1start, actualRange.getStartTime().getValue());
-        assertEquals(t1end - ONE_SECOND, actualRange.getEndTime().getValue());
-    }
-
-    /**
-     * Test the range clamping when both the start and end times of the signal's
-     * range are outside of the trace's range. The range should clamp to the
-     * experiment's range.
-     */
-    @Test
-    public void testExperimentRangeClampingBoth() {
-        TmfExperiment exp = createExperiment(trace1, trace2);
-        openTrace(exp);
-
-        final TmfTimeRange range = new TmfTimeRange(
-                new TmfTimestamp(t1start - ONE_SECOND, SCALE),
-                new TmfTimestamp(t2end + ONE_SECOND, SCALE));
-        selectTimeRange(range);
-
-        TmfTimeRange actualRange = tm.getCurrentRange();
-        assertEquals(t1start, actualRange.getStartTime().getValue());
-        assertEquals(t2end, actualRange.getEndTime().getValue());
-    }
-
-    /**
-     * Test selecting a range in-between two disjoint traces in an experiment.
-     * The range should still get correctly selected, even if no trace has any
-     * events in that range.
-     */
-    @Test
-    public void testExperimentRangeInBetween() {
-        TmfExperiment exp = createExperiment(trace1, trace2);
-        openTrace(exp);
-
-        final TmfTimeRange range = new TmfTimeRange(
-                new TmfTimestamp(t1end + ONE_SECOND, SCALE),
-                new TmfTimestamp(t2start - ONE_SECOND, SCALE));
-        selectTimeRange(range);
-
-        TmfTimeRange actualRange = tm.getCurrentRange();
-        assertEquals(range, actualRange);
-    }
-
-    // ------------------------------------------------------------------------
-    // Utility methods
-    // ------------------------------------------------------------------------
-
-    private static TmfExperiment createExperiment(ITmfTrace t1, ITmfTrace t2) {
-        ITmfTrace[] traces = new ITmfTrace[] { t1, t2 };
-        TmfExperiment exp = new TmfExperiment(ITmfEvent.class, "test-exp", traces);
-        exp.indexTrace(true);
-        // Deregister experiment from signal manager so that it doesn't
-        // interfere with the TmfTraceManager tests
-        TmfSignalManager.deregister(exp);
-        return exp;
-    }
-
-    private static TmfTimeRange getInitialRange(ITmfTrace trace) {
-        return new TmfTimeRange(
-                trace.getStartTime(),
-                calculateOffset(trace.getStartTime(), trace.getInitialRangeOffset()));
-    }
-
-    /**
-     * Basically a "initial + offset" operation, but for ITmfTimetamp objects.
-     */
-    private static ITmfTimestamp calculateOffset(ITmfTimestamp initialTs, ITmfTimestamp offsetTs) {
-        long start = initialTs.normalize(0, SCALE).getValue();
-        long offset = offsetTs.normalize(0, SCALE).getValue();
-        return new TmfTimestamp(start + offset, SCALE);
-    }
-}
index c536f104bc6cd112b79b6221406e25ac8a41ff15..fa46b548a8e8c60436586afe078384c743476340 100644 (file)
@@ -452,7 +452,10 @@ public class TmfTraceTest {
         assertTrue(modules.iterator().hasNext());
         assertTrue(testModules.iterator().hasNext());
 
-        /* Make sure all modules of type TestAnalysis are returned in the second call */
+        /*
+         * Make sure all modules of type TestAnalysis are returned in the second
+         * call
+         */
         for (IAnalysisModule module : modules) {
             if (module instanceof TestAnalysis) {
                 IAnalysisModule otherModule = fTrace.getAnalysisModule(module.getId());
diff --git a/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/ctf/CtfTmfTraceStub.java b/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/ctf/CtfTmfTraceStub.java
deleted file mode 100644 (file)
index 4e90868..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Ã‰cole Polytechnique de Montréal
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Geneviève Bastien - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.tests.stubs.ctf;
-
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
-import org.eclipse.linuxtools.tmf.core.signal.TmfSignalManager;
-import org.eclipse.linuxtools.tmf.core.signal.TmfTraceOpenedSignal;
-import org.eclipse.linuxtools.tmf.core.signal.TmfTraceSelectedSignal;
-
-/**
- * Dummy test ctf trace
- */
-public class CtfTmfTraceStub extends CtfTmfTrace {
-
-    /**
-     * Simulate trace opening, to be called by tests who need an actively opened
-     * trace
-     */
-    public void openTrace() {
-        TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(this, this, null));
-        selectTrace();
-    }
-
-    /**
-     * Simulate selecting the trace
-     */
-    public void selectTrace() {
-        TmfSignalManager.dispatchSignal(new TmfTraceSelectedSignal(this, this));
-    }
-
-}
index da3f25734fdea354aac7951834c746bbb48cfbb0..60bf29ccb700ab59b4770e4ed63fd519d992128e 100644 (file)
@@ -9,8 +9,7 @@ Bundle-Activator: org.eclipse.linuxtools.internal.tmf.core.Activator
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.7
 Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.core.resources,
- org.eclipse.linuxtools.ctf.core;bundle-version="3.0.0"
+ org.eclipse.core.resources
 Export-Package: org.eclipse.linuxtools.internal.tmf.core;x-friends:="org.eclipse.linuxtools.tmf.core.tests",
  org.eclipse.linuxtools.internal.tmf.core.analysis;x-friends:="org.eclipse.linuxtools.tmf.core.tests",
  org.eclipse.linuxtools.internal.tmf.core.component;x-friends:="org.eclipse.linuxtools.tmf.core.tests",
@@ -26,7 +25,6 @@ Export-Package: org.eclipse.linuxtools.internal.tmf.core;x-friends:="org.eclipse
  org.eclipse.linuxtools.tmf.core.analysis,
  org.eclipse.linuxtools.tmf.core.callstack,
  org.eclipse.linuxtools.tmf.core.component,
- org.eclipse.linuxtools.tmf.core.ctfadaptor,
  org.eclipse.linuxtools.tmf.core.event,
  org.eclipse.linuxtools.tmf.core.event.lookup,
  org.eclipse.linuxtools.tmf.core.event.matching,
index be7438f4d24bd6ed45838ff233e5ac741ddf4b5b..a60daa47b40a41eeff8e7d01b49ce7eb36a27994 100644 (file)
@@ -14,9 +14,5 @@
 Bundle-Vendor = Eclipse Linux Tools
 Bundle-Name = Linux Tools TMF Core Plug-in
 
-# CTF trace type
-tracetype.category.ctf = Common Trace Format
-tracetype.type.ctf = Generic CTF Trace
-
 # Experiment type
 experimenttype.type.generic = Generic Experiment
index d615cd4fff2f875fb7d8a917dd5fb64cb43cbcfb..0df89e021c72a20201fa244f6f068454ff1442d0 100644 (file)
    </extension>
    <extension
          point="org.eclipse.linuxtools.tmf.core.tracetype">
-      <category
-            id="org.eclipse.linuxtools.tmf.core.category.ctf"
-            name="%tracetype.category.ctf">
-      </category>
-      <type
-            category="org.eclipse.linuxtools.tmf.core.category.ctf"
-            event_type="org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent"
-            id="org.eclipse.linuxtools.tmf.ui.type.ctf"
-            isDirectory="true"
-            name="%tracetype.type.ctf"
-            trace_type="org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace">
-      </type>
       <experiment
             id="org.eclipse.linuxtools.tmf.core.experiment.generic"
             name="%experimenttype.type.generic"
index 33075c09d4e3ce55450e3482bc31b664e8f15ddf..70b4ee8e4548ba4054e7c130d3b95d0910249e51 100644 (file)
@@ -20,7 +20,7 @@ public class Messages extends NLS {
     private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.tmf.core.messages"; //$NON-NLS-1$
     public static String TmfCheckpointIndexer_EventsPerSecond;
     public static String TmfCheckpointIndexer_Indexing;
-    public static String TmfEventField_UnsupportedType;
+
     static {
         // initialize resource bundle
         NLS.initializeMessages(BUNDLE_NAME, Messages.class);
index 3b48d56a2abcda405dd7a87a66d95872bb2a2576..ef096a387b7fa7b4347f24c182eac13744ba16d5 100644 (file)
@@ -12,4 +12,3 @@
 
 TmfCheckpointIndexer_EventsPerSecond=events/s
 TmfCheckpointIndexer_Indexing=Indexing
-TmfEventField_UnsupportedType=Unsupported field type:
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfConstants.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfConstants.java
deleted file mode 100644 (file)
index b729524..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Ericsson, Ecole Polytechnique de Montreal and others
- *
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Ansgar Radermacher - support for model URI
- *   Patrick Tasse - context strings
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.ctfadaptor;
-
-/**
- * Set of constants used by the CTF adaptor classes
- *
- * @since 2.0
- */
-@SuppressWarnings("nls")
-public interface CtfConstants {
-
-    /*
-     * Context strings
-     */
-
-    /** Prefix for context information stored as CtfTmfEventfield */
-    public static final String CONTEXT_FIELD_PREFIX = "context.";
-
-    /** Key for ip field */
-    public static final String IP_KEY = "_ip";
-
-    /*
-     * Custom attributes names (key within hash table)
-     */
-
-    /** Model URI for traces related to EMF models */
-    public final static String MODEL_URI_KEY = "model.emf.uri";
-}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfEnumPair.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfEnumPair.java
deleted file mode 100644 (file)
index 34aaa46..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Bernd Hufmann - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.ctfadaptor;
-
-import org.eclipse.linuxtools.tmf.core.util.Pair;
-
-/**
- * Pair of Enum value name and its long value.
- *
- * @author Bernd Hufmann
- * @since 2.0
- */
-public class CtfEnumPair extends Pair<String, Long> {
-
-    /**
-     * Constructs a CtfEnumPair
-     *
-     * @param strValue
-     *                  The first parameter of the pair (String)
-     * @param longValue
-     *                  The second parameter of the pair (Long)
-     */
-    public CtfEnumPair(String strValue, Long longValue) {
-        super(strValue, longValue);
-    }
-
-    /**
-     * Returns the String value of the Enum.
-     *
-     * @return the string value
-     */
-    public String getStringValue() {
-        return getFirst();
-    }
-
-    /**
-     * Returns the long value of the Enum.
-     *
-     * @return the Long value
-     */
-    public Long getLongValue() {
-        return getSecond();
-    }
-
-    @Override
-    public String toString() {
-        return getFirst();
-    }
-}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java
deleted file mode 100644 (file)
index d5cece5..0000000
+++ /dev/null
@@ -1,333 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson, Ã‰cole Polytechnique de Montréal
- *
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial API and implementation
- *   Florian Wininger - Performance improvements
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.ctfadaptor;
-
-import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
-import org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader;
-import org.eclipse.linuxtools.ctf.core.trace.StreamInputReader;
-import org.eclipse.linuxtools.internal.tmf.core.Activator;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
-
-/**
- * The CTF trace reader iterator.
- *
- * It doesn't reserve a file handle, so many iterators can be used without
- * worries of I/O errors or resource exhaustion.
- *
- * @author Matthew Khouzam
- */
-public class CtfIterator extends CTFTraceReader
-        implements ITmfContext, Comparable<CtfIterator> {
-
-    /** An invalid location */
-    public static final CtfLocation NULL_LOCATION = new CtfLocation(CtfLocation.INVALID_LOCATION);
-
-    private final CtfTmfTrace fTrace;
-
-    private CtfLocation fCurLocation;
-    private long fCurRank;
-
-    private CtfLocation fPreviousLocation;
-    private CtfTmfEvent fPreviousEvent;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Create a new CTF trace iterator, which initially points at the first
-     * event in the trace.
-     *
-     * @param trace
-     *            The trace to iterate over
-     * @throws CTFReaderException
-     *             If the iterator couldn't not be instantiated, probably due to
-     *             a read error.
-     */
-    public CtfIterator(CtfTmfTrace trace) throws CTFReaderException {
-        super(trace.getCTFTrace());
-        fTrace = trace;
-        if (hasMoreEvents()) {
-            fCurLocation = new CtfLocation(trace.getStartTime());
-            fCurRank = 0;
-        } else {
-            setUnknownLocation();
-        }
-    }
-
-    /**
-     * Create a new CTF trace iterator, which will initially point to the given
-     * location/rank.
-     *
-     * @param trace
-     *            The trace to iterate over
-     * @param ctfLocationData
-     *            The initial timestamp the iterator will be pointing to
-     * @param rank
-     *            The initial rank
-     * @throws CTFReaderException
-     *             If the iterator couldn't not be instantiated, probably due to
-     *             a read error.
-     * @since 2.0
-     */
-    public CtfIterator(CtfTmfTrace trace, CtfLocationInfo ctfLocationData, long rank)
-            throws CTFReaderException {
-        super(trace.getCTFTrace());
-
-        this.fTrace = trace;
-        if (this.hasMoreEvents()) {
-            this.fCurLocation = new CtfLocation(ctfLocationData);
-            if (this.getCurrentEvent().getTimestamp().getValue() != ctfLocationData.getTimestamp()) {
-                this.seek(ctfLocationData);
-                this.fCurRank = rank;
-            }
-        } else {
-            setUnknownLocation();
-        }
-    }
-
-    private void setUnknownLocation() {
-        fCurLocation = NULL_LOCATION;
-        fCurRank = UNKNOWN_RANK;
-    }
-
-    // ------------------------------------------------------------------------
-    // Accessors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Return this iterator's trace.
-     *
-     * @return CtfTmfTrace The iterator's trace
-     */
-    public CtfTmfTrace getCtfTmfTrace() {
-        return fTrace;
-    }
-
-    /**
-     * Return the current event pointed to by the iterator.
-     *
-     * @return CtfTmfEvent The current event
-     */
-    public synchronized CtfTmfEvent getCurrentEvent() {
-        final StreamInputReader top = super.getPrio().peek();
-        if (top != null) {
-            if (!fCurLocation.equals(fPreviousLocation)) {
-                fPreviousLocation = fCurLocation;
-                fPreviousEvent = CtfTmfEventFactory.createEvent(top.getCurrentEvent(),
-                        top.getFilename(), fTrace);
-            }
-            return fPreviousEvent;
-        }
-        return null;
-    }
-
-    /**
-     * Seek this iterator to a given location.
-     *
-     * @param ctfLocationData
-     *            The LocationData representing the position to seek to
-     * @return boolean True if the seek was successful, false if there was an
-     *         error seeking.
-     * @since 2.0
-     */
-    public synchronized boolean seek(CtfLocationInfo ctfLocationData) {
-        boolean ret = false;
-
-        /* Avoid the cost of seeking at the current location. */
-        if (fCurLocation.getLocationInfo().equals(ctfLocationData)) {
-            return super.hasMoreEvents();
-        }
-
-        /* Adjust the timestamp depending on the trace's offset */
-        long currTimestamp = ctfLocationData.getTimestamp();
-        final long offsetTimestamp = this.getCtfTmfTrace().getCTFTrace().timestampNanoToCycles(currTimestamp);
-        try {
-            if (offsetTimestamp < 0) {
-                ret = super.seek(0L);
-            } else {
-                ret = super.seek(offsetTimestamp);
-            }
-        } catch (CTFReaderException e) {
-            Activator.logError(e.getMessage(), e);
-            return false;
-        }
-        /*
-         * Check if there is already one or more events for that timestamp, and
-         * assign the location index correctly
-         */
-        long index = 0;
-        final CtfTmfEvent currentEvent = this.getCurrentEvent();
-        if (currentEvent != null) {
-            currTimestamp = currentEvent.getTimestamp().getValue();
-
-            for (long i = 0; i < ctfLocationData.getIndex(); i++) {
-                if (currTimestamp == currentEvent.getTimestamp().getValue()) {
-                    index++;
-                } else {
-                    index = 0;
-                }
-                this.advance();
-            }
-        } else {
-            ret = false;
-        }
-        /* Seek the current location accordingly */
-        if (ret) {
-            fCurLocation = new CtfLocation(new CtfLocationInfo(getCurrentEvent().getTimestamp().getValue(), index));
-        } else {
-            fCurLocation = NULL_LOCATION;
-        }
-
-        return ret;
-    }
-
-    // ------------------------------------------------------------------------
-    // CTFTraceReader
-    // ------------------------------------------------------------------------
-
-    @Override
-    public boolean seek(long timestamp) {
-        return seek(new CtfLocationInfo(timestamp, 0));
-    }
-
-    @Override
-    public synchronized boolean advance() {
-        long index = fCurLocation.getLocationInfo().getIndex();
-        long timestamp = fCurLocation.getLocationInfo().getTimestamp();
-        boolean ret = false;
-        try {
-            ret = super.advance();
-        } catch (CTFReaderException e) {
-            Activator.logError(e.getMessage(), e);
-        }
-
-        if (ret) {
-            final long timestampValue = getCurrentEvent().getTimestamp().getValue();
-            if (timestamp == timestampValue) {
-                fCurLocation = new CtfLocation(timestampValue, index + 1);
-            } else {
-                fCurLocation = new CtfLocation(timestampValue, 0L);
-            }
-        } else {
-            fCurLocation = NULL_LOCATION;
-        }
-        return ret;
-    }
-
-    // ------------------------------------------------------------------------
-    // ITmfContext
-    // ------------------------------------------------------------------------
-
-    @Override
-    public long getRank() {
-        return fCurRank;
-    }
-
-    @Override
-    public void setRank(long rank) {
-        fCurRank = rank;
-    }
-
-    @Override
-    public void increaseRank() {
-        /* Only increase the rank if it's valid */
-        if (hasValidRank()) {
-            fCurRank++;
-        }
-    }
-
-    @Override
-    public boolean hasValidRank() {
-        return (getRank() >= 0);
-    }
-
-    /**
-     * @since 3.0
-     */
-    @Override
-    public void setLocation(ITmfLocation location) {
-        // FIXME alex: isn't there a cleaner way than a cast here?
-        fCurLocation = (CtfLocation) location;
-        seek(((CtfLocation) location).getLocationInfo());
-    }
-
-    @Override
-    public CtfLocation getLocation() {
-        return fCurLocation;
-    }
-
-    // ------------------------------------------------------------------------
-    // Comparable
-    // ------------------------------------------------------------------------
-
-    @Override
-    public int compareTo(final CtfIterator o) {
-        if (getRank() < o.getRank()) {
-            return -1;
-        } else if (getRank() > o.getRank()) {
-            return 1;
-        }
-        return 0;
-    }
-
-    // ------------------------------------------------------------------------
-    // Object
-    // ------------------------------------------------------------------------
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = super.hashCode();
-        result = (prime * result)
-                + ((fTrace == null) ? 0 : fTrace.hashCode());
-        result = (prime * result)
-                + ((fCurLocation == null) ? 0 : fCurLocation.hashCode());
-        result = (prime * result) + (int) (fCurRank ^ (fCurRank >>> 32));
-        return result;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (!super.equals(obj)) {
-            return false;
-        }
-        if (!(obj instanceof CtfIterator)) {
-            return false;
-        }
-        CtfIterator other = (CtfIterator) obj;
-        if (fTrace == null) {
-            if (other.fTrace != null) {
-                return false;
-            }
-        } else if (!fTrace.equals(other.fTrace)) {
-            return false;
-        }
-        if (fCurLocation == null) {
-            if (other.fCurLocation != null) {
-                return false;
-            }
-        } else if (!fCurLocation.equals(other.fCurLocation)) {
-            return false;
-        }
-        if (fCurRank != other.fCurRank) {
-            return false;
-        }
-        return true;
-    }
-}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIteratorManager.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIteratorManager.java
deleted file mode 100644 (file)
index 5ebd934..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial API and implementation
- *   Simon Delisle - Added a method to remove the iterator
- *******************************************************************************/
-package org.eclipse.linuxtools.tmf.core.ctfadaptor;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Random;
-
-/**
- * Ctf Iterator Manager, allows mapping of iterators (a limited resource) to
- * contexts (many many resources).
- *
- * @author Matthew Khouzam
- * @version 1.0
- * @since 1.1
- */
-public abstract class CtfIteratorManager {
-    /*
-     * A side note synchronized works on the whole object, Therefore add and
-     * remove will be thread safe.
-     */
-
-    /*
-     * The map of traces to trace managers.
-     */
-    private static HashMap<CtfTmfTrace, CtfTraceManager> map = new HashMap<>();
-
-    /**
-     * Registers a trace to the iterator manager, the trace can now get
-     * iterators.
-     *
-     * @param trace
-     *            the trace to register.
-     */
-    public static synchronized void addTrace(final CtfTmfTrace trace) {
-        map.put(trace, new CtfTraceManager(trace));
-    }
-
-    /**
-     * Removes a trace to the iterator manager.
-     *
-     * @param trace
-     *            the trace to register.
-     */
-    public static synchronized void removeTrace(final CtfTmfTrace trace) {
-        CtfTraceManager mgr = map.remove(trace);
-        if (mgr != null) {
-            mgr.clear();
-        }
-    }
-
-    /**
-     * Get an iterator for a given trace and context.
-     *
-     * @param trace
-     *            the trace
-     * @param ctx
-     *            the context
-     * @return the iterator
-     * @since 2.0
-     */
-    public static synchronized CtfIterator getIterator(final CtfTmfTrace trace,
-            final CtfTmfContext ctx) {
-        return map.get(trace).getIterator(ctx);
-    }
-
-    /**
-     * Remove an iterator for a given trace and context
-     *
-     * @param trace
-     *            the trace
-     * @param ctx
-     *            the context
-     * @since 2.1
-     */
-    public static synchronized void removeIterator(final CtfTmfTrace trace, final CtfTmfContext ctx) {
-        CtfTraceManager traceManager = map.get(trace);
-        if (traceManager != null) {
-            traceManager.removeIterator(ctx);
-        }
-    }
-}
-
-/**
- * A trace manager
- *
- * @author Matthew Khouzam
- */
-class CtfTraceManager {
-    /*
-     * Cache size. Under 1023 on linux32 systems. Number of file handles
-     * created.
-     */
-    private final static int MAX_SIZE = 100;
-    /*
-     * The map of the cache.
-     */
-    private final HashMap<CtfTmfContext, CtfIterator> fMap;
-    /*
-     * An array pointing to the same cache. this allows fast "random" accesses.
-     */
-    private final ArrayList<CtfTmfContext> fRandomAccess;
-    /*
-     * The parent trace
-     */
-    private final CtfTmfTrace fTrace;
-    /*
-     * Random number generator
-     */
-    private final Random fRnd;
-
-    public CtfTraceManager(CtfTmfTrace trace) {
-        fMap = new HashMap<>();
-        fRandomAccess = new ArrayList<>();
-        fRnd = new Random(System.nanoTime());
-        fTrace = trace;
-    }
-
-    /**
-     * This needs explaining: the iterator table is effectively a cache.
-     * Originally the contexts had a 1 to 1 structure with the file handles of a
-     * trace. This failed since there is a limit to how many file handles we can
-     * have opened simultaneously. Then a round-robin scheme was implemented,
-     * this lead up to a two competing contexts syncing up and using the same
-     * file handler, causing horrible slowdowns. Now a random replacement
-     * algorithm is selected. This is the same as used by arm processors, and it
-     * works quite well when many cores so this looks promising for very
-     * multi-threaded systems.
-     *
-     * @param context
-     *            the context to look up
-     * @return the iterator referring to the context
-     */
-    public CtfIterator getIterator(final CtfTmfContext context) {
-        /*
-         * if the element is in the map, we don't need to do anything else.
-         */
-        CtfIterator retVal = fMap.get(context);
-        if (retVal == null) {
-            /*
-             * Assign an iterator to a context, this means we will need to seek
-             * at the end.
-             */
-            if (fRandomAccess.size() < MAX_SIZE) {
-                /*
-                 * if we're not full yet, just add an element.
-                 */
-                retVal = fTrace.createIterator();
-                addElement(context, retVal);
-
-            } else {
-                /*
-                 * if we're full, randomly replace an element
-                 */
-                retVal = replaceRandomElement(context);
-            }
-            if (context.getLocation() != null) {
-                final CtfLocationInfo location = (CtfLocationInfo) context.getLocation().getLocationInfo();
-                retVal.seek(location);
-            }
-        }
-        return retVal;
-    }
-
-    public void removeIterator(CtfTmfContext context) {
-        fMap.remove(context);
-        fRandomAccess.remove(context);
-    }
-
-    /**
-     * Add a pair of context and element to the hashmap and the arraylist.
-     *
-     * @param context
-     *            the context
-     * @param elem
-     *            the iterator
-     */
-    private void addElement(final CtfTmfContext context,
-            final CtfIterator elem) {
-        fMap.put(context, elem);
-        fRandomAccess.add(context);
-    }
-
-    /**
-     * Replace a random element
-     *
-     * @param context
-     *            the context to swap in
-     * @return the iterator of the removed elements.
-     */
-    private CtfIterator replaceRandomElement(
-            final CtfTmfContext context) {
-        /*
-         * This needs some explanation too: We need to select a random victim
-         * and remove it. The order of the elements is not important, so instead
-         * of just calling arraylist.remove(element) which has an O(n)
-         * complexity, we pick an random number. The element is swapped out of
-         * the array and removed and replaced in the hashmap.
-         */
-        final int size = fRandomAccess.size();
-        final int pos = fRnd.nextInt(size);
-        final CtfTmfContext victim = fRandomAccess.get(pos);
-        fRandomAccess.set(pos, context);
-        final CtfIterator elem = fMap.remove(victim);
-        fMap.put(context, elem);
-        return elem;
-    }
-
-    void clear() {
-        for (CtfIterator iterator : fMap.values()) {
-            iterator.dispose();
-        }
-        fMap.clear();
-        fRandomAccess.clear();
-    }
-}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java
deleted file mode 100644 (file)
index e59a2d3..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial API and implementation
- *   Alexandre Montplaisir - Extends TmfLocation
- *******************************************************************************/
-package org.eclipse.linuxtools.tmf.core.ctfadaptor;
-
-import java.nio.ByteBuffer;
-
-import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.trace.location.TmfLocation;
-
-/**
- * The nugget of information that is unique to a location in a CTF trace.
- *
- * It can be copied and used to restore a position in a given trace.
- *
- * @version 1.0
- * @author Matthew Khouzam
- */
-public final class CtfLocation extends TmfLocation {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    /**
-     * An invalid location
-     */
-    public static final CtfLocationInfo INVALID_LOCATION = new CtfLocationInfo(-1, -1);
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Basic constructor for CtfLocation. Uses a default index of 0.
-     *
-     * @param timestamp
-     *            The timestamp of this location
-     * @since 2.0
-     */
-    public CtfLocation(final ITmfTimestamp timestamp) {
-        this(timestamp.getValue(), 0);
-    }
-
-    /**
-     * Constructor using timestamp object and index
-     *
-     * @param timestamp
-     *            The timestamp of this location
-     * @param index
-     *            The index of this location for this timestamp
-     * @since 2.0
-     */
-    public CtfLocation(final ITmfTimestamp timestamp, long index) {
-        this(timestamp.getValue(), index);
-    }
-
-    /**
-     * Constructor using a long value for the timestamp, and an index
-     *
-     * @param timestampValue
-     *            The new timestamp
-     * @param index
-     *            The new index
-     * @since 2.0
-     */
-    public CtfLocation(final long timestampValue, final long index) {
-       super(new CtfLocationInfo(timestampValue, index));
-    }
-
-    /**
-     * Constructor using a pre-made locationInfo object
-     *
-     * @param locationInfo
-     *            The locationInfo object to use
-     * @since 2.0
-     */
-    public CtfLocation(CtfLocationInfo locationInfo) {
-        super(locationInfo);
-    }
-
-    /**
-     * Copy constructor
-     *
-     * @param location
-     *            Other location to copy
-     * @since 2.0
-     */
-    public CtfLocation(final CtfLocation location) {
-        super(location);
-    }
-
-    // ------------------------------------------------------------------------
-    // TmfLocation
-    // ------------------------------------------------------------------------
-
-    /**
-     * Construct the location from the ByteBuffer.
-     *
-     * @param bufferIn
-     *            the buffer to read from
-     *
-     * @since 3.0
-     */
-    public CtfLocation(ByteBuffer bufferIn) {
-        super(new CtfLocationInfo(bufferIn));
-    }
-
-    /**
-     * @since 2.0
-     */
-    @Override
-    public CtfLocationInfo getLocationInfo() {
-        return (CtfLocationInfo) super.getLocationInfo();
-    }
-
-    // ------------------------------------------------------------------------
-    // Object
-    // ------------------------------------------------------------------------
-
-    @Override
-    public String toString() {
-        if (getLocationInfo().equals(CtfLocation.INVALID_LOCATION )) {
-            return getClass().getSimpleName() + " [INVALID]"; //$NON-NLS-1$
-        }
-        return super.toString();
-    }
-
-    /**
-     * Constructs the location from the ByteBuffer. This typically happens when reading from disk.
-     *
-     * @since 3.0
-     */
-    @Override
-    public void serialize(ByteBuffer bufferOut) {
-        getLocationInfo().serialize(bufferOut);
-    }
-}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocationInfo.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocationInfo.java
deleted file mode 100644 (file)
index 0e9d59a..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.tmf.core.ctfadaptor;
-
-import java.nio.ByteBuffer;
-
-/**
- * The data object to go in a {@link CtfLocation}.
- *
- * @author Matthew Khouzam
- * @since 2.0
- */
-public class CtfLocationInfo implements Comparable<CtfLocationInfo> {
-
-    private final long fTimestamp;
-    private final long fIndex;
-
-    /**
-     * @param ts
-     *            Timestamp
-     * @param index
-     *            Index of this event (if there are N elements with the same
-     *            timestamp, which one is it.)
-     */
-    public CtfLocationInfo(long ts, long index) {
-        fTimestamp = ts;
-        fIndex = index;
-    }
-
-    /**
-     * Construct the location from the ByteBuffer.
-     *
-     * @param bufferIn
-     *            the buffer to read from
-     *
-     * @since 3.0
-     */
-    public CtfLocationInfo(ByteBuffer bufferIn) {
-        fTimestamp = bufferIn.getLong();
-        fIndex = bufferIn.getLong();
-    }
-
-    /**
-     * @return The timestamp
-     */
-    public long getTimestamp() {
-        return fTimestamp;
-    }
-
-    /**
-     * @return The index of the element
-     */
-    public long getIndex() {
-        return fIndex;
-    }
-
-    // ------------------------------------------------------------------------
-    // Object
-    // ------------------------------------------------------------------------
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = (prime * result) + (int) (fIndex ^ (fIndex >>> 32));
-        result = (prime * result) + (int) (fTimestamp ^ (fTimestamp >>> 32));
-        return result;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (!(obj instanceof CtfLocationInfo)) {
-            return false;
-        }
-        CtfLocationInfo other = (CtfLocationInfo) obj;
-        if (fIndex != other.fIndex) {
-            return false;
-        }
-        if (fTimestamp != other.fTimestamp) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return "Element [" + fTimestamp + '/' + fIndex + ']'; //$NON-NLS-1$
-    }
-
-    // ------------------------------------------------------------------------
-    // Comparable
-    // ------------------------------------------------------------------------
-
-    @Override
-    public int compareTo(CtfLocationInfo other) {
-        if (fTimestamp > other.getTimestamp()) {
-            return 1;
-        }
-        if (fTimestamp < other.getTimestamp()) {
-            return -1;
-        }
-        if (fIndex > other.getIndex()) {
-            return 1;
-        }
-        if (fIndex < other.getIndex()) {
-            return -1;
-        }
-        return 0;
-    }
-
-    /**
-     * Write the location to the ByteBuffer so that it can be saved to disk.
-     *
-     * @param bufferOut
-     *            the buffer to write to
-     *
-     * @since 3.0
-     */
-    public void serialize(ByteBuffer bufferOut) {
-        bufferOut.putLong(fTimestamp);
-        bufferOut.putLong(fIndex);
-    }
-}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfCallsite.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfCallsite.java
deleted file mode 100644 (file)
index d929d6b..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     Patrick Tasse - Initial API and implementation
- *     Bernd Hufmann - Updated for new parent class
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.ctfadaptor;
-
-import org.eclipse.linuxtools.ctf.core.event.CTFCallsite;
-import org.eclipse.linuxtools.tmf.core.event.lookup.TmfCallsite;
-
-/**
- * CTF TMF call site information for source code lookup.
- *
- * @author Patrick Tasse
- * @since 2.0
- */
-public class CtfTmfCallsite extends TmfCallsite {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    /** The event name. */
-    final private String fEventName;
-
-    /** The instruction pointer. */
-    final private long fInstructionPointer;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Standard Constructor.
-     *
-     * @param callsite
-     *              - a CTF call site
-     */
-    CtfTmfCallsite(CTFCallsite callsite) {
-        super(callsite.getFileName(), callsite.getFunctionName(), callsite.getLineNumber());
-        fEventName = callsite.getEventName();
-        fInstructionPointer = callsite.getIp();
-    }
-
-    // ------------------------------------------------------------------------
-    // Accessors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Returns the event name of the call site.
-     * @return the event name
-     */
-    public String getEventName() {
-        return fEventName;
-    }
-
-    /**
-     * Returns the instruction pointer of the call site.
-     * @return the instruction pointer
-     */
-    public long getIntructionPointer() {
-        return fInstructionPointer;
-    }
-
-    // ------------------------------------------------------------------------
-    // Accessors
-    // ------------------------------------------------------------------------
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = super.hashCode();
-        result = prime * result + ((fEventName == null) ? 0 : fEventName.hashCode());
-        result = prime * result + (int) (fInstructionPointer ^ (fInstructionPointer >>> 32));
-        return result;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (!super.equals(obj)) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        CtfTmfCallsite other = (CtfTmfCallsite) obj;
-        if (fEventName == null) {
-            if (other.fEventName != null) {
-                return false;
-            }
-        } else if (!fEventName.equals(other.fEventName)) {
-            return false;
-        }
-        if (fInstructionPointer != other.fInstructionPointer) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return getEventName() + "@0x" + Long.toHexString(fInstructionPointer) + ": " + //$NON-NLS-1$ //$NON-NLS-2$
-                getFileName() + ':' + Long.toString(getLineNumber()) + ' ' + getFileName() + "()"; //$NON-NLS-1$
-    }
-}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfContext.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfContext.java
deleted file mode 100644 (file)
index 46b61a0..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial API and implementation
- *   Simon Delisle - Remove the iterator in dispose()
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.ctfadaptor;
-
-import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
-
-/**
- * Lightweight Context for CtfTmf traces. Should only use 3 references, 1 ref to
- * a boxed Long, a long and an int.
- *
- * @author Matthew Khouzam
- * @version 1.0
- * @since 2.0
- */
-public class CtfTmfContext implements ITmfContext {
-
-    // -------------------------------------------
-    // Fields
-    // -------------------------------------------
-
-    private CtfLocation fCurLocation;
-    private long fCurRank;
-
-    private final CtfTmfTrace fTrace;
-
-    // -------------------------------------------
-    // Constructor
-    // -------------------------------------------
-
-    /**
-     * Constructor
-     *
-     * @param ctfTmfTrace
-     *            the parent trace
-     * @since 1.1
-     */
-    public CtfTmfContext(CtfTmfTrace ctfTmfTrace) {
-        fTrace = ctfTmfTrace;
-        fCurLocation = new CtfLocation(new CtfLocationInfo(0, 0));
-    }
-
-    // -------------------------------------------
-    // TmfContext Overrides
-    // -------------------------------------------
-
-    @Override
-    public long getRank() {
-        return fCurRank;
-    }
-
-    /**
-     * @since 3.0
-     */
-    @Override
-    public ITmfLocation getLocation() {
-        return fCurLocation;
-    }
-
-    @Override
-    public boolean hasValidRank() {
-        return fCurRank != CtfLocation.INVALID_LOCATION.getTimestamp();
-    }
-
-    /**
-     * @since 3.0
-     */
-    @Override
-    public void setLocation(ITmfLocation location) {
-        fCurLocation = (CtfLocation) location;
-        if (fCurLocation != null) {
-            getIterator().seek(fCurLocation.getLocationInfo());
-        }
-    }
-
-    @Override
-    public void setRank(long rank) {
-        fCurRank = rank;
-
-    }
-
-    @Override
-    public void increaseRank() {
-        if (hasValidRank()) {
-            fCurRank++;
-        }
-    }
-
-    // -------------------------------------------
-    // CtfTmfTrace Helpers
-    // -------------------------------------------
-
-    /**
-     * Gets the trace of this context.
-     *
-     * @return The trace of this context
-     */
-    public CtfTmfTrace getTrace() {
-        return fTrace;
-    }
-
-    /**
-     * Gets the current event. Wrapper to help CtfTmfTrace
-     *
-     * @return The event or null
-     */
-    public synchronized CtfTmfEvent getCurrentEvent() {
-        return getIterator().getCurrentEvent();
-    }
-
-    /**
-     * Advances to a the next event. Wrapper to help CtfTmfTrace
-     *
-     * @return success or not
-     */
-    public synchronized boolean advance() {
-        final CtfLocationInfo curLocationData = fCurLocation.getLocationInfo();
-        boolean retVal = getIterator().advance();
-        CtfTmfEvent currentEvent = getIterator().getCurrentEvent();
-
-        if (currentEvent != null) {
-            final long timestampValue = currentEvent.getTimestamp().getValue();
-            if (curLocationData.getTimestamp() == timestampValue) {
-                fCurLocation = new CtfLocation(timestampValue, curLocationData.getIndex() + 1);
-            } else {
-                fCurLocation = new CtfLocation(timestampValue, 0L);
-            }
-        } else {
-            fCurLocation = new CtfLocation(CtfLocation.INVALID_LOCATION);
-        }
-
-        return retVal;
-    }
-
-    @Override
-    public void dispose() {
-        CtfIteratorManager.removeIterator(fTrace, this);
-    }
-
-    /**
-     * Seeks to a given timestamp. Wrapper to help CtfTmfTrace
-     *
-     * @param timestamp
-     *            desired timestamp
-     * @return success or not
-     */
-    public synchronized boolean seek(final long timestamp) {
-        fCurLocation = new CtfLocation(timestamp, 0);
-        return getIterator().seek(timestamp);
-    }
-
-    /**
-     * Seeks to a given location. Wrapper to help CtfTmfTrace
-     * @param location
-     *              unique location to find the event.
-     *
-     * @return success or not
-     * @since 2.0
-     */
-    public synchronized boolean seek(final CtfLocationInfo location) {
-        fCurLocation = new CtfLocation(location);
-        return getIterator().seek(location);
-    }
-
-    @Override
-    public CtfTmfContext clone() {
-        CtfTmfContext ret = null;
-        try {
-            ret = (CtfTmfContext) super.clone();
-            /* Fields are immutable, no need to deep-copy them */
-        } catch (CloneNotSupportedException e) {
-            /* Should not happen, we're calling Object.clone() */
-        }
-        return ret;
-    }
-
-    // -------------------------------------------
-    // Private helpers
-    // -------------------------------------------
-
-    /**
-     * Get iterator, called every time to get an iterator, no local copy is
-     * stored so that there is no need to "update"
-     *
-     * @return an iterator
-     */
-    private CtfIterator getIterator() {
-        return CtfIteratorManager.getIterator(fTrace, this);
-    }
-}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java
deleted file mode 100644 (file)
index 8cab950..0000000
+++ /dev/null
@@ -1,214 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     Alexandre Montplaisir - Initial API and implementation
- *     Bernd Hufmann - Updated for source and model lookup interfaces
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.ctfadaptor;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.linuxtools.ctf.core.event.CTFCallsite;
-import org.eclipse.linuxtools.ctf.core.event.IEventDeclaration;
-import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
-import org.eclipse.linuxtools.tmf.core.event.ITmfCustomAttributes;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEventType;
-import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
-import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
-import org.eclipse.linuxtools.tmf.core.event.lookup.ITmfModelLookup;
-import org.eclipse.linuxtools.tmf.core.event.lookup.ITmfSourceLookup;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
-
-/**
- * A wrapper class around CTF's Event Definition/Declaration that maps all types
- * of Declaration to native Java types.
- *
- * @version 1.0
- * @author Alexandre Montplaisir
- * @since 2.0
- */
-public class CtfTmfEvent extends TmfEvent
-        implements ITmfSourceLookup, ITmfModelLookup, ITmfCustomAttributes {
-
-    // ------------------------------------------------------------------------
-    // Constants
-    // ------------------------------------------------------------------------
-
-    static final String NO_STREAM = "No stream"; //$NON-NLS-1$
-    private static final String EMPTY_CTF_EVENT_NAME = "Empty CTF event"; //$NON-NLS-1$
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    private final int fSourceCPU;
-    private final long fTypeId;
-    private final String fEventName;
-    private final IEventDeclaration fDeclaration;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Constructor used by {@link CtfTmfEventFactory#createEvent}
-     */
-    CtfTmfEvent(CtfTmfTrace trace, long rank, CtfTmfTimestamp timestamp,
-            ITmfEventField content, String fileName, int cpu,
-            IEventDeclaration declaration) {
-        super(trace,
-                rank,
-                timestamp,
-                String.valueOf(cpu), // Source
-                null, // Event type. We don't use TmfEvent's field here, we re-implement getType()
-                content,
-                fileName // Reference
-        );
-
-        fDeclaration = declaration;
-        fSourceCPU = cpu;
-        fTypeId = declaration.getId();
-        fEventName = declaration.getName();
-
-    }
-
-    /**
-     * Inner constructor to create "null" events. Don't use this directly in
-     * normal usage, use {@link CtfTmfEventFactory#getNullEvent()} to get an
-     * instance of an empty event.
-     *
-     * This needs to be public however because it's used in extension points,
-     * and the framework will use this constructor to get the class type.
-     */
-    public CtfTmfEvent() {
-        super(null,
-                ITmfContext.UNKNOWN_RANK,
-                new CtfTmfTimestamp(-1),
-                null,
-                null,
-                new TmfEventField("", null, new CtfTmfEventField[0]), //$NON-NLS-1$
-                NO_STREAM);
-        fSourceCPU = -1;
-        fTypeId = -1;
-        fEventName = EMPTY_CTF_EVENT_NAME;
-        fDeclaration = null;
-    }
-
-    // ------------------------------------------------------------------------
-    // Getters/Setters/Predicates
-    // ------------------------------------------------------------------------
-
-    /**
-     * Gets the cpu core the event was recorded on.
-     *
-     * @return The cpu id for a given source. In lttng it's from CPUINFO
-     */
-    public int getCPU() {
-        return fSourceCPU;
-    }
-
-    /**
-     * Return this event's ID, according to the trace's metadata.
-     *
-     * Watch out, this ID is not constant from one trace to another for the same
-     * event types! Use "getEventName()" for a constant reference.
-     *
-     * @return The event ID
-     */
-    public long getID() {
-        return fTypeId;
-    }
-
-    @Override
-    public CtfTmfTrace getTrace() {
-        /*
-         * Should be of the right type, since we take a CtfTmfTrace at the
-         * constructor
-         */
-        return (CtfTmfTrace) super.getTrace();
-    }
-
-    @Override
-    public ITmfEventType getType() {
-        CtfTmfEventType ctfTmfEventType = CtfTmfEventType.get(getTrace(), fEventName);
-        if (ctfTmfEventType == null) {
-            /* Should only return null the first time */
-            ctfTmfEventType = new CtfTmfEventType(fEventName, getTrace(), getContent());
-        }
-        return ctfTmfEventType;
-    }
-
-    /**
-     * @since 2.0
-     */
-    @Override
-    public Set<String> listCustomAttributes() {
-        if (fDeclaration == null) {
-            return new HashSet<>();
-        }
-        return fDeclaration.getCustomAttributes();
-    }
-
-    /**
-     * @since 2.0
-     */
-    @Override
-    public String getCustomAttribute(String name) {
-        if (fDeclaration == null) {
-            return null;
-        }
-        return fDeclaration.getCustomAttribute(name);
-    }
-
-    /**
-     * Get the call site for this event.
-     *
-     * @return the call site information, or null if there is none
-     * @since 2.0
-     */
-    @Override
-    public CtfTmfCallsite getCallsite() {
-        CTFCallsite callsite = null;
-        CtfTmfTrace trace = getTrace();
-        if (trace == null) {
-            return null;
-        }
-        CTFTrace ctfTrace = trace.getCTFTrace();
-        /* Should not happen, but it is a good check */
-        if (ctfTrace == null) {
-            return null;
-        }
-        if (getContent() != null) {
-            ITmfEventField ipField = getContent().getField(CtfConstants.CONTEXT_FIELD_PREFIX + CtfConstants.IP_KEY);
-            if (ipField != null && ipField.getValue() instanceof Long) {
-                long ip = (Long) ipField.getValue();
-                callsite = ctfTrace.getCallsite(fEventName, ip);
-            }
-        }
-        if (callsite == null) {
-            callsite = ctfTrace.getCallsite(fEventName);
-        }
-        if (callsite != null) {
-            return new CtfTmfCallsite(callsite);
-        }
-        return null;
-    }
-
-    /**
-     * @since 2.0
-     */
-    @Override
-    public String getModelUri() {
-        return getCustomAttribute(CtfConstants.MODEL_URI_KEY);
-    }
-
-}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventFactory.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventFactory.java
deleted file mode 100644 (file)
index a7832ca..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.ctfadaptor;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.linuxtools.ctf.core.CTFStrings;
-import org.eclipse.linuxtools.ctf.core.event.EventDefinition;
-import org.eclipse.linuxtools.ctf.core.event.IEventDeclaration;
-import org.eclipse.linuxtools.ctf.core.event.types.Definition;
-import org.eclipse.linuxtools.ctf.core.event.types.IntegerDefinition;
-import org.eclipse.linuxtools.ctf.core.event.types.StructDefinition;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
-import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
-import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
-
-/**
- * Factory for CtfTmfEvent's.
- *
- * This code was moved out of CtfTmfEvent to provide better separation between
- * the parsing/instantiation of events, and the usual TMF API implementations.
- *
- * @author Alexandre Montplaisir
- * @since 2.0
- */
-public final class CtfTmfEventFactory {
-
-    /**
-     * Don't let anyone instantiate this class.
-     */
-    private CtfTmfEventFactory() {}
-
-    /**
-     * Factory method to instantiate new {@link CtfTmfEvent}'s.
-     *
-     * @param eventDef
-     *            CTF EventDefinition object corresponding to this trace event
-     * @param fileName
-     *            The path to the trace file
-     * @param originTrace
-     *            The trace from which this event originates
-     * @return The newly-built CtfTmfEvent
-     */
-    public static CtfTmfEvent createEvent(EventDefinition eventDef,
-            String fileName, CtfTmfTrace originTrace) {
-
-        /* Prepare what to pass to CtfTmfEvent's constructor */
-        final IEventDeclaration eventDecl = eventDef.getDeclaration();
-        final long ts = eventDef.getTimestamp();
-        final CtfTmfTimestamp timestamp = originTrace.createTimestamp(
-                originTrace.getCTFTrace().timestampCyclesToNanos(ts));
-
-        int sourceCPU = eventDef.getCPU();
-
-        ITmfEventField content = new TmfEventField(
-                ITmfEventField.ROOT_FIELD_ID, null, parseFields(eventDef));
-
-        String reference = fileName == null ? CtfTmfEvent.NO_STREAM : fileName;
-
-        /* Handle the special case of lost events */
-        if (eventDecl.getName().equals(CTFStrings.LOST_EVENT_NAME)) {
-            Definition nbLostEventsDef = eventDef.getFields().getDefinitions().get(CTFStrings.LOST_EVENTS_FIELD);
-            Definition durationDef = eventDef.getFields().getDefinitions().get(CTFStrings.LOST_EVENTS_DURATION);
-            if (!(nbLostEventsDef instanceof IntegerDefinition) || !(durationDef instanceof IntegerDefinition)) {
-                /*
-                 * One or both of these fields doesn't exist, or is not of the
-                 * right type. The event claims to be a "lost event", but is
-                 * malformed. Log it and return a null event instead.
-                 */
-                return getNullEvent();
-            }
-            long nbLostEvents = ((IntegerDefinition) nbLostEventsDef).getValue();
-            long duration = ((IntegerDefinition) durationDef).getValue();
-            CtfTmfTimestamp timestampEnd = new CtfTmfTimestamp(
-                    originTrace.getCTFTrace().timestampCyclesToNanos(ts) + duration);
-
-            CtfTmfLostEvent lostEvent = new CtfTmfLostEvent(originTrace,
-                    ITmfContext.UNKNOWN_RANK,
-                    content,
-                    reference, // filename
-                    sourceCPU,
-                    eventDecl,
-                    new TmfTimeRange(timestamp, timestampEnd),
-                    nbLostEvents);
-            return lostEvent;
-        }
-
-        /* Handle standard event types */
-        CtfTmfEvent event = new CtfTmfEvent(
-                originTrace,
-                ITmfContext.UNKNOWN_RANK,
-                timestamp,
-                content,
-                reference, // filename
-                sourceCPU,
-                eventDecl);
-        return event;
-    }
-
-    /* Singleton instance of a null event */
-    private static CtfTmfEvent nullEvent = null;
-
-    /**
-     * Get an instance of a null event.
-     *
-     * @return An empty event
-     */
-    public static CtfTmfEvent getNullEvent() {
-        if (nullEvent == null) {
-            nullEvent = new CtfTmfEvent();
-        }
-        return nullEvent;
-    }
-
-    /**
-     * Extract the field information from the structDefinition haze-inducing
-     * mess, and put them into something ITmfEventField can cope with.
-     */
-    private static CtfTmfEventField[] parseFields(EventDefinition eventDef) {
-        List<CtfTmfEventField> fields = new ArrayList<>();
-
-        StructDefinition structFields = eventDef.getFields();
-        for (Map.Entry<String, Definition> entry : structFields.getDefinitions().entrySet()) {
-            String curFieldName = entry.getKey();
-            Definition curFieldDef = entry.getValue();
-            CtfTmfEventField curField = CtfTmfEventField.parseField(curFieldDef, curFieldName);
-            fields.add(curField);
-        }
-
-        /* Add context information as CtfTmfEventField */
-        StructDefinition structContext = eventDef.getContext();
-        if (structContext != null) {
-            for (Map.Entry<String, Definition> entry : structContext.getDefinitions().entrySet()) {
-                /* Prefix field name */
-                String curContextName = CtfConstants.CONTEXT_FIELD_PREFIX + entry.getKey();
-                Definition curContextDef = entry.getValue();
-                CtfTmfEventField curContext = CtfTmfEventField.parseField(curContextDef, curContextName);
-                fields.add(curContext);
-            }
-        }
-
-        return fields.toArray(new CtfTmfEventField[fields.size()]);
-    }
-}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java
deleted file mode 100644 (file)
index 6e77376..0000000
+++ /dev/null
@@ -1,455 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ã‰cole Polytechnique de Montréal
- *
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *  Matthew Khouzam - Initial API and implementation
- *  Alexandre Montplaisir - Initial API and implementation, extend TmfEventField
- *  Bernd Hufmann - Add Enum field handling
- *  Geneviève Bastien - Add Struct and Variant field handling
- *  Jean-Christian Kouame - Correct handling of unsigned integer fields
- *  François Doray - Add generic array field type
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.ctfadaptor;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map.Entry;
-
-import org.eclipse.linuxtools.ctf.core.event.types.ArrayDefinition;
-import org.eclipse.linuxtools.ctf.core.event.types.Definition;
-import org.eclipse.linuxtools.ctf.core.event.types.EnumDefinition;
-import org.eclipse.linuxtools.ctf.core.event.types.FloatDefinition;
-import org.eclipse.linuxtools.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.linuxtools.ctf.core.event.types.IntegerDefinition;
-import org.eclipse.linuxtools.ctf.core.event.types.SequenceDeclaration;
-import org.eclipse.linuxtools.ctf.core.event.types.SequenceDefinition;
-import org.eclipse.linuxtools.ctf.core.event.types.StringDefinition;
-import org.eclipse.linuxtools.ctf.core.event.types.StructDefinition;
-import org.eclipse.linuxtools.ctf.core.event.types.VariantDefinition;
-import org.eclipse.linuxtools.internal.tmf.core.Messages;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
-import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
-
-/**
- * The CTF implementation of the TMF event field model
- *
- * @version 2.0
- * @author Matthew Khouzam
- * @author Alexandre Montplaisir
- */
-public abstract class CtfTmfEventField extends TmfEventField {
-
-    // ------------------------------------------------------------------------
-    // Constructor
-    // ------------------------------------------------------------------------
-
-    /**
-     * Standard constructor. Only to be used internally, call parseField() to
-     * generate a new field object.
-     *
-     * @param name
-     *            The name of this field
-     * @param value
-     *            The value of this field. Its type should match the field type.
-     * @param fields
-     *            The children fields. Useful for composite fields
-     * @since 2.0
-     */
-    protected CtfTmfEventField(String name, Object value, ITmfEventField[] fields) {
-        super(/* Strip the underscore from the field name if there is one */
-                name.startsWith("_") ? name.substring(1) : name, //$NON-NLS-1$
-                value,
-                fields);
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /**
-     * Factory method to instantiate CtfTmfEventField objects.
-     *
-     * @param fieldDef
-     *            The CTF Definition of this event field
-     * @param fieldName
-     *            String The name to assign to this field
-     * @return The resulting CtfTmfEventField object
-     */
-    public static CtfTmfEventField parseField(Definition fieldDef,
-            String fieldName) {
-        CtfTmfEventField field = null;
-
-        /* Determine the Definition type */
-        if (fieldDef instanceof IntegerDefinition) {
-            IntegerDefinition intDef = (IntegerDefinition) fieldDef;
-            int base = intDef.getDeclaration().getBase();
-            field = new CTFIntegerField(fieldName, intDef.getValue(), base, intDef.getDeclaration().isSigned());
-
-        } else if (fieldDef instanceof EnumDefinition) {
-            EnumDefinition enumDef = (EnumDefinition) fieldDef;
-            field = new CTFEnumField(fieldName, new CtfEnumPair(enumDef.getValue(), enumDef.getIntegerValue()));
-
-        } else if (fieldDef instanceof StringDefinition) {
-            field = new CTFStringField(fieldName, ((StringDefinition) fieldDef).getValue());
-
-        } else if (fieldDef instanceof FloatDefinition) {
-            FloatDefinition floatDef = (FloatDefinition) fieldDef;
-            field = new CTFFloatField(fieldName, floatDef.getValue());
-
-        } else if (fieldDef instanceof ArrayDefinition) {
-            ArrayDefinition arrayDef = (ArrayDefinition) fieldDef;
-
-            if (arrayDef.getDeclaration().isString()) {
-                /* This is an array of UTF-8 bytes, a.k.a. a String! */
-                field = new CTFStringField(fieldName, fieldDef.toString());
-
-            } else {
-                /* Arrays of elements of any other type */
-                Definition[] definitions = arrayDef.getDefinitions();
-                CtfTmfEventField[] elements = new CtfTmfEventField[definitions.length];
-
-                /* Parse the elements of the array. */
-                for (int i = 0; i < definitions.length; i++) {
-                    CtfTmfEventField curField = CtfTmfEventField.parseField(
-                            definitions[i], fieldName + '[' + i + ']');
-                    elements[i] = curField;
-                }
-
-                field = new CTFArrayField(fieldName, elements);
-            }
-        } else if (fieldDef instanceof SequenceDefinition) {
-            SequenceDefinition seqDef = (SequenceDefinition) fieldDef;
-            SequenceDeclaration seqDecl = seqDef.getDeclaration();
-
-            if (seqDef.getLength() == 0) {
-                /* Some sequences have length = 0. Simply use an empty string */
-                field = new CTFStringField(fieldName, ""); //$NON-NLS-1$
-            } else if (seqDef.isString()) {
-                /* Interpret this sequence as a String */
-                field = new CTFStringField(fieldName, seqDef.toString());
-            } else if (seqDecl.getElementType() instanceof IntegerDeclaration) {
-                /* Sequence of integers => CTFIntegerArrayField */
-                long[] values = new long[seqDef.getLength()];
-                for (int i = 0; i < seqDef.getLength(); i++) {
-                    values[i] = ((IntegerDefinition) seqDef.getElem(i)).getValue();
-                }
-                field = new CTFIntegerArrayField(fieldName, values,
-                        ((IntegerDeclaration) seqDecl.getElementType()).getBase(),
-                        ((IntegerDeclaration) seqDecl.getElementType()).isSigned());
-
-            }
-            /* Add other Sequence types here */
-
-        } else if (fieldDef instanceof StructDefinition) {
-            StructDefinition strDef = (StructDefinition) fieldDef;
-
-            String curFieldName = null;
-            Definition curFieldDef;
-            CtfTmfEventField curField;
-            List<ITmfEventField> list = new ArrayList<>();
-            /* Recursively parse the fields */
-            for (Entry<String, Definition> entry : strDef.getDefinitions().entrySet()) {
-                curFieldName = entry.getKey();
-                curFieldDef = entry.getValue();
-                curField = CtfTmfEventField.parseField(curFieldDef, curFieldName);
-                list.add(curField);
-            }
-            field = new CTFStructField(fieldName, list.toArray(new CtfTmfEventField[list.size()]));
-
-        } else if (fieldDef instanceof VariantDefinition) {
-            VariantDefinition varDef = (VariantDefinition) fieldDef;
-
-            String curFieldName = varDef.getCurrentFieldName();
-            Definition curFieldDef = varDef.getDefinitions().get(curFieldName);
-            if (curFieldDef != null) {
-                CtfTmfEventField subField = CtfTmfEventField.parseField(curFieldDef, curFieldName);
-                field = new CTFVariantField(fieldName, subField);
-            } else {
-                /* A safe-guard, but curFieldDef should never be null */
-                field = new CTFStringField(curFieldName, ""); //$NON-NLS-1$
-            }
-
-        } else {
-            /*
-             * Safe-guard, to avoid null exceptions later, field is expected not
-             * to be null
-             */
-            field = new CTFStringField(fieldName, Messages.TmfEventField_UnsupportedType + fieldDef.getClass().toString());
-        }
-        return field;
-    }
-
-    @Override
-    public String toString() {
-        return getName() + '=' + getFormattedValue();
-    }
-
-}
-
-/**
- * The CTF field implementation for integer fields.
- *
- * @author alexmont
- */
-final class CTFIntegerField extends CtfTmfEventField {
-
-    private final int fBase;
-    private final boolean fSigned;
-
-    /**
-     * A CTF "IntegerDefinition" can be an integer of any byte size, so in the
-     * Java parser this is interpreted as a long.
-     *
-     * @param name
-     *            The name of this field
-     * @param longValue
-     *            The integer value of this field
-     * @param signed
-     *            Is the value signed or not
-     */
-    CTFIntegerField(String name, long longValue, int base, boolean signed) {
-        super(name, longValue, null);
-        fSigned = signed;
-        fBase = base;
-    }
-
-    @Override
-    public Long getValue() {
-        return (Long) super.getValue();
-    }
-
-    @Override
-    public String getFormattedValue() {
-        return IntegerDefinition.formatNumber(getValue(), fBase, fSigned);
-    }
-
-}
-
-/**
- * The CTF field implementation for string fields
- *
- * @author alexmont
- */
-final class CTFStringField extends CtfTmfEventField {
-
-    /**
-     * Constructor for CTFStringField.
-     *
-     * @param strValue
-     *            The string value of this field
-     * @param name
-     *            The name of this field
-     */
-    CTFStringField(String name, String strValue) {
-        super(name, strValue, null);
-    }
-
-    @Override
-    public String getValue() {
-        return (String) super.getValue();
-    }
-}
-
-/**
- * CTF field implementation for arrays of integers.
- *
- * @author alexmont
- */
-final class CTFIntegerArrayField extends CtfTmfEventField {
-
-    private final int fBase;
-    private final boolean fSigned;
-    private String fFormattedValue = null;
-
-    /**
-     * Constructor for CTFIntegerArrayField.
-     *
-     * @param name
-     *            The name of this field
-     * @param longValues
-     *            The array of integers (as longs) that compose this field's
-     *            value
-     * @param signed
-     *            Are the values in the array signed or not
-     */
-    CTFIntegerArrayField(String name, long[] longValues, int base, boolean signed) {
-        super(name, longValues, null);
-        fBase = base;
-        fSigned = signed;
-    }
-
-    @Override
-    public long[] getValue() {
-        return (long[]) super.getValue();
-    }
-
-    @Override
-    public synchronized String getFormattedValue() {
-        if (fFormattedValue == null) {
-            List<String> strings = new ArrayList<>();
-            for (long value : getValue()) {
-                strings.add(IntegerDefinition.formatNumber(value, fBase, fSigned));
-            }
-            fFormattedValue = strings.toString();
-        }
-        return fFormattedValue;
-    }
-
-}
-
-/**
- * CTF field implementation for arrays of arbitrary types.
- *
- * @author fdoray
- */
-final class CTFArrayField extends CtfTmfEventField {
-
-    private String fFormattedValue = null;
-
-    /**
-     * Constructor for CTFArrayField.
-     *
-     * @param name
-     *            The name of this field
-     * @param elements
-     *            The array elements of this field
-     */
-    CTFArrayField(String name, CtfTmfEventField[] elements) {
-        super(name, elements, elements);
-    }
-
-    @Override
-    public CtfTmfEventField[] getValue() {
-        return (CtfTmfEventField[]) super.getValue();
-    }
-
-    @Override
-    public synchronized String getFormattedValue() {
-        if (fFormattedValue == null) {
-            List<String> strings = new ArrayList<>();
-            for (CtfTmfEventField element : getValue()) {
-                strings.add(element.getFormattedValue());
-            }
-            fFormattedValue = strings.toString();
-        }
-        return fFormattedValue;
-    }
-}
-
-/**
- * CTF field implementation for floats.
- *
- * @author emathko
- */
-final class CTFFloatField extends CtfTmfEventField {
-
-    /**
-     * Constructor for CTFFloatField.
-     *
-     * @param value
-     *            The float value (actually a double) of this field
-     * @param name
-     *            The name of this field
-     */
-    protected CTFFloatField(String name, double value) {
-        super(name, value, null);
-    }
-
-    @Override
-    public Double getValue() {
-        return (Double) super.getValue();
-    }
-}
-
-/**
- * The CTF field implementation for Enum fields
- *
- * @author Bernd Hufmann
- */
-final class CTFEnumField extends CtfTmfEventField {
-
-    /**
-     * Constructor for CTFEnumField.
-     *
-     * @param enumValue
-     *            The Enum value consisting of a pair of Enum value name and its
-     *            long value
-     * @param name
-     *            The name of this field
-     */
-    CTFEnumField(String name, CtfEnumPair enumValue) {
-        super(name, new CtfEnumPair(enumValue.getFirst(),
-                enumValue.getSecond()), null);
-    }
-
-    @Override
-    public CtfEnumPair getValue() {
-        return (CtfEnumPair) super.getValue();
-    }
-}
-
-/**
- * The CTF field implementation for struct fields with sub-fields
- *
- * @author gbastien
- */
-final class CTFStructField extends CtfTmfEventField {
-
-    /**
-     * Constructor for CTFStructField.
-     *
-     * @param fields
-     *            The children of this field
-     * @param name
-     *            The name of this field
-     */
-    CTFStructField(String name, CtfTmfEventField[] fields) {
-        super(name, fields, fields);
-    }
-
-    @Override
-    public CtfTmfEventField[] getValue() {
-        return (CtfTmfEventField[]) super.getValue();
-    }
-
-    @Override
-    public String getFormattedValue() {
-        return Arrays.toString(getValue());
-    }
-
-}
-
-/**
- * The CTF field implementation for variant fields its child
- *
- * @author gbastien
- */
-final class CTFVariantField extends CtfTmfEventField {
-
-    /**
-     * Constructor for CTFVariantField.
-     *
-     * @param field
-     *            The field selected for this variant
-     * @param name
-     *            The name of this field
-     */
-    CTFVariantField(String name, CtfTmfEventField field) {
-        super(name, field, new CtfTmfEventField[] { field });
-    }
-
-    @Override
-    public CtfTmfEventField getValue() {
-        return (CtfTmfEventField) super.getValue();
-    }
-
-}
-
-/* Implement other possible fields types here... */
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventType.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventType.java
deleted file mode 100644 (file)
index 80c97ad..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.ctfadaptor;
-
-import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
-import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
-import org.eclipse.linuxtools.tmf.core.event.TmfEventTypeManager;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-
-/**
- * The CTF extension of the TMF event type
- *
- * @version 1.0
- * @author Matthew khouzam
- */
-public class CtfTmfEventType extends TmfEventType {
-
-    /**
-     * CTFTmfEventType context for the event type manager
-     */
-    private static final String CONTEXT_ID = "Ctf Event"; //$NON-NLS-1$
-
-    private static final String UNKNOWN_TRACE = "unknown"; //$NON-NLS-1$
-
-    /**
-     * Constructor for CtfTmfEventType.
-     *
-     * @param eventName
-     *            The event name
-     * @param trace
-     *            the parent trace
-     * @param content
-     *            The event field
-     * @since 3.0
-     */
-    public CtfTmfEventType(String eventName, ITmfTrace trace, ITmfEventField content) {
-        super(computeContextName(trace), eventName, content);
-    }
-
-    /**
-     * Method toString.
-     *
-     * @return String
-     */
-    @Override
-    public String toString() {
-        return getName();
-    }
-
-    /**
-     * gets the event type for an event name
-     *
-     * @param trace
-     *            the parent trace
-     * @param eventName
-     *            the event name
-     * @return the event type
-     * @since 3.0
-     */
-    public static CtfTmfEventType get(CtfTmfTrace trace, String eventName) {
-        return (CtfTmfEventType) TmfEventTypeManager.getInstance().getType(computeContextName(trace), eventName);
-    }
-
-    /**
-     * Get the context name of a ctf trace
-     *
-     * @param trace
-     *            the trace
-     * @return the context name
-     * @since 3.0
-     */
-    public static String computeContextName(ITmfTrace trace) {
-        return CONTEXT_ID + "/" + (trace == null ? UNKNOWN_TRACE : trace.getPath()); //$NON-NLS-1$
-    }
-}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfLostEvent.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfLostEvent.java
deleted file mode 100644 (file)
index 05834bd..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.ctfadaptor;
-
-import org.eclipse.linuxtools.ctf.core.event.IEventDeclaration;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
-import org.eclipse.linuxtools.tmf.core.event.ITmfLostEvent;
-import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
-
-/**
- * An implementation of {@link ITmfLostEvent} for use in the CTF adaptor.
- *
- * @author Alexandre Montplaisir
- * @since 2.2
- */
-public class CtfTmfLostEvent extends CtfTmfEvent implements ITmfLostEvent {
-
-    private final TmfTimeRange fTimeRange;
-    private final long fNbLost;
-
-    /**
-     * Constructor. Only {@link CtfTmfEventFactory} should call this.
-     *
-     * @param trace
-     *            The origin trace
-     * @param rank
-     *            The rank of the event in the trace
-     * @param content
-     *            The event's payload (fields). In case this event has some.
-     * @param fileName
-     *            The name of the trace file from which this event comes
-     * @param cpu
-     *            The CPU on which this event happened
-     * @param declaration
-     *            The CTF Event Declaration object that created this event
-     * @param timeRange
-     *            The time range of lost events indicated by this one
-     * @param nbLost
-     *            The number of lost events in the range
-     */
-    CtfTmfLostEvent(CtfTmfTrace trace,
-            long rank,
-            ITmfEventField content,
-            String fileName,
-            int cpu,
-            IEventDeclaration declaration,
-            TmfTimeRange timeRange,
-            long nbLost) {
-        /*
-         * Only the factory should call this method, the case to
-         * (CtfTmfTimestamp) should be safe.
-         */
-        super(trace, rank, (CtfTmfTimestamp) timeRange.getStartTime(), content, fileName, cpu, declaration);
-        fTimeRange = timeRange;
-        fNbLost = nbLost;
-    }
-
-    @Override
-    public TmfTimeRange getTimeRange() {
-        return fTimeRange;
-    }
-
-    @Override
-    public long getNbLostEvents() {
-        return fNbLost;
-    }
-
-}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTimestamp.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTimestamp.java
deleted file mode 100644 (file)
index bff867e..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.ctfadaptor;
-
-import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
-
-/**
- * The CTF adapter for the TMF timestamp. It's basically the same as a
- * TmfTimestamp, but the scale is always nanoseconds, and the precision is 0.
- *
- * @version 1.2
- * @author Matthew khouzam
- */
-public final class CtfTmfTimestamp extends TmfTimestamp {
-
-    /**
-     * Constructor for CtfTmfTimestamp.
-     *
-     * @param timestamp
-     *            The timestamp value (in nanoseconds)
-     */
-    public CtfTmfTimestamp(long timestamp) {
-        super(timestamp, ITmfTimestamp.NANOSECOND_SCALE, 0);
-    }
-
-}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTrace.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTrace.java
deleted file mode 100644 (file)
index 66d53cd..0000000
+++ /dev/null
@@ -1,488 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson, Ã‰cole Polytechnique de Montréal
- *
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial API and implementation
- *   Patrick Tasse - Updated for removal of context clone
- *   Geneviève Bastien - Added the createTimestamp function
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.ctfadaptor;
-
-import java.nio.BufferOverflowException;
-import java.nio.ByteBuffer;
-import java.util.Map;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.linuxtools.ctf.core.event.CTFClock;
-import org.eclipse.linuxtools.ctf.core.event.IEventDeclaration;
-import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
-import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
-import org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader;
-import org.eclipse.linuxtools.internal.tmf.core.Activator;
-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.TmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfEventParser;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfTraceProperties;
-import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;
-import org.eclipse.linuxtools.tmf.core.trace.TraceValidationStatus;
-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.TmfBTreeTraceIndexer;
-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;
-
-/**
- * The CTf trace handler
- *
- * @version 1.0
- * @author Matthew khouzam
- */
-public class CtfTmfTrace extends TmfTrace
-        implements ITmfEventParser, ITmfTraceProperties, ITmfPersistentlyIndexable {
-
-    // -------------------------------------------
-    // Constants
-    // -------------------------------------------
-    /**
-     * Default cache size for CTF traces
-     */
-    protected static final int DEFAULT_CACHE_SIZE = 50000;
-
-    /*
-     * The Ctf clock unique identifier field
-     */
-    private static final String CLOCK_HOST_PROPERTY = "uuid"; //$NON-NLS-1$
-    private static final int CONFIDENCE = 10;
-
-    // -------------------------------------------
-    // Fields
-    // -------------------------------------------
-
-    /* Reference to the CTF Trace */
-    private CTFTrace fTrace;
-
-    // -------------------------------------------
-    // TmfTrace Overrides
-    // -------------------------------------------
-    /**
-     * Method initTrace.
-     *
-     * @param resource
-     *            The resource associated with this trace
-     * @param path
-     *            The path to the trace file
-     * @param eventType
-     *            The type of events that will be read from this trace
-     * @throws TmfTraceException
-     *             If something went wrong while reading the trace
-     */
-    @Override
-    public void initTrace(final IResource resource, final String path, final Class<? extends ITmfEvent> eventType)
-            throws TmfTraceException {
-        /*
-         * Set the cache size. This has to be done before the call to super()
-         * because the super needs to know the cache size.
-         */
-        setCacheSize();
-
-        super.initTrace(resource, path, eventType);
-
-        try {
-            this.fTrace = new CTFTrace(path);
-            CtfIteratorManager.addTrace(this);
-            CtfTmfContext ctx;
-            /* Set the start and (current) end times for this trace */
-            ctx = (CtfTmfContext) seekEvent(0L);
-            CtfTmfEvent event = getNext(ctx);
-            if ((ctx.getLocation().equals(CtfIterator.NULL_LOCATION)) || (ctx.getCurrentEvent() == null)) {
-                /* Handle the case where the trace is empty */
-                this.setStartTime(TmfTimestamp.BIG_BANG);
-            } else {
-                final ITmfTimestamp curTime = event.getTimestamp();
-                this.setStartTime(curTime);
-                this.setEndTime(curTime);
-            }
-
-        } catch (final CTFReaderException e) {
-            /*
-             * If it failed at the init(), we can assume it's because the file
-             * was not found or was not recognized as a CTF trace. Throw into
-             * the new type of exception expected by the rest of TMF.
-             */
-            throw new TmfTraceException(e.getMessage(), e);
-        }
-    }
-
-    @Override
-    public synchronized void dispose() {
-        CtfIteratorManager.removeTrace(this);
-        if (fTrace != null) {
-            fTrace.dispose();
-            fTrace = null;
-        }
-        super.dispose();
-    }
-
-    /**
-     * {@inheritDoc}
-     * <p>
-     * The default implementation sets the confidence to 10 if the trace is a
-     * valid CTF trace.
-     */
-    @Override
-    public IStatus validate(final IProject project, final String path) {
-        IStatus validTrace = new TraceValidationStatus(CONFIDENCE, Activator.PLUGIN_ID);
-        try {
-            final CTFTrace temp = new CTFTrace(path);
-            if (!temp.majorIsSet()) {
-                validTrace = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_MajorNotSet);
-            } else {
-                CTFTraceReader ctfTraceReader = new CTFTraceReader(temp);
-                if (!ctfTraceReader.hasMoreEvents()) {
-                    // TODO: This will need an additional check when we support live traces
-                    // because having no event is valid for a live trace
-                    validTrace = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_NoEvent);
-                }
-                ctfTraceReader.dispose();
-            }
-            temp.dispose();
-        } catch (final CTFReaderException e) {
-            validTrace = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_ReadingError +": " + e.toString()); //$NON-NLS-1$
-        } catch (final BufferOverflowException e){
-            validTrace = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_ReadingError +": " + Messages.CtfTmfTrace_BufferOverflowErrorMessage); //$NON-NLS-1$
-        }
-
-        return validTrace;
-    }
-
-    /**
-     * Method getCurrentLocation. This is not applicable in CTF
-     *
-     * @return null, since the trace has no knowledge of the current location
-     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getCurrentLocation()
-     * @since 3.0
-     */
-    @Override
-    public ITmfLocation getCurrentLocation() {
-        return null;
-    }
-
-    /**
-     * @since 3.0
-     */
-    @Override
-    public double getLocationRatio(ITmfLocation location) {
-        final CtfLocation curLocation = (CtfLocation) location;
-        final CtfTmfContext context = new CtfTmfContext(this);
-        context.setLocation(curLocation);
-        context.seek(curLocation.getLocationInfo());
-        final CtfLocationInfo currentTime = ((CtfLocationInfo) context.getLocation().getLocationInfo());
-        final long startTime = getIterator(this, context).getStartTime();
-        final long endTime = getIterator(this, context).getEndTime();
-        return ((double) currentTime.getTimestamp() - startTime)
-                / (endTime - startTime);
-    }
-
-    /**
-     * Method seekEvent.
-     *
-     * @param location
-     *            ITmfLocation<?>
-     * @return ITmfContext
-     * @since 3.0
-     */
-    @Override
-    public synchronized ITmfContext seekEvent(final ITmfLocation location) {
-        CtfLocation currentLocation = (CtfLocation) location;
-        CtfTmfContext context = new CtfTmfContext(this);
-        if (fTrace == null) {
-            context.setLocation(null);
-            context.setRank(ITmfContext.UNKNOWN_RANK);
-            return context;
-        }
-        /*
-         * The rank is set to 0 if the iterator seeks the beginning. If not, it
-         * will be set to UNKNOWN_RANK, since CTF traces don't support seeking
-         * by rank for now.
-         */
-        if (currentLocation == null) {
-            currentLocation = new CtfLocation(new CtfLocationInfo(0L, 0L));
-            context.setRank(0);
-        }
-        if (currentLocation.getLocationInfo() == CtfLocation.INVALID_LOCATION) {
-            currentLocation = new CtfLocation(getEndTime().getValue() + 1, 0L);
-        }
-        context.setLocation(currentLocation);
-        if (location == null) {
-            CtfTmfEvent event = getIterator(this, context).getCurrentEvent();
-            if (event != null) {
-                currentLocation = new CtfLocation(event.getTimestamp().getValue(), 0);
-            }
-        }
-        if (context.getRank() != 0) {
-            context.setRank(ITmfContext.UNKNOWN_RANK);
-        }
-        return context;
-    }
-
-    @Override
-    public synchronized ITmfContext seekEvent(double ratio) {
-        CtfTmfContext context = new CtfTmfContext(this);
-        if (fTrace == null) {
-            context.setLocation(null);
-            context.setRank(ITmfContext.UNKNOWN_RANK);
-            return context;
-        }
-        final long end = this.getEndTime().getValue();
-        final long start = this.getStartTime().getValue();
-        final long diff = end - start;
-        final long ratioTs = Math.round(diff * ratio) + start;
-        context.seek(ratioTs);
-        context.setRank(ITmfContext.UNKNOWN_RANK);
-        return context;
-    }
-
-    /**
-     * Method readNextEvent.
-     *
-     * @param context
-     *            ITmfContext
-     * @return CtfTmfEvent
-     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getNext(ITmfContext)
-     */
-    @Override
-    public synchronized CtfTmfEvent getNext(final ITmfContext context) {
-        if (fTrace == null) {
-            return null;
-        }
-        CtfTmfEvent event = null;
-        if (context instanceof CtfTmfContext) {
-            if (context.getLocation() == null || CtfLocation.INVALID_LOCATION.equals(context.getLocation().getLocationInfo())) {
-                return null;
-            }
-            CtfTmfContext ctfContext = (CtfTmfContext) context;
-            event = ctfContext.getCurrentEvent();
-
-            if (event != null) {
-                updateAttributes(context, event.getTimestamp());
-                ctfContext.advance();
-                ctfContext.increaseRank();
-            }
-        }
-
-        return event;
-    }
-
-    /**
-     * gets the CTFtrace that this is wrapping
-     *
-     * @return the CTF trace
-     */
-    public CTFTrace getCTFTrace() {
-        return fTrace;
-    }
-
-    /**
-     * Ctf traces have a clock with a unique uuid that will be used to identify
-     * the host. Traces with the same clock uuid will be known to have been made
-     * on the same machine.
-     *
-     * Note: uuid is an optional field, it may not be there for a clock.
-     */
-    @Override
-    public String getHostId() {
-        CTFClock clock = getCTFTrace().getClock();
-        if (clock != null) {
-            String clockHost = (String) clock.getProperty(CLOCK_HOST_PROPERTY);
-            if (clockHost != null) {
-                return clockHost;
-            }
-        }
-        return super.getHostId();
-    }
-
-    // -------------------------------------------
-    // ITmfTraceProperties
-    // -------------------------------------------
-
-    /**
-     * @since 2.0
-     */
-    @Override
-    public Map<String, String> getTraceProperties() {
-        return fTrace.getEnvironment();
-    }
-
-    // -------------------------------------------
-    // Clocks
-    // -------------------------------------------
-
-    /**
-     * gets the clock offset
-     *
-     * @return the clock offset in ns
-     */
-    public long getOffset() {
-        if (fTrace != null) {
-            return fTrace.getOffset();
-        }
-        return 0;
-    }
-
-    /**
-     * Returns whether or not an event is in the metadata of the trace,
-     * therefore if it can possibly be in the trace. It does not verify whether
-     * or not the event is actually in the trace
-     *
-     * @param eventName
-     *            The name of the event to check
-     * @return Whether the event is in the metadata or not
-     * @since 2.1
-     */
-    public boolean hasEvent(final String eventName) {
-        Map<Long, IEventDeclaration> events = fTrace.getEvents(0L);
-        if (events != null) {
-            for (IEventDeclaration decl : events.values()) {
-                if (decl.getName().equals(eventName)) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Return whether all requested events are in the metadata
-     *
-     * @param names
-     *            The array of events to check for
-     * @return Whether all events are in the metadata
-     * @since 2.1
-     */
-    public boolean hasAllEvents(String[] names) {
-        for (String name : names) {
-            if (!hasEvent(name)) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    /**
-     * Returns whether the metadata contains at least one of the requested
-     * events
-     *
-     * @param names
-     *            The array of event names of check for
-     * @return Whether one of the event is present in trace metadata
-     * @since 2.1
-     */
-    public boolean hasAtLeastOneOfEvents(String[] names) {
-        for (String name : names) {
-            if (hasEvent(name)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    // -------------------------------------------
-    // Parser
-    // -------------------------------------------
-
-    @Override
-    public CtfTmfEvent parseEvent(ITmfContext context) {
-        CtfTmfEvent event = null;
-        if (context instanceof CtfTmfContext) {
-            final ITmfContext tmpContext = seekEvent(context.getLocation());
-            event = getNext(tmpContext);
-        }
-        return event;
-    }
-
-    /**
-     * Sets the cache size for a CtfTmfTrace.
-     */
-    protected void setCacheSize() {
-        setCacheSize(DEFAULT_CACHE_SIZE);
-    }
-
-    // -------------------------------------------
-    // Helpers
-    // -------------------------------------------
-
-    private static CtfIterator getIterator(CtfTmfTrace trace, CtfTmfContext context) {
-        return CtfIteratorManager.getIterator(trace, context);
-    }
-
-    /**
-     * Get an iterator to the trace
-     *
-     * @return an iterator to the trace
-     * @since 2.0
-     */
-    public CtfIterator createIterator() {
-        try {
-            return new CtfIterator(this);
-        } catch (CTFReaderException e) {
-            Activator.logError(e.getMessage(), e);
-        }
-        return null;
-    }
-
-    // ------------------------------------------------------------------------
-    // Timestamp transformation functions
-    // ------------------------------------------------------------------------
-
-    /**
-     * @since 3.0
-     */
-    @Override
-    public CtfTmfTimestamp createTimestamp(long ts) {
-        return new CtfTmfTimestamp(getTimestampTransform().transform(ts));
-    }
-
-    private static int fCheckpointSize = -1;
-
-    /**
-     * @since 3.0
-     */
-    @Override
-    public synchronized int getCheckpointSize() {
-        if (fCheckpointSize == -1) {
-            TmfCheckpoint c = new TmfCheckpoint(new CtfTmfTimestamp(0), new CtfLocation(0, 0), 0);
-            ByteBuffer b = ByteBuffer.allocate(ITmfCheckpoint.MAX_SERIALIZE_SIZE);
-            b.clear();
-            c.serialize(b);
-            fCheckpointSize = b.position();
-        }
-
-        return fCheckpointSize;
-    }
-
-    @Override
-    protected ITmfTraceIndexer createIndexer(int interval) {
-        return new TmfBTreeTraceIndexer(this, interval);
-    }
-
-    /**
-     * @since 3.0
-     */
-    @Override
-    public ITmfLocation restoreLocation(ByteBuffer bufferIn) {
-        return new CtfLocation(bufferIn);
-    }
-}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/Messages.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/Messages.java
deleted file mode 100644 (file)
index 6d51e61..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Ericsson.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.ctfadaptor;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Message bundle for tmf.core.ctfadaptor
- *
- * @author Matthew Khouzam
- * @since 2.0
- */
-public class Messages extends NLS {
-
-    private static final String BUNDLE_NAME = "org.eclipse.linuxtools.tmf.core.ctfadaptor.messages"; //$NON-NLS-1$
-
-    /** Buffer overflow detected
-     * @since 2.1*/
-    public static String CtfTmfTrace_BufferOverflowErrorMessage;
-
-    /** Major version number not set */
-    public static String CtfTmfTrace_MajorNotSet;
-
-    /** Reading error */
-    public static String CtfTmfTrace_ReadingError;
-
-    /** No event */
-    public static String CtfTmfTrace_NoEvent;
-
-    static {
-        // initialize resource bundle
-        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
-    }
-
-    private Messages() {
-    }
-}
diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/messages.properties b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/messages.properties
deleted file mode 100644 (file)
index ba5eee5..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-###############################################################################
-# Copyright (c) 2013 Ericsson
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-#     Ericsson - Initial API and implementation
-###############################################################################
-
-CtfTmfTrace_BufferOverflowErrorMessage=Buffer overflow exception, trace is malformed
-CtfTmfTrace_MajorNotSet=Major version number not set
-CtfTmfTrace_ReadingError=Reading error
-CtfTmfTrace_NoEvent=Trace has no events
\ No newline at end of file
index 7b3926325316a7c5a2563e8d594d3402977a83d3..fbe88a308a1a7423cf0115bd0c98c41cf3a34f66 100644 (file)
@@ -19,7 +19,6 @@ import java.util.List;
 import java.util.Map;
 
 import org.eclipse.linuxtools.internal.tmf.core.Activator;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
 import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
@@ -240,7 +239,7 @@ class EventMatchingBuildRequest extends TmfEventRequest {
     private final ITmfTrace trace;
 
     EventMatchingBuildRequest(TmfEventMatching matching, ITmfTrace trace) {
-        super(CtfTmfEvent.class,
+        super(ITmfEvent.class,
                 TmfTimeRange.ETERNITY,
                 0,
                 ITmfEventRequest.ALL_DATA,
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/.classpath b/org.eclipse.linuxtools.tmf.ctf.core.tests/.classpath
new file mode 100644 (file)
index 0000000..68143fe
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="src" path="shared"/>
+       <classpathentry kind="src" path="stubs"/>
+       <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/.gitignore b/org.eclipse.linuxtools.tmf.ctf.core.tests/.gitignore
new file mode 100644 (file)
index 0000000..fb60f67
--- /dev/null
@@ -0,0 +1,2 @@
+bin/
+target/
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/.project b/org.eclipse.linuxtools.tmf.ctf.core.tests/.project
new file mode 100644 (file)
index 0000000..b7c6da5
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.eclipse.linuxtools.tmf.ctf.core.tests</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+               <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+       </natures>
+</projectDescription>
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/.settings/org.eclipse.core.resources.prefs b/org.eclipse.linuxtools.tmf.ctf.core.tests/.settings/org.eclipse.core.resources.prefs
new file mode 100644 (file)
index 0000000..99f26c0
--- /dev/null
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/.settings/org.eclipse.core.runtime.prefs b/org.eclipse.linuxtools.tmf.ctf.core.tests/.settings/org.eclipse.core.runtime.prefs
new file mode 100644 (file)
index 0000000..5a0ad22
--- /dev/null
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.linuxtools.tmf.ctf.core.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..8a55f3f
--- /dev/null
@@ -0,0 +1,393 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
+org.eclipse.jdt.core.compiler.problem.deadCode=error
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=error
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=error
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=error
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=enabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=error
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=error
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=error
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=error
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
+org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=false
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=250
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=space
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.linuxtools.tmf.ctf.core.tests/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644 (file)
index 0000000..4fd0c70
--- /dev/null
@@ -0,0 +1,56 @@
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_tmf-style
+formatter_settings_version=12
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=false
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=false
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=false
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/.settings/org.eclipse.pde.api.tools.prefs b/org.eclipse.linuxtools.tmf.ctf.core.tests/.settings/org.eclipse.pde.api.tools.prefs
new file mode 100644 (file)
index 0000000..acc3abd
--- /dev/null
@@ -0,0 +1,97 @@
+ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
+ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
+API_USE_SCAN_FIELD_SEVERITY=Error
+API_USE_SCAN_METHOD_SEVERITY=Error
+API_USE_SCAN_TYPE_SEVERITY=Error
+CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
+CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
+CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
+CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
+CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
+ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
+ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
+ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
+FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
+FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
+FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
+FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
+ILLEGAL_EXTEND=Warning
+ILLEGAL_IMPLEMENT=Warning
+ILLEGAL_INSTANTIATE=Warning
+ILLEGAL_OVERRIDE=Warning
+ILLEGAL_REFERENCE=Warning
+INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+INVALID_JAVADOC_TAG=Warning
+INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Warning
+LEAK_EXTEND=Warning
+LEAK_FIELD_DECL=Warning
+LEAK_IMPLEMENT=Warning
+LEAK_METHOD_PARAM=Warning
+LEAK_METHOD_RETURN_TYPE=Warning
+METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
+METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+MISSING_EE_DESCRIPTIONS=Ignore
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
+UNUSED_PROBLEM_FILTERS=Warning
+automatically_removed_unused_problem_filters=false
+eclipse.preferences.version=1
+incompatible_api_component_version=Error
+incompatible_api_component_version_include_major_without_breaking_change=Disabled
+incompatible_api_component_version_include_minor_without_api_change=Disabled
+invalid_since_tag_version=Error
+malformed_since_tag=Error
+missing_since_tag=Error
+report_api_breakage_when_major_version_incremented=Disabled
+report_resolution_errors_api_component=Warning
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/.settings/org.eclipse.pde.prefs b/org.eclipse.linuxtools.tmf.ctf.core.tests/.settings/org.eclipse.pde.prefs
new file mode 100644 (file)
index 0000000..97b4320
--- /dev/null
@@ -0,0 +1,32 @@
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=2
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=1
+compilers.p.discouraged-class=1
+compilers.p.internal=1
+compilers.p.missing-packages=1
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=2
+compilers.p.unknown-attribute=1
+compilers.p.unknown-class=1
+compilers.p.unknown-element=1
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=1
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+eclipse.preferences.version=1
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/META-INF/MANIFEST.MF b/org.eclipse.linuxtools.tmf.ctf.core.tests/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..6f9c9e5
--- /dev/null
@@ -0,0 +1,24 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-Vendor: %Bundle-Vendor
+Bundle-Version: 3.0.0.qualifier
+Bundle-Localization: plugin
+Bundle-SymbolicName: org.eclipse.linuxtools.tmf.ctf.core.tests;singleton:=true
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Require-Bundle: org.junit;bundle-version="4.0.0",
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.core.tests,
+ org.eclipse.linuxtools.tmf.ctf.core,
+ org.eclipse.linuxtools.ctf.core,
+ org.eclipse.linuxtools.ctf.core.tests
+Export-Package: org.eclipse.linuxtools.tmf.ctf.core.tests,
+ org.eclipse.linuxtools.tmf.ctf.core.tests.headless;x-internal:=true,
+ org.eclipse.linuxtools.tmf.ctf.core.tests.request;x-internal:=true,
+ org.eclipse.linuxtools.tmf.ctf.core.tests.shared,
+ org.eclipse.linuxtools.tmf.ctf.core.tests.statistics;x-internal:=true,
+ org.eclipse.linuxtools.tmf.ctf.core.tests.stubs,
+ org.eclipse.linuxtools.tmf.ctf.core.tests.tracemanager;x-internal:=true
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/about.html b/org.eclipse.linuxtools.tmf.ctf.core.tests/about.html
new file mode 100644 (file)
index 0000000..28737f6
--- /dev/null
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;).  Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;).  A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content.  Check the Redistributor's license that was
+provided with the Content.  If no such license exists, contact the Redistributor.  Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/build.properties b/org.eclipse.linuxtools.tmf.ctf.core.tests/build.properties
new file mode 100644 (file)
index 0000000..9f2d161
--- /dev/null
@@ -0,0 +1,23 @@
+###############################################################################
+# Copyright (c) 2013 Ericsson
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#     Ericsson - Initial API and implementation
+###############################################################################
+
+source.. = src/,\
+           shared/,\
+           stubs
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.properties,\
+               plugin.xml
+src.includes = about.html
+additional.bundles = org.eclipse.jdt.annotation
+jars.extra.classpath = platform:/plugin/org.eclipse.jdt.annotation
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/plugin.properties b/org.eclipse.linuxtools.tmf.ctf.core.tests/plugin.properties
new file mode 100644 (file)
index 0000000..bceb689
--- /dev/null
@@ -0,0 +1,15 @@
+###############################################################################
+# Copyright (c) 2013 Ericsson
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#     Ericsson - Initial API and implementation
+###############################################################################
+
+#Properties file for org.eclipse.linuxtools.tmf.ctf.core.tests
+Bundle-Vendor = Eclipse Linux Tools
+Bundle-Name = CTF support for TMF Core Tests Plug-in
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/plugin.xml b/org.eclipse.linuxtools.tmf.ctf.core.tests/plugin.xml
new file mode 100644 (file)
index 0000000..5fa1596
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+   <extension
+         point="org.eclipse.linuxtools.tmf.core.tracetype">
+      <type
+            category="org.eclipse.linuxtools.tmf.core.tests.category"
+            event_type="org.eclipse.linuxtools.tmf.ctf.core.CtfTmfEvent"
+            id="org.eclipse.linuxtools.tmf.ctf.core.tests.ctf.tracetype"
+            isDirectory="true"
+            name="CTF Test Trace"
+            trace_type="org.eclipse.linuxtools.tmf.ctf.core.tests.stubs.CtfTmfTraceStub">
+      </type>
+   </extension>
+
+</plugin>
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/pom.xml b/org.eclipse.linuxtools.tmf.ctf.core.tests/pom.xml
new file mode 100644 (file)
index 0000000..1afb24c
--- /dev/null
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Copyright (C) 2011, Red Hat, Inc.
+
+   All rights reserved. This program and the accompanying materials
+   are made available under the terms of the Eclipse Public License v1.0
+   which accompanies this distribution, and is available at
+   http://www.eclipse.org/legal/epl-v10.html
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>linuxtools-lttng-parent</artifactId>
+    <groupId>org.eclipse.linuxtools.lttng</groupId>
+    <version>3.0.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>org.eclipse.linuxtools.tmf.ctf.core.tests</artifactId>
+  <version>3.0.0-SNAPSHOT</version>
+  <packaging>eclipse-test-plugin</packaging>
+
+  <name>CTF Support for TMF Core Tests Plug-in</name>
+
+ <build>
+    <plugins>
+        <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-antrun-plugin</artifactId>
+            <version>1.7</version>
+            <executions>
+                <execution>
+                    <id>prepare</id>
+                    <phase>validate</phase>
+                    <configuration>
+                    <target>
+                        <echo message="prepare phase" />
+                    </target>
+                    </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                </execution>
+            </executions>
+        </plugin>
+        <plugin>
+            <groupId>org.eclipse.tycho</groupId>
+            <artifactId>tycho-surefire-plugin</artifactId>
+            <version>${tycho-version}</version>
+            <configuration>
+                <includes>
+                    <include>**/AllTests.*</include>
+                </includes>
+                <useUIHarness>false</useUIHarness>
+                <useUIThread>false</useUIThread>
+                <product>org.eclipse.platform.ide</product>
+            </configuration>
+        </plugin>
+    </plugins>
+  </build>
+
+ <groupId>org.eclipse.linuxtools.tmf</groupId>
+</project>
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/shared/org/eclipse/linuxtools/tmf/ctf/core/tests/shared/CtfTmfTestTrace.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/shared/org/eclipse/linuxtools/tmf/ctf/core/tests/shared/CtfTmfTestTrace.java
new file mode 100644 (file)
index 0000000..7b8e574
--- /dev/null
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests.shared;
+
+import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTrace;
+import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfEvent;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.stubs.CtfTmfTraceStub;
+
+/**
+ * Available CTF TMF test traces. Kind-of-extends {@link CtfTestTrace}.
+ *
+ * To run tests using these, you first need to run the "get-traces.[xml|sh]"
+ * script located under lttng/org.eclipse.linuxtools.ctf.core.tests/traces/ .
+ *
+ * @author Alexandre Montplaisir
+ */
+public enum CtfTmfTestTrace {
+    /** Example kernel trace */
+    KERNEL,
+    /** Another kernel trace */
+    TRACE2,
+    /** Kernel trace with event contexts */
+    KERNEL_VM,
+    /** Trace synchronization: source trace */
+    SYNC_SRC,
+    /** Trace synchronization: destination trace */
+    SYNC_DEST,
+    /** UST trace with lots of lost events */
+    HELLO_LOST,
+    /** UST trace with lttng-ust-cyg-profile events (aka -finstrument-functions) */
+    CYG_PROFILE,
+    /** UST trace with lttng-ust-cyg-profile-fast events (no address in func_exit) */
+    CYG_PROFILE_FAST,
+    /** Autogenerated Syntetic trace */
+    SYNTHETIC_TRACE,
+    /** Trace with non-standard field sizes */
+    FUNKY_TRACE;
+
+
+    private final String fPath;
+    private CtfTmfTraceStub fTrace = null;
+
+    private CtfTmfTestTrace() {
+        /* This makes my head spin */
+        fPath = CtfTestTrace.valueOf(this.name()).getPath();
+    }
+
+    /**
+     * @return The path of this trace
+     */
+    public String getPath() {
+        return fPath;
+    }
+
+    /**
+     * Return a CtfTmfTraceStub object of this test trace. It will be already
+     * initTrace()'ed.
+     *
+     * Make sure you call {@link #exists()} before calling this!
+     *
+     * After being used by unit tests, traces must be properly disposed of by
+     * calling the {@link CtfTmfTestTrace#dispose()} method.
+     *
+     * @return A CtfTmfTrace reference to this trace
+     */
+    public synchronized CtfTmfTrace getTrace() {
+        if (fTrace != null) {
+            fTrace.dispose();
+        }
+        fTrace = new CtfTmfTraceStub();
+        try {
+            fTrace.initTrace(null, fPath, CtfTmfEvent.class);
+        } catch (TmfTraceException e) {
+            /* Should not happen if tracesExist() passed */
+            throw new RuntimeException(e);
+        }
+        return fTrace;
+    }
+
+    /**
+     * Check if the trace actually exists on disk or not.
+     *
+     * @return If the trace is present
+     */
+    public boolean exists() {
+        return CtfTestTrace.valueOf(this.name()).exists();
+    }
+
+    /**
+     * Dispose of the trace
+     */
+    public void dispose() {
+        if (fTrace != null) {
+            fTrace.dispose();
+            fTrace = null;
+        }
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/AllTests.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/AllTests.java
new file mode 100644 (file)
index 0000000..3230a87
--- /dev/null
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial generation with CodePro tools
+ *   Alexandre Montplaisir - Clean up, consolidate redundant tests
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * The class <code>TestAll</code> builds a suite that can be used to run all
+ * of the tests within its package as well as within any subpackages of its
+ * package.
+ *
+ * @author ematkho
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    CtfIteratorTest.class,
+    CtfLocationDataTest.class,
+    CtfLocationTest.class,
+    CtfTmfContextTest.class,
+    CtfTmfEventFieldTest.class,
+    CtfTmfEventTest.class,
+    CtfTmfEventTypeTest.class,
+    CtfTmfLostEventsTest.class,
+    CtfTmfTimestampTest.class,
+    CtfTmfTraceTest.class,
+    EventContextTest.class,
+    FunkyTraceTest.class,
+
+    /* Tests in other packages (that are there because of CTF) */
+    org.eclipse.linuxtools.tmf.ctf.core.tests.request.AllTests.class,
+    org.eclipse.linuxtools.tmf.ctf.core.tests.statistics.AllTests.class,
+    org.eclipse.linuxtools.tmf.ctf.core.tests.tracemanager.AllTests.class
+})
+public class AllTests {
+
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfIteratorTest.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfIteratorTest.java
new file mode 100644 (file)
index 0000000..cbd7ede
--- /dev/null
@@ -0,0 +1,237 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial generation with CodePro tools
+ *   Alexandre Montplaisir - Clean up, consolidate redundant tests
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
+
+import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfIterator;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfLocation;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfLocationInfo;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfEvent;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>CtfIteratorTest</code> contains tests for the class
+ * <code>{@link CtfIterator}</code>.
+ *
+ * @author ematkho
+ * @version 1.0
+ */
+public class CtfIteratorTest {
+
+    private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
+
+    private CtfTmfTrace trace;
+    private CtfIterator iterator;
+
+    /**
+     * Perform pre-test initialization.
+     * @throws CTFReaderException error
+     */
+    @Before
+    public void setUp() throws CTFReaderException {
+        assumeTrue(testTrace.exists());
+        trace = testTrace.getTrace();
+        iterator = new CtfIterator(trace);
+        CtfLocation ctfLocation = new CtfLocation(new CtfLocationInfo(1, 0));
+        iterator.setLocation(ctfLocation);
+        iterator.increaseRank();
+    }
+
+    /**
+     * Perform post-test clean-up.
+     */
+    @After
+    public void tearDown() {
+        if (iterator != null) {
+            iterator.dispose();
+        }
+    }
+
+    /**
+     * Run the CtfIterator(CtfTmfTrace) constructor on a non init'ed trace.
+     * @throws CTFReaderException error
+     */
+    @Test
+    public void testCtfIterator_noinit() throws CTFReaderException {
+        CtfIterator result = new CtfIterator(trace);
+        assertNotNull(result);
+    }
+
+    /**
+     * Run the CtfIterator(CtfTmfTrace) constructor on an init'ed trace.
+     * @throws CTFReaderException error
+     */
+    @Test
+    public void testCtfIterator_init() throws CTFReaderException {
+        trace.init("test");
+        CtfIterator result = new CtfIterator(trace);
+
+        assertNotNull(result);
+    }
+
+    /**
+     * Run the CtfIterator(CtfTmfTrace,long,long) constructor test, which
+     * specifies an initial position for the iterator.
+     * @throws CTFReaderException error
+     */
+    @Test
+    public void testCtfIterator_position() throws CTFReaderException {
+        long timestampValue = 1L;
+        long rank = 1L;
+        CtfIterator result = new CtfIterator(trace, new CtfLocationInfo(timestampValue, 0), rank);
+
+        assertNotNull(result);
+    }
+
+
+    /**
+     * Run the boolean advance() method test.
+     */
+    @Test
+    public void testAdvance() {
+        boolean result = iterator.advance();
+        assertTrue(result);
+    }
+
+    /**
+     * Run the int compareTo(CtfIterator) method test.
+     * @throws CTFReaderException error
+     */
+    @Test
+    public void testCompareTo() throws CTFReaderException {
+        CtfIterator o = new CtfIterator(trace);
+        int result = iterator.compareTo(o);
+
+        assertEquals(1L, result);
+    }
+
+    /**
+     * Run the boolean equals(Object) method test. Compare with another iterator
+     * on the same trace.
+     * @throws CTFReaderException error
+     */
+    @Test
+    public void testEquals_other() throws CTFReaderException {
+        CtfIterator obj = new CtfIterator(trace);
+        CtfLocation ctfLocation1 = new CtfLocation(new CtfLocationInfo(1, 0));
+        obj.setLocation(ctfLocation1);
+        obj.increaseRank();
+
+        boolean result = iterator.equals(obj);
+        assertTrue(result);
+    }
+
+    /**
+     * Run the boolean equals(Object) method test. Compare with an empty object.
+     */
+    @Test
+    public void testEquals_empty() {
+        Object obj = new Object();
+        boolean result = iterator.equals(obj);
+
+        assertFalse(result);
+    }
+
+    /**
+     * Run the CtfTmfTrace getCtfTmfTrace() method test.
+     */
+    @Test
+    public void testGetCtfTmfTrace() {
+        CtfTmfTrace result = iterator.getCtfTmfTrace();
+        assertNotNull(result);
+    }
+
+    /**
+     * Run the CtfTmfEvent getCurrentEvent() method test.
+     */
+    @Test
+    public void testGetCurrentEvent() {
+        CtfTmfEvent result = iterator.getCurrentEvent();
+        assertNotNull(result);
+    }
+
+    /**
+     * Run the CtfLocation getLocation() method test.
+     */
+    @Test
+    public void testGetLocation() {
+        CtfLocation result = iterator.getLocation();
+        assertNotNull(result);
+    }
+
+    /**
+     * Run the long getRank() method test.
+     */
+    @Test
+    public void testGetRank() {
+        long result = iterator.getRank();
+        assertEquals(1L, result);
+    }
+
+    /**
+     * Run the boolean hasValidRank() method test.
+     */
+    @Test
+    public void testHasValidRank() {
+        boolean result = iterator.hasValidRank();
+        assertTrue(result);
+    }
+
+    /**
+     * Run the int hashCode() method test.
+     */
+    @Test
+    public void testHashCode() {
+        int result = iterator.hashCode();
+        int result2 = iterator.hashCode();
+        assertEquals(result, result2);
+    }
+
+    /**
+     * Run the void increaseRank() method test.
+     */
+    @Test
+    public void testIncreaseRank() {
+        iterator.increaseRank();
+    }
+
+    /**
+     * Run the boolean seek(long) method test.
+     */
+    @Test
+    public void testSeek() {
+        long timestamp = 1L;
+        boolean result = iterator.seek(timestamp);
+        assertTrue(result);
+    }
+
+    /**
+     * Run the void setLocation(ITmfLocation<?>) method test.
+     */
+    @Test
+    public void testSetLocation() {
+        CtfLocation location = new CtfLocation(new CtfLocationInfo(1, 0));
+        iterator.setLocation(location);
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfLocationDataTest.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfLocationDataTest.java
new file mode 100644 (file)
index 0000000..2a963b4
--- /dev/null
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.linuxtools.tmf.ctf.core.CtfLocationInfo;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Collection of tests for the {@link CtfLocationInfo}
+ *
+ * @author alexmont
+ */
+public class CtfLocationDataTest {
+
+    private CtfLocationInfo fixture;
+
+    /**
+     * Perform pre-test initialization.
+     */
+    @Before
+    public void setUp() {
+        fixture = new CtfLocationInfo(1, 0);
+    }
+
+    /**
+     * Test for the .getTimestamp() and .getIndex() methods
+     */
+    @Test
+    public void testGetters() {
+        long timestamp = fixture.getTimestamp();
+        long index = fixture.getIndex();
+
+        assertEquals(1, timestamp);
+        assertEquals(0, index);
+    }
+
+    /**
+     * Test for the .hashCode() method
+     */
+    @Test
+    public void testHashCode() {
+        int code = fixture.hashCode();
+        assertEquals(962, code);
+    }
+
+    /**
+     * Test for the .equals() method
+     */
+    @Test
+    public void testEquals() {
+        CtfLocationInfo same = new CtfLocationInfo(1, 0);
+        CtfLocationInfo diff1 = new CtfLocationInfo(100, 0);
+        CtfLocationInfo diff2 = new CtfLocationInfo(1, 10);
+
+        assertTrue(fixture.equals(same));
+        assertFalse(fixture.equals(diff1));
+        assertFalse(fixture.equals(diff2));
+    }
+
+    /**
+     * Test for the .compareTo() method
+     */
+    @Test
+    public void testCompareTo() {
+        CtfLocationInfo same = new CtfLocationInfo(1, 0);
+        CtfLocationInfo smaller = new CtfLocationInfo(0, 0);
+        CtfLocationInfo bigger1 = new CtfLocationInfo(1000, 500);
+        CtfLocationInfo bigger2 = new CtfLocationInfo(1, 1);
+
+        assertEquals(0, same.compareTo(fixture));
+        assertEquals(-1, smaller.compareTo(fixture));
+        assertEquals(1, bigger1.compareTo(fixture));
+        assertEquals(1, bigger2.compareTo(fixture));
+    }
+
+    /**
+     * Test for the .toString() method
+     */
+    @Test
+    public void testToString() {
+        String expected = "Element [1/0]";
+        assertEquals(expected, fixture.toString());
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfLocationTest.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfLocationTest.java
new file mode 100644 (file)
index 0000000..dd0a965
--- /dev/null
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial generation with CodePro tools
+ *   Alexandre Montplaisir - Clean up, consolidate redundant tests
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfLocation;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfLocationInfo;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>CtfLocationTest</code> contains tests for the class
+ * <code>{@link CtfLocation}</code>.
+ *
+ * @author ematkho
+ * @version 1.0
+ */
+public class CtfLocationTest {
+
+    private CtfLocation fixture;
+
+    /**
+     * Perform pre-test initialization.
+     */
+    @Before
+    public void setUp() {
+        fixture = new CtfLocation(new CtfLocationInfo(1, 0));
+    }
+
+    /**
+     * Run the CtfLocation(Long) constructor test.
+     */
+    @Test
+    public void testCtfLocation_long() {
+        CtfLocationInfo location = new CtfLocationInfo(1, 0);
+        CtfLocation result = new CtfLocation(location);
+
+        assertNotNull(result);
+        assertEquals(1L, result.getLocationInfo().getTimestamp());
+    }
+
+    /**
+     * Run the CtfLocation(ITmfTimestamp) constructor test.
+     */
+    @Test
+    public void testCtfLocation_timestamp() {
+        ITmfTimestamp timestamp = new TmfTimestamp();
+        CtfLocation result = new CtfLocation(timestamp);
+
+        assertNotNull(result);
+        assertEquals(0L, result.getLocationInfo().getTimestamp());
+    }
+
+    /**
+     * Run the Long getLocation() method test.
+     */
+    @Test
+    public void testGetLocation() {
+        CtfLocationInfo location = fixture.getLocationInfo();
+        long result = location.getTimestamp();
+        assertEquals(1L, result);
+    }
+
+    /**
+     * Run the void setLocation(Long) method test.
+     */
+    @Test
+    public void testSetLocation() {
+        CtfLocationInfo location = new CtfLocationInfo(1337, 7331);
+        fixture = new CtfLocation(location);
+    }
+
+    /**
+     * Test the toString() method with a valid location.
+     */
+    @Test
+    public void testToString_valid(){
+        CtfLocation fixture2 = new CtfLocation(new CtfLocationInfo(1337, 7331));
+        assertEquals("CtfLocation [fLocationInfo=Element [1337/7331]]", fixture2.toString());
+    }
+
+    /**
+     * Test the toString() method with an invalid location.
+     */
+    @Test
+    public void testToString_invalid(){
+        CtfLocation fixture2 = new CtfLocation(new CtfLocationInfo(-1, -1));
+        assertEquals("CtfLocation [INVALID]", fixture2.toString());
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfContextTest.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfContextTest.java
new file mode 100644 (file)
index 0000000..2aa8224
--- /dev/null
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial implementation
+ *   Alexandre Montplaisir
+ *   Patrick Tasse - Updated for removal of context clone
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfContext;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfEvent;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests for the CtfTmfLightweightContext class
+ *
+ * @author Matthew Khouzam
+ * @version 1.1
+ */
+public class CtfTmfContextTest {
+
+    private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
+    private static final long begin = 1332170682440133097L; /* Trace start time */
+    private static final long end = 1332170692664579801L; /* Trace end time */
+
+    private CtfTmfTrace trace;
+
+    private class SeekerThread extends Thread {
+        long val;
+
+        public void setVal(long val) {
+            this.val = val;
+        }
+    }
+
+    /**
+     * Pre-test initialization
+     *
+     * @throws TmfTraceException
+     *             If the trace couldn't be init'ed, which shouldn't happen.
+     */
+    @Before
+    public void setUp() throws TmfTraceException {
+        assumeTrue(testTrace.exists());
+        trace = new CtfTmfTrace();
+        String path = testTrace.getPath();
+        trace.initTrace((IResource) null, path, CtfTmfEvent.class);
+    }
+
+    /**
+     * Index all the events in the test trace.
+     */
+    @Test
+    public void testIndexing() {
+        CtfTmfContext context = new CtfTmfContext(trace);
+        context.seek(0);
+
+        int count = 0;
+        while (trace.getNext(context) != null) {
+            count++;
+        }
+        assertTrue(count > 0);
+    }
+
+    /**
+     * Context fuzzer. Use an amount of contexts greater than the size of the
+     * iterator cache and have them access the trace in parallel.
+     *
+     * @throws InterruptedException
+     *             Would fail the test
+     */
+    @Test
+    public void testTooManyContexts() throws InterruptedException {
+        final int lwcCount = 101;
+        double increment = (end - begin) / lwcCount;
+        final ArrayList<Long> vals = new ArrayList<>();
+        final ArrayList<Thread> threads = new ArrayList<>();
+        final ArrayList<CtfTmfContext> tooManyContexts = new ArrayList<>();
+
+        for (double i = begin; i < end; i += increment) {
+            SeekerThread thread = new SeekerThread() {
+                @Override
+                public void run() {
+                    CtfTmfContext lwc = new CtfTmfContext(trace);
+                    lwc.seek(val);
+                    trace.getNext(lwc);
+                    synchronized(trace){
+                        if (lwc.getCurrentEvent() != null) {
+                            vals.add(lwc.getCurrentEvent().getTimestamp().getValue());
+                        }
+                        tooManyContexts.add(lwc);
+                    }
+                }
+            };
+            thread.setVal((long)i);
+            threads.add(thread);
+            thread.start();
+        }
+
+        for (Thread t: threads){
+            t.join();
+        }
+
+        for (long val : vals){
+            assertTrue(val >= begin);
+            assertTrue(val <= end);
+        }
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfEventFieldTest.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfEventFieldTest.java
new file mode 100644 (file)
index 0000000..6b31cbf
--- /dev/null
@@ -0,0 +1,327 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial generation with CodePro tools
+ *   Alexandre Montplaisir - Clean up, consolidate redundant tests
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.eclipse.linuxtools.ctf.core.event.io.BitBuffer;
+import org.eclipse.linuxtools.ctf.core.event.types.ArrayDeclaration;
+import org.eclipse.linuxtools.ctf.core.event.types.Definition;
+import org.eclipse.linuxtools.ctf.core.event.types.Encoding;
+import org.eclipse.linuxtools.ctf.core.event.types.EnumDeclaration;
+import org.eclipse.linuxtools.ctf.core.event.types.FloatDeclaration;
+import org.eclipse.linuxtools.ctf.core.event.types.FloatDefinition;
+import org.eclipse.linuxtools.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.linuxtools.ctf.core.event.types.SequenceDeclaration;
+import org.eclipse.linuxtools.ctf.core.event.types.StringDeclaration;
+import org.eclipse.linuxtools.ctf.core.event.types.StructDeclaration;
+import org.eclipse.linuxtools.ctf.core.event.types.StructDefinition;
+import org.eclipse.linuxtools.ctf.core.event.types.VariantDeclaration;
+import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfEventField;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>CtfTmfEventFieldTest</code> contains tests for the class
+ * <code>{@link CtfTmfEventField}</code>.
+ *
+ * @author ematkho
+ * @version 1.0
+ */
+public class CtfTmfEventFieldTest {
+
+    private static final String ROOT = "root";
+    private static final String SEQ = "seq";
+    private static final String ARRAY_STR = "array_str";
+    private static final String ARRAY_FLOAT = "array_float";
+    private static final String ARRAY_INT = "array_int";
+    private static final String ARRAY_STRUCT = "array_struct";
+    private static final String ARRAY_VARIANT = "array_variant";
+    private static final String ARRAY_ENUM = "array_enum";
+    private static final String STR = "str";
+    private static final String FLOAT = "float";
+    private static final String LEN = "len";
+    private static final String INT = "int";
+    private static final String NAME = "test";
+    private static final String STRUCT = "struct";
+    private static final String VARIANT = "variant";
+    private static final String ENUM = "enum";
+
+    private static final byte TEST_NUMBER = 2;
+    private static final String TEST_STRING = "two";
+
+    private static final int ARRAY_SIZE = 2;
+
+    private StructDefinition fixture;
+
+    /**
+     * Perform pre-test initialization.
+     *
+     * @throws UnsupportedEncodingException
+     *             Thrown when UTF-8 encoding is not available.
+     * @throws CTFReaderException
+     *             error
+     */
+    @Before
+    public void setUp() throws UnsupportedEncodingException, CTFReaderException {
+        final byte[] testStringBytes = TEST_STRING.getBytes("UTF-8");
+
+        int capacity = 2048;
+        ByteBuffer bb = ByteBuffer.allocateDirect(capacity);
+
+        StructDeclaration sDec = new StructDeclaration(1l);
+        StringDeclaration strDec = new StringDeclaration();
+        IntegerDeclaration intDec = new IntegerDeclaration(8, false, 8,
+                ByteOrder.BIG_ENDIAN, Encoding.NONE, null, 8);
+        FloatDeclaration flDec = new FloatDeclaration(8, 24,
+                ByteOrder.BIG_ENDIAN, 8);
+        SequenceDeclaration seqDec = new SequenceDeclaration(LEN, intDec);
+        StructDeclaration structDec = new StructDeclaration(8);
+        EnumDeclaration enumDec = new EnumDeclaration(intDec);
+        VariantDeclaration varDec = new VariantDeclaration();
+        ArrayDeclaration arrStrDec = new ArrayDeclaration(ARRAY_SIZE, strDec);
+        ArrayDeclaration arrFloatDec = new ArrayDeclaration(ARRAY_SIZE, flDec);
+        ArrayDeclaration arrIntDec = new ArrayDeclaration(ARRAY_SIZE, intDec);
+        ArrayDeclaration arrStructDec = new ArrayDeclaration(ARRAY_SIZE, structDec);
+        ArrayDeclaration arrVariantDec = new ArrayDeclaration(ARRAY_SIZE, varDec);
+        ArrayDeclaration arrEnumDec = new ArrayDeclaration(ARRAY_SIZE, enumDec);
+
+        sDec.addField(INT, intDec);
+        bb.put(TEST_NUMBER);
+
+        sDec.addField(ARRAY_INT, arrIntDec);
+        for (int i = 0; i < ARRAY_SIZE; ++i) {
+            bb.put(TEST_NUMBER);
+        }
+
+        sDec.addField(LEN, intDec);
+        bb.put(TEST_NUMBER);
+
+        sDec.addField(FLOAT, flDec);
+        bb.putFloat(TEST_NUMBER);
+
+        sDec.addField(ARRAY_FLOAT, arrFloatDec);
+        for (int i = 0; i < ARRAY_SIZE; ++i) {
+            bb.putFloat(TEST_NUMBER);
+        }
+
+        sDec.addField(STR, strDec);
+        bb.put(testStringBytes);
+        bb.put((byte) 0);
+
+        sDec.addField(ARRAY_STR, arrStrDec);
+        for (int i = 0; i < ARRAY_SIZE; ++i) {
+            bb.put(testStringBytes);
+            bb.put((byte) 0);
+        }
+
+        sDec.addField(SEQ, seqDec);
+        bb.put(TEST_NUMBER);
+        bb.put(TEST_NUMBER);
+
+        structDec.addField(STR, strDec);
+        structDec.addField(INT, intDec);
+        sDec.addField(STRUCT, structDec);
+        bb.put(testStringBytes);
+        bb.put((byte) 0);
+        bb.put(TEST_NUMBER);
+
+        sDec.addField(ARRAY_STRUCT, arrStructDec);
+        for (int i = 0; i < ARRAY_SIZE; ++i) {
+            bb.put(testStringBytes);
+            bb.put((byte) 0);
+            bb.put(TEST_NUMBER);
+        }
+
+        enumDec.add(0, 1, LEN);
+        enumDec.add(2, 3, FLOAT);
+        sDec.addField(ENUM, enumDec);
+        bb.put(TEST_NUMBER);
+
+        sDec.addField(ARRAY_ENUM, arrEnumDec);
+        for (int i = 0; i < ARRAY_SIZE; ++i) {
+            bb.put(TEST_NUMBER);
+        }
+
+        varDec.addField(LEN, intDec);
+        varDec.addField(FLOAT, flDec);
+        varDec.setTag(ENUM);
+        sDec.addField(VARIANT, varDec);
+        bb.putFloat(TEST_NUMBER);
+
+        sDec.addField(ARRAY_VARIANT, arrVariantDec);
+        for (int i = 0; i < ARRAY_SIZE; ++i) {
+            bb.putFloat(TEST_NUMBER);
+        }
+
+        fixture = sDec.createDefinition(fixture, ROOT);
+
+        bb.position(0);
+        fixture.read(new BitBuffer(bb));
+    }
+
+    /**
+     * Run the CtfTmfEventField parseField(Definition,String) method test.
+     */
+    @Test
+    public void testParseField_float() {
+        FloatDefinition fieldDef = (FloatDefinition) fixture.lookupDefinition(FLOAT);
+        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, "_" + NAME);
+        assertEquals("test=2.0", result.toString());
+    }
+
+    /**
+     * Run the CtfTmfEventField parseField(Definition,String) method test for an
+     * array of floats field.
+     */
+    @Test
+    public void testParseField_array_float() {
+        Definition fieldDef = fixture.lookupArray(ARRAY_FLOAT);
+        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+        assertEquals("test=[2.0, 2.0]", result.toString());
+    }
+
+    /**
+     * Run the CtfTmfEventField parseField(Definition,String) method test.
+     */
+    @Test
+    public void testParseField_int() {
+        Definition fieldDef = fixture.lookupDefinition(INT);
+        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+        assertEquals("test=02", result.toString());
+    }
+
+    /**
+     * Run the CtfTmfEventField parseField(Definition,String) method test for an
+     * array of integers field.
+     */
+    @Test
+    public void testParseField_array_int() {
+        Definition fieldDef = fixture.lookupArray(ARRAY_INT);
+        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+        assertEquals("test=[02, 02]", result.toString());
+    }
+
+    /**
+     * Run the CtfTmfEventField parseField(Definition,String) method test.
+     */
+    @Test
+    public void testParseField_sequence() {
+        Definition fieldDef = fixture.lookupDefinition(SEQ);
+        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+        assertEquals("test=[02, 02]", result.toString());
+    }
+
+    /**
+     * Run the CtfTmfEventField parseField(Definition,String) method test.
+     */
+    @Test
+    public void testParseField_sequence_value() {
+        Definition fieldDef = fixture.lookupDefinition(SEQ);
+        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+        long[] values = (long[]) result.getValue();
+        long[] expected = new long[] { 2, 2 };
+        assertArrayEquals(expected, values);
+    }
+
+    /**
+     * Run the CtfTmfEventField parseField(Definition,String) method test.
+     */
+    @Test
+    public void testParseField_string() {
+        Definition fieldDef = fixture.lookupDefinition(STR);
+        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+        assertEquals("test=two", result.toString());
+    }
+
+    /**
+     * Run the CtfTmfEventField parseField(Definition,String) method test for an
+     * array of strings field.
+     */
+    @Test
+    public void testParseField_array_string() {
+        Definition fieldDef = fixture.lookupArray(ARRAY_STR);
+        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+        assertEquals("test=[two, two]", result.toString());
+    }
+
+    /**
+     * Run the CtfTmfEventField parseField(Definition,String) method test.
+     */
+    @Test
+    public void testParseField_struct() {
+        Definition fieldDef = fixture.lookupDefinition(STRUCT);
+        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+        assertEquals("test=[str=two, int=02]", result.toString());
+    }
+
+    /**
+     * Run the CtfTmfEventField parseField(Definition,String) method test for an
+     * array of structs field.
+     */
+    @Test
+    public void testParseField_array_struct() {
+        Definition fieldDef = fixture.lookupArray(ARRAY_STRUCT);
+        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+        assertEquals("test=[[str=two, int=02], [str=two, int=02]]", result.toString());
+    }
+
+    /**
+     * Run the CtfTmfEventField parseField(Definition,String) method test.
+     */
+    @Test
+    public void testParseField_enum() {
+        Definition fieldDef = fixture.lookupDefinition(ENUM);
+        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+        assertEquals("test=float", result.toString());
+    }
+
+    /**
+     * Run the CtfTmfEventField parseField(Definition,String) method test for an
+     * array of enums field.
+     */
+    @Test
+    public void testParseField_array_enum() {
+        Definition fieldDef = fixture.lookupArray(ARRAY_ENUM);
+        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+        assertEquals("test=[float, float]", result.toString());
+    }
+
+    /**
+     * Run the CtfTmfEventField parseField(Definition,String) method test.
+     */
+    @Test
+    public void testParseField_variant() {
+        Definition fieldDef = fixture.lookupDefinition(VARIANT);
+        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+        assertEquals("test=float=2.0", result.toString());
+    }
+
+    /**
+     * Run the CtfTmfEventField parseField(Definition,String) method test for an
+     * array of variants field.
+     */
+    @Test
+    public void testParseField_array_variant() {
+        Definition fieldDef = fixture.lookupArray(ARRAY_VARIANT);
+        CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+        assertEquals("test=[float=2.0, float=2.0]", result.toString());
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfEventTest.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfEventTest.java
new file mode 100644 (file)
index 0000000..de655f2
--- /dev/null
@@ -0,0 +1,223 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial generation with CodePro tools
+ *   Alexandre Montplaisir - Clean up, consolidate redundant tests
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assume.assumeTrue;
+
+import java.util.Set;
+
+import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEventType;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfIterator;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfEvent;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfEventFactory;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * The class <code>CtfTmfEventTest</code> contains tests for the class
+ * <code>{@link CtfTmfEvent}</code>.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+public class CtfTmfEventTest {
+
+    private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
+
+    private static CtfTmfEvent nullEvent;
+    private CtfTmfEvent fixture;
+
+    /**
+     * Test class initialization
+     */
+    @BeforeClass
+    public static void initialize() {
+        nullEvent = CtfTmfEventFactory.getNullEvent();
+    }
+
+    /**
+     * Perform pre-test initialization.
+     * @throws CTFReaderException error
+     */
+    @Before
+    public void setUp() throws CTFReaderException {
+        assumeTrue(testTrace.exists());
+        CtfTmfTrace trace = testTrace.getTrace();
+        CtfIterator tr = new CtfIterator(trace);
+        tr.advance();
+        fixture = tr.getCurrentEvent();
+    }
+
+    /**
+     * Run the CTFEvent(EventDefinition,StreamInputReader) constructor test.
+     */
+    @Test
+    public void testCTFEvent_read() {
+        assertNotNull(fixture);
+    }
+
+    /**
+     * Run the int getCPU() method test.
+     */
+    @Test
+    public void testGetCPU() {
+        int result = nullEvent.getCPU();
+        assertEquals(-1, result);
+    }
+
+    /**
+     * Run the String getEventName() method test.
+     */
+    @Test
+    public void testGetEventName() {
+        String result = nullEvent.getType().getName();
+        assertEquals("Empty CTF event", result);
+    }
+
+    /**
+     * Run the ArrayList<String> getFieldNames() method test.
+     */
+    @Test
+    public void testGetFieldNames() {
+        String[] result = fixture.getContent().getFieldNames();
+        assertNotNull(result);
+    }
+
+    /**
+     * Run the Object getFieldValue(String) method test.
+     */
+    @Test
+    public void testGetFieldValue() {
+        String fieldName = "pid";
+        ITmfEventField result = fixture.getContent().getField(fieldName);
+
+        assertNotNull(result);
+        assertNotNull(result.getValue());
+    }
+
+    /**
+     * Run the HashMap<String, CTFEventField> getFields() method test.
+     */
+    @Test
+    public void testGetFields() {
+        ITmfEventField[] fields = nullEvent.getContent().getFields();
+        ITmfEventField[] fields2 = new ITmfEventField[0];
+        assertArrayEquals(fields2, fields);
+    }
+
+    /**
+     * Run the ITmfEventField getSubFieldValue(String[]) method test.
+     */
+    @Test
+    public void testGetSubFieldValue() {
+        /* Field exists */
+        String[] names = { "pid" };
+        assertNotNull(fixture.getContent().getSubField(names));
+
+        /* First field exists, not the second */
+        String[] names2 = { "pid", "abcd" };
+        assertNull(fixture.getContent().getSubField(names2));
+
+        /* Both field do not exist */
+        String[] names3 = { "pfid", "abcd" };
+        assertNull(fixture.getContent().getSubField(names3));
+
+        /* TODO Missing case of embedded field, need event for it */
+    }
+
+    /**
+     * Run the long getID() method test.
+     */
+    @Test
+    public void testGetID() {
+        long result = nullEvent.getID();
+        assertEquals(-1L, result);
+    }
+
+    /**
+     * Run the long getTimestamp() method test.
+     */
+    @Test
+    public void testGetTimestamp() {
+        long result = nullEvent.getTimestamp().getValue();
+        assertEquals(-1L, result);
+    }
+
+    /**
+     * Test the getters for the reference, source and type.
+     */
+    @Test
+    public void testGetters() {
+        long rank = fixture.getRank();
+        CtfTmfTrace trace = fixture.getTrace();
+        String reference = fixture.getReference();
+        String source = fixture.getSource();
+        ITmfEventType type = fixture.getType();
+        assertEquals(ITmfContext.UNKNOWN_RANK, rank);
+        assertEquals("kernel", trace.getName());
+        assertEquals("channel0_1", reference);
+        assertEquals("1", source);
+        assertEquals("lttng_statedump_vm_map", type.toString());
+    }
+
+    /**
+     * Test the custom CTF attributes methods. The test trace doesn't have any,
+     * so the list of attributes should be empty.
+     */
+    @Test
+    public void testCustomAttributes() {
+        Set<String> attributes = fixture.listCustomAttributes();
+        assertEquals(0, attributes.size());
+
+        String attrib = fixture.getCustomAttribute("bozo");
+        assertNull(attrib);
+    }
+
+    /**
+     * Test the toString() method
+     */
+    @Test
+    public void testToString() {
+        String s = fixture.getContent().toString();
+        assertEquals("pid=1922, start=0xb73ea000, end=0xb73ec000, flags=0x8000075, inode=917738, pgoff=0", s);
+    }
+
+    /**
+     * Test the {@link CtfTmfEventFactory#getNullEvent()} method, and the
+     * nullEvent's values.
+     */
+    @Test
+    public void testNullEvent() {
+        CtfTmfEvent nullEvent2 = CtfTmfEventFactory.getNullEvent();
+        assertSame(nullEvent2, nullEvent);
+        assertNotNull(nullEvent);
+        assertEquals(-1, nullEvent.getCPU());
+        assertEquals("Empty CTF event", nullEvent.getType().getName());
+        assertEquals("No stream", nullEvent.getReference());
+        assertArrayEquals(new ITmfEventField[0], nullEvent.getContent().getFields());
+        assertEquals(-1L, nullEvent.getID());
+        assertEquals(-1L, nullEvent.getTimestamp().getValue());
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfEventTypeTest.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfEventTypeTest.java
new file mode 100644 (file)
index 0000000..167bce8
--- /dev/null
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial generation with CodePro tools
+ *   Alexandre Montplaisir - Clean up, consolidate redundant tests
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
+import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfEventType;
+import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
+import org.junit.Test;
+
+/**
+ * The class <code>CtfTmfEventTypeTest</code> contains tests for the class
+ * <code>{@link CtfTmfEventType}</code>.
+ *
+ * @author ematkho
+ * @version 1.0
+ */
+public class CtfTmfEventTypeTest {
+
+    /**
+     * Run the CtfTmfEventType(String,String,ITmfEventField) constructor test.
+     */
+    @Test
+    public void testCtfTmfEventType() {
+        String eventName = "";
+        ITmfEventField content = new TmfEventField("", null, new ITmfEventField[] {});
+        CtfTmfEventType result = new CtfTmfEventType(eventName, new TmfTraceStub(), content);
+
+        assertNotNull(result);
+        assertEquals("", result.toString());
+        assertEquals("", result.getName());
+        assertEquals("Ctf Event/null", result.getContext());
+    }
+
+    /**
+     * Run the String toString() method test.
+     */
+    @Test
+    public void testToString() {
+        ITmfEventField emptyField = new TmfEventField("", null, new ITmfEventField[] {});
+        CtfTmfEventType fixture = new CtfTmfEventType("", new TmfTraceStub() , emptyField);
+
+        String result = fixture.toString();
+
+        assertEquals("", result);
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfLostEventStatisticsTest.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfLostEventStatisticsTest.java
new file mode 100644 (file)
index 0000000..98a92cd
--- /dev/null
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Alexandre Montplaisir - Initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
+
+import java.util.Map;
+
+import org.eclipse.linuxtools.ctf.core.CTFStrings;
+import org.eclipse.linuxtools.tmf.core.exceptions.TmfAnalysisException;
+import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
+import org.eclipse.linuxtools.tmf.core.statistics.ITmfStatistics;
+import org.eclipse.linuxtools.tmf.core.statistics.TmfStateStatistics;
+import org.eclipse.linuxtools.tmf.core.statistics.TmfStatisticsEventTypesModule;
+import org.eclipse.linuxtools.tmf.core.statistics.TmfStatisticsTotalsModule;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestRule;
+import org.junit.rules.Timeout;
+
+/**
+ * Unit tests for handling of lost events by the statistics backends.
+ *
+ * @author Alexandre Montplaisir
+ */
+public class CtfTmfLostEventStatisticsTest {
+
+    /** Time-out tests after 30 seconds */
+    @Rule
+    public TestRule globalTimeout= new Timeout(30000);
+
+    /**Test trace with lost events */
+    private static final CtfTmfTestTrace lostEventsTrace = CtfTmfTestTrace.HELLO_LOST;
+
+    private ITmfTrace fTrace;
+
+    /** The statistics back-end object for the trace with lost events */
+    private ITmfStatistics fStats;
+
+    // ------------------------------------------------------------------------
+    // Maintenance
+    // ------------------------------------------------------------------------
+
+    /**
+     * Class setup
+     */
+    @BeforeClass
+    public static void setUpClass() {
+        assumeTrue(lostEventsTrace.exists());
+    }
+
+    /**
+     * Test setup
+     */
+    @Before
+    public void setUp() {
+        fTrace = lostEventsTrace.getTrace();
+
+        /* Prepare the two analysis-backed state systems */
+        TmfStatisticsTotalsModule totalsMod = new TmfStatisticsTotalsModule();
+        TmfStatisticsEventTypesModule eventTypesMod = new TmfStatisticsEventTypesModule();
+        try {
+            totalsMod.setTrace(fTrace);
+            eventTypesMod.setTrace(fTrace);
+        } catch (TmfAnalysisException e) {
+            fail();
+        }
+
+        totalsMod.schedule();
+        eventTypesMod.schedule();
+        assertTrue(totalsMod.waitForCompletion());
+        assertTrue(eventTypesMod.waitForCompletion());
+
+        ITmfStateSystem totalsSS = totalsMod.getStateSystem();
+        ITmfStateSystem eventTypesSS = eventTypesMod.getStateSystem();
+        assertNotNull(totalsSS);
+        assertNotNull(eventTypesSS);
+
+        fStats = new TmfStateStatistics(totalsSS, eventTypesSS);
+    }
+
+    /**
+     * Test cleanup
+     */
+    @After
+    public void tearDown() {
+        fTrace.dispose();
+    }
+
+    // ------------------------------------------------------------------------
+    // Test methods
+    // ------------------------------------------------------------------------
+
+    /*
+     * Trace start = 1376592664828559410
+     * Trace end   = 1376592665108210547
+     */
+
+    private static final long rangeStart = 1376592664900000000L;
+    private static final long rangeEnd =   1376592665000000000L;
+
+    /**
+     * Test the total number of "real" events. Make sure the lost events aren't
+     * counted in the total.
+     */
+    @Test
+    public void testLostEventsTotals() {
+        long realEvents = fStats.getEventsTotal();
+        assertEquals(32300, realEvents);
+    }
+
+    /**
+     * Test the number of real events in a given range. Lost events shouldn't be
+     * counted.
+     */
+    @Test
+    public void testLostEventsTotalInRange() {
+        long realEventsInRange = fStats.getEventsInRange(rangeStart, rangeEnd);
+        assertEquals(11209L, realEventsInRange);
+    }
+
+    /**
+     * Test the total number of lost events reported in the trace.
+     */
+    @Test
+    public void testLostEventsTypes() {
+        Map<String, Long> events = fStats.getEventTypesTotal();
+        Long lostEvents = events.get(CTFStrings.LOST_EVENT_NAME);
+        assertEquals(Long.valueOf(967700L), lostEvents);
+    }
+
+    /**
+     * Test the number of lost events reported in a given range.
+     */
+    @Test
+    public void testLostEventsTypesInRange() {
+        Map<String, Long> eventsInRange = fStats.getEventTypesInRange(rangeStart, rangeEnd);
+        long lostEventsInRange = eventsInRange.get(CTFStrings.LOST_EVENT_NAME);
+        assertEquals(363494L, lostEventsInRange);
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfLostEventsTest.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfLostEventsTest.java
new file mode 100644 (file)
index 0000000..02f3db4
--- /dev/null
@@ -0,0 +1,256 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
+
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+import org.eclipse.linuxtools.tmf.core.event.ITmfLostEvent;
+import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
+import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
+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.ctf.core.CtfTmfEvent;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTimestamp;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests to verify that lost events are handled correctly.
+ *
+ * Be wary if you are using Babeltrace to cross-check those values. There could
+ * be a bug in Babeltrace with regards to lost events. See
+ * http://bugs.lttng.org/issues/589
+ *
+ * It's not 100% sure at this point which implementation is correct, so for now
+ * these tests assume the Java implementation is the right one.
+ *
+ * @author Alexandre Montplaisir
+ */
+public class CtfTmfLostEventsTest {
+
+    private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.HELLO_LOST;
+
+    private CtfTmfTrace fixture = null;
+
+    /**
+     * Class setup
+     */
+    @Before
+    public void setUp() {
+        assumeTrue(testTrace.exists());
+        fixture = testTrace.getTrace();
+        fixture.indexTrace(true);
+    }
+
+    /**
+     * Clean-up
+     */
+    @After
+    public void tearDown() {
+        if (fixture != null) {
+            fixture.dispose();
+        }
+    }
+
+    // ------------------------------------------------------------------------
+    // Test methods
+    // ------------------------------------------------------------------------
+
+    /**
+     * Test that the number of events is reported correctly (a range of lost
+     * events is counted as one event).
+     */
+    @Test
+    public void testNbEvents() {
+        final long expectedReal = 32300;
+        final long expectedLost = 562;
+
+        EventCountRequest req = new EventCountRequest();
+        fixture.sendRequest(req);
+        try {
+            req.waitForCompletion();
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+
+        assertEquals(expectedReal, req.getReal());
+        assertEquals(expectedLost, req.getLost());
+    }
+
+    /**
+     * Test getting the first lost event from the trace.
+     */
+    @Test
+    public void testFirstLostEvent() {
+        final long rank = 153;
+        final ITmfTimestamp start = new CtfTmfTimestamp(1376592664828848222L);
+        final ITmfTimestamp end   = new CtfTmfTimestamp(1376592664828848540L);
+        final long nbLost = 859;
+
+        final CtfTmfEvent ev = getOneEventTime(start);
+        /* Make sure seeking by rank yields the same event */
+        final CtfTmfEvent ev2 = getOneEventRank(rank);
+        assertEquals(ev, ev2);
+
+        assertTrue(ev instanceof ITmfLostEvent);
+        ITmfLostEvent event = (ITmfLostEvent) ev;
+
+        assertEquals(start, event.getTimestamp());
+        assertEquals(start, event.getTimeRange().getStartTime());
+        assertEquals(end, event.getTimeRange().getEndTime());
+        assertEquals(nbLost, event.getNbLostEvents());
+    }
+
+    /**
+     * Test getting the second lost event from the trace.
+     */
+    @Test
+    public void testSecondLostEvent() {
+        final long rank = 191;
+        final ITmfTimestamp start = new CtfTmfTimestamp(1376592664829402521L);
+        final ITmfTimestamp end   = new CtfTmfTimestamp(1376592664829403076L);
+        final long nbLost = 488;
+
+        final CtfTmfEvent ev = getOneEventTime(start);
+        /* Make sure seeking by rank yields the same event */
+        final CtfTmfEvent ev2 = getOneEventRank(rank);
+        assertEquals(ev, ev2);
+
+        assertTrue(ev instanceof ITmfLostEvent);
+        ITmfLostEvent event = (ITmfLostEvent) ev;
+
+        assertEquals(start, event.getTimestamp());
+        assertEquals(start, event.getTimeRange().getStartTime());
+        assertEquals(end, event.getTimeRange().getEndTime());
+        assertEquals(nbLost, event.getNbLostEvents());
+    }
+
+    /**
+     * Test getting one normal event from the trace (lost events should not
+     * interfere).
+     */
+    @Test
+    public void testNormalEvent() {
+        final long rank = 200;
+        final ITmfTimestamp ts = new CtfTmfTimestamp(1376592664829423928L);
+
+        final CtfTmfEvent event = getOneEventTime(ts);
+        /* Make sure seeking by rank yields the same event */
+        final CtfTmfEvent event2 = getOneEventRank(rank);
+        assertEquals(event, event2);
+
+        assertFalse(event instanceof ITmfLostEvent);
+        assertEquals(ts, event.getTimestamp());
+    }
+
+    // ------------------------------------------------------------------------
+    // Event requests
+    // ------------------------------------------------------------------------
+
+    private CtfTmfEvent getOneEventRank(long rank) {
+        OneEventRequestPerRank req = new OneEventRequestPerRank(rank);
+        fixture.sendRequest(req);
+        try {
+            req.waitForCompletion();
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+        return req.getEvent();
+    }
+
+    private CtfTmfEvent getOneEventTime(ITmfTimestamp ts) {
+        OneEventRequestPerTs req = new OneEventRequestPerTs(ts);
+        fixture.sendRequest(req);
+        try {
+            req.waitForCompletion();
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+        return req.getEvent();
+    }
+
+    private class OneEventRequestPerRank extends TmfEventRequest {
+
+        private CtfTmfEvent event = null;
+
+        public OneEventRequestPerRank(long rank) {
+            super(CtfTmfEvent.class, TmfTimeRange.ETERNITY, rank, 1, ExecutionType.FOREGROUND);
+        }
+
+        @Override
+        public void handleData(ITmfEvent ev) {
+            /* Type is checked by the request, cast should be safe */
+            event = (CtfTmfEvent) ev;
+        }
+
+        public CtfTmfEvent getEvent() {
+            return event;
+        }
+    }
+
+    private class OneEventRequestPerTs extends TmfEventRequest {
+
+        private CtfTmfEvent event = null;
+
+        public OneEventRequestPerTs(ITmfTimestamp ts) {
+            super(CtfTmfEvent.class,
+                    new TmfTimeRange(ts, TmfTimestamp.PROJECT_IS_CANNED),
+                    0, 1, ExecutionType.FOREGROUND);
+        }
+
+        @Override
+        public void handleData(ITmfEvent ev) {
+            event = (CtfTmfEvent) ev;
+        }
+
+        public CtfTmfEvent getEvent() {
+            return event;
+        }
+    }
+
+    private class EventCountRequest extends TmfEventRequest {
+
+        private long nbReal = 0;
+        private long nbLost = 0;
+
+        public EventCountRequest() {
+            super(CtfTmfEvent.class, TmfTimeRange.ETERNITY, 0,
+                    ITmfEventRequest.ALL_DATA, ExecutionType.FOREGROUND);
+        }
+
+        @Override
+        public void handleData(ITmfEvent event) {
+            if (event instanceof ITmfLostEvent) {
+                nbLost++;
+            } else {
+                nbReal++;
+            }
+        }
+
+        public long getReal() {
+            return nbReal;
+        }
+
+        public long getLost() {
+            return nbLost;
+        }
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfTimestampTest.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfTimestampTest.java
new file mode 100644 (file)
index 0000000..b16bccc
--- /dev/null
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial generation with CodePro tools
+ *   Alexandre Montplaisir - Clean up, consolidate redundant tests
+ *   Patrick Tasse - Fix for local time zone
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTimestamp;
+import org.junit.Test;
+
+/**
+ * The class <code>CtfTmfTimestampTest</code> contains tests for the class
+ * <code>{@link CtfTmfTimestamp}</code>.
+ *
+ * @author ematkho
+ * @version 1.0
+ */
+public class CtfTmfTimestampTest {
+
+    /**
+     * Run the CtfTmfTimestamp(long) constructor test.
+     */
+    @Test
+    public void testCtfTmfTimestamp() {
+        long timestamp = 1L;
+        DateFormat df = new SimpleDateFormat("HH:mm:ss.SSS");
+        Date d = new Date(timestamp / 1000000);
+
+        CtfTmfTimestamp result = new CtfTmfTimestamp(timestamp);
+
+        assertNotNull(result);
+        assertEquals(df.format(d) + " 000 001", result.toString());
+        assertEquals(0, result.getPrecision());
+        assertEquals(-9, result.getScale());
+        assertEquals(1L, result.getValue());
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfTraceTest.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/CtfTmfTraceTest.java
new file mode 100644 (file)
index 0000000..cff3f56
--- /dev/null
@@ -0,0 +1,374 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial generation with CodePro tools
+ *   Alexandre Montplaisir - Clean up, consolidate redundant tests
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.linuxtools.tmf.core.signal.TmfEndSynchSignal;
+import org.eclipse.linuxtools.tmf.core.signal.TmfSignal;
+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.ctf.core.CtfLocation;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfLocationInfo;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfEvent;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTimestamp;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>CtfTmfTraceTest</code> contains tests for the class
+ * <code>{@link CtfTmfTrace}</code>.
+ *
+ * @author ematkho
+ * @version 1.0
+ */
+public class CtfTmfTraceTest {
+
+    private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
+
+    private CtfTmfTrace fixture;
+
+    /**
+     * Perform pre-test initialization.
+     *
+     * @throws TmfTraceException
+     *             If the test trace is not found
+     */
+    @Before
+    public void setUp() throws TmfTraceException {
+        assumeTrue(testTrace.exists());
+        fixture = new CtfTmfTrace();
+        fixture.initTrace((IResource) null, testTrace.getPath(), CtfTmfEvent.class);
+    }
+
+    /**
+     * Perform post-test clean-up.
+     */
+    @After
+    public void tearDown() {
+        if (fixture != null) {
+            fixture.dispose();
+        }
+    }
+
+    /**
+     * Run the CtfTmfTrace() constructor test.
+     */
+    @Test
+    public void testCtfTmfTrace() {
+        CtfTmfTrace result = new CtfTmfTrace();
+
+        assertNotNull(result);
+        assertNull(result.getEventType());
+        assertEquals(1000, result.getCacheSize());
+        assertEquals(0L, result.getNbEvents());
+        assertEquals(0L, result.getStreamingInterval());
+        assertNull(result.getResource());
+        assertNull(result.getType());
+    }
+
+    /**
+     * Test the parseEvent() method
+     */
+    @Test
+    public void testParseEvent() {
+        ITmfContext ctx = fixture.seekEvent(0);
+        fixture.getNext(ctx);
+        CtfTmfEvent event = fixture.parseEvent(ctx);
+        assertNotNull(event);
+    }
+
+    /**
+     * Run the void broadcast(TmfSignal) method test.
+     */
+    @Test
+    public void testBroadcast() {
+        TmfSignal signal = new TmfEndSynchSignal(1);
+        fixture.broadcast(signal);
+    }
+
+
+    /**
+     * Run the void dispose() method test.
+     */
+    @Test
+    public void testDispose() {
+        CtfTmfTrace emptyFixture = new CtfTmfTrace();
+        emptyFixture.dispose();
+
+    }
+
+    /**
+     * Run the int getCacheSize() method test.
+     */
+    @Test
+    public void testGetCacheSize() {
+        CtfTmfTrace emptyFixture = new CtfTmfTrace();
+        int result = emptyFixture.getCacheSize();
+        assertEquals(1000, result);
+    }
+
+    /**
+     * Run the ITmfLocation<Comparable> getCurrentLocation() method test.
+     */
+    @Test
+    public void testGetCurrentLocation() {
+        CtfLocation result = (CtfLocation) fixture.getCurrentLocation();
+        assertNull(result);
+    }
+
+    /**
+     * Test the seekEvent() method with a null location.
+     */
+    @Test
+    public void testSeekEventLoc_null() {
+        CtfLocation loc = null;
+        fixture.seekEvent(loc);
+        assertNotNull(fixture);
+    }
+
+    /**
+     * Test the seekEvent() method with a location from a timestamp.
+     */
+    @Test
+    public void testSeekEventLoc_timetamp(){
+        CtfLocation loc = new CtfLocation(new CtfTmfTimestamp(0L));
+        fixture.seekEvent(loc);
+        assertNotNull(fixture);
+    }
+
+
+    /**
+     * Run the ITmfTimestamp getEndTime() method test.
+     */
+    @Test
+    public void testGetEndTime() {
+        ITmfTimestamp result = fixture.getEndTime();
+        assertNotNull(result);
+    }
+
+    /**
+     * Run the String getEnvironment method test.
+     */
+    @Test
+    public void testGetEnvValue() {
+        String key = "tracer_name";
+        String result = fixture.getTraceProperties().get(key);
+        assertEquals("\"lttng-modules\"",result);
+    }
+
+    /**
+     * Run the Class<CtfTmfEvent> getEventType() method test.
+     */
+    @Test
+    public void testGetEventType() {
+        Class<? extends ITmfEvent> result = fixture.getEventType();
+        assertNotNull(result);
+    }
+
+    /**
+     * Run the double getLocationRatio(ITmfLocation<?>) method test.
+     */
+    @Test
+    public void testGetLocationRatio() {
+        final CtfLocationInfo location2 = new CtfLocationInfo(1, 0);
+        CtfLocation location = new CtfLocation(location2);
+        double result = fixture.getLocationRatio(location);
+
+        assertEquals(Double.NEGATIVE_INFINITY, result, 0.1);
+    }
+
+    /**
+     * Run the String getName() method test.
+     */
+    @Test
+    public void testGetName() {
+        String result = fixture.getName();
+        assertNotNull(result);
+    }
+
+    /**
+     * Run the int getNbEnvVars() method test.
+     */
+    @Test
+    public void testGetNbEnvVars() {
+        int result = fixture.getTraceProperties().size();
+        assertEquals(8, result);
+    }
+
+    /**
+     * Run the long getNbEvents() method test.
+     */
+    @Test
+    public void testGetNbEvents() {
+        long result = fixture.getNbEvents();
+        assertEquals(1L, result);
+    }
+
+    /**
+     * Run the CtfTmfEvent getNext(ITmfContext) method test.
+     */
+    @Test
+    public void testGetNext() {
+        ITmfContext context = fixture.seekEvent(0);
+        CtfTmfEvent result = fixture.getNext(context);
+        assertNotNull(result);
+    }
+
+    /**
+     * Run the String getPath() method test.
+     */
+    @Test
+    public void testGetPath() {
+        String result = fixture.getPath();
+        assertNotNull(result);
+    }
+
+    /**
+     * Run the IResource getResource() method test.
+     */
+    @Test
+    public void testGetResource() {
+        IResource result = fixture.getResource();
+        assertNull(result);
+    }
+
+    /**
+     * Run the ITmfTimestamp getStartTime() method test.
+     */
+    @Test
+    public void testGetStartTime() {
+        ITmfTimestamp result = fixture.getStartTime();
+        assertNotNull(result);
+    }
+
+    /**
+     * Run the long getStreamingInterval() method test.
+     */
+    @Test
+    public void testGetStreamingInterval() {
+        long result = fixture.getStreamingInterval();
+        assertEquals(0L, result);
+    }
+
+    /**
+     * Run the TmfTimeRange getTimeRange() method test.
+     */
+    @Test
+    public void testGetTimeRange() {
+        TmfTimeRange result = fixture.getTimeRange();
+        assertNotNull(result);
+    }
+
+    /**
+     * Run the CtfTmfEvent readNextEvent(ITmfContext) method test.
+     */
+    @Test
+    public void testReadNextEvent() {
+        ITmfContext context = fixture.seekEvent(0);
+        CtfTmfEvent result = fixture.getNext(context);
+        assertNotNull(result);
+    }
+
+    /**
+     * Run the ITmfContext seekEvent(double) method test.
+     */
+    @Test
+    public void testSeekEvent_ratio() {
+        double ratio = 0.99;
+        ITmfContext result = fixture.seekEvent(ratio);
+        assertNotNull(result);
+    }
+
+    /**
+     * Run the ITmfContext seekEvent(long) method test.
+     */
+    @Test
+    public void testSeekEvent_rank() {
+        long rank = 1L;
+        ITmfContext result = fixture.seekEvent(rank);
+        assertNotNull(result);
+    }
+
+    /**
+     * Run the ITmfContext seekEvent(ITmfTimestamp) method test.
+     */
+    @Test
+    public void testSeekEvent_timestamp() {
+        ITmfTimestamp timestamp = new TmfTimestamp();
+        ITmfContext result = fixture.seekEvent(timestamp);
+        assertNotNull(result);
+    }
+
+    /**
+     * Run the ITmfContext seekEvent(ITmfLocation<?>) method test.
+     */
+    @Test
+    public void testSeekEvent_location() {
+        final CtfLocationInfo location2 = new CtfLocationInfo(1L, 0L);
+        CtfLocation ctfLocation = new CtfLocation(location2);
+        ITmfContext result = fixture.seekEvent(ctfLocation);
+        assertNotNull(result);
+    }
+
+    /**
+     * Run the boolean validate(IProject,String) method test.
+     */
+    @Test
+    public void testValidate() {
+        IProject project = null;
+        IStatus result = fixture.validate(project, testTrace.getPath());
+        assertTrue(result.isOK());
+    }
+
+    /**
+     * Run the boolean hasEvent(final String) method test
+     */
+    @Test
+    public void testEventLookup() {
+        assertTrue(fixture.hasEvent("sched_switch"));
+        assertFalse(fixture.hasEvent("Sched_switch"));
+        String[] events = { "sched_switch", "sched_wakeup", "timer_init" };
+        assertTrue(fixture.hasAllEvents(events));
+        assertTrue(fixture.hasAtLeastOneOfEvents(events));
+        String[] names = { "inexistent", "sched_switch", "SomeThing" };
+        assertTrue(fixture.hasAtLeastOneOfEvents(names));
+        assertFalse(fixture.hasAllEvents(names));
+    }
+
+    /**
+     * Run the String getHostId() method test
+     */
+    @Test
+    public void testCtfHostId() {
+        String a = fixture.getHostId();
+        assertEquals("\"84db105b-b3f4-4821-b662-efc51455106a\"", a);
+    }
+
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/EventContextTest.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/EventContextTest.java
new file mode 100644 (file)
index 0000000..0cfdb8f
--- /dev/null
@@ -0,0 +1,241 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assume.assumeTrue;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
+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.ctf.core.CtfTmfEvent;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTimestamp;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests for reading event contexts from a CtfTmfTrace.
+ *
+ * @author Alexandre Montplaisir
+ */
+public class EventContextTest {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    /* We use test trace #2, kernel_vm, which has event contexts */
+    private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL_VM;
+
+    private CtfTmfTrace fixture;
+    private long startTime;
+    private long endTime;
+
+    // ------------------------------------------------------------------------
+    // Class  methods
+    // ------------------------------------------------------------------------
+
+    /**
+     * Perform pre-class initialization.
+     *
+     * @throws TmfTraceException
+     *             If the test trace is not found
+     */
+    @Before
+    public void setUp() throws TmfTraceException {
+        assumeTrue(testTrace.exists());
+        fixture = new CtfTmfTrace();
+        fixture.initTrace((IResource) null, testTrace.getPath(), CtfTmfEvent.class);
+        fixture.indexTrace(true);
+
+        startTime = fixture.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+        endTime = fixture.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+    }
+
+    /**
+     * Perform post-class clean-up.
+     */
+    @After
+    public void tearDown() {
+        if (fixture != null) {
+            fixture.dispose();
+        }
+    }
+
+    // ------------------------------------------------------------------------
+    // Test methods
+    // ------------------------------------------------------------------------
+
+    /**
+     * Make sure the trace is the correct one, and its timestamps are read
+     * correctly.
+     */
+    @Test
+    public void testTrace() {
+        assertEquals(1363700740555978750L, startTime);
+        assertEquals(1363700770550261288L, endTime);
+    }
+
+    /**
+     * Test the context of the very first event of the trace.
+     */
+    @Test
+    public void testContextStart() {
+        CtfTmfEvent firstEvent = getEventAt(startTime);
+        long perfPageFault = (Long) firstEvent.getContent().getField("context._perf_page_fault").getValue();
+        String procname = (String) firstEvent.getContent().getField("context._procname").getValue();
+        long tid = (Long) firstEvent.getContent().getField("context._tid").getValue();
+
+        assertEquals(613, perfPageFault);
+        assertEquals("lttng-sessiond", procname);
+        assertEquals(1230, tid);
+    }
+
+    /**
+     * Test the context of the event at 1363700745.559739078.
+     */
+    @Test
+    public void testContext1() {
+        long time = startTime + 5000000000L; // 1363700745.559739078
+        CtfTmfEvent event = getEventAt(time);
+        long perfPageFault = (Long) event.getContent().getField("context._perf_page_fault").getValue();
+        String procname = (String) event.getContent().getField("context._procname").getValue();
+        long tid = (Long) event.getContent().getField("context._tid").getValue();
+
+        assertEquals(6048, perfPageFault);
+        assertEquals("swapper/0", procname);
+        assertEquals(0, tid);
+    }
+
+    /**
+     * Test the context of the event at 1363700750.559707062.
+     */
+    @Test
+    public void testContext2() {
+        long time = startTime + 2 * 5000000000L; // 1363700750.559707062
+        CtfTmfEvent event = getEventAt(time);
+        long perfPageFault = (Long) event.getContent().getField("context._perf_page_fault").getValue();
+        String procname = (String) event.getContent().getField("context._procname").getValue();
+        long tid = (Long) event.getContent().getField("context._tid").getValue();
+
+        assertEquals(13258, perfPageFault);
+        assertEquals("swapper/0", procname);
+        assertEquals(0, tid);
+    }
+
+    /**
+     * Test the context of the event at 1363700755.555723128, which is roughly
+     * mid-way through the trace.
+     */
+    @Test
+    public void testContextMiddle() {
+        long midTime = startTime + (endTime - startTime) / 2L; // 1363700755.555723128
+        CtfTmfEvent midEvent = getEventAt(midTime);
+        long perfPageFault = (Long) midEvent.getContent().getField("context._perf_page_fault").getValue();
+        String procname = (String) midEvent.getContent().getField("context._procname").getValue();
+        long tid = (Long) midEvent.getContent().getField("context._tid").getValue();
+
+        assertEquals(19438, perfPageFault);
+        assertEquals("swapper/0", procname);
+        assertEquals(0, tid);
+    }
+
+    /**
+     * Test the context of the event at 1363700760.559719724.
+     */
+    @Test
+    public void testContext3() {
+        long time = startTime + 4 * 5000000000L; // 1363700760.559719724
+        CtfTmfEvent event = getEventAt(time);
+        long perfPageFault = (Long) event.getContent().getField("context._perf_page_fault").getValue();
+        String procname = (String) event.getContent().getField("context._procname").getValue();
+        long tid = (Long) event.getContent().getField("context._tid").getValue();
+
+        assertEquals(21507, perfPageFault);
+        assertEquals("swapper/0", procname);
+        assertEquals(0, tid);
+    }
+
+    /**
+     * Test the context of the event at 1363700765.559714634.
+     */
+    @Test
+    public void testContext4() {
+        long time = startTime + 5 * 5000000000L; // 1363700765.559714634
+        CtfTmfEvent event = getEventAt(time);
+        long perfPageFault = (Long) event.getContent().getField("context._perf_page_fault").getValue();
+        String procname = (String) event.getContent().getField("context._procname").getValue();
+        long tid = (Long) event.getContent().getField("context._tid").getValue();
+
+        assertEquals(21507, perfPageFault);
+        assertEquals("swapper/0", procname);
+        assertEquals(0, tid);
+    }
+
+    /**
+     * Test the context of the last event of the trace.
+     */
+    @Test
+    public void testContextEnd() {
+        CtfTmfEvent lastEvent = getEventAt(endTime);
+        long perfPageFault = (Long) lastEvent.getContent().getField("context._perf_page_fault").getValue();
+        String procname = (String) lastEvent.getContent().getField("context._procname").getValue();
+        long tid = (Long) lastEvent.getContent().getField("context._tid").getValue();
+
+        assertEquals(22117, perfPageFault);
+        assertEquals("lttng-sessiond", procname);
+        assertEquals(1230, tid);
+    }
+
+    // ------------------------------------------------------------------------
+    // Private stuff
+    // ------------------------------------------------------------------------
+
+    private synchronized CtfTmfEvent getEventAt(long timestamp) {
+        EventContextTestRequest req = new EventContextTestRequest(timestamp);
+        fixture.sendRequest(req);
+        try {
+            req.waitForCompletion();
+        } catch (InterruptedException e) {
+            return null;
+        }
+        return req.getEvent();
+    }
+
+    private class EventContextTestRequest extends TmfEventRequest {
+
+        private CtfTmfEvent retEvent = null;
+
+        public EventContextTestRequest(long timestamp) {
+            super(CtfTmfEvent.class,
+                    new TmfTimeRange(new CtfTmfTimestamp(timestamp), TmfTimestamp.BIG_CRUNCH),
+                    0, 1, ExecutionType.FOREGROUND);
+        }
+
+        @Override
+        public void handleData(ITmfEvent event) {
+            retEvent = (CtfTmfEvent) event;
+        }
+
+        public CtfTmfEvent getEvent() {
+            return retEvent;
+        }
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/FunkyTraceTest.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/FunkyTraceTest.java
new file mode 100644 (file)
index 0000000..9303d64
--- /dev/null
@@ -0,0 +1,212 @@
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assume.assumeTrue;
+
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
+import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfEnumPair;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfEvent;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestRule;
+import org.junit.rules.Timeout;
+
+/**
+ * More advanced CTF tests using "funky_trace", a trace generated with the
+ * Babeltrace CTF writer API, which has lots of fun things like different
+ * integer/float sizes and non-standard struct alignments.
+ *
+ * @author Alexandre Montplaisir
+ */
+public class FunkyTraceTest {
+
+    /** Time-out tests after 20 seconds */
+    @Rule
+    public TestRule globalTimeout= new Timeout(20000);
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.FUNKY_TRACE;
+    private static final double DELTA = 0.0000001;
+
+    private CtfTmfTrace fTrace;
+
+    // ------------------------------------------------------------------------
+    // Setup
+    // ------------------------------------------------------------------------
+
+    /**
+     * Test setup
+     */
+    @Before
+    public void setup() {
+        assumeTrue(testTrace.exists());
+        fTrace = testTrace.getTrace();
+        fTrace.indexTrace(true);
+    }
+
+    /**
+     * Clean-up
+     */
+    @After
+    public void tearDown() {
+        if (fTrace != null) {
+            fTrace.dispose();
+        }
+    }
+
+    // ------------------------------------------------------------------------
+    // Test methods
+    // ------------------------------------------------------------------------
+
+    /**
+     * Verify the contents of the first event
+     */
+    @Test
+    public void testFirstEvent() {
+        CtfTmfEvent event = getEvent(0);
+        assertEquals("Simple Event", event.getType().getName());
+        assertEquals(1234567, event.getTimestamp().getValue());
+        assertEquals(42, ((Long) event.getContent().getField("integer_field").getValue()).intValue());
+        assertEquals(3.1415, ((Double) event.getContent().getField("float_field").getValue()).doubleValue(), DELTA);
+    }
+
+    /**
+     * Verify the contents of the second event (the first "spammy event")
+     */
+    @Test
+    public void testSecondEvent() {
+        CtfTmfEvent event = getEvent(1);
+        assertEquals("Spammy_Event", event.getType().getName());
+        assertEquals(1234568, event.getTimestamp().getValue());
+        assertEquals(0, ((Long) event.getContent().getField("field_1").getValue()).intValue());
+        assertEquals("This is a test", event.getContent().getField("a_string").getValue());
+    }
+
+    /**
+     * Verify the contents of the last "spammy event"
+     */
+    @Test
+    public void testSecondToLastEvent() {
+        CtfTmfEvent event = getEvent(100000);
+        assertEquals("Spammy_Event", event.getType().getName());
+        assertEquals(1334567, event.getTimestamp().getValue());
+        assertEquals(99999, ((Long) event.getContent().getField("field_1").getValue()).intValue());
+        assertEquals("This is a test", event.getContent().getField("a_string").getValue());
+    }
+
+    /**
+     * Verify the contents of the last, complex event
+     */
+    @Test
+    public void testLastEvent() {
+        /*
+         * Last event as seen in Babeltrace:
+         * [19:00:00.001334568] (+0.000000001) Complex Test Event: { }, {
+         *     uint_35 = 0xDDF00D,
+         *     int_16 = -12345,
+         *     complex_structure = {
+         *         variant_selector = ( INT16_TYPE : container = 1 ),
+         *         a_string = "Test string",
+         *         variant_value = { INT16_TYPE = -200 },
+         *         inner_structure = {
+         *             seq_len = 0xA,
+         *             a_sequence = [ [0] = 4, [1] = 3, [2] = 2, [3] = 1, [4] = 0, [5] = -1, [6] = -2, [7] = -3, [8] = -4, [9] = -5 ]
+         *         }
+         *     }
+         * }
+         */
+
+        CtfTmfEvent event = getEvent(100001);
+        assertEquals("Complex Test Event", event.getType().getName());
+        assertEquals(1334568, event.getTimestamp().getValue());
+        assertEquals(0xddf00d, ((Long) event.getContent().getField("uint_35").getValue()).intValue());
+        assertEquals(-12345, ((Long) event.getContent().getField("int_16").getValue()).intValue());
+
+        ITmfEventField[] complexStruct =
+                (ITmfEventField[]) event.getContent().getField("complex_structure").getValue();
+
+        assertEquals("variant_selector", complexStruct[0].getName());
+        CtfEnumPair variant1 = (CtfEnumPair) complexStruct[0].getValue();
+        assertEquals("INT16_TYPE", variant1.getStringValue());
+        assertEquals(Long.valueOf(1), variant1.getLongValue());
+
+        assertEquals("a_string", complexStruct[1].getName());
+        assertEquals("Test string", complexStruct[1].getValue());
+
+        assertEquals("variant_value", complexStruct[2].getName());
+        ITmfEventField variantField = (ITmfEventField) complexStruct[2].getValue();
+        assertEquals("INT16_TYPE", variantField.getName());
+        assertEquals(Long.valueOf(-200), variantField.getValue());
+
+        ITmfEventField[] innerStruct = (ITmfEventField[]) complexStruct[3].getValue();
+
+        assertEquals("seq_len", innerStruct[0].getName());
+        assertEquals(Long.valueOf(10), innerStruct[0].getValue());
+
+        assertEquals("a_sequence", innerStruct[1].getName());
+        long[] seqValues = (long[]) innerStruct[1].getValue();
+        long[] expectedValues = { 4, 3, 2, 1, 0, -1, -2, -3, -4, -5 };
+        assertArrayEquals(expectedValues, seqValues);
+    }
+
+    // ------------------------------------------------------------------------
+    // Private stuff
+    // ------------------------------------------------------------------------
+
+    private synchronized CtfTmfEvent getEvent(long index) {
+        TestEventRequest req = new TestEventRequest(index);
+        fTrace.sendRequest(req);
+        try {
+            req.waitForCompletion();
+        } catch (InterruptedException e) {
+            return null;
+        }
+        return req.getEvent();
+    }
+
+    private class TestEventRequest extends TmfEventRequest {
+
+        private CtfTmfEvent fRetEvent = null;
+
+        public TestEventRequest(long index) {
+            super(CtfTmfEvent.class,
+                    TmfTimeRange.ETERNITY,
+                    index,
+                    1,
+                    ExecutionType.FOREGROUND);
+        }
+
+        @Override
+        public void handleData(ITmfEvent event) {
+            fRetEvent = (CtfTmfEvent) event;
+        }
+
+        public CtfTmfEvent getEvent() {
+            return fRetEvent;
+        }
+    }
+
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/headless/Benchmark.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/headless/Benchmark.java
new file mode 100644 (file)
index 0000000..6dfa6ff
--- /dev/null
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests.headless;
+
+import java.util.Vector;
+
+import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfContext;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfEvent;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
+
+/**
+ * Test and benchmark reading a CTF LTTng kernel trace.
+ *
+ * @author Matthew Khouzam
+ */
+public class Benchmark {
+
+    /**
+     * Run the benchmark.
+     *
+     * @param args The command-line arguments
+     */
+    public static void main(final String[] args) {
+        final String TRACE_PATH = "testfiles/kernel";
+        final int NUM_LOOPS = 100;
+
+        // Change this to enable text output
+        final boolean USE_TEXT = true;
+
+        // Work variables
+        long nbEvent = 0L;
+        final Vector<Double> benchs = new Vector<>();
+        CtfTmfTrace trace = null;
+        long start, stop;
+        for (int loops = 0; loops < NUM_LOOPS; loops++) {
+            nbEvent = 0L;
+            trace = new CtfTmfTrace();
+            try {
+                trace.initTrace(null, TRACE_PATH, CtfTmfEvent.class);
+            } catch (final TmfTraceException e) {
+                loops = NUM_LOOPS +1;
+                break;
+            }
+
+            start = System.nanoTime();
+            if (nbEvent != -1) {
+                final CtfTmfContext traceReader = (CtfTmfContext) trace.seekEvent(0);
+
+                start = System.nanoTime();
+                CtfTmfEvent current = traceReader.getCurrentEvent();
+                while (current != null) {
+                    nbEvent++;
+                    if (USE_TEXT) {
+
+                        System.out.println("Event " + nbEvent + " Time "
+                                + current.getTimestamp().toString() + " type " + current.getType().getName()
+                                + " on CPU " + current.getSource() + " " + current.getContent().toString());
+                    }
+                    // advance the trace to the next event.
+                    boolean hasMore = traceReader.advance();
+                    if( hasMore ){
+                        // you can know the trace has more events.
+                    }
+                    current = traceReader.getCurrentEvent();
+                }
+            }
+            stop = System.nanoTime();
+            System.out.print('.');
+            final double time = (stop - start) / (double) nbEvent;
+            benchs.add(time);
+        }
+        System.out.println("");
+        double avg = 0;
+        for (final double val : benchs) {
+            avg += val;
+        }
+        avg /= benchs.size();
+        System.out.println("Time to read = " + avg + " events/ns");
+        for (final Double val : benchs) {
+            System.out.print(val);
+            System.out.print(", ");
+        }
+
+    }
+
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/headless/RequestBenchmark.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/headless/RequestBenchmark.java
new file mode 100644 (file)
index 0000000..7f063eb
--- /dev/null
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   William Bourque <wbourque@gmail.com> - Initial API and implementation
+ *   Matthew Khouzam - Update to CtfTmf trace and events
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests.headless;
+
+import java.util.Vector;
+
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfEvent;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
+
+/**
+ * Benchmark the event request subsystem of TMF.
+ */
+public class RequestBenchmark extends TmfEventRequest {
+
+    private RequestBenchmark(final Class<? extends ITmfEvent> dataType,
+            final TmfTimeRange range, final int nbRequested) {
+        super(dataType, range, 0, nbRequested, ExecutionType.FOREGROUND);
+    }
+
+    // Path of the trace
+    private static final String TRACE_PATH = "../org.eclipse.linuxtools.ctf.core.tests/traces/kernel";
+
+    // Change this to run several time over the same trace
+    private static final int NB_OF_PASS = 100;
+
+    // Work variables
+    private static int nbEvent = 0;
+    private static TmfExperiment fExperiment = null;
+    private static Vector<Double> benchs = new Vector<>();
+
+    /**
+     * Run the benchmark
+     *
+     * @param args
+     *            The command-line arguments
+     */
+    public static void main(final String[] args) {
+
+        try {
+            /* Our experiment will contains ONE trace */
+            final ITmfTrace[] traces = new ITmfTrace[1];
+            traces[0] = new CtfTmfTrace();
+            traces[0].initTrace(null, TRACE_PATH, CtfTmfEvent.class);
+            /* Create our new experiment */
+            fExperiment = new TmfExperiment(CtfTmfEvent.class, "Headless", traces);
+
+            /*
+             * We will issue a request for each "pass". TMF will then process
+             * them synchronously.
+             */
+            RequestBenchmark request = null;
+            for (int x = 0; x < NB_OF_PASS; x++) {
+                request = new RequestBenchmark(CtfTmfEvent.class,
+                        TmfTimeRange.ETERNITY, Integer.MAX_VALUE);
+                fExperiment.sendRequest(request);
+            }
+            prev = System.nanoTime();
+        } catch (final NullPointerException e) {
+            /*
+             * Silently dismiss Null pointer exception The only way to "finish"
+             * the threads in TMF is by crashing them with null.
+             */
+        } catch (final Exception e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    @Override
+    public void handleData(final ITmfEvent event) {
+        super.handleData(event);
+        nbEvent++;
+
+    }
+
+    static long prev;
+    static long done = 0;
+    @Override
+    public void handleCompleted() {
+        final long next = System.nanoTime();
+        double val = next - prev;
+        final int nbEvent2 = nbEvent;
+        val /= nbEvent2;
+
+        nbEvent = 0;
+        prev = next;
+        benchs.add(val);
+        if (benchs.size() == NB_OF_PASS) {
+            try {
+                System.out.println("Nb events : " + nbEvent2);
+
+                for (final double value : benchs) {
+                    System.out.print(value + ", ");
+                }
+                fExperiment.sendRequest(null);
+
+            } catch (final Exception e) {
+            }
+        }
+    }
+
+    @Override
+    public void handleSuccess() {
+    }
+
+    @Override
+    public void handleFailure() {
+    }
+
+    @Override
+    public void handleCancel() {
+    }
+
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/request/AllTests.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/request/AllTests.java
new file mode 100644 (file)
index 0000000..6fe21d2
--- /dev/null
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests.request;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    TmfSchedulerTest.class
+})
+public class AllTests {}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/request/TmfSchedulerBenchmark.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/request/TmfSchedulerBenchmark.java
new file mode 100644 (file)
index 0000000..cffdf1f
--- /dev/null
@@ -0,0 +1,360 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Simon Delisle - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests.request;
+
+import java.io.PrintWriter;
+
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
+import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+
+/**
+ * Benchmark for the request scheduler
+ *
+ * The benchmark has three tests. The first one is the latency (time between the
+ * creation of the request and the beginning of its execution). The second one
+ * is the average waiting time for a request. The last one is the total
+ * completion time.
+ */
+public class TmfSchedulerBenchmark {
+
+    // ------------------------------------------------------------------------
+    // Constants
+    // ------------------------------------------------------------------------
+
+    private static final int NUM_LOOPS = 10;
+    private static final int NANOSECONDS_IN_MILLISECONDS = 1000000;
+    private static final int NANOSECONDS_IN_SECONDS = 1000000000;
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    private static CtfTmfTrace trace = CtfTmfTestTrace.KERNEL.getTrace();
+    private static ForegroundRequest lastForegroundRequest = null;
+    private static BackgroundRequest lastBackgroundRequest = null;
+
+    private static PrintWriter pw = new PrintWriter(System.out, true);
+
+    /**
+     * Start the benchmark
+     *
+     * @param args
+     *            The command-line arguments
+     */
+    public static void main(final String[] args) {
+        trace.indexTrace(true);
+        pw.println("---------- Benchmark started ----------");
+        latencyBenchmark();
+        averageWaitingTime();
+        completedTime();
+        benchmarkResults();
+        trace.dispose();
+    }
+
+    private static void latencyBenchmark() {
+        long averageLatency = 0;
+
+        pw.println("----- Latency -----");
+        for (int i = 0; i < NUM_LOOPS; i++) {
+            try {
+                ForegroundRequest foreground1 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+                trace.sendRequest(foreground1);
+                foreground1.waitForCompletion();
+                averageLatency += foreground1.getLatency();
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        }
+        pw.println((averageLatency / NUM_LOOPS) / NANOSECONDS_IN_MILLISECONDS + " ms");
+    }
+
+    private static void averageWaitingTime() {
+        long averageWaitingBackground = 0;
+        long averageWaitingForeground1 = 0;
+        long averageWaitingForeground2 = 0;
+
+        pw.println("----- Average waiting time with 3 requests -----");
+        for (int i = 0; i < NUM_LOOPS; i++) {
+            ForegroundRequest foreground1 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+            ForegroundRequest foreground2 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+            BackgroundRequest background1 = new BackgroundRequest(TmfTimeRange.ETERNITY);
+            trace.sendRequest(background1);
+            trace.sendRequest(foreground1);
+            trace.sendRequest(foreground2);
+            try {
+                foreground1.waitForCompletion();
+                foreground2.waitForCompletion();
+                background1.waitForCompletion();
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+            averageWaitingBackground += background1.getAverageWaitingTime();
+            averageWaitingForeground1 += foreground1.getAverageWaitingTime();
+            averageWaitingForeground2 += foreground2.getAverageWaitingTime();
+        }
+        pw.print("-- Background : ");
+        pw.println((averageWaitingBackground / NUM_LOOPS) / NANOSECONDS_IN_MILLISECONDS + " ms");
+
+        pw.print("-- First foreground : ");
+        pw.println((averageWaitingForeground1 / NUM_LOOPS) / NANOSECONDS_IN_MILLISECONDS + " ms");
+
+        pw.print("-- Second foreground : ");
+        pw.println((averageWaitingForeground2 / NUM_LOOPS) / NANOSECONDS_IN_MILLISECONDS + " ms");
+    }
+
+    private static void completedTime() {
+        long averageCompletedTime1 = 0;
+        long averageCompletedTime2 = 0;
+        long averageCompletedTime3 = 0;
+        long averageCompletedTime4 = 0;
+        long averageCompletedTime5 = 0;
+        long averageCompletedTime6 = 0;
+
+        pw.println("----- Time to complete request -----");
+        for (int i = 0; i < NUM_LOOPS; i++) {
+            try {
+                ForegroundRequest foreground1 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+                trace.sendRequest(foreground1);
+                foreground1.waitForCompletion();
+                averageCompletedTime1 += foreground1.getCompletedTime();
+
+                ForegroundRequest foreground2 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+                ForegroundRequest foreground3 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+                trace.sendRequest(foreground2);
+                trace.sendRequest(foreground3);
+                foreground2.waitForCompletion();
+                foreground3.waitForCompletion();
+                averageCompletedTime2 += (foreground2.getCompletedTime() + foreground3.getCompletedTime());
+
+                ForegroundRequest foreground4 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+                BackgroundRequest background1 = new BackgroundRequest(TmfTimeRange.ETERNITY);
+                trace.sendRequest(foreground4);
+                trace.sendRequest(background1);
+                foreground4.waitForCompletion();
+                background1.waitForCompletion();
+                averageCompletedTime3 += (foreground4.getCompletedTime() + background1.getCompletedTime());
+
+                ForegroundRequest foreground5 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+                ForegroundRequest foreground6 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+                BackgroundRequest background2 = new BackgroundRequest(TmfTimeRange.ETERNITY);
+                trace.sendRequest(foreground5);
+                trace.sendRequest(foreground6);
+                trace.sendRequest(background2);
+                foreground5.waitForCompletion();
+                foreground6.waitForCompletion();
+                background2.waitForCompletion();
+                averageCompletedTime4 += (foreground5.getCompletedTime() + foreground6.getCompletedTime() + background2.getCompletedTime());
+
+                ForegroundRequest foreground7 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+                ForegroundRequest foreground8 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+                ForegroundRequest foreground9 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+                BackgroundRequest background3 = new BackgroundRequest(TmfTimeRange.ETERNITY);
+                trace.sendRequest(foreground7);
+                trace.sendRequest(foreground8);
+                trace.sendRequest(foreground9);
+                trace.sendRequest(background3);
+                foreground7.waitForCompletion();
+                foreground8.waitForCompletion();
+                foreground9.waitForCompletion();
+                background3.waitForCompletion();
+                averageCompletedTime5 += (foreground7.getCompletedTime() + foreground8.getCompletedTime() + foreground9.getCompletedTime() + background3.getCompletedTime());
+
+                ForegroundRequest foreground10 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+                ForegroundRequest foreground11 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+                ForegroundRequest foreground12 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+                ForegroundRequest foreground13 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+                BackgroundRequest background4 = new BackgroundRequest(TmfTimeRange.ETERNITY);
+                trace.sendRequest(foreground10);
+                trace.sendRequest(foreground11);
+                trace.sendRequest(foreground12);
+                trace.sendRequest(foreground13);
+                trace.sendRequest(background4);
+                foreground10.waitForCompletion();
+                foreground11.waitForCompletion();
+                foreground12.waitForCompletion();
+                foreground13.waitForCompletion();
+                background4.waitForCompletion();
+                averageCompletedTime6 += (foreground10.getCompletedTime() + foreground11.getCompletedTime() + foreground12.getCompletedTime() + foreground13.getCompletedTime() + background4.getCompletedTime());
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        }
+
+        pw.print("-- Time to complete one request : ");
+        pw.println((averageCompletedTime1 / NUM_LOOPS) / NANOSECONDS_IN_SECONDS + " s");
+
+        pw.print("-- Time to complete 2 requests (2 foreground) : ");
+        pw.println((averageCompletedTime2 / NUM_LOOPS) / NANOSECONDS_IN_SECONDS + " s");
+
+        pw.print("-- Time to complete 2 requests (1 foreground, 1 background) : ");
+        pw.println((averageCompletedTime3 / NUM_LOOPS) / NANOSECONDS_IN_SECONDS + " s");
+
+        pw.print("-- Time to complete 3 requests (2 foreground, 1 background) : ");
+        pw.println((averageCompletedTime4 / NUM_LOOPS) / NANOSECONDS_IN_SECONDS + " s");
+
+        pw.print("-- Time to complete 4 requests (3 foreground, 1 background) : ");
+        pw.println((averageCompletedTime5 / NUM_LOOPS) / NANOSECONDS_IN_SECONDS + " s");
+
+        pw.print("-- Time to complete 5 requests (4 foreground, 1 background) : ");
+        pw.println((averageCompletedTime6 / NUM_LOOPS) / NANOSECONDS_IN_SECONDS + " s");
+    }
+
+    /**
+     * The benchmark results
+     */
+    public static void benchmarkResults() {
+        pw.println("---------- Benchmark completed ----------");
+    }
+
+    // ------------------------------------------------------------------------
+    // Helper methods
+    // ------------------------------------------------------------------------
+
+    private static class BackgroundRequest extends TmfEventRequest {
+        private long startTime;
+        private long endTimeLatency = -1;
+        private long completedTime = 0;
+        private long waitingTimeStart = 0;
+        private long waitingTimeEnd = 0;
+        private long waitingTime = 0;
+        private int waitingCounter = 0;
+        private boolean isWaiting = false;
+
+        BackgroundRequest(TmfTimeRange timeRange) {
+            super(trace.getEventType(),
+                    timeRange,
+                    0,
+                    ITmfEventRequest.ALL_DATA,
+                    ExecutionType.BACKGROUND);
+            startTime = System.nanoTime();
+        }
+
+        @Override
+        public void handleData(final ITmfEvent event) {
+            if (endTimeLatency == -1) {
+                endTimeLatency = System.nanoTime();
+            }
+            super.handleData(event);
+            if (lastForegroundRequest == null && lastBackgroundRequest == null) {
+                lastBackgroundRequest = this;
+            }
+            if (isWaiting) {
+                waitingTimeEnd = System.nanoTime();
+                waitingTime += waitingTimeEnd - waitingTimeStart;
+                ++waitingCounter;
+                isWaiting = false;
+            }
+            if (lastForegroundRequest != null) {
+                lastForegroundRequest.waitingTimeStart = System.nanoTime();
+                lastForegroundRequest.isWaiting = true;
+                lastForegroundRequest = null;
+                lastBackgroundRequest = this;
+            }
+            if (lastBackgroundRequest != this) {
+                lastBackgroundRequest.waitingTimeStart = System.nanoTime();
+                lastBackgroundRequest.isWaiting = true;
+                lastBackgroundRequest = this;
+            }
+        }
+
+        @Override
+        public void handleCompleted() {
+            completedTime = System.nanoTime();
+            super.handleCompleted();
+        }
+
+        public long getCompletedTime() {
+            return completedTime - startTime;
+        }
+
+        public long getAverageWaitingTime() {
+            if (waitingCounter == 0) {
+                return 0;
+            }
+            return waitingTime / waitingCounter;
+        }
+    }
+
+    private static class ForegroundRequest extends TmfEventRequest {
+        private long startTime = 0;
+        private long endTimeLatency = -1;
+        private long completedTime = 0;
+        private long waitingTimeStart = 0;
+        private long waitingTimeEnd = 0;
+        private long waitingTime = 0;
+        private int waitingCounter = 0;
+        private boolean isWaiting = false;
+
+        ForegroundRequest(TmfTimeRange timeRange) {
+            super(trace.getEventType(),
+                    timeRange,
+                    0,
+                    ITmfEventRequest.ALL_DATA,
+                    ExecutionType.FOREGROUND);
+            startTime = System.nanoTime();
+        }
+
+        @Override
+        public void handleData(final ITmfEvent event) {
+            if (endTimeLatency == -1) {
+                endTimeLatency = System.nanoTime();
+            }
+            super.handleData(event);
+            if (lastBackgroundRequest == null && lastForegroundRequest == null) {
+                lastForegroundRequest = this;
+            }
+            if (isWaiting) {
+                waitingTimeEnd = System.nanoTime();
+                waitingTime += waitingTimeEnd - waitingTimeStart;
+                ++waitingCounter;
+                isWaiting = false;
+            }
+            if (lastBackgroundRequest != null) {
+                lastBackgroundRequest.waitingTimeStart = System.nanoTime();
+                lastBackgroundRequest.isWaiting = true;
+                lastBackgroundRequest = null;
+                lastForegroundRequest = this;
+            }
+            if (lastForegroundRequest != this) {
+                lastForegroundRequest.waitingTimeStart = System.nanoTime();
+                lastForegroundRequest.isWaiting = true;
+                lastForegroundRequest = this;
+            }
+        }
+
+        @Override
+        public void handleCompleted() {
+            completedTime = System.nanoTime();
+            super.handleCompleted();
+        }
+
+        public long getLatency() {
+            return endTimeLatency - startTime;
+        }
+
+        public long getCompletedTime() {
+            return completedTime - startTime;
+        }
+
+        public long getAverageWaitingTime() {
+            if (waitingCounter == 0) {
+                return 0;
+            }
+            return waitingTime / waitingCounter;
+        }
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/request/TmfSchedulerTest.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/request/TmfSchedulerTest.java
new file mode 100644 (file)
index 0000000..a86a62e
--- /dev/null
@@ -0,0 +1,451 @@
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Simon Delisle - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests.request;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
+import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
+import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;
+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.ctf.core.CtfTmfEvent;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestRule;
+import org.junit.rules.Timeout;
+
+/**
+ * Test suite for the scheduler.
+ */
+public class TmfSchedulerTest {
+
+    /** Time-out tests after 60 seconds */
+    @Rule
+    public TestRule globalTimeout= new Timeout(60000);
+
+    // ------------------------------------------------------------------------
+    // Constants
+    // ------------------------------------------------------------------------
+
+    private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
+    private static final int NB_EVENTS_TRACE = 695319;
+    private static final int NB_EVENTS_TIME_RANGE = 155133;
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    private CtfTmfTrace fixture;
+
+    private long fStartTime;
+    private long fEndTime;
+    private TmfTimeRange fForegroundTimeRange;
+
+    private final List<String> fOrderList = new ArrayList<>();
+    private int fForegroundId = 0;
+    private int fBackgroundId = 0;
+
+    /**
+     * Perform pre-test initialization.
+     *
+     * @throws TmfTraceException
+     *             If the test trace is not found
+     */
+    @Before
+    public void setUp() throws TmfTraceException {
+        assumeTrue(testTrace.exists());
+        fixture = new CtfTmfTrace();
+        fixture.initTrace((IResource) null, testTrace.getPath(), CtfTmfEvent.class);
+        fixture.indexTrace(true);
+        fStartTime = fixture.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+        fEndTime = fixture.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+
+        long foregroundStartTime = fStartTime + ((fEndTime - fStartTime) / 4);
+        long foregroundEndTime = fStartTime + ((fEndTime - fStartTime) / 2);
+        fForegroundTimeRange = new TmfTimeRange(new TmfTimestamp(foregroundStartTime, ITmfTimestamp.NANOSECOND_SCALE, 0), new TmfTimestamp(foregroundEndTime, ITmfTimestamp.NANOSECOND_SCALE, 0));
+    }
+
+    /**
+     * Perform post-test clean-up.
+     */
+    @After
+    public void tearDown() {
+        if (fixture != null) {
+            fixture.dispose();
+        }
+    }
+
+    // ------------------------------------------------------------------------
+    // Tests cases
+    // ------------------------------------------------------------------------
+
+    /**
+     * Test one background request
+     */
+    @Test
+    public void backgroundRequest() {
+        BackgroundRequest background = new BackgroundRequest(TmfTimeRange.ETERNITY);
+        fixture.sendRequest(background);
+        try {
+            background.waitForCompletion();
+        } catch (InterruptedException e) {
+            fail();
+        }
+        assertEquals(NB_EVENTS_TRACE, background.getNbEvents());
+    }
+
+    /**
+     * Test one foreground request
+     */
+    @Test
+    public void foregroundRequest() {
+        ForegroundRequest foreground = new ForegroundRequest(TmfTimeRange.ETERNITY);
+        fixture.sendRequest(foreground);
+        try {
+            foreground.waitForCompletion();
+        } catch (InterruptedException e) {
+            fail();
+        }
+        assertEquals(NB_EVENTS_TRACE, foreground.getNbEvents());
+    }
+
+    /**
+     * Test one foreground and one background request for the entire trace at
+     * the same time
+     */
+    @Test
+    public void TestMultiRequest1() {
+        BackgroundRequest background = new BackgroundRequest(TmfTimeRange.ETERNITY);
+        ForegroundRequest foreground = new ForegroundRequest(TmfTimeRange.ETERNITY);
+
+        fixture.sendRequest(background);
+        fixture.sendRequest(foreground);
+        try {
+            background.waitForCompletion();
+            foreground.waitForCompletion();
+        } catch (InterruptedException e) {
+            fail();
+        }
+
+        assertEquals(NB_EVENTS_TRACE, background.getNbEvents());
+        assertEquals(NB_EVENTS_TRACE, foreground.getNbEvents());
+    }
+
+    /**
+     * Test one background request for the entire trace and one foreground
+     * request for smaller time range
+     */
+    @Test
+    public void TestMultiRequest2() {
+        BackgroundRequest background2 = new BackgroundRequest(TmfTimeRange.ETERNITY);
+        ForegroundRequest foreground2 = new ForegroundRequest(fForegroundTimeRange);
+
+        fixture.sendRequest(background2);
+        fixture.sendRequest(foreground2);
+        try {
+            background2.waitForCompletion();
+            foreground2.waitForCompletion();
+        } catch (InterruptedException e) {
+            fail();
+        }
+
+        assertEquals(NB_EVENTS_TRACE, background2.getNbEvents());
+        assertEquals(NB_EVENTS_TIME_RANGE, foreground2.getNbEvents());
+    }
+
+    /**
+     * Test two foreground request, one to select a time range and one to select
+     * an event in this time range
+     */
+    @Test
+    public void TestMultiRequest3() {
+        ForegroundRequest foreground3 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+        fixture.sendRequest(foreground3);
+
+        TmfTimeSynchSignal signal3 = new TmfTimeSynchSignal(this, new TmfTimestamp(fForegroundTimeRange.getStartTime()));
+        fixture.broadcast(signal3);
+
+        try {
+            foreground3.waitForCompletion();
+        } catch (InterruptedException e) {
+            fail();
+        }
+
+        assertEquals(NB_EVENTS_TRACE, foreground3.getNbEvents());
+    }
+
+    /**
+     * Test two foreground request, one to select a time range and one to select
+     * an event before this time range
+     */
+    @Test
+    public void TestMultiRequest4() {
+        ForegroundRequest foreground4 = new ForegroundRequest(fForegroundTimeRange);
+        fixture.sendRequest(foreground4);
+        TmfTimeSynchSignal signal4 = new TmfTimeSynchSignal(this, new TmfTimestamp(fStartTime + ((fEndTime - fStartTime) / 8)));
+        fixture.broadcast(signal4);
+
+        try {
+            foreground4.waitForCompletion();
+        } catch (InterruptedException e) {
+            fail();
+        }
+
+        assertEquals(NB_EVENTS_TIME_RANGE, foreground4.getNbEvents());
+    }
+
+    /**
+     * Test two foreground request, one to select a time range and one to select
+     * an event after this time range
+     */
+    @Test
+    public void TestMultiRequest5() {
+        ForegroundRequest foreground5 = new ForegroundRequest(fForegroundTimeRange);
+        fixture.sendRequest(foreground5);
+        TmfTimeSynchSignal signal5 = new TmfTimeSynchSignal(this, new TmfTimestamp(fEndTime - ((fEndTime - fStartTime) / 4)));
+        fixture.broadcast(signal5);
+
+        try {
+            foreground5.waitForCompletion();
+        } catch (InterruptedException e) {
+            fail();
+        }
+
+        assertEquals(NB_EVENTS_TIME_RANGE, foreground5.getNbEvents());
+    }
+
+    /**
+     * Test one background and one foreground request for the entire trace and
+     * one foreground request to select an event
+     */
+    @Test
+    public void TestMultiRequest6() {
+        BackgroundRequest background6 = new BackgroundRequest(TmfTimeRange.ETERNITY);
+        ForegroundRequest foreground6 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+
+        fixture.sendRequest(background6);
+        fixture.sendRequest(foreground6);
+
+        TmfTimeSynchSignal signal6 = new TmfTimeSynchSignal(this, new TmfTimestamp(fStartTime + ((fEndTime - fStartTime) / 8)));
+        fixture.broadcast(signal6);
+
+        try {
+            background6.waitForCompletion();
+            foreground6.waitForCompletion();
+        } catch (InterruptedException e) {
+            fail();
+        }
+
+        assertEquals(NB_EVENTS_TRACE, background6.getNbEvents());
+        assertEquals(NB_EVENTS_TRACE, foreground6.getNbEvents());
+    }
+
+    /**
+     * Four request, two foreground and two background
+     */
+    @Test
+    public void TestMultiRequest7() {
+        ForegroundRequest foreground7 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+        ForegroundRequest foreground8 = new ForegroundRequest(fForegroundTimeRange);
+        BackgroundRequest background7 = new BackgroundRequest(TmfTimeRange.ETERNITY);
+        BackgroundRequest background8 = new BackgroundRequest(TmfTimeRange.ETERNITY);
+        fixture.sendRequest(foreground7);
+        fixture.sendRequest(foreground8);
+        fixture.sendRequest(background7);
+        fixture.sendRequest(background8);
+        try {
+            foreground7.waitForCompletion();
+            foreground8.waitForCompletion();
+            background7.waitForCompletion();
+            background8.waitForCompletion();
+        } catch (InterruptedException e) {
+            fail();
+        }
+        assertEquals(NB_EVENTS_TRACE, foreground7.getNbEvents());
+        assertEquals(NB_EVENTS_TIME_RANGE, foreground8.getNbEvents());
+        assertEquals(NB_EVENTS_TRACE, background7.getNbEvents());
+        assertEquals(NB_EVENTS_TRACE, background8.getNbEvents());
+    }
+
+    /**
+     * One long foreground request and one short foreground request, the short
+     * one should finish first
+     */
+    @Test
+    public void preemptedForegroundRequest() {
+        ForegroundRequest foreground9 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+        TmfTimeRange shortTimeRange = new TmfTimeRange(new TmfTimestamp(fStartTime, ITmfTimestamp.NANOSECOND_SCALE, 0), new TmfTimestamp(fStartTime + ((fEndTime - fStartTime) / 16), ITmfTimestamp.NANOSECOND_SCALE, 0));
+        ForegroundRequest shortForeground = new ForegroundRequest(shortTimeRange);
+        fixture.sendRequest(foreground9);
+        try {
+            foreground9.waitForStart();
+        } catch (InterruptedException e) {
+            fail();
+        }
+        fixture.sendRequest(shortForeground);
+        try {
+            shortForeground.waitForCompletion();
+        } catch (InterruptedException e) {
+            fail();
+        }
+        assertFalse(foreground9.isCompleted());
+    }
+
+    /**
+     * One long background request and one short foreground request, the
+     * foreground request should finish first
+     */
+    @Test
+    public void preemptedBackgroundRequest() {
+        BackgroundRequest background9 = new BackgroundRequest(TmfTimeRange.ETERNITY);
+        ForegroundRequest foreground10 = new ForegroundRequest(fForegroundTimeRange);
+        fixture.sendRequest(background9);
+        fixture.sendRequest(foreground10);
+        try {
+            foreground10.waitForCompletion();
+        } catch (InterruptedException e) {
+            fail();
+        }
+        assertTrue(foreground10.isCompleted());
+        assertFalse(background9.isCompleted());
+    }
+
+    /**
+     * Test if the scheduler is working as expected
+     */
+    @Ignore
+    @Test
+    public void executionOrder() {
+        List<String> expectedOrder = new LinkedList<>();
+        expectedOrder.add("FOREGROUND1");
+        expectedOrder.add("FOREGROUND2");
+        expectedOrder.add("FOREGROUND3");
+        expectedOrder.add("FOREGROUND4");
+        expectedOrder.add("BACKGROUND1");
+        expectedOrder.add("FOREGROUND1");
+        expectedOrder.add("FOREGROUND2");
+        expectedOrder.add("FOREGROUND3");
+        expectedOrder.add("FOREGROUND4");
+        expectedOrder.add("BACKGROUND2");
+
+        fOrderList.clear();
+        fForegroundId = 0;
+        fBackgroundId = 0;
+
+        BackgroundRequest background1 = new BackgroundRequest(TmfTimeRange.ETERNITY);
+        BackgroundRequest background2 = new BackgroundRequest(TmfTimeRange.ETERNITY);
+
+        ForegroundRequest foreground1 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+        ForegroundRequest foreground2 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+        ForegroundRequest foreground3 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+        ForegroundRequest foreground4 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+
+        fixture.sendRequest(foreground1);
+        fixture.sendRequest(foreground2);
+        fixture.sendRequest(foreground3);
+        fixture.sendRequest(foreground4);
+        fixture.sendRequest(background1);
+        fixture.sendRequest(background2);
+        try {
+            foreground1.waitForCompletion();
+            foreground2.waitForCompletion();
+            foreground3.waitForCompletion();
+            foreground4.waitForCompletion();
+            background1.waitForCompletion();
+            background2.waitForCompletion();
+        } catch (InterruptedException e) {
+            fail();
+        }
+        assertEquals(expectedOrder, fOrderList.subList(0, expectedOrder.size()));
+    }
+
+    // ------------------------------------------------------------------------
+    // Helper methods
+    // ------------------------------------------------------------------------
+
+    private class BackgroundRequest extends TmfEventRequest {
+        private int nbEvents = 0;
+        private String backgroundName;
+
+        BackgroundRequest(TmfTimeRange timeRange) {
+            super(fixture.getEventType(),
+                    timeRange,
+                    0,
+                    ITmfEventRequest.ALL_DATA,
+                    ExecutionType.BACKGROUND);
+            backgroundName = getExecType().toString() + ++fBackgroundId;
+        }
+
+        @Override
+        public void handleData(final ITmfEvent event) {
+            super.handleData(event);
+            synchronized (fOrderList) {
+                if (fOrderList.isEmpty() || !fOrderList.get(fOrderList.size() - 1).equals(backgroundName)) {
+                    fOrderList.add(backgroundName);
+                }
+            }
+            ++nbEvents;
+        }
+
+        public int getNbEvents() {
+            return nbEvents;
+        }
+    }
+
+    private class ForegroundRequest extends TmfEventRequest {
+        private int nbEvents = 0;
+        private String foregroundName;
+
+        ForegroundRequest(TmfTimeRange timeRange) {
+            super(fixture.getEventType(),
+                    timeRange,
+                    0,
+                    ITmfEventRequest.ALL_DATA,
+                    ExecutionType.FOREGROUND);
+            foregroundName = getExecType().toString() + ++fForegroundId;
+        }
+
+        @Override
+        public void handleData(final ITmfEvent event) {
+            super.handleData(event);
+            synchronized (fOrderList) {
+                if (fOrderList.isEmpty() || !fOrderList.get(fOrderList.size() - 1).equals(foregroundName)) {
+                    fOrderList.add(foregroundName);
+                }
+            }
+            ++nbEvents;
+        }
+
+        public int getNbEvents() {
+            return nbEvents;
+        }
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/statistics/AllTests.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/statistics/AllTests.java
new file mode 100644 (file)
index 0000000..11721ed
--- /dev/null
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Alexandre Montplaisir - Initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests.statistics;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    TmfEventsStatisticsTest.class,
+    TmfStateStatisticsTest.class
+})
+public class AllTests {}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/statistics/TmfEventsStatisticsTest.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/statistics/TmfEventsStatisticsTest.java
new file mode 100644 (file)
index 0000000..18d475b
--- /dev/null
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Alexandre Montplaisir - Initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests.statistics;
+
+import static org.junit.Assume.assumeTrue;
+
+import org.eclipse.linuxtools.tmf.core.statistics.TmfEventsStatistics;
+import org.junit.BeforeClass;
+
+/**
+ * Unit tests for the {@link TmfEventsStatistics}
+ *
+ * @author Alexandre Montplaisir
+ */
+public class TmfEventsStatisticsTest extends TmfStatisticsTest {
+
+    /**
+     * Set up the fixture once for all tests.
+     */
+    @BeforeClass
+    public static void setUpClass() {
+        assumeTrue(testTrace.exists());
+        backend = new TmfEventsStatistics(testTrace.getTrace());
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/statistics/TmfStateStatisticsTest.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/statistics/TmfStateStatisticsTest.java
new file mode 100644 (file)
index 0000000..df76a34
--- /dev/null
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Alexandre Montplaisir - Initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests.statistics;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
+
+import org.eclipse.linuxtools.tmf.core.exceptions.TmfAnalysisException;
+import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
+import org.eclipse.linuxtools.tmf.core.statistics.TmfStateStatistics;
+import org.eclipse.linuxtools.tmf.core.statistics.TmfStatisticsEventTypesModule;
+import org.eclipse.linuxtools.tmf.core.statistics.TmfStatisticsTotalsModule;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+
+/**
+ * Unit tests for the {@link TmfStateStatistics}
+ *
+ * @author Alexandre Montplaisir
+ */
+public class TmfStateStatisticsTest extends TmfStatisticsTest {
+
+    private ITmfTrace fTrace;
+
+    /**
+     * Class setup
+     */
+    @BeforeClass
+    public static void setUpClass() {
+        assumeTrue(testTrace.exists());
+    }
+
+    /**
+     * Test setup
+     */
+    @Before
+    public void setUp() {
+        fTrace = testTrace.getTrace();
+
+        /* Prepare the two analysis-backed state systems */
+        TmfStatisticsTotalsModule totalsMod = new TmfStatisticsTotalsModule();
+        TmfStatisticsEventTypesModule eventTypesMod = new TmfStatisticsEventTypesModule();
+        try {
+            totalsMod.setTrace(fTrace);
+            eventTypesMod.setTrace(fTrace);
+        } catch (TmfAnalysisException e) {
+            fail();
+        }
+
+        totalsMod.schedule();
+        eventTypesMod.schedule();
+        assertTrue(totalsMod.waitForCompletion());
+        assertTrue(eventTypesMod.waitForCompletion());
+
+        ITmfStateSystem totalsSS = totalsMod.getStateSystem();
+        ITmfStateSystem eventTypesSS = eventTypesMod.getStateSystem();
+        assertNotNull(totalsSS);
+        assertNotNull(eventTypesSS);
+
+        backend = new TmfStateStatistics(totalsSS, eventTypesSS);
+    }
+
+    /**
+     * Test cleanup
+     */
+    @After
+    public void tearDown() {
+        fTrace.dispose();
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/statistics/TmfStatisticsTest.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/statistics/TmfStatisticsTest.java
new file mode 100644 (file)
index 0000000..97aa9bd
--- /dev/null
@@ -0,0 +1,364 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Alexandre Montplaisir - Initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests.statistics;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.linuxtools.tmf.core.statistics.ITmfStatistics;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestRule;
+import org.junit.rules.Timeout;
+
+/**
+ * Base unit test class for any type of ITmfStatistics. Sub-classes should
+ * implement a "@BeforeClass" method to setup the 'backend' fixture accordingly.
+ *
+ * @author Alexandre Montplaisir
+ */
+public abstract class TmfStatisticsTest {
+
+    /** Time-out tests after 30 seconds */
+    @Rule public TestRule globalTimeout= new Timeout(30000);
+
+    /** Test trace used for these tests */
+    protected static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
+
+    /** The statistics back-end object */
+    protected static ITmfStatistics backend;
+
+    /* Known values about the trace */
+    private static final int totalNbEvents = 695319;
+    private static final long tStart = 1332170682440133097L; /* Timestamp of first event */
+    private static final long tEnd   = 1332170692664579801L; /* Timestamp of last event */
+
+    /* Timestamps of interest */
+    private static final long t1 = 1332170682490946000L;
+    private static final long t2 = 1332170682490947524L; /* event exactly here */
+    private static final long t3 = 1332170682490948000L;
+    private static final long t4 = 1332170682490949000L;
+    private static final long t5 = 1332170682490949270L; /* following event here */
+    private static final long t6 = 1332170682490949300L;
+
+    private static final String eventType = "lttng_statedump_process_state";
+
+
+    // ------------------------------------------------------------------------
+    // Tests for histogramQuery()
+    // ------------------------------------------------------------------------
+
+    /**
+     * Test the {@link ITmfStatistics#histogramQuery} method for the small known
+     * interval.
+     */
+    @Test
+    public void testHistogramQuerySmall() {
+        final int NB_REQ = 10;
+        List<Long> results = backend.histogramQuery(t1, t6, NB_REQ);
+
+        /* Make sure the returned array has the right size */
+        assertEquals(NB_REQ, results.size());
+
+        /* Check the contents of each "bucket" */
+        assertEquals(0, results.get(0).longValue());
+        assertEquals(0, results.get(1).longValue());
+        assertEquals(0, results.get(2).longValue());
+        assertEquals(0, results.get(3).longValue());
+        assertEquals(1, results.get(4).longValue());
+        assertEquals(0, results.get(5).longValue());
+        assertEquals(0, results.get(6).longValue());
+        assertEquals(0, results.get(7).longValue());
+        assertEquals(0, results.get(8).longValue());
+        assertEquals(1, results.get(9).longValue());
+
+    }
+
+    /**
+     * Test the {@link ITmfStatistics#histogramQuery} method over the whole
+     * trace.
+     */
+    @Test
+    public void testHistogramQueryFull() {
+        final int NB_REQ = 10;
+        List<Long> results = backend.histogramQuery(tStart, tEnd, NB_REQ);
+
+        /* Make sure the returned array has the right size */
+        assertEquals(NB_REQ, results.size());
+
+        /* Check the total number of events */
+        long count = 0;
+        for (long val : results) {
+            count += val;
+        }
+        assertEquals(totalNbEvents, count);
+
+        /* Check the contents of each "bucket" */
+        assertEquals(94161, results.get(0).longValue());
+        assertEquals(87348, results.get(1).longValue());
+        assertEquals(58941, results.get(2).longValue());
+        assertEquals(59879, results.get(3).longValue());
+        assertEquals(66941, results.get(4).longValue());
+        assertEquals(68939, results.get(5).longValue());
+        assertEquals(72746, results.get(6).longValue());
+        assertEquals(60749, results.get(7).longValue());
+        assertEquals(61208, results.get(8).longValue());
+        assertEquals(64407, results.get(9).longValue());
+    }
+
+    // ------------------------------------------------------------------------
+    // Test for getEventsTotal()
+    // ------------------------------------------------------------------------
+
+    /**
+     * Basic test for {@link ITmfStatistics#getEventsTotal}
+     */
+    @Test
+    public void testGetEventsTotal() {
+        long count = backend.getEventsTotal();
+        assertEquals(totalNbEvents, count);
+    }
+
+    // ------------------------------------------------------------------------
+    // Test for getEventTypesTotal()
+    // ------------------------------------------------------------------------
+
+    /**
+     * Basic test for {@link ITmfStatistics#getEventTypesTotal}
+     */
+    @Test
+    public void testEventTypesTotal() {
+        Map<String, Long> res = backend.getEventTypesTotal();
+        assertEquals(126, res.size()); /* Number of different event types in the trace */
+
+        long count = sumOfEvents(res);
+        assertEquals(totalNbEvents, count);
+    }
+
+    // ------------------------------------------------------------------------
+    // Tests for getEventsInRange(ITmfTimestamp start, ITmfTimestamp end)
+    // ------------------------------------------------------------------------
+
+    /**
+     * Test for {@link ITmfStatistics#getEventsInRange} over the whole trace.
+     */
+    @Test
+    public void testGetEventsInRangeWholeRange() {
+        long count = backend.getEventsInRange(tStart, tEnd);
+        assertEquals(totalNbEvents, count);
+    }
+
+    /**
+     * Test for {@link ITmfStatistics#getEventsInRange} for the whole range,
+     * except the start time (there is only one event at the start time).
+     */
+    @Test
+    public void testGetEventsInRangeMinusStart() {
+        long count = backend.getEventsInRange(tStart + 1, tEnd);
+        assertEquals(totalNbEvents - 1, count);
+    }
+
+    /**
+     * Test for {@link ITmfStatistics#getEventsInRange} for the whole range,
+     * except the end time (there is only one event at the end time).
+     */
+    @Test
+    public void testGetEventsInRangeMinusEnd() {
+        long count = backend.getEventsInRange(tStart, tEnd - 1);
+        assertEquals(totalNbEvents - 1, count);
+    }
+
+    /**
+     * Test for {@link ITmfStatistics#getEventsInRange} when both the start and
+     * end times don't match an event.
+     */
+    @Test
+    public void testGetEventsInRangeNoEventsAtEdges() {
+        long count = backend.getEventsInRange(t1, t6);
+        assertEquals(2, count);
+    }
+
+    /**
+     * Test for {@link ITmfStatistics#getEventsInRange} when the *start* of the
+     * interval is exactly on an event (that event should be included).
+     */
+    @Test
+    public void testGetEventsInRangeEventAtStart() {
+        long count = backend.getEventsInRange(t2, t3);
+        assertEquals(1, count);
+
+        count = backend.getEventsInRange(t2, t6);
+        assertEquals(2, count);
+    }
+
+    /**
+     * Test for {@link ITmfStatistics#getEventsInRange} when the *end* of the
+     * interval is exactly on an event (that event should be included).
+     */
+    @Test
+    public void testGetEventsInRangeEventAtEnd() {
+        long count = backend.getEventsInRange(t4, t5);
+        assertEquals(1, count);
+
+        count = backend.getEventsInRange(t1, t5);
+        assertEquals(2, count);
+    }
+
+    /**
+     * Test for {@link ITmfStatistics#getEventsInRange} when there are events
+     * matching exactly both the start and end times of the range (both should
+     * be included).
+     */
+    @Test
+    public void testGetEventsInRangeEventAtBoth() {
+        long count = backend.getEventsInRange(t2, t5);
+        assertEquals(2, count);
+    }
+
+    /**
+     * Test for {@link ITmfStatistics#getEventsInRange} when there are no events
+     * in a given range.
+     */
+    @Test
+    public void testGetEventsInRangeNoEvents() {
+        long count = backend.getEventsInRange(t3, t4);
+        assertEquals(0, count);
+    }
+
+    // ------------------------------------------------------------------------
+    // Tests for getEventTypesInRange(ITmfTimestamp start, ITmfTimestamp end)
+    // ------------------------------------------------------------------------
+
+    /**
+     * Test for {@link ITmfStatistics#getEventTypesInRange} over the whole trace.
+     */
+    @Test
+    public void testGetEventTypesInRangeWholeRange() {
+        Map<String, Long> result = backend.getEventTypesInRange(tStart, tEnd);
+        /* Number of events of that type in the whole trace */
+        assertEquals(new Long(464L), result.get(eventType));
+
+        long count = sumOfEvents(result);
+        assertEquals(totalNbEvents, count);
+    }
+
+    /**
+     * Test for {@link ITmfStatistics#getEventTypesInRange} for the whole range,
+     * except the start time (there is only one event at the start time).
+     */
+    @Test
+    public void testGetEventTypesInRangeMinusStart() {
+        Map<String, Long> result = backend.getEventTypesInRange(tStart + 1, tEnd);
+
+        long count = sumOfEvents(result);
+        assertEquals(totalNbEvents - 1, count);
+    }
+
+    /**
+     * Test for {@link ITmfStatistics#getEventTypesInRange} for the whole range,
+     * except the end time (there is only one event at the end time).
+     */
+    @Test
+    public void testGetEventTypesInRangeMinusEnd() {
+        Map<String, Long> result = backend.getEventTypesInRange(tStart, tEnd - 1);
+
+        long count = sumOfEvents(result);
+        assertEquals(totalNbEvents - 1, count);
+    }
+
+    /**
+     * Test for {@link ITmfStatistics#getEventTypesInRange} when both the start
+     * and end times don't match an event.
+     */
+    @Test
+    public void testGetEventTypesInRangeNoEventsAtEdges() {
+        Map<String, Long> result = backend.getEventTypesInRange(t1, t6);
+        assertEquals(new Long(2L), result.get(eventType));
+
+        long count = sumOfEvents(result);
+        assertEquals(2, count);
+    }
+
+    /**
+     * Test for {@link ITmfStatistics#getEventTypesInRange} when the *start* of
+     * the interval is exactly on an event (that event should be included).
+     */
+    @Test
+    public void testGetEventTypesInRangeEventAtStart() {
+        Map<String, Long> result = backend.getEventTypesInRange(t2, t3);
+        assertEquals(new Long(1L), result.get(eventType));
+        long count = sumOfEvents(result);
+        assertEquals(1, count);
+
+        result = backend.getEventTypesInRange(t2, t6);
+        assertEquals(new Long(2L), result.get(eventType));
+        count = sumOfEvents(result);
+        assertEquals(2, count);
+    }
+
+    /**
+     * Test for {@link ITmfStatistics#getEventTypesInRange} when the *end* of
+     * the interval is exactly on an event (that event should be included).
+     */
+    @Test
+    public void testGetEventTypesInRangeEventAtEnd() {
+        Map<String, Long> result = backend.getEventTypesInRange(t4, t5);
+        assertEquals(new Long(1L), result.get(eventType));
+        long count = sumOfEvents(result);
+        assertEquals(1, count);
+
+        result = backend.getEventTypesInRange(t1, t5);
+        assertEquals(new Long(2L), result.get(eventType));
+        count = sumOfEvents(result);
+        assertEquals(2, count);
+    }
+
+    /**
+     * Test for {@link ITmfStatistics#getEventTypesInRange} when there are
+     * events matching exactly both the start and end times of the range (both
+     * should be included).
+     */
+    @Test
+    public void testGetEventTypesInRangeEventAtBoth() {
+        Map<String, Long> result = backend.getEventTypesInRange(t2, t5);
+        assertEquals(new Long(2L), result.get(eventType));
+        long count = sumOfEvents(result);
+        assertEquals(2, count);
+    }
+
+    /**
+     * Test for {@link ITmfStatistics#getEventTypesInRange} when there are no
+     * events in a given range.
+     */
+    @Test
+    public void testGetEventTypesInRangeNoEvents() {
+        Map<String, Long> result = backend.getEventTypesInRange(t3, t4);
+        long count = sumOfEvents(result);
+        assertEquals(0, count);
+    }
+
+    // ------------------------------------------------------------------------
+    // Convenience methods
+    // ------------------------------------------------------------------------
+
+    private static long sumOfEvents(Map<String, Long> map) {
+        long count = 0;
+        for (long val : map.values()) {
+            count += val;
+        }
+        return count;
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/tracemanager/AllTests.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/tracemanager/AllTests.java
new file mode 100644 (file)
index 0000000..e0831e5
--- /dev/null
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests.tracemanager;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    TmfTraceManagerTest.class
+})
+public class AllTests {}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/tracemanager/TmfTraceManagerTest.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/src/org/eclipse/linuxtools/tmf/ctf/core/tests/tracemanager/TmfTraceManagerTest.java
new file mode 100644 (file)
index 0000000..0cc1b90
--- /dev/null
@@ -0,0 +1,692 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Alexandre Montplaisir - Initial API and implementation
+ *   Patrick Tasse - Support selection range
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests.tracemanager;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assume.assumeTrue;
+
+import java.io.File;
+
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+import org.eclipse.linuxtools.tmf.core.signal.TmfRangeSynchSignal;
+import org.eclipse.linuxtools.tmf.core.signal.TmfSignalManager;
+import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;
+import org.eclipse.linuxtools.tmf.core.signal.TmfTraceClosedSignal;
+import org.eclipse.linuxtools.tmf.core.signal.TmfTraceOpenedSignal;
+import org.eclipse.linuxtools.tmf.core.signal.TmfTraceSelectedSignal;
+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.ITmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
+import org.eclipse.linuxtools.tmf.core.trace.TmfTraceManager;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Test suite for the {@link TmfTraceManager}.
+ *
+ * @author Alexandre Montplaisir
+ */
+public class TmfTraceManagerTest {
+
+    private static final int SCALE = ITmfTimestamp.NANOSECOND_SCALE;
+
+    private static ITmfTrace trace1;
+    private static final long t1start = 1331668247314038062L;
+    private static final long t1end =   1331668259054285979L;
+
+    private static ITmfTrace trace2;
+    private static final long t2start = 1332170682440133097L;
+    private static final long t2end =   1332170692664579801L;
+
+    private static final long ONE_SECOND = 1000000000L;
+
+    private TmfTraceManager tm;
+
+
+    /**
+     * Test class initialization
+     */
+    @BeforeClass
+    public static void setUpClass() {
+        assumeTrue(CtfTmfTestTrace.TRACE2.exists());
+        assumeTrue(CtfTmfTestTrace.KERNEL.exists());
+        trace1 = CtfTmfTestTrace.TRACE2.getTrace();
+        trace2 = CtfTmfTestTrace.KERNEL.getTrace();
+
+        trace1.indexTrace(true);
+        trace2.indexTrace(true);
+
+        // Deregister traces from signal manager so that they don't
+        // interfere with the TmfTraceManager tests
+        TmfSignalManager.deregister(trace1);
+        TmfSignalManager.deregister(trace2);
+    }
+
+    /**
+     * Test initialization
+     */
+    @Before
+    public void setUp() {
+        tm = TmfTraceManager.getInstance();
+    }
+
+    /**
+     * Test clean-up
+     */
+    @After
+    public void tearDown() {
+        while (tm.getActiveTrace() != null) {
+            closeTrace(tm.getActiveTrace());
+        }
+    }
+
+    /**
+     * Test class clean-up
+     */
+    @AfterClass
+    public static void tearDownClass() {
+        CtfTmfTestTrace.TRACE2.dispose();
+        CtfTmfTestTrace.KERNEL.dispose();
+    }
+
+    // ------------------------------------------------------------------------
+    // Dummy actions (fake signals)
+    // ------------------------------------------------------------------------
+
+    private void openTrace(ITmfTrace trace) {
+        TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(this, trace, null));
+        selectTrace(trace);
+    }
+
+    private void closeTrace(ITmfTrace trace) {
+        TmfSignalManager.dispatchSignal(new TmfTraceClosedSignal(this, trace));
+        /*
+         * In TMF, the next tab would now be selected (if there are some), which
+         * would select another trace automatically.
+         */
+        if (tm.getOpenedTraces().size() > 0) {
+            selectTrace(tm.getOpenedTraces().toArray(new ITmfTrace[0])[0]);
+        }
+    }
+
+    private void selectTrace(ITmfTrace trace) {
+        TmfSignalManager.dispatchSignal(new TmfTraceSelectedSignal(this, trace));
+    }
+
+    private void selectTimestamp(ITmfTimestamp ts) {
+        TmfSignalManager.dispatchSignal(new TmfTimeSynchSignal(this, ts));
+    }
+
+    private void selectTimeRange(TmfTimeRange tr) {
+        TmfSignalManager.dispatchSignal(new TmfRangeSynchSignal(this, tr));
+    }
+
+    // ------------------------------------------------------------------------
+    // General tests
+    // ------------------------------------------------------------------------
+
+    /**
+     * Test that the manager is correctly initialized
+     */
+    @Test
+    public void testInitialize() {
+        TmfTraceManager mgr = TmfTraceManager.getInstance();
+        assertNotNull(mgr);
+        assertSame(tm, mgr);
+    }
+
+    /**
+     * Test the contents of a trace set with one trace.
+     */
+    @Test
+    public void testTraceSet() {
+        openTrace(trace1);
+        openTrace(trace2);
+        selectTrace(trace2);
+
+        ITmfTrace[] expected = new ITmfTrace[] { trace2 };
+        ITmfTrace[] actual = tm.getActiveTraceSet();
+
+        assertEquals(1, actual.length);
+        assertArrayEquals(expected, actual);
+    }
+
+    /**
+     * Test the contents of a trace set with an experiment.
+     */
+    @Test
+    public void testTraceSetExperiment() {
+        TmfExperiment exp = createExperiment(trace1, trace2);
+        openTrace(trace1);
+        openTrace(exp);
+
+        ITmfTrace[] expected = new ITmfTrace[] { trace1, trace2 };
+        ITmfTrace[] actual = tm.getActiveTraceSet();
+
+        assertEquals(2, actual.length);
+        assertArrayEquals(expected, actual);
+    }
+
+    /**
+     * Test the {@link TmfTraceManager#getSupplementaryFileDir} method.
+     */
+    @Test
+    public void testSupplementaryFileDir() {
+        String name1 = trace1.getName();
+        String name2 = trace2.getName();
+        String basePath = System.getProperty("java.io.tmpdir") + File.separator;
+
+        String expected1 = basePath + name1 + File.separator;
+        String expected2 = basePath + name2 + File.separator;
+
+        assertEquals(expected1, TmfTraceManager.getSupplementaryFileDir(trace1));
+        assertEquals(expected2, TmfTraceManager.getSupplementaryFileDir(trace2));
+    }
+
+    // ------------------------------------------------------------------------
+    // Test a single trace
+    // ------------------------------------------------------------------------
+
+    /**
+     * Test the initial range of a single trace.
+     */
+    @Test
+    public void testTraceInitialRange() {
+        openTrace(trace2);
+        final TmfTimeRange expectedRange = new TmfTimeRange(
+                trace2.getStartTime(),
+                calculateOffset(trace2.getStartTime(), trace2.getInitialRangeOffset()));
+        TmfTimeRange actualRange = tm.getCurrentRange();
+        assertEquals(expectedRange, actualRange);
+    }
+
+    /**
+     * Try selecting a timestamp contained inside the trace's range. The trace's
+     * current time should get updated correctly.
+     */
+    @Test
+    public void testNewTimestamp() {
+        openTrace(trace2);
+        ITmfTimestamp ts = new TmfTimestamp(t2start + ONE_SECOND, SCALE);
+        selectTimestamp(ts);
+
+        ITmfTimestamp afterTs = tm.getSelectionBeginTime();
+        assertEquals(ts, afterTs);
+        afterTs = tm.getSelectionEndTime();
+        assertEquals(ts, afterTs);
+    }
+
+    /**
+     * Try selecting a timestamp happening before the trace's start. The change
+     * should be ignored.
+     */
+    @Test
+    public void testTimestampBefore() {
+        openTrace(trace2);
+        ITmfTimestamp beforeTs = tm.getSelectionBeginTime();
+        ITmfTimestamp ts = new TmfTimestamp(t2start - ONE_SECOND, SCALE);
+        selectTimestamp(ts);
+
+        ITmfTimestamp curTs = tm.getSelectionBeginTime();
+        assertEquals(beforeTs, curTs);
+        curTs = tm.getSelectionEndTime();
+        assertEquals(beforeTs, curTs);
+    }
+
+    /**
+     * Try selecting a timestamp happening after the trace's end. The change
+     * should be ignored.
+     */
+    @Test
+    public void testTimestampAfter() {
+        openTrace(trace2);
+        ITmfTimestamp beforeTs = tm.getSelectionBeginTime();
+        ITmfTimestamp ts = new TmfTimestamp(t2end + ONE_SECOND, SCALE);
+        selectTimestamp(ts);
+
+        ITmfTimestamp curTs = tm.getSelectionBeginTime();
+        assertEquals(beforeTs, curTs);
+        curTs = tm.getSelectionEndTime();
+        assertEquals(beforeTs, curTs);
+    }
+
+    /**
+     * Test selecting a normal sub-range of a single trace.
+     */
+    @Test
+    public void testTraceNewTimeRange() {
+        openTrace(trace2);
+        TmfTimeRange range = new TmfTimeRange(
+                new TmfTimestamp(t2start + ONE_SECOND, SCALE),
+                new TmfTimestamp(t2end - ONE_SECOND, SCALE));
+        selectTimeRange(range);
+
+        TmfTimeRange curRange = tm.getCurrentRange();
+        assertEquals(range.getStartTime(), curRange.getStartTime());
+        assertEquals(range.getEndTime(), curRange.getEndTime());
+    }
+
+    /**
+     * Test selecting a range whose start time is before the trace's start time.
+     * The selected range should get clamped to the trace's range.
+     */
+    @Test
+    public void testTraceTimeRangeClampingStart() {
+        openTrace(trace2);
+        TmfTimeRange range = new TmfTimeRange(
+                new TmfTimestamp(t2start - ONE_SECOND, SCALE), // minus here
+                new TmfTimestamp(t2end - ONE_SECOND, SCALE));
+        selectTimeRange(range);
+
+        TmfTimeRange curRange = tm.getCurrentRange();
+        assertEquals(t2start, curRange.getStartTime().getValue());
+        assertEquals(range.getEndTime(), curRange.getEndTime());
+    }
+
+    /**
+     * Test selecting a range whose end time is after the trace's end time.
+     * The selected range should get clamped to the trace's range.
+     */
+    @Test
+    public void testTraceTimeRangeClampingEnd() {
+        openTrace(trace2);
+        TmfTimeRange range = new TmfTimeRange(
+                new TmfTimestamp(t2start + ONE_SECOND, SCALE),
+                new TmfTimestamp(t2end + ONE_SECOND, SCALE)); // plus here
+        selectTimeRange(range);
+
+        TmfTimeRange curRange = tm.getCurrentRange();
+        assertEquals(range.getStartTime(), curRange.getStartTime());
+        assertEquals(t2end, curRange.getEndTime().getValue());
+    }
+
+    /**
+     * Test selecting a range whose both start and end times are outside of the
+     * trace's range. The selected range should get clamped to the trace's
+     * range.
+     */
+    @Test
+    public void testTraceTimeRangeClampingBoth() {
+        openTrace(trace2);
+        TmfTimeRange range = new TmfTimeRange(
+                new TmfTimestamp(t2start - ONE_SECOND, SCALE), // minus here
+                new TmfTimestamp(t2end + ONE_SECOND, SCALE)); // plus here
+        selectTimeRange(range);
+
+        TmfTimeRange curRange = tm.getCurrentRange();
+        assertEquals(t2start, curRange.getStartTime().getValue());
+        assertEquals(t2end, curRange.getEndTime().getValue());
+    }
+
+    // ------------------------------------------------------------------------
+    // Test multiple, non-overlapping traces in parallel
+    // ------------------------------------------------------------------------
+
+    /**
+     * Test, with two traces in parallel, when we select a timestamp that is
+     * part of the first trace.
+     *
+     * The first trace's timestamp should be updated, but the second trace's one
+     * should not change.
+     */
+    @Test
+    public void testTwoTracesTimestampValid() {
+        openTrace(trace1);
+        openTrace(trace2);
+        selectTrace(trace1);
+        TmfTimestamp ts = new TmfTimestamp(t1start + ONE_SECOND, SCALE);
+        selectTimestamp(ts);
+
+        /* Timestamp of trace1 should have been updated */
+        assertEquals(ts, tm.getSelectionBeginTime());
+        assertEquals(ts, tm.getSelectionEndTime());
+
+        /* Timestamp of trace2 should not have changed */
+        selectTrace(trace2);
+        assertEquals(trace2.getStartTime(), tm.getSelectionBeginTime());
+        assertEquals(trace2.getStartTime(), tm.getSelectionEndTime());
+    }
+
+    /**
+     * Test, with two traces in parallel, when we select a timestamp that is
+     * between two traces.
+     *
+     * None of the trace's timestamps should be updated (we are not in an
+     * experiment!)
+     */
+    @Test
+    public void testTwoTracesTimestampInBetween() {
+        openTrace(trace1);
+        openTrace(trace2);
+        selectTrace(trace1);
+        TmfTimestamp ts = new TmfTimestamp(t1end + ONE_SECOND, SCALE);
+        selectTimestamp(ts);
+
+        /* Timestamp of trace1 should not have changed */
+        assertEquals(trace1.getStartTime(), tm.getSelectionBeginTime());
+        assertEquals(trace1.getStartTime(), tm.getSelectionEndTime());
+
+        /* Timestamp of trace2 should not have changed */
+        selectTrace(trace2);
+        assertEquals(trace2.getStartTime(), tm.getSelectionBeginTime());
+        assertEquals(trace2.getStartTime(), tm.getSelectionEndTime());
+    }
+
+    /**
+     * Test, with two traces in parallel, when we select a timestamp that is
+     * completely out of the trace's range.
+     *
+     * None of the trace's timestamps should be updated.
+     */
+    @Test
+    public void testTwoTracesTimestampInvalid() {
+        openTrace(trace1);
+        openTrace(trace2);
+        selectTrace(trace1);
+        TmfTimestamp ts = new TmfTimestamp(t2end + ONE_SECOND, SCALE);
+        selectTimestamp(ts);
+
+        /* Timestamp of trace1 should not have changed */
+        assertEquals(trace1.getStartTime(), tm.getSelectionBeginTime());
+        assertEquals(trace1.getStartTime(), tm.getSelectionEndTime());
+
+        /* Timestamp of trace2 should not have changed */
+        selectTrace(trace2);
+        assertEquals(trace2.getStartTime(), tm.getSelectionBeginTime());
+        assertEquals(trace2.getStartTime(), tm.getSelectionEndTime());
+    }
+
+    /**
+     * Test, with two traces opened in parallel (not in an experiment), if we
+     * select a time range valid in one of them. That trace's time range should
+     * be updated, but not the other one.
+     */
+    @Test
+    public void testTwoTracesTimeRangeAllInOne() {
+        openTrace(trace1);
+        openTrace(trace2);
+        selectTrace(trace1);
+        TmfTimeRange range = new TmfTimeRange(
+                new TmfTimestamp(t1start + ONE_SECOND, SCALE),
+                new TmfTimestamp(t1end - ONE_SECOND, SCALE));
+        selectTimeRange(range);
+
+        /* Range of trace1 should be equal to the requested one */
+        assertEquals(range, tm.getCurrentRange());
+
+        /* The range of trace 2 should not have changed */
+        selectTrace(trace2);
+        assertEquals(getInitialRange(trace2), tm.getCurrentRange());
+    }
+
+    /**
+     * Test, with two traces in parallel, when we select a time range that is
+     * only partially valid for one of the traces.
+     *
+     * The first trace's time range should be clamped to a valid range, and the
+     * second one's should not change.
+     */
+    @Test
+    public void testTwoTracesTimeRangePartiallyInOne() {
+        openTrace(trace1);
+        openTrace(trace2);
+        selectTrace(trace1);
+        TmfTimeRange range = new TmfTimeRange(
+                new TmfTimestamp(t1start + ONE_SECOND, SCALE),
+                new TmfTimestamp(t1end + ONE_SECOND, SCALE));
+        selectTimeRange(range);
+
+        /* Range of trace1 should get clamped to its end time */
+        TmfTimeRange expectedRange = new TmfTimeRange(
+                new TmfTimestamp(t1start + ONE_SECOND, SCALE),
+                new TmfTimestamp(t1end, SCALE));
+        assertEquals(expectedRange, tm.getCurrentRange());
+
+        /* Range of trace2 should not have changed */
+        selectTrace(trace2);
+        assertEquals(getInitialRange(trace2), tm.getCurrentRange());
+    }
+
+    /**
+     * Test, with two traces in parallel, when we select a time range that is
+     * only partially valid for both traces.
+     *
+     * Each trace's time range should get clamped to respectively valid ranges.
+     */
+    @Test
+    public void testTwoTracesTimeRangeInBoth() {
+        openTrace(trace1);
+        openTrace(trace2);
+        selectTrace(trace1);
+        TmfTimeRange range = new TmfTimeRange(
+                new TmfTimestamp(t1end - ONE_SECOND, SCALE),
+                new TmfTimestamp(t2start + ONE_SECOND, SCALE));
+        selectTimeRange(range);
+
+        /* Range of trace1 should be clamped to its end time */
+        TmfTimeRange expectedRange = new TmfTimeRange(
+                new TmfTimestamp(t1end - ONE_SECOND, SCALE),
+                new TmfTimestamp(t1end, SCALE));
+        assertEquals(expectedRange, tm.getCurrentRange());
+
+        /* Range of trace2 should be clamped to its start time */
+        selectTrace(trace2);
+        expectedRange = new TmfTimeRange(
+                new TmfTimestamp(t2start, SCALE),
+                new TmfTimestamp(t2start + ONE_SECOND, SCALE));
+        assertEquals(expectedRange, tm.getCurrentRange());
+    }
+
+    /**
+     * Test, with two traces in parallel, when we select a time range that is
+     * not valid for any trace.
+     *
+     * Each trace's time range should not be modified.
+     */
+    @Test
+    public void testTwoTracesTimeRangeInBetween() {
+        openTrace(trace1);
+        openTrace(trace2);
+        selectTrace(trace1);
+        TmfTimeRange range = new TmfTimeRange(
+                new TmfTimestamp(t1end + ONE_SECOND, SCALE),
+                new TmfTimestamp(t1end - ONE_SECOND, SCALE));
+        selectTimeRange(range);
+
+        /* Range of trace1 should not have changed */
+        TmfTimeRange expectedRange = getInitialRange(trace1);
+        TmfTimeRange curRange = tm.getCurrentRange();
+        assertEquals(expectedRange.getStartTime(), curRange.getStartTime());
+        assertEquals(expectedRange.getEndTime(), curRange.getEndTime());
+
+        /* Range of trace2 should not have changed */
+        selectTrace(trace2);
+        expectedRange = getInitialRange(trace2);
+        curRange = tm.getCurrentRange();
+        assertEquals(expectedRange.getStartTime(), curRange.getStartTime());
+        assertEquals(expectedRange.getEndTime(), curRange.getEndTime());
+    }
+
+    // ------------------------------------------------------------------------
+    // Test an experiment
+    // ------------------------------------------------------------------------
+
+    /**
+     * Test in an experiment when we select a timestamp that is part of one of
+     * the experiment's traces.
+     *
+     * The experiment's current time should be correctly updated.
+     */
+    @Test
+    public void testExperimentTimestampInTrace() {
+        TmfExperiment exp = createExperiment(trace1, trace2);
+        openTrace(exp);
+        TmfTimestamp ts = new TmfTimestamp(t1start + ONE_SECOND, SCALE);
+        selectTimestamp(ts);
+
+        /* The experiment's current time should be updated. */
+        assertEquals(ts, tm.getSelectionBeginTime());
+        assertEquals(ts, tm.getSelectionEndTime());
+    }
+
+    /**
+     * Test in an experiment when we select a timestamp that is between two
+     * traces in the experiment.
+     *
+     * The experiment's current time should still be updated, since the
+     * timestamp is valid in the experiment itself.
+     */
+    @Test
+    public void testExperimentTimestampInBetween() {
+        TmfExperiment exp = createExperiment(trace1, trace2);
+        openTrace(exp);
+        TmfTimestamp ts = new TmfTimestamp(t1end + ONE_SECOND, SCALE);
+        selectTimestamp(ts);
+
+        /* The experiment's current time should be updated. */
+        assertEquals(ts, tm.getSelectionBeginTime());
+        assertEquals(ts, tm.getSelectionEndTime());
+    }
+
+    /**
+     * Test in an experiment when we select a timestamp that is outside of the
+     * total range of the experiment.
+     *
+     * The experiment's current time should not be updated.
+     */
+    @Test
+    public void testExperimentTimestampInvalid() {
+        TmfExperiment exp = createExperiment(trace1, trace2);
+        openTrace(exp);
+        TmfTimestamp ts = new TmfTimestamp(t2end + ONE_SECOND, SCALE);
+        selectTimestamp(ts);
+
+        /* The experiment's current time should NOT be updated. */
+        assertEquals(trace1.getStartTime(), tm.getSelectionBeginTime());
+        assertEquals(trace1.getStartTime(), tm.getSelectionEndTime());
+    }
+
+    /**
+     * Test the initial range of an experiment.
+     */
+    @Test
+    public void testExperimentInitialRange() {
+        TmfExperiment exp = createExperiment(trace1, trace2);
+        openTrace(exp);
+        /*
+         * The initial range should be == to the initial range of the earliest
+         * trace (here trace1).
+         */
+        final TmfTimeRange actualRange = tm.getCurrentRange();
+
+        assertEquals(getInitialRange(trace1), actualRange);
+        assertEquals(getInitialRange(exp), actualRange);
+    }
+
+    /**
+     * Test the range clamping with the start time of the range outside of the
+     * earliest trace's range. Only that start time should get clamped.
+     */
+    @Test
+    public void testExperimentRangeClampingOne() {
+        TmfExperiment exp = createExperiment(trace1, trace2);
+        openTrace(exp);
+
+        final TmfTimeRange range = new TmfTimeRange(
+                new TmfTimestamp(t1start - ONE_SECOND, SCALE),
+                new TmfTimestamp(t1end - ONE_SECOND, SCALE));
+        selectTimeRange(range);
+
+        TmfTimeRange actualRange = tm.getCurrentRange();
+        assertEquals(t1start, actualRange.getStartTime().getValue());
+        assertEquals(t1end - ONE_SECOND, actualRange.getEndTime().getValue());
+    }
+
+    /**
+     * Test the range clamping when both the start and end times of the signal's
+     * range are outside of the trace's range. The range should clamp to the
+     * experiment's range.
+     */
+    @Test
+    public void testExperimentRangeClampingBoth() {
+        TmfExperiment exp = createExperiment(trace1, trace2);
+        openTrace(exp);
+
+        final TmfTimeRange range = new TmfTimeRange(
+                new TmfTimestamp(t1start - ONE_SECOND, SCALE),
+                new TmfTimestamp(t2end + ONE_SECOND, SCALE));
+        selectTimeRange(range);
+
+        TmfTimeRange actualRange = tm.getCurrentRange();
+        assertEquals(t1start, actualRange.getStartTime().getValue());
+        assertEquals(t2end, actualRange.getEndTime().getValue());
+    }
+
+    /**
+     * Test selecting a range in-between two disjoint traces in an experiment.
+     * The range should still get correctly selected, even if no trace has any
+     * events in that range.
+     */
+    @Test
+    public void testExperimentRangeInBetween() {
+        TmfExperiment exp = createExperiment(trace1, trace2);
+        openTrace(exp);
+
+        final TmfTimeRange range = new TmfTimeRange(
+                new TmfTimestamp(t1end + ONE_SECOND, SCALE),
+                new TmfTimestamp(t2start - ONE_SECOND, SCALE));
+        selectTimeRange(range);
+
+        TmfTimeRange actualRange = tm.getCurrentRange();
+        assertEquals(range, actualRange);
+    }
+
+    // ------------------------------------------------------------------------
+    // Utility methods
+    // ------------------------------------------------------------------------
+
+    private static TmfExperiment createExperiment(ITmfTrace t1, ITmfTrace t2) {
+        ITmfTrace[] traces = new ITmfTrace[] { t1, t2 };
+        TmfExperiment exp = new TmfExperiment(ITmfEvent.class, "test-exp", traces);
+        exp.indexTrace(true);
+        // Deregister experiment from signal manager so that it doesn't
+        // interfere with the TmfTraceManager tests
+        TmfSignalManager.deregister(exp);
+        return exp;
+    }
+
+    private static TmfTimeRange getInitialRange(ITmfTrace trace) {
+        return new TmfTimeRange(
+                trace.getStartTime(),
+                calculateOffset(trace.getStartTime(), trace.getInitialRangeOffset()));
+    }
+
+    /**
+     * Basically a "initial + offset" operation, but for ITmfTimetamp objects.
+     */
+    private static ITmfTimestamp calculateOffset(ITmfTimestamp initialTs, ITmfTimestamp offsetTs) {
+        long start = initialTs.normalize(0, SCALE).getValue();
+        long offset = offsetTs.normalize(0, SCALE).getValue();
+        return new TmfTimestamp(start + offset, SCALE);
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core.tests/stubs/org/eclipse/linuxtools/tmf/ctf/core/tests/stubs/CtfTmfTraceStub.java b/org.eclipse.linuxtools.tmf.ctf.core.tests/stubs/org/eclipse/linuxtools/tmf/ctf/core/tests/stubs/CtfTmfTraceStub.java
new file mode 100644 (file)
index 0000000..5a52a13
--- /dev/null
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Ã‰cole Polytechnique de Montréal
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Geneviève Bastien - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core.tests.stubs;
+
+import org.eclipse.linuxtools.tmf.core.signal.TmfSignalManager;
+import org.eclipse.linuxtools.tmf.core.signal.TmfTraceOpenedSignal;
+import org.eclipse.linuxtools.tmf.core.signal.TmfTraceSelectedSignal;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
+
+/**
+ * Dummy test ctf trace
+ */
+public class CtfTmfTraceStub extends CtfTmfTrace {
+
+    /**
+     * Simulate trace opening, to be called by tests who need an actively opened
+     * trace
+     */
+    public void openTrace() {
+        TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(this, this, null));
+        selectTrace();
+    }
+
+    /**
+     * Simulate selecting the trace
+     */
+    public void selectTrace() {
+        TmfSignalManager.dispatchSignal(new TmfTraceSelectedSignal(this, this));
+    }
+
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/.classpath b/org.eclipse.linuxtools.tmf.ctf.core/.classpath
new file mode 100644 (file)
index 0000000..098194c
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/.gitignore b/org.eclipse.linuxtools.tmf.ctf.core/.gitignore
new file mode 100644 (file)
index 0000000..fb60f67
--- /dev/null
@@ -0,0 +1,2 @@
+bin/
+target/
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/.project b/org.eclipse.linuxtools.tmf.ctf.core/.project
new file mode 100644 (file)
index 0000000..6b8f39f
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.eclipse.linuxtools.tmf.ctf.core</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+               <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+       </natures>
+</projectDescription>
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/.settings/org.eclipse.core.resources.prefs b/org.eclipse.linuxtools.tmf.ctf.core/.settings/org.eclipse.core.resources.prefs
new file mode 100644 (file)
index 0000000..99f26c0
--- /dev/null
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/.settings/org.eclipse.core.runtime.prefs b/org.eclipse.linuxtools.tmf.ctf.core/.settings/org.eclipse.core.runtime.prefs
new file mode 100644 (file)
index 0000000..5a0ad22
--- /dev/null
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.linuxtools.tmf.ctf.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..688c46d
--- /dev/null
@@ -0,0 +1,393 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=error
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=error
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=error
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=error
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=enabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=error
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=error
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=error
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=error
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=false
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=250
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=space
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.linuxtools.tmf.ctf.core/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644 (file)
index 0000000..4fd0c70
--- /dev/null
@@ -0,0 +1,56 @@
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_tmf-style
+formatter_settings_version=12
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=false
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=false
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=false
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/.settings/org.eclipse.pde.api.tools.prefs b/org.eclipse.linuxtools.tmf.ctf.core/.settings/org.eclipse.pde.api.tools.prefs
new file mode 100644 (file)
index 0000000..acc3abd
--- /dev/null
@@ -0,0 +1,97 @@
+ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
+ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
+API_USE_SCAN_FIELD_SEVERITY=Error
+API_USE_SCAN_METHOD_SEVERITY=Error
+API_USE_SCAN_TYPE_SEVERITY=Error
+CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
+CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
+CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
+CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
+CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
+ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
+ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
+ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
+FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
+FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
+FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
+FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
+ILLEGAL_EXTEND=Warning
+ILLEGAL_IMPLEMENT=Warning
+ILLEGAL_INSTANTIATE=Warning
+ILLEGAL_OVERRIDE=Warning
+ILLEGAL_REFERENCE=Warning
+INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+INVALID_JAVADOC_TAG=Warning
+INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Warning
+LEAK_EXTEND=Warning
+LEAK_FIELD_DECL=Warning
+LEAK_IMPLEMENT=Warning
+LEAK_METHOD_PARAM=Warning
+LEAK_METHOD_RETURN_TYPE=Warning
+METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
+METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+MISSING_EE_DESCRIPTIONS=Ignore
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
+UNUSED_PROBLEM_FILTERS=Warning
+automatically_removed_unused_problem_filters=false
+eclipse.preferences.version=1
+incompatible_api_component_version=Error
+incompatible_api_component_version_include_major_without_breaking_change=Disabled
+incompatible_api_component_version_include_minor_without_api_change=Disabled
+invalid_since_tag_version=Error
+malformed_since_tag=Error
+missing_since_tag=Error
+report_api_breakage_when_major_version_incremented=Disabled
+report_resolution_errors_api_component=Warning
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/.settings/org.eclipse.pde.prefs b/org.eclipse.linuxtools.tmf.ctf.core/.settings/org.eclipse.pde.prefs
new file mode 100644 (file)
index 0000000..97b4320
--- /dev/null
@@ -0,0 +1,32 @@
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=2
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=1
+compilers.p.discouraged-class=1
+compilers.p.internal=1
+compilers.p.missing-packages=1
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=2
+compilers.p.unknown-attribute=1
+compilers.p.unknown-class=1
+compilers.p.unknown-element=1
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=1
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+eclipse.preferences.version=1
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/META-INF/MANIFEST.MF b/org.eclipse.linuxtools.tmf.ctf.core/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..eb52863
--- /dev/null
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-Vendor: %Bundle-Vendor
+Bundle-Version: 3.0.0.qualifier
+Bundle-Localization: plugin
+Bundle-SymbolicName: org.eclipse.linuxtools.tmf.ctf.core;singleton:=true
+Bundle-Activator: org.eclipse.linuxtools.internal.tmf.ctf.core.Activator
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.linuxtools.ctf.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0"
+Export-Package: org.eclipse.linuxtools.internal.tmf.ctf.core;x-internal:=true,
+ org.eclipse.linuxtools.tmf.ctf.core
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/about.html b/org.eclipse.linuxtools.tmf.ctf.core/about.html
new file mode 100644 (file)
index 0000000..28737f6
--- /dev/null
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;).  Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;).  A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content.  Check the Redistributor's license that was
+provided with the Content.  If no such license exists, contact the Redistributor.  Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/build.properties b/org.eclipse.linuxtools.tmf.ctf.core/build.properties
new file mode 100644 (file)
index 0000000..244c9d8
--- /dev/null
@@ -0,0 +1,22 @@
+###############################################################################
+# Copyright (c) 2013, 2014 Ericsson
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#     Ericsson - Initial API and implementation
+###############################################################################
+
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               about.html,\
+               plugin.properties,\
+               plugin.xml
+src.includes = about.html
+additional.bundles = org.eclipse.jdt.annotation
+jars.extra.classpath = platform:/plugin/org.eclipse.jdt.annotation
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/plugin.properties b/org.eclipse.linuxtools.tmf.ctf.core/plugin.properties
new file mode 100644 (file)
index 0000000..9532831
--- /dev/null
@@ -0,0 +1,19 @@
+###############################################################################
+# Copyright (c) 2013, 2014 Ericsson
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#     Ericsson - Initial API and implementation
+###############################################################################
+
+#Properties file for org.eclipse.linuxtools.tmf.ctf.core
+Bundle-Vendor = Eclipse Linux Tools
+Bundle-Name = CTF support for TMF Core Plug-in
+
+# CTF trace type
+tracetype.category.ctf = Common Trace Format
+tracetype.type.ctf = Generic CTF Trace
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/plugin.xml b/org.eclipse.linuxtools.tmf.ctf.core/plugin.xml
new file mode 100644 (file)
index 0000000..0b2f6eb
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+   <extension
+         point="org.eclipse.linuxtools.tmf.core.tracetype">
+      <category
+            id="org.eclipse.linuxtools.tmf.ctf.core.category.ctf"
+            name="%tracetype.category.ctf">
+      </category>
+      <type
+            category="org.eclipse.linuxtools.tmf.ctf.core.category.ctf"
+            event_type="org.eclipse.linuxtools.tmf.ctf.core.CtfTmfEvent"
+            id="org.eclipse.linuxtools.tmf.ui.type.ctf"
+            isDirectory="false"
+            name="%tracetype.type.ctf"
+            trace_type="org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace">
+      </type>
+   </extension>
+
+</plugin>
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/pom.xml b/org.eclipse.linuxtools.tmf.ctf.core/pom.xml
new file mode 100644 (file)
index 0000000..cfb78c9
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Copyright (C) 2011, Red Hat, Inc.
+
+   All rights reserved. This program and the accompanying materials
+   are made available under the terms of the Eclipse Public License v1.0
+   which accompanies this distribution, and is available at
+   http://www.eclipse.org/legal/epl-v10.html
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>linuxtools-lttng-parent</artifactId>
+    <groupId>org.eclipse.linuxtools.lttng</groupId>
+    <version>3.0.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>org.eclipse.linuxtools.tmf.ctf.core</artifactId>
+  <version>3.0.0-SNAPSHOT</version>
+  <packaging>eclipse-plugin</packaging>
+
+  <name>CTF support for TMF Core Plug-in</name>
+
+ <build>
+    <plugins>
+      <plugin>
+        <groupId>org.eclipse.tycho</groupId>
+        <artifactId>tycho-source-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
+
+ <groupId>org.eclipse.linuxtools.tmf</groupId>
+</project>
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/internal/tmf/ctf/core/Activator.java b/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/internal/tmf/ctf/core/Activator.java
new file mode 100644 (file)
index 0000000..6a13879
--- /dev/null
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Francois Chouinard - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.tmf.ctf.core;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.osgi.framework.BundleContext;
+
+/**
+ * <b><u>Activator</u></b>
+ * <p>
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    /**
+     * The plug-in ID
+     */
+    public static final String PLUGIN_ID = "org.eclipse.linuxtools.tmf.ctf.core"; //$NON-NLS-1$
+
+    /**
+     * The shared instance
+     */
+    private static Activator plugin;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * The constructor
+     */
+    public Activator() {
+    }
+
+    // ------------------------------------------------------------------------
+    // Accessors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Returns the shared instance
+     *
+     * @return the shared instance
+     */
+    public static Activator getDefault() {
+        return plugin;
+    }
+
+    // ------------------------------------------------------------------------
+    // Operators
+    // ------------------------------------------------------------------------
+
+    @Override
+    public void start(BundleContext context) throws Exception {
+        super.start(context);
+        plugin = this;
+    }
+
+    @Override
+    public void stop(BundleContext context) throws Exception {
+        plugin = null;
+        super.stop(context);
+    }
+
+    /**
+     * Logs a message with severity INFO in the runtime log of the plug-in.
+     *
+     * @param message A message to log
+     */
+    public void logInfo(String message) {
+        getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
+    }
+
+    /**
+     * Logs a message and exception with severity INFO in the runtime log of the plug-in.
+     *
+     * @param message A message to log
+     * @param exception A exception to log
+     */
+    public void logInfo(String message, Throwable exception) {
+        getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message, exception));
+    }
+
+    /**
+     * Logs a message and exception with severity WARNING in the runtime log of the plug-in.
+     *
+     * @param message A message to log
+     */
+    public void logWarning(String message) {
+        getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message));
+    }
+
+    /**
+     * Logs a message and exception with severity WARNING in the runtime log of the plug-in.
+     *
+     * @param message A message to log
+     * @param exception A exception to log
+     */
+    public void logWarning(String message, Throwable exception) {
+        getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message, exception));
+    }
+
+    /**
+     * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
+     *
+     * @param message A message to log
+     */
+    public void logError(String message) {
+        getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
+    }
+
+    /**
+     * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
+     *
+     * @param message A message to log
+     * @param exception A exception to log
+     */
+    public void logError(String message, Throwable exception) {
+        getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
+    }
+
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfConstants.java b/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfConstants.java
new file mode 100644 (file)
index 0000000..2730e18
--- /dev/null
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Ericsson, Ecole Polytechnique de Montreal and others
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Ansgar Radermacher - support for model URI
+ *   Patrick Tasse - context strings
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core;
+
+/**
+ * Set of constants used by the CTF adaptor classes
+ *
+ * @since 2.0
+ */
+@SuppressWarnings("nls")
+public interface CtfConstants {
+
+    /*
+     * Context strings
+     */
+
+    /** Prefix for context information stored as CtfTmfEventfield */
+    public static final String CONTEXT_FIELD_PREFIX = "context.";
+
+    /** Key for ip field */
+    public static final String IP_KEY = "_ip";
+
+    /*
+     * Custom attributes names (key within hash table)
+     */
+
+    /** Model URI for traces related to EMF models */
+    public final static String MODEL_URI_KEY = "model.emf.uri";
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfEnumPair.java b/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfEnumPair.java
new file mode 100644 (file)
index 0000000..f27894d
--- /dev/null
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Bernd Hufmann - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core;
+
+import org.eclipse.linuxtools.tmf.core.util.Pair;
+
+/**
+ * Pair of Enum value name and its long value.
+ *
+ * @author Bernd Hufmann
+ * @since 2.0
+ */
+public class CtfEnumPair extends Pair<String, Long> {
+
+    /**
+     * Constructs a CtfEnumPair
+     *
+     * @param strValue
+     *                  The first parameter of the pair (String)
+     * @param longValue
+     *                  The second parameter of the pair (Long)
+     */
+    public CtfEnumPair(String strValue, Long longValue) {
+        super(strValue, longValue);
+    }
+
+    /**
+     * Returns the String value of the Enum.
+     *
+     * @return the string value
+     */
+    public String getStringValue() {
+        return getFirst();
+    }
+
+    /**
+     * Returns the long value of the Enum.
+     *
+     * @return the Long value
+     */
+    public Long getLongValue() {
+        return getSecond();
+    }
+
+    @Override
+    public String toString() {
+        return getFirst();
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfIterator.java b/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfIterator.java
new file mode 100644 (file)
index 0000000..50b823b
--- /dev/null
@@ -0,0 +1,333 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson, Ã‰cole Polytechnique de Montréal
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial API and implementation
+ *   Florian Wininger - Performance improvements
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core;
+
+import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
+import org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader;
+import org.eclipse.linuxtools.ctf.core.trace.StreamInputReader;
+import org.eclipse.linuxtools.internal.tmf.ctf.core.Activator;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+
+/**
+ * The CTF trace reader iterator.
+ *
+ * It doesn't reserve a file handle, so many iterators can be used without
+ * worries of I/O errors or resource exhaustion.
+ *
+ * @author Matthew Khouzam
+ */
+public class CtfIterator extends CTFTraceReader
+        implements ITmfContext, Comparable<CtfIterator> {
+
+    /** An invalid location */
+    public static final CtfLocation NULL_LOCATION = new CtfLocation(CtfLocation.INVALID_LOCATION);
+
+    private final CtfTmfTrace fTrace;
+
+    private CtfLocation fCurLocation;
+    private long fCurRank;
+
+    private CtfLocation fPreviousLocation;
+    private CtfTmfEvent fPreviousEvent;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Create a new CTF trace iterator, which initially points at the first
+     * event in the trace.
+     *
+     * @param trace
+     *            The trace to iterate over
+     * @throws CTFReaderException
+     *             If the iterator couldn't not be instantiated, probably due to
+     *             a read error.
+     */
+    public CtfIterator(CtfTmfTrace trace) throws CTFReaderException {
+        super(trace.getCTFTrace());
+        fTrace = trace;
+        if (hasMoreEvents()) {
+            fCurLocation = new CtfLocation(trace.getStartTime());
+            fCurRank = 0;
+        } else {
+            setUnknownLocation();
+        }
+    }
+
+    /**
+     * Create a new CTF trace iterator, which will initially point to the given
+     * location/rank.
+     *
+     * @param trace
+     *            The trace to iterate over
+     * @param ctfLocationData
+     *            The initial timestamp the iterator will be pointing to
+     * @param rank
+     *            The initial rank
+     * @throws CTFReaderException
+     *             If the iterator couldn't not be instantiated, probably due to
+     *             a read error.
+     * @since 2.0
+     */
+    public CtfIterator(CtfTmfTrace trace, CtfLocationInfo ctfLocationData, long rank)
+            throws CTFReaderException {
+        super(trace.getCTFTrace());
+
+        this.fTrace = trace;
+        if (this.hasMoreEvents()) {
+            this.fCurLocation = new CtfLocation(ctfLocationData);
+            if (this.getCurrentEvent().getTimestamp().getValue() != ctfLocationData.getTimestamp()) {
+                this.seek(ctfLocationData);
+                this.fCurRank = rank;
+            }
+        } else {
+            setUnknownLocation();
+        }
+    }
+
+    private void setUnknownLocation() {
+        fCurLocation = NULL_LOCATION;
+        fCurRank = UNKNOWN_RANK;
+    }
+
+    // ------------------------------------------------------------------------
+    // Accessors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Return this iterator's trace.
+     *
+     * @return CtfTmfTrace The iterator's trace
+     */
+    public CtfTmfTrace getCtfTmfTrace() {
+        return fTrace;
+    }
+
+    /**
+     * Return the current event pointed to by the iterator.
+     *
+     * @return CtfTmfEvent The current event
+     */
+    public synchronized CtfTmfEvent getCurrentEvent() {
+        final StreamInputReader top = super.getPrio().peek();
+        if (top != null) {
+            if (!fCurLocation.equals(fPreviousLocation)) {
+                fPreviousLocation = fCurLocation;
+                fPreviousEvent = CtfTmfEventFactory.createEvent(top.getCurrentEvent(),
+                        top.getFilename(), fTrace);
+            }
+            return fPreviousEvent;
+        }
+        return null;
+    }
+
+    /**
+     * Seek this iterator to a given location.
+     *
+     * @param ctfLocationData
+     *            The LocationData representing the position to seek to
+     * @return boolean True if the seek was successful, false if there was an
+     *         error seeking.
+     * @since 2.0
+     */
+    public synchronized boolean seek(CtfLocationInfo ctfLocationData) {
+        boolean ret = false;
+
+        /* Avoid the cost of seeking at the current location. */
+        if (fCurLocation.getLocationInfo().equals(ctfLocationData)) {
+            return super.hasMoreEvents();
+        }
+
+        /* Adjust the timestamp depending on the trace's offset */
+        long currTimestamp = ctfLocationData.getTimestamp();
+        final long offsetTimestamp = this.getCtfTmfTrace().getCTFTrace().timestampNanoToCycles(currTimestamp);
+        try {
+            if (offsetTimestamp < 0) {
+                ret = super.seek(0L);
+            } else {
+                ret = super.seek(offsetTimestamp);
+            }
+        } catch (CTFReaderException e) {
+            Activator.getDefault().logError(e.getMessage(), e);
+            return false;
+        }
+        /*
+         * Check if there is already one or more events for that timestamp, and
+         * assign the location index correctly
+         */
+        long index = 0;
+        final CtfTmfEvent currentEvent = this.getCurrentEvent();
+        if (currentEvent != null) {
+            currTimestamp = currentEvent.getTimestamp().getValue();
+
+            for (long i = 0; i < ctfLocationData.getIndex(); i++) {
+                if (currTimestamp == currentEvent.getTimestamp().getValue()) {
+                    index++;
+                } else {
+                    index = 0;
+                }
+                this.advance();
+            }
+        } else {
+            ret = false;
+        }
+        /* Seek the current location accordingly */
+        if (ret) {
+            fCurLocation = new CtfLocation(new CtfLocationInfo(getCurrentEvent().getTimestamp().getValue(), index));
+        } else {
+            fCurLocation = NULL_LOCATION;
+        }
+
+        return ret;
+    }
+
+    // ------------------------------------------------------------------------
+    // CTFTraceReader
+    // ------------------------------------------------------------------------
+
+    @Override
+    public boolean seek(long timestamp) {
+        return seek(new CtfLocationInfo(timestamp, 0));
+    }
+
+    @Override
+    public synchronized boolean advance() {
+        long index = fCurLocation.getLocationInfo().getIndex();
+        long timestamp = fCurLocation.getLocationInfo().getTimestamp();
+        boolean ret = false;
+        try {
+            ret = super.advance();
+        } catch (CTFReaderException e) {
+            Activator.getDefault().logError(e.getMessage(), e);
+        }
+
+        if (ret) {
+            final long timestampValue = getCurrentEvent().getTimestamp().getValue();
+            if (timestamp == timestampValue) {
+                fCurLocation = new CtfLocation(timestampValue, index + 1);
+            } else {
+                fCurLocation = new CtfLocation(timestampValue, 0L);
+            }
+        } else {
+            fCurLocation = NULL_LOCATION;
+        }
+        return ret;
+    }
+
+    // ------------------------------------------------------------------------
+    // ITmfContext
+    // ------------------------------------------------------------------------
+
+    @Override
+    public long getRank() {
+        return fCurRank;
+    }
+
+    @Override
+    public void setRank(long rank) {
+        fCurRank = rank;
+    }
+
+    @Override
+    public void increaseRank() {
+        /* Only increase the rank if it's valid */
+        if (hasValidRank()) {
+            fCurRank++;
+        }
+    }
+
+    @Override
+    public boolean hasValidRank() {
+        return (getRank() >= 0);
+    }
+
+    /**
+     * @since 3.0
+     */
+    @Override
+    public void setLocation(ITmfLocation location) {
+        // FIXME alex: isn't there a cleaner way than a cast here?
+        fCurLocation = (CtfLocation) location;
+        seek(((CtfLocation) location).getLocationInfo());
+    }
+
+    @Override
+    public CtfLocation getLocation() {
+        return fCurLocation;
+    }
+
+    // ------------------------------------------------------------------------
+    // Comparable
+    // ------------------------------------------------------------------------
+
+    @Override
+    public int compareTo(final CtfIterator o) {
+        if (getRank() < o.getRank()) {
+            return -1;
+        } else if (getRank() > o.getRank()) {
+            return 1;
+        }
+        return 0;
+    }
+
+    // ------------------------------------------------------------------------
+    // Object
+    // ------------------------------------------------------------------------
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = (prime * result)
+                + ((fTrace == null) ? 0 : fTrace.hashCode());
+        result = (prime * result)
+                + ((fCurLocation == null) ? 0 : fCurLocation.hashCode());
+        result = (prime * result) + (int) (fCurRank ^ (fCurRank >>> 32));
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!super.equals(obj)) {
+            return false;
+        }
+        if (!(obj instanceof CtfIterator)) {
+            return false;
+        }
+        CtfIterator other = (CtfIterator) obj;
+        if (fTrace == null) {
+            if (other.fTrace != null) {
+                return false;
+            }
+        } else if (!fTrace.equals(other.fTrace)) {
+            return false;
+        }
+        if (fCurLocation == null) {
+            if (other.fCurLocation != null) {
+                return false;
+            }
+        } else if (!fCurLocation.equals(other.fCurLocation)) {
+            return false;
+        }
+        if (fCurRank != other.fCurRank) {
+            return false;
+        }
+        return true;
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfIteratorManager.java b/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfIteratorManager.java
new file mode 100644 (file)
index 0000000..a9c96f9
--- /dev/null
@@ -0,0 +1,226 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial API and implementation
+ *   Simon Delisle - Added a method to remove the iterator
+ *******************************************************************************/
+package org.eclipse.linuxtools.tmf.ctf.core;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Random;
+
+/**
+ * Ctf Iterator Manager, allows mapping of iterators (a limited resource) to
+ * contexts (many many resources).
+ *
+ * @author Matthew Khouzam
+ * @version 1.0
+ * @since 1.1
+ */
+public abstract class CtfIteratorManager {
+    /*
+     * A side note synchronized works on the whole object, Therefore add and
+     * remove will be thread safe.
+     */
+
+    /*
+     * The map of traces to trace managers.
+     */
+    private static HashMap<CtfTmfTrace, CtfTraceManager> map = new HashMap<>();
+
+    /**
+     * Registers a trace to the iterator manager, the trace can now get
+     * iterators.
+     *
+     * @param trace
+     *            the trace to register.
+     */
+    public static synchronized void addTrace(final CtfTmfTrace trace) {
+        map.put(trace, new CtfTraceManager(trace));
+    }
+
+    /**
+     * Removes a trace to the iterator manager.
+     *
+     * @param trace
+     *            the trace to register.
+     */
+    public static synchronized void removeTrace(final CtfTmfTrace trace) {
+        CtfTraceManager mgr = map.remove(trace);
+        if (mgr != null) {
+            mgr.clear();
+        }
+    }
+
+    /**
+     * Get an iterator for a given trace and context.
+     *
+     * @param trace
+     *            the trace
+     * @param ctx
+     *            the context
+     * @return the iterator
+     * @since 2.0
+     */
+    public static synchronized CtfIterator getIterator(final CtfTmfTrace trace,
+            final CtfTmfContext ctx) {
+        return map.get(trace).getIterator(ctx);
+    }
+
+    /**
+     * Remove an iterator for a given trace and context
+     *
+     * @param trace
+     *            the trace
+     * @param ctx
+     *            the context
+     * @since 2.1
+     */
+    public static synchronized void removeIterator(final CtfTmfTrace trace, final CtfTmfContext ctx) {
+        CtfTraceManager traceManager = map.get(trace);
+        if (traceManager != null) {
+            traceManager.removeIterator(ctx);
+        }
+    }
+}
+
+/**
+ * A trace manager
+ *
+ * @author Matthew Khouzam
+ */
+class CtfTraceManager {
+    /*
+     * Cache size. Under 1023 on linux32 systems. Number of file handles
+     * created.
+     */
+    private final static int MAX_SIZE = 100;
+    /*
+     * The map of the cache.
+     */
+    private final HashMap<CtfTmfContext, CtfIterator> fMap;
+    /*
+     * An array pointing to the same cache. this allows fast "random" accesses.
+     */
+    private final ArrayList<CtfTmfContext> fRandomAccess;
+    /*
+     * The parent trace
+     */
+    private final CtfTmfTrace fTrace;
+    /*
+     * Random number generator
+     */
+    private final Random fRnd;
+
+    public CtfTraceManager(CtfTmfTrace trace) {
+        fMap = new HashMap<>();
+        fRandomAccess = new ArrayList<>();
+        fRnd = new Random(System.nanoTime());
+        fTrace = trace;
+    }
+
+    /**
+     * This needs explaining: the iterator table is effectively a cache.
+     * Originally the contexts had a 1 to 1 structure with the file handles of a
+     * trace. This failed since there is a limit to how many file handles we can
+     * have opened simultaneously. Then a round-robin scheme was implemented,
+     * this lead up to a two competing contexts syncing up and using the same
+     * file handler, causing horrible slowdowns. Now a random replacement
+     * algorithm is selected. This is the same as used by arm processors, and it
+     * works quite well when many cores so this looks promising for very
+     * multi-threaded systems.
+     *
+     * @param context
+     *            the context to look up
+     * @return the iterator referring to the context
+     */
+    public CtfIterator getIterator(final CtfTmfContext context) {
+        /*
+         * if the element is in the map, we don't need to do anything else.
+         */
+        CtfIterator retVal = fMap.get(context);
+        if (retVal == null) {
+            /*
+             * Assign an iterator to a context, this means we will need to seek
+             * at the end.
+             */
+            if (fRandomAccess.size() < MAX_SIZE) {
+                /*
+                 * if we're not full yet, just add an element.
+                 */
+                retVal = fTrace.createIterator();
+                addElement(context, retVal);
+
+            } else {
+                /*
+                 * if we're full, randomly replace an element
+                 */
+                retVal = replaceRandomElement(context);
+            }
+            if (context.getLocation() != null) {
+                final CtfLocationInfo location = (CtfLocationInfo) context.getLocation().getLocationInfo();
+                retVal.seek(location);
+            }
+        }
+        return retVal;
+    }
+
+    public void removeIterator(CtfTmfContext context) {
+        fMap.remove(context);
+        fRandomAccess.remove(context);
+    }
+
+    /**
+     * Add a pair of context and element to the hashmap and the arraylist.
+     *
+     * @param context
+     *            the context
+     * @param elem
+     *            the iterator
+     */
+    private void addElement(final CtfTmfContext context,
+            final CtfIterator elem) {
+        fMap.put(context, elem);
+        fRandomAccess.add(context);
+    }
+
+    /**
+     * Replace a random element
+     *
+     * @param context
+     *            the context to swap in
+     * @return the iterator of the removed elements.
+     */
+    private CtfIterator replaceRandomElement(
+            final CtfTmfContext context) {
+        /*
+         * This needs some explanation too: We need to select a random victim
+         * and remove it. The order of the elements is not important, so instead
+         * of just calling arraylist.remove(element) which has an O(n)
+         * complexity, we pick an random number. The element is swapped out of
+         * the array and removed and replaced in the hashmap.
+         */
+        final int size = fRandomAccess.size();
+        final int pos = fRnd.nextInt(size);
+        final CtfTmfContext victim = fRandomAccess.get(pos);
+        fRandomAccess.set(pos, context);
+        final CtfIterator elem = fMap.remove(victim);
+        fMap.put(context, elem);
+        return elem;
+    }
+
+    void clear() {
+        for (CtfIterator iterator : fMap.values()) {
+            iterator.dispose();
+        }
+        fMap.clear();
+        fRandomAccess.clear();
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfLocation.java b/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfLocation.java
new file mode 100644 (file)
index 0000000..e909c8f
--- /dev/null
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial API and implementation
+ *   Alexandre Montplaisir - Extends TmfLocation
+ *******************************************************************************/
+package org.eclipse.linuxtools.tmf.ctf.core;
+
+import java.nio.ByteBuffer;
+
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfLocation;
+
+/**
+ * The nugget of information that is unique to a location in a CTF trace.
+ *
+ * It can be copied and used to restore a position in a given trace.
+ *
+ * @version 1.0
+ * @author Matthew Khouzam
+ */
+public final class CtfLocation extends TmfLocation {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    /**
+     * An invalid location
+     */
+    public static final CtfLocationInfo INVALID_LOCATION = new CtfLocationInfo(-1, -1);
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Basic constructor for CtfLocation. Uses a default index of 0.
+     *
+     * @param timestamp
+     *            The timestamp of this location
+     * @since 2.0
+     */
+    public CtfLocation(final ITmfTimestamp timestamp) {
+        this(timestamp.getValue(), 0);
+    }
+
+    /**
+     * Constructor using timestamp object and index
+     *
+     * @param timestamp
+     *            The timestamp of this location
+     * @param index
+     *            The index of this location for this timestamp
+     * @since 2.0
+     */
+    public CtfLocation(final ITmfTimestamp timestamp, long index) {
+        this(timestamp.getValue(), index);
+    }
+
+    /**
+     * Constructor using a long value for the timestamp, and an index
+     *
+     * @param timestampValue
+     *            The new timestamp
+     * @param index
+     *            The new index
+     * @since 2.0
+     */
+    public CtfLocation(final long timestampValue, final long index) {
+       super(new CtfLocationInfo(timestampValue, index));
+    }
+
+    /**
+     * Constructor using a pre-made locationInfo object
+     *
+     * @param locationInfo
+     *            The locationInfo object to use
+     * @since 2.0
+     */
+    public CtfLocation(CtfLocationInfo locationInfo) {
+        super(locationInfo);
+    }
+
+    /**
+     * Copy constructor
+     *
+     * @param location
+     *            Other location to copy
+     * @since 2.0
+     */
+    public CtfLocation(final CtfLocation location) {
+        super(location);
+    }
+
+    // ------------------------------------------------------------------------
+    // TmfLocation
+    // ------------------------------------------------------------------------
+
+    /**
+     * Construct the location from the ByteBuffer.
+     *
+     * @param bufferIn
+     *            the buffer to read from
+     *
+     * @since 3.0
+     */
+    public CtfLocation(ByteBuffer bufferIn) {
+        super(new CtfLocationInfo(bufferIn));
+    }
+
+    /**
+     * @since 2.0
+     */
+    @Override
+    public CtfLocationInfo getLocationInfo() {
+        return (CtfLocationInfo) super.getLocationInfo();
+    }
+
+    // ------------------------------------------------------------------------
+    // Object
+    // ------------------------------------------------------------------------
+
+    @Override
+    public String toString() {
+        if (getLocationInfo().equals(CtfLocation.INVALID_LOCATION )) {
+            return getClass().getSimpleName() + " [INVALID]"; //$NON-NLS-1$
+        }
+        return super.toString();
+    }
+
+    /**
+     * Constructs the location from the ByteBuffer. This typically happens when reading from disk.
+     *
+     * @since 3.0
+     */
+    @Override
+    public void serialize(ByteBuffer bufferOut) {
+        getLocationInfo().serialize(bufferOut);
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfLocationInfo.java b/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfLocationInfo.java
new file mode 100644 (file)
index 0000000..c0088ac
--- /dev/null
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.tmf.ctf.core;
+
+import java.nio.ByteBuffer;
+
+/**
+ * The data object to go in a {@link CtfLocation}.
+ *
+ * @author Matthew Khouzam
+ * @since 2.0
+ */
+public class CtfLocationInfo implements Comparable<CtfLocationInfo> {
+
+    private final long fTimestamp;
+    private final long fIndex;
+
+    /**
+     * @param ts
+     *            Timestamp
+     * @param index
+     *            Index of this event (if there are N elements with the same
+     *            timestamp, which one is it.)
+     */
+    public CtfLocationInfo(long ts, long index) {
+        fTimestamp = ts;
+        fIndex = index;
+    }
+
+    /**
+     * Construct the location from the ByteBuffer.
+     *
+     * @param bufferIn
+     *            the buffer to read from
+     *
+     * @since 3.0
+     */
+    public CtfLocationInfo(ByteBuffer bufferIn) {
+        fTimestamp = bufferIn.getLong();
+        fIndex = bufferIn.getLong();
+    }
+
+    /**
+     * @return The timestamp
+     */
+    public long getTimestamp() {
+        return fTimestamp;
+    }
+
+    /**
+     * @return The index of the element
+     */
+    public long getIndex() {
+        return fIndex;
+    }
+
+    // ------------------------------------------------------------------------
+    // Object
+    // ------------------------------------------------------------------------
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = (prime * result) + (int) (fIndex ^ (fIndex >>> 32));
+        result = (prime * result) + (int) (fTimestamp ^ (fTimestamp >>> 32));
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (!(obj instanceof CtfLocationInfo)) {
+            return false;
+        }
+        CtfLocationInfo other = (CtfLocationInfo) obj;
+        if (fIndex != other.fIndex) {
+            return false;
+        }
+        if (fTimestamp != other.fTimestamp) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "Element [" + fTimestamp + '/' + fIndex + ']'; //$NON-NLS-1$
+    }
+
+    // ------------------------------------------------------------------------
+    // Comparable
+    // ------------------------------------------------------------------------
+
+    @Override
+    public int compareTo(CtfLocationInfo other) {
+        if (fTimestamp > other.getTimestamp()) {
+            return 1;
+        }
+        if (fTimestamp < other.getTimestamp()) {
+            return -1;
+        }
+        if (fIndex > other.getIndex()) {
+            return 1;
+        }
+        if (fIndex < other.getIndex()) {
+            return -1;
+        }
+        return 0;
+    }
+
+    /**
+     * Write the location to the ByteBuffer so that it can be saved to disk.
+     *
+     * @param bufferOut
+     *            the buffer to write to
+     *
+     * @since 3.0
+     */
+    public void serialize(ByteBuffer bufferOut) {
+        bufferOut.putLong(fTimestamp);
+        bufferOut.putLong(fIndex);
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfCallsite.java b/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfCallsite.java
new file mode 100644 (file)
index 0000000..867db01
--- /dev/null
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Patrick Tasse - Initial API and implementation
+ *     Bernd Hufmann - Updated for new parent class
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core;
+
+import org.eclipse.linuxtools.ctf.core.event.CTFCallsite;
+import org.eclipse.linuxtools.tmf.core.event.lookup.TmfCallsite;
+
+/**
+ * CTF TMF call site information for source code lookup.
+ *
+ * @author Patrick Tasse
+ * @since 2.0
+ */
+public class CtfTmfCallsite extends TmfCallsite {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    /** The event name. */
+    final private String fEventName;
+
+    /** The instruction pointer. */
+    final private long fInstructionPointer;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Standard Constructor.
+     *
+     * @param callsite
+     *              - a CTF call site
+     */
+    CtfTmfCallsite(CTFCallsite callsite) {
+        super(callsite.getFileName(), callsite.getFunctionName(), callsite.getLineNumber());
+        fEventName = callsite.getEventName();
+        fInstructionPointer = callsite.getIp();
+    }
+
+    // ------------------------------------------------------------------------
+    // Accessors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Returns the event name of the call site.
+     * @return the event name
+     */
+    public String getEventName() {
+        return fEventName;
+    }
+
+    /**
+     * Returns the instruction pointer of the call site.
+     * @return the instruction pointer
+     */
+    public long getIntructionPointer() {
+        return fInstructionPointer;
+    }
+
+    // ------------------------------------------------------------------------
+    // Accessors
+    // ------------------------------------------------------------------------
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((fEventName == null) ? 0 : fEventName.hashCode());
+        result = prime * result + (int) (fInstructionPointer ^ (fInstructionPointer >>> 32));
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!super.equals(obj)) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        CtfTmfCallsite other = (CtfTmfCallsite) obj;
+        if (fEventName == null) {
+            if (other.fEventName != null) {
+                return false;
+            }
+        } else if (!fEventName.equals(other.fEventName)) {
+            return false;
+        }
+        if (fInstructionPointer != other.fInstructionPointer) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return getEventName() + "@0x" + Long.toHexString(fInstructionPointer) + ": " + //$NON-NLS-1$ //$NON-NLS-2$
+                getFileName() + ':' + Long.toString(getLineNumber()) + ' ' + getFileName() + "()"; //$NON-NLS-1$
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfContext.java b/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfContext.java
new file mode 100644 (file)
index 0000000..b490fe7
--- /dev/null
@@ -0,0 +1,201 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial API and implementation
+ *   Simon Delisle - Remove the iterator in dispose()
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core;
+
+import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+
+/**
+ * Lightweight Context for CtfTmf traces. Should only use 3 references, 1 ref to
+ * a boxed Long, a long and an int.
+ *
+ * @author Matthew Khouzam
+ * @version 1.0
+ * @since 2.0
+ */
+public class CtfTmfContext implements ITmfContext {
+
+    // -------------------------------------------
+    // Fields
+    // -------------------------------------------
+
+    private CtfLocation fCurLocation;
+    private long fCurRank;
+
+    private final CtfTmfTrace fTrace;
+
+    // -------------------------------------------
+    // Constructor
+    // -------------------------------------------
+
+    /**
+     * Constructor
+     *
+     * @param ctfTmfTrace
+     *            the parent trace
+     * @since 1.1
+     */
+    public CtfTmfContext(CtfTmfTrace ctfTmfTrace) {
+        fTrace = ctfTmfTrace;
+        fCurLocation = new CtfLocation(new CtfLocationInfo(0, 0));
+    }
+
+    // -------------------------------------------
+    // TmfContext Overrides
+    // -------------------------------------------
+
+    @Override
+    public long getRank() {
+        return fCurRank;
+    }
+
+    /**
+     * @since 3.0
+     */
+    @Override
+    public ITmfLocation getLocation() {
+        return fCurLocation;
+    }
+
+    @Override
+    public boolean hasValidRank() {
+        return fCurRank != CtfLocation.INVALID_LOCATION.getTimestamp();
+    }
+
+    /**
+     * @since 3.0
+     */
+    @Override
+    public void setLocation(ITmfLocation location) {
+        fCurLocation = (CtfLocation) location;
+        if (fCurLocation != null) {
+            getIterator().seek(fCurLocation.getLocationInfo());
+        }
+    }
+
+    @Override
+    public void setRank(long rank) {
+        fCurRank = rank;
+
+    }
+
+    @Override
+    public void increaseRank() {
+        if (hasValidRank()) {
+            fCurRank++;
+        }
+    }
+
+    // -------------------------------------------
+    // CtfTmfTrace Helpers
+    // -------------------------------------------
+
+    /**
+     * Gets the trace of this context.
+     *
+     * @return The trace of this context
+     */
+    public CtfTmfTrace getTrace() {
+        return fTrace;
+    }
+
+    /**
+     * Gets the current event. Wrapper to help CtfTmfTrace
+     *
+     * @return The event or null
+     */
+    public synchronized CtfTmfEvent getCurrentEvent() {
+        return getIterator().getCurrentEvent();
+    }
+
+    /**
+     * Advances to a the next event. Wrapper to help CtfTmfTrace
+     *
+     * @return success or not
+     */
+    public synchronized boolean advance() {
+        final CtfLocationInfo curLocationData = fCurLocation.getLocationInfo();
+        boolean retVal = getIterator().advance();
+        CtfTmfEvent currentEvent = getIterator().getCurrentEvent();
+
+        if (currentEvent != null) {
+            final long timestampValue = currentEvent.getTimestamp().getValue();
+            if (curLocationData.getTimestamp() == timestampValue) {
+                fCurLocation = new CtfLocation(timestampValue, curLocationData.getIndex() + 1);
+            } else {
+                fCurLocation = new CtfLocation(timestampValue, 0L);
+            }
+        } else {
+            fCurLocation = new CtfLocation(CtfLocation.INVALID_LOCATION);
+        }
+
+        return retVal;
+    }
+
+    @Override
+    public void dispose() {
+        CtfIteratorManager.removeIterator(fTrace, this);
+    }
+
+    /**
+     * Seeks to a given timestamp. Wrapper to help CtfTmfTrace
+     *
+     * @param timestamp
+     *            desired timestamp
+     * @return success or not
+     */
+    public synchronized boolean seek(final long timestamp) {
+        fCurLocation = new CtfLocation(timestamp, 0);
+        return getIterator().seek(timestamp);
+    }
+
+    /**
+     * Seeks to a given location. Wrapper to help CtfTmfTrace
+     * @param location
+     *              unique location to find the event.
+     *
+     * @return success or not
+     * @since 2.0
+     */
+    public synchronized boolean seek(final CtfLocationInfo location) {
+        fCurLocation = new CtfLocation(location);
+        return getIterator().seek(location);
+    }
+
+    @Override
+    public CtfTmfContext clone() {
+        CtfTmfContext ret = null;
+        try {
+            ret = (CtfTmfContext) super.clone();
+            /* Fields are immutable, no need to deep-copy them */
+        } catch (CloneNotSupportedException e) {
+            /* Should not happen, we're calling Object.clone() */
+        }
+        return ret;
+    }
+
+    // -------------------------------------------
+    // Private helpers
+    // -------------------------------------------
+
+    /**
+     * Get iterator, called every time to get an iterator, no local copy is
+     * stored so that there is no need to "update"
+     *
+     * @return an iterator
+     */
+    private CtfIterator getIterator() {
+        return CtfIteratorManager.getIterator(fTrace, this);
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfEvent.java b/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfEvent.java
new file mode 100644 (file)
index 0000000..f08690f
--- /dev/null
@@ -0,0 +1,214 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Alexandre Montplaisir - Initial API and implementation
+ *     Bernd Hufmann - Updated for source and model lookup interfaces
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.linuxtools.ctf.core.event.CTFCallsite;
+import org.eclipse.linuxtools.ctf.core.event.IEventDeclaration;
+import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
+import org.eclipse.linuxtools.tmf.core.event.ITmfCustomAttributes;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEventType;
+import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
+import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
+import org.eclipse.linuxtools.tmf.core.event.lookup.ITmfModelLookup;
+import org.eclipse.linuxtools.tmf.core.event.lookup.ITmfSourceLookup;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
+
+/**
+ * A wrapper class around CTF's Event Definition/Declaration that maps all types
+ * of Declaration to native Java types.
+ *
+ * @version 1.0
+ * @author Alexandre Montplaisir
+ * @since 2.0
+ */
+public class CtfTmfEvent extends TmfEvent
+        implements ITmfSourceLookup, ITmfModelLookup, ITmfCustomAttributes {
+
+    // ------------------------------------------------------------------------
+    // Constants
+    // ------------------------------------------------------------------------
+
+    static final String NO_STREAM = "No stream"; //$NON-NLS-1$
+    private static final String EMPTY_CTF_EVENT_NAME = "Empty CTF event"; //$NON-NLS-1$
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    private final int fSourceCPU;
+    private final long fTypeId;
+    private final String fEventName;
+    private final IEventDeclaration fDeclaration;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Constructor used by {@link CtfTmfEventFactory#createEvent}
+     */
+    CtfTmfEvent(CtfTmfTrace trace, long rank, CtfTmfTimestamp timestamp,
+            ITmfEventField content, String fileName, int cpu,
+            IEventDeclaration declaration) {
+        super(trace,
+                rank,
+                timestamp,
+                String.valueOf(cpu), // Source
+                null, // Event type. We don't use TmfEvent's field here, we re-implement getType()
+                content,
+                fileName // Reference
+        );
+
+        fDeclaration = declaration;
+        fSourceCPU = cpu;
+        fTypeId = declaration.getId();
+        fEventName = declaration.getName();
+
+    }
+
+    /**
+     * Inner constructor to create "null" events. Don't use this directly in
+     * normal usage, use {@link CtfTmfEventFactory#getNullEvent()} to get an
+     * instance of an empty event.
+     *
+     * This needs to be public however because it's used in extension points,
+     * and the framework will use this constructor to get the class type.
+     */
+    public CtfTmfEvent() {
+        super(null,
+                ITmfContext.UNKNOWN_RANK,
+                new CtfTmfTimestamp(-1),
+                null,
+                null,
+                new TmfEventField("", null, new CtfTmfEventField[0]), //$NON-NLS-1$
+                NO_STREAM);
+        fSourceCPU = -1;
+        fTypeId = -1;
+        fEventName = EMPTY_CTF_EVENT_NAME;
+        fDeclaration = null;
+    }
+
+    // ------------------------------------------------------------------------
+    // Getters/Setters/Predicates
+    // ------------------------------------------------------------------------
+
+    /**
+     * Gets the cpu core the event was recorded on.
+     *
+     * @return The cpu id for a given source. In lttng it's from CPUINFO
+     */
+    public int getCPU() {
+        return fSourceCPU;
+    }
+
+    /**
+     * Return this event's ID, according to the trace's metadata.
+     *
+     * Watch out, this ID is not constant from one trace to another for the same
+     * event types! Use "getEventName()" for a constant reference.
+     *
+     * @return The event ID
+     */
+    public long getID() {
+        return fTypeId;
+    }
+
+    @Override
+    public CtfTmfTrace getTrace() {
+        /*
+         * Should be of the right type, since we take a CtfTmfTrace at the
+         * constructor
+         */
+        return (CtfTmfTrace) super.getTrace();
+    }
+
+    @Override
+    public ITmfEventType getType() {
+        CtfTmfEventType ctfTmfEventType = CtfTmfEventType.get(getTrace(), fEventName);
+        if (ctfTmfEventType == null) {
+            /* Should only return null the first time */
+            ctfTmfEventType = new CtfTmfEventType(fEventName, getTrace(), getContent());
+        }
+        return ctfTmfEventType;
+    }
+
+    /**
+     * @since 2.0
+     */
+    @Override
+    public Set<String> listCustomAttributes() {
+        if (fDeclaration == null) {
+            return new HashSet<>();
+        }
+        return fDeclaration.getCustomAttributes();
+    }
+
+    /**
+     * @since 2.0
+     */
+    @Override
+    public String getCustomAttribute(String name) {
+        if (fDeclaration == null) {
+            return null;
+        }
+        return fDeclaration.getCustomAttribute(name);
+    }
+
+    /**
+     * Get the call site for this event.
+     *
+     * @return the call site information, or null if there is none
+     * @since 2.0
+     */
+    @Override
+    public CtfTmfCallsite getCallsite() {
+        CTFCallsite callsite = null;
+        CtfTmfTrace trace = getTrace();
+        if (trace == null) {
+            return null;
+        }
+        CTFTrace ctfTrace = trace.getCTFTrace();
+        /* Should not happen, but it is a good check */
+        if (ctfTrace == null) {
+            return null;
+        }
+        if (getContent() != null) {
+            ITmfEventField ipField = getContent().getField(CtfConstants.CONTEXT_FIELD_PREFIX + CtfConstants.IP_KEY);
+            if (ipField != null && ipField.getValue() instanceof Long) {
+                long ip = (Long) ipField.getValue();
+                callsite = ctfTrace.getCallsite(fEventName, ip);
+            }
+        }
+        if (callsite == null) {
+            callsite = ctfTrace.getCallsite(fEventName);
+        }
+        if (callsite != null) {
+            return new CtfTmfCallsite(callsite);
+        }
+        return null;
+    }
+
+    /**
+     * @since 2.0
+     */
+    @Override
+    public String getModelUri() {
+        return getCustomAttribute(CtfConstants.MODEL_URI_KEY);
+    }
+
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfEventFactory.java b/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfEventFactory.java
new file mode 100644 (file)
index 0000000..93ba0ed
--- /dev/null
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.linuxtools.ctf.core.CTFStrings;
+import org.eclipse.linuxtools.ctf.core.event.EventDefinition;
+import org.eclipse.linuxtools.ctf.core.event.IEventDeclaration;
+import org.eclipse.linuxtools.ctf.core.event.types.Definition;
+import org.eclipse.linuxtools.ctf.core.event.types.IntegerDefinition;
+import org.eclipse.linuxtools.ctf.core.event.types.StructDefinition;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
+import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
+
+/**
+ * Factory for CtfTmfEvent's.
+ *
+ * This code was moved out of CtfTmfEvent to provide better separation between
+ * the parsing/instantiation of events, and the usual TMF API implementations.
+ *
+ * @author Alexandre Montplaisir
+ * @since 2.0
+ */
+public final class CtfTmfEventFactory {
+
+    /**
+     * Don't let anyone instantiate this class.
+     */
+    private CtfTmfEventFactory() {}
+
+    /**
+     * Factory method to instantiate new {@link CtfTmfEvent}'s.
+     *
+     * @param eventDef
+     *            CTF EventDefinition object corresponding to this trace event
+     * @param fileName
+     *            The path to the trace file
+     * @param originTrace
+     *            The trace from which this event originates
+     * @return The newly-built CtfTmfEvent
+     */
+    public static CtfTmfEvent createEvent(EventDefinition eventDef,
+            String fileName, CtfTmfTrace originTrace) {
+
+        /* Prepare what to pass to CtfTmfEvent's constructor */
+        final IEventDeclaration eventDecl = eventDef.getDeclaration();
+        final long ts = eventDef.getTimestamp();
+        final CtfTmfTimestamp timestamp = originTrace.createTimestamp(
+                originTrace.getCTFTrace().timestampCyclesToNanos(ts));
+
+        int sourceCPU = eventDef.getCPU();
+
+        ITmfEventField content = new TmfEventField(
+                ITmfEventField.ROOT_FIELD_ID, null, parseFields(eventDef));
+
+        String reference = fileName == null ? CtfTmfEvent.NO_STREAM : fileName;
+
+        /* Handle the special case of lost events */
+        if (eventDecl.getName().equals(CTFStrings.LOST_EVENT_NAME)) {
+            Definition nbLostEventsDef = eventDef.getFields().getDefinitions().get(CTFStrings.LOST_EVENTS_FIELD);
+            Definition durationDef = eventDef.getFields().getDefinitions().get(CTFStrings.LOST_EVENTS_DURATION);
+            if (!(nbLostEventsDef instanceof IntegerDefinition) || !(durationDef instanceof IntegerDefinition)) {
+                /*
+                 * One or both of these fields doesn't exist, or is not of the
+                 * right type. The event claims to be a "lost event", but is
+                 * malformed. Log it and return a null event instead.
+                 */
+                return getNullEvent();
+            }
+            long nbLostEvents = ((IntegerDefinition) nbLostEventsDef).getValue();
+            long duration = ((IntegerDefinition) durationDef).getValue();
+            CtfTmfTimestamp timestampEnd = new CtfTmfTimestamp(
+                    originTrace.getCTFTrace().timestampCyclesToNanos(ts) + duration);
+
+            CtfTmfLostEvent lostEvent = new CtfTmfLostEvent(originTrace,
+                    ITmfContext.UNKNOWN_RANK,
+                    content,
+                    reference, // filename
+                    sourceCPU,
+                    eventDecl,
+                    new TmfTimeRange(timestamp, timestampEnd),
+                    nbLostEvents);
+            return lostEvent;
+        }
+
+        /* Handle standard event types */
+        CtfTmfEvent event = new CtfTmfEvent(
+                originTrace,
+                ITmfContext.UNKNOWN_RANK,
+                timestamp,
+                content,
+                reference, // filename
+                sourceCPU,
+                eventDecl);
+        return event;
+    }
+
+    /* Singleton instance of a null event */
+    private static CtfTmfEvent nullEvent = null;
+
+    /**
+     * Get an instance of a null event.
+     *
+     * @return An empty event
+     */
+    public static CtfTmfEvent getNullEvent() {
+        if (nullEvent == null) {
+            nullEvent = new CtfTmfEvent();
+        }
+        return nullEvent;
+    }
+
+    /**
+     * Extract the field information from the structDefinition haze-inducing
+     * mess, and put them into something ITmfEventField can cope with.
+     */
+    private static CtfTmfEventField[] parseFields(EventDefinition eventDef) {
+        List<CtfTmfEventField> fields = new ArrayList<>();
+
+        StructDefinition structFields = eventDef.getFields();
+        for (Map.Entry<String, Definition> entry : structFields.getDefinitions().entrySet()) {
+            String curFieldName = entry.getKey();
+            Definition curFieldDef = entry.getValue();
+            CtfTmfEventField curField = CtfTmfEventField.parseField(curFieldDef, curFieldName);
+            fields.add(curField);
+        }
+
+        /* Add context information as CtfTmfEventField */
+        StructDefinition structContext = eventDef.getContext();
+        if (structContext != null) {
+            for (Map.Entry<String, Definition> entry : structContext.getDefinitions().entrySet()) {
+                /* Prefix field name */
+                String curContextName = CtfConstants.CONTEXT_FIELD_PREFIX + entry.getKey();
+                Definition curContextDef = entry.getValue();
+                CtfTmfEventField curContext = CtfTmfEventField.parseField(curContextDef, curContextName);
+                fields.add(curContext);
+            }
+        }
+
+        return fields.toArray(new CtfTmfEventField[fields.size()]);
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfEventField.java b/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfEventField.java
new file mode 100644 (file)
index 0000000..1640db6
--- /dev/null
@@ -0,0 +1,454 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ã‰cole Polytechnique de Montréal
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *  Matthew Khouzam - Initial API and implementation
+ *  Alexandre Montplaisir - Initial API and implementation, extend TmfEventField
+ *  Bernd Hufmann - Add Enum field handling
+ *  Geneviève Bastien - Add Struct and Variant field handling
+ *  Jean-Christian Kouame - Correct handling of unsigned integer fields
+ *  François Doray - Add generic array field type
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map.Entry;
+
+import org.eclipse.linuxtools.ctf.core.event.types.ArrayDefinition;
+import org.eclipse.linuxtools.ctf.core.event.types.Definition;
+import org.eclipse.linuxtools.ctf.core.event.types.EnumDefinition;
+import org.eclipse.linuxtools.ctf.core.event.types.FloatDefinition;
+import org.eclipse.linuxtools.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.linuxtools.ctf.core.event.types.IntegerDefinition;
+import org.eclipse.linuxtools.ctf.core.event.types.SequenceDeclaration;
+import org.eclipse.linuxtools.ctf.core.event.types.SequenceDefinition;
+import org.eclipse.linuxtools.ctf.core.event.types.StringDefinition;
+import org.eclipse.linuxtools.ctf.core.event.types.StructDefinition;
+import org.eclipse.linuxtools.ctf.core.event.types.VariantDefinition;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
+import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
+
+/**
+ * The CTF implementation of the TMF event field model
+ *
+ * @version 2.0
+ * @author Matthew Khouzam
+ * @author Alexandre Montplaisir
+ */
+public abstract class CtfTmfEventField extends TmfEventField {
+
+    // ------------------------------------------------------------------------
+    // Constructor
+    // ------------------------------------------------------------------------
+
+    /**
+     * Standard constructor. Only to be used internally, call parseField() to
+     * generate a new field object.
+     *
+     * @param name
+     *            The name of this field
+     * @param value
+     *            The value of this field. Its type should match the field type.
+     * @param fields
+     *            The children fields. Useful for composite fields
+     * @since 2.0
+     */
+    protected CtfTmfEventField(String name, Object value, ITmfEventField[] fields) {
+        super(/* Strip the underscore from the field name if there is one */
+                name.startsWith("_") ? name.substring(1) : name, //$NON-NLS-1$
+                value,
+                fields);
+    }
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    /**
+     * Factory method to instantiate CtfTmfEventField objects.
+     *
+     * @param fieldDef
+     *            The CTF Definition of this event field
+     * @param fieldName
+     *            String The name to assign to this field
+     * @return The resulting CtfTmfEventField object
+     */
+    public static CtfTmfEventField parseField(Definition fieldDef,
+            String fieldName) {
+        CtfTmfEventField field = null;
+
+        /* Determine the Definition type */
+        if (fieldDef instanceof IntegerDefinition) {
+            IntegerDefinition intDef = (IntegerDefinition) fieldDef;
+            int base = intDef.getDeclaration().getBase();
+            field = new CTFIntegerField(fieldName, intDef.getValue(), base, intDef.getDeclaration().isSigned());
+
+        } else if (fieldDef instanceof EnumDefinition) {
+            EnumDefinition enumDef = (EnumDefinition) fieldDef;
+            field = new CTFEnumField(fieldName, new CtfEnumPair(enumDef.getValue(), enumDef.getIntegerValue()));
+
+        } else if (fieldDef instanceof StringDefinition) {
+            field = new CTFStringField(fieldName, ((StringDefinition) fieldDef).getValue());
+
+        } else if (fieldDef instanceof FloatDefinition) {
+            FloatDefinition floatDef = (FloatDefinition) fieldDef;
+            field = new CTFFloatField(fieldName, floatDef.getValue());
+
+        } else if (fieldDef instanceof ArrayDefinition) {
+            ArrayDefinition arrayDef = (ArrayDefinition) fieldDef;
+
+            if (arrayDef.getDeclaration().isString()) {
+                /* This is an array of UTF-8 bytes, a.k.a. a String! */
+                field = new CTFStringField(fieldName, fieldDef.toString());
+
+            } else {
+                /* Arrays of elements of any other type */
+                Definition[] definitions = arrayDef.getDefinitions();
+                CtfTmfEventField[] elements = new CtfTmfEventField[definitions.length];
+
+                /* Parse the elements of the array. */
+                for (int i = 0; i < definitions.length; i++) {
+                    CtfTmfEventField curField = CtfTmfEventField.parseField(
+                            definitions[i], fieldName + '[' + i + ']');
+                    elements[i] = curField;
+                }
+
+                field = new CTFArrayField(fieldName, elements);
+            }
+        } else if (fieldDef instanceof SequenceDefinition) {
+            SequenceDefinition seqDef = (SequenceDefinition) fieldDef;
+            SequenceDeclaration seqDecl = seqDef.getDeclaration();
+
+            if (seqDef.getLength() == 0) {
+                /* Some sequences have length = 0. Simply use an empty string */
+                field = new CTFStringField(fieldName, ""); //$NON-NLS-1$
+            } else if (seqDef.isString()) {
+                /* Interpret this sequence as a String */
+                field = new CTFStringField(fieldName, seqDef.toString());
+            } else if (seqDecl.getElementType() instanceof IntegerDeclaration) {
+                /* Sequence of integers => CTFIntegerArrayField */
+                long[] values = new long[seqDef.getLength()];
+                for (int i = 0; i < seqDef.getLength(); i++) {
+                    values[i] = ((IntegerDefinition) seqDef.getElem(i)).getValue();
+                }
+                field = new CTFIntegerArrayField(fieldName, values,
+                        ((IntegerDeclaration) seqDecl.getElementType()).getBase(),
+                        ((IntegerDeclaration) seqDecl.getElementType()).isSigned());
+
+            }
+            /* Add other Sequence types here */
+
+        } else if (fieldDef instanceof StructDefinition) {
+            StructDefinition strDef = (StructDefinition) fieldDef;
+
+            String curFieldName = null;
+            Definition curFieldDef;
+            CtfTmfEventField curField;
+            List<ITmfEventField> list = new ArrayList<>();
+            /* Recursively parse the fields */
+            for (Entry<String, Definition> entry : strDef.getDefinitions().entrySet()) {
+                curFieldName = entry.getKey();
+                curFieldDef = entry.getValue();
+                curField = CtfTmfEventField.parseField(curFieldDef, curFieldName);
+                list.add(curField);
+            }
+            field = new CTFStructField(fieldName, list.toArray(new CtfTmfEventField[list.size()]));
+
+        } else if (fieldDef instanceof VariantDefinition) {
+            VariantDefinition varDef = (VariantDefinition) fieldDef;
+
+            String curFieldName = varDef.getCurrentFieldName();
+            Definition curFieldDef = varDef.getDefinitions().get(curFieldName);
+            if (curFieldDef != null) {
+                CtfTmfEventField subField = CtfTmfEventField.parseField(curFieldDef, curFieldName);
+                field = new CTFVariantField(fieldName, subField);
+            } else {
+                /* A safe-guard, but curFieldDef should never be null */
+                field = new CTFStringField(curFieldName, ""); //$NON-NLS-1$
+            }
+
+        } else {
+            /*
+             * Safe-guard, to avoid null exceptions later, field is expected not
+             * to be null
+             */
+            field = new CTFStringField(fieldName, Messages.CtfTmfEventField_UnsupportedType + fieldDef.getClass().toString());
+        }
+        return field;
+    }
+
+    @Override
+    public String toString() {
+        return getName() + '=' + getFormattedValue();
+    }
+
+}
+
+/**
+ * The CTF field implementation for integer fields.
+ *
+ * @author alexmont
+ */
+final class CTFIntegerField extends CtfTmfEventField {
+
+    private final int fBase;
+    private final boolean fSigned;
+
+    /**
+     * A CTF "IntegerDefinition" can be an integer of any byte size, so in the
+     * Java parser this is interpreted as a long.
+     *
+     * @param name
+     *            The name of this field
+     * @param longValue
+     *            The integer value of this field
+     * @param signed
+     *            Is the value signed or not
+     */
+    CTFIntegerField(String name, long longValue, int base, boolean signed) {
+        super(name, longValue, null);
+        fSigned = signed;
+        fBase = base;
+    }
+
+    @Override
+    public Long getValue() {
+        return (Long) super.getValue();
+    }
+
+    @Override
+    public String getFormattedValue() {
+        return IntegerDefinition.formatNumber(getValue(), fBase, fSigned);
+    }
+
+}
+
+/**
+ * The CTF field implementation for string fields
+ *
+ * @author alexmont
+ */
+final class CTFStringField extends CtfTmfEventField {
+
+    /**
+     * Constructor for CTFStringField.
+     *
+     * @param strValue
+     *            The string value of this field
+     * @param name
+     *            The name of this field
+     */
+    CTFStringField(String name, String strValue) {
+        super(name, strValue, null);
+    }
+
+    @Override
+    public String getValue() {
+        return (String) super.getValue();
+    }
+}
+
+/**
+ * CTF field implementation for arrays of integers.
+ *
+ * @author alexmont
+ */
+final class CTFIntegerArrayField extends CtfTmfEventField {
+
+    private final int fBase;
+    private final boolean fSigned;
+    private String fFormattedValue = null;
+
+    /**
+     * Constructor for CTFIntegerArrayField.
+     *
+     * @param name
+     *            The name of this field
+     * @param longValues
+     *            The array of integers (as longs) that compose this field's
+     *            value
+     * @param signed
+     *            Are the values in the array signed or not
+     */
+    CTFIntegerArrayField(String name, long[] longValues, int base, boolean signed) {
+        super(name, longValues, null);
+        fBase = base;
+        fSigned = signed;
+    }
+
+    @Override
+    public long[] getValue() {
+        return (long[]) super.getValue();
+    }
+
+    @Override
+    public synchronized String getFormattedValue() {
+        if (fFormattedValue == null) {
+            List<String> strings = new ArrayList<>();
+            for (long value : getValue()) {
+                strings.add(IntegerDefinition.formatNumber(value, fBase, fSigned));
+            }
+            fFormattedValue = strings.toString();
+        }
+        return fFormattedValue;
+    }
+
+}
+
+/**
+ * CTF field implementation for arrays of arbitrary types.
+ *
+ * @author fdoray
+ */
+final class CTFArrayField extends CtfTmfEventField {
+
+    private String fFormattedValue = null;
+
+    /**
+     * Constructor for CTFArrayField.
+     *
+     * @param name
+     *            The name of this field
+     * @param elements
+     *            The array elements of this field
+     */
+    CTFArrayField(String name, CtfTmfEventField[] elements) {
+        super(name, elements, elements);
+    }
+
+    @Override
+    public CtfTmfEventField[] getValue() {
+        return (CtfTmfEventField[]) super.getValue();
+    }
+
+    @Override
+    public synchronized String getFormattedValue() {
+        if (fFormattedValue == null) {
+            List<String> strings = new ArrayList<>();
+            for (CtfTmfEventField element : getValue()) {
+                strings.add(element.getFormattedValue());
+            }
+            fFormattedValue = strings.toString();
+        }
+        return fFormattedValue;
+    }
+}
+
+/**
+ * CTF field implementation for floats.
+ *
+ * @author emathko
+ */
+final class CTFFloatField extends CtfTmfEventField {
+
+    /**
+     * Constructor for CTFFloatField.
+     *
+     * @param value
+     *            The float value (actually a double) of this field
+     * @param name
+     *            The name of this field
+     */
+    protected CTFFloatField(String name, double value) {
+        super(name, value, null);
+    }
+
+    @Override
+    public Double getValue() {
+        return (Double) super.getValue();
+    }
+}
+
+/**
+ * The CTF field implementation for Enum fields
+ *
+ * @author Bernd Hufmann
+ */
+final class CTFEnumField extends CtfTmfEventField {
+
+    /**
+     * Constructor for CTFEnumField.
+     *
+     * @param enumValue
+     *            The Enum value consisting of a pair of Enum value name and its
+     *            long value
+     * @param name
+     *            The name of this field
+     */
+    CTFEnumField(String name, CtfEnumPair enumValue) {
+        super(name, new CtfEnumPair(enumValue.getFirst(),
+                enumValue.getSecond()), null);
+    }
+
+    @Override
+    public CtfEnumPair getValue() {
+        return (CtfEnumPair) super.getValue();
+    }
+}
+
+/**
+ * The CTF field implementation for struct fields with sub-fields
+ *
+ * @author gbastien
+ */
+final class CTFStructField extends CtfTmfEventField {
+
+    /**
+     * Constructor for CTFStructField.
+     *
+     * @param fields
+     *            The children of this field
+     * @param name
+     *            The name of this field
+     */
+    CTFStructField(String name, CtfTmfEventField[] fields) {
+        super(name, fields, fields);
+    }
+
+    @Override
+    public CtfTmfEventField[] getValue() {
+        return (CtfTmfEventField[]) super.getValue();
+    }
+
+    @Override
+    public String getFormattedValue() {
+        return Arrays.toString(getValue());
+    }
+
+}
+
+/**
+ * The CTF field implementation for variant fields its child
+ *
+ * @author gbastien
+ */
+final class CTFVariantField extends CtfTmfEventField {
+
+    /**
+     * Constructor for CTFVariantField.
+     *
+     * @param field
+     *            The field selected for this variant
+     * @param name
+     *            The name of this field
+     */
+    CTFVariantField(String name, CtfTmfEventField field) {
+        super(name, field, new CtfTmfEventField[] { field });
+    }
+
+    @Override
+    public CtfTmfEventField getValue() {
+        return (CtfTmfEventField) super.getValue();
+    }
+
+}
+
+/* Implement other possible fields types here... */
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfEventType.java b/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfEventType.java
new file mode 100644 (file)
index 0000000..85bb249
--- /dev/null
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core;
+
+import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
+import org.eclipse.linuxtools.tmf.core.event.TmfEventType;
+import org.eclipse.linuxtools.tmf.core.event.TmfEventTypeManager;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+
+/**
+ * The CTF extension of the TMF event type
+ *
+ * @version 1.0
+ * @author Matthew khouzam
+ */
+public class CtfTmfEventType extends TmfEventType {
+
+    /**
+     * CTFTmfEventType context for the event type manager
+     */
+    private static final String CONTEXT_ID = "Ctf Event"; //$NON-NLS-1$
+
+    private static final String UNKNOWN_TRACE = "unknown"; //$NON-NLS-1$
+
+    /**
+     * Constructor for CtfTmfEventType.
+     *
+     * @param eventName
+     *            The event name
+     * @param trace
+     *            the parent trace
+     * @param content
+     *            The event field
+     * @since 3.0
+     */
+    public CtfTmfEventType(String eventName, ITmfTrace trace, ITmfEventField content) {
+        super(computeContextName(trace), eventName, content);
+    }
+
+    /**
+     * Method toString.
+     *
+     * @return String
+     */
+    @Override
+    public String toString() {
+        return getName();
+    }
+
+    /**
+     * gets the event type for an event name
+     *
+     * @param trace
+     *            the parent trace
+     * @param eventName
+     *            the event name
+     * @return the event type
+     * @since 3.0
+     */
+    public static CtfTmfEventType get(CtfTmfTrace trace, String eventName) {
+        return (CtfTmfEventType) TmfEventTypeManager.getInstance().getType(computeContextName(trace), eventName);
+    }
+
+    /**
+     * Get the context name of a ctf trace
+     *
+     * @param trace
+     *            the trace
+     * @return the context name
+     * @since 3.0
+     */
+    public static String computeContextName(ITmfTrace trace) {
+        return CONTEXT_ID + "/" + (trace == null ? UNKNOWN_TRACE : trace.getPath()); //$NON-NLS-1$
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfLostEvent.java b/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfLostEvent.java
new file mode 100644 (file)
index 0000000..1e4e433
--- /dev/null
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core;
+
+import org.eclipse.linuxtools.ctf.core.event.IEventDeclaration;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
+import org.eclipse.linuxtools.tmf.core.event.ITmfLostEvent;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+
+/**
+ * An implementation of {@link ITmfLostEvent} for use in the CTF adaptor.
+ *
+ * @author Alexandre Montplaisir
+ * @since 2.2
+ */
+public class CtfTmfLostEvent extends CtfTmfEvent implements ITmfLostEvent {
+
+    private final TmfTimeRange fTimeRange;
+    private final long fNbLost;
+
+    /**
+     * Constructor. Only {@link CtfTmfEventFactory} should call this.
+     *
+     * @param trace
+     *            The origin trace
+     * @param rank
+     *            The rank of the event in the trace
+     * @param content
+     *            The event's payload (fields). In case this event has some.
+     * @param fileName
+     *            The name of the trace file from which this event comes
+     * @param cpu
+     *            The CPU on which this event happened
+     * @param declaration
+     *            The CTF Event Declaration object that created this event
+     * @param timeRange
+     *            The time range of lost events indicated by this one
+     * @param nbLost
+     *            The number of lost events in the range
+     */
+    CtfTmfLostEvent(CtfTmfTrace trace,
+            long rank,
+            ITmfEventField content,
+            String fileName,
+            int cpu,
+            IEventDeclaration declaration,
+            TmfTimeRange timeRange,
+            long nbLost) {
+        /*
+         * Only the factory should call this method, the case to
+         * (CtfTmfTimestamp) should be safe.
+         */
+        super(trace, rank, (CtfTmfTimestamp) timeRange.getStartTime(), content, fileName, cpu, declaration);
+        fTimeRange = timeRange;
+        fNbLost = nbLost;
+    }
+
+    @Override
+    public TmfTimeRange getTimeRange() {
+        return fTimeRange;
+    }
+
+    @Override
+    public long getNbLostEvents() {
+        return fNbLost;
+    }
+
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfTimestamp.java b/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfTimestamp.java
new file mode 100644 (file)
index 0000000..1d6873c
--- /dev/null
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core;
+
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
+
+/**
+ * The CTF adapter for the TMF timestamp. It's basically the same as a
+ * TmfTimestamp, but the scale is always nanoseconds, and the precision is 0.
+ *
+ * @version 1.2
+ * @author Matthew khouzam
+ */
+public final class CtfTmfTimestamp extends TmfTimestamp {
+
+    /**
+     * Constructor for CtfTmfTimestamp.
+     *
+     * @param timestamp
+     *            The timestamp value (in nanoseconds)
+     */
+    public CtfTmfTimestamp(long timestamp) {
+        super(timestamp, ITmfTimestamp.NANOSECOND_SCALE, 0);
+    }
+
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfTrace.java b/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/CtfTmfTrace.java
new file mode 100644 (file)
index 0000000..dc0cd4d
--- /dev/null
@@ -0,0 +1,488 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson, Ã‰cole Polytechnique de Montréal
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial API and implementation
+ *   Patrick Tasse - Updated for removal of context clone
+ *   Geneviève Bastien - Added the createTimestamp function
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core;
+
+import java.nio.BufferOverflowException;
+import java.nio.ByteBuffer;
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.linuxtools.ctf.core.event.CTFClock;
+import org.eclipse.linuxtools.ctf.core.event.IEventDeclaration;
+import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
+import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
+import org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader;
+import org.eclipse.linuxtools.internal.tmf.ctf.core.Activator;
+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.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfEventParser;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTraceProperties;
+import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.TraceValidationStatus;
+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.TmfBTreeTraceIndexer;
+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;
+
+/**
+ * The CTf trace handler
+ *
+ * @version 1.0
+ * @author Matthew khouzam
+ */
+public class CtfTmfTrace extends TmfTrace
+        implements ITmfEventParser, ITmfTraceProperties, ITmfPersistentlyIndexable {
+
+    // -------------------------------------------
+    // Constants
+    // -------------------------------------------
+    /**
+     * Default cache size for CTF traces
+     */
+    protected static final int DEFAULT_CACHE_SIZE = 50000;
+
+    /*
+     * The Ctf clock unique identifier field
+     */
+    private static final String CLOCK_HOST_PROPERTY = "uuid"; //$NON-NLS-1$
+    private static final int CONFIDENCE = 10;
+
+    // -------------------------------------------
+    // Fields
+    // -------------------------------------------
+
+    /* Reference to the CTF Trace */
+    private CTFTrace fTrace;
+
+    // -------------------------------------------
+    // TmfTrace Overrides
+    // -------------------------------------------
+    /**
+     * Method initTrace.
+     *
+     * @param resource
+     *            The resource associated with this trace
+     * @param path
+     *            The path to the trace file
+     * @param eventType
+     *            The type of events that will be read from this trace
+     * @throws TmfTraceException
+     *             If something went wrong while reading the trace
+     */
+    @Override
+    public void initTrace(final IResource resource, final String path, final Class<? extends ITmfEvent> eventType)
+            throws TmfTraceException {
+        /*
+         * Set the cache size. This has to be done before the call to super()
+         * because the super needs to know the cache size.
+         */
+        setCacheSize();
+
+        super.initTrace(resource, path, eventType);
+
+        try {
+            this.fTrace = new CTFTrace(path);
+            CtfIteratorManager.addTrace(this);
+            CtfTmfContext ctx;
+            /* Set the start and (current) end times for this trace */
+            ctx = (CtfTmfContext) seekEvent(0L);
+            CtfTmfEvent event = getNext(ctx);
+            if ((ctx.getLocation().equals(CtfIterator.NULL_LOCATION)) || (ctx.getCurrentEvent() == null)) {
+                /* Handle the case where the trace is empty */
+                this.setStartTime(TmfTimestamp.BIG_BANG);
+            } else {
+                final ITmfTimestamp curTime = event.getTimestamp();
+                this.setStartTime(curTime);
+                this.setEndTime(curTime);
+            }
+
+        } catch (final CTFReaderException e) {
+            /*
+             * If it failed at the init(), we can assume it's because the file
+             * was not found or was not recognized as a CTF trace. Throw into
+             * the new type of exception expected by the rest of TMF.
+             */
+            throw new TmfTraceException(e.getMessage(), e);
+        }
+    }
+
+    @Override
+    public synchronized void dispose() {
+        CtfIteratorManager.removeTrace(this);
+        if (fTrace != null) {
+            fTrace.dispose();
+            fTrace = null;
+        }
+        super.dispose();
+    }
+
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The default implementation sets the confidence to 10 if the trace is a
+     * valid CTF trace.
+     */
+    @Override
+    public IStatus validate(final IProject project, final String path) {
+        IStatus validTrace = new TraceValidationStatus(CONFIDENCE, Activator.PLUGIN_ID);
+        try {
+            final CTFTrace temp = new CTFTrace(path);
+            if (!temp.majorIsSet()) {
+                validTrace = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_MajorNotSet);
+            } else {
+                CTFTraceReader ctfTraceReader = new CTFTraceReader(temp);
+                if (!ctfTraceReader.hasMoreEvents()) {
+                    // TODO: This will need an additional check when we support live traces
+                    // because having no event is valid for a live trace
+                    validTrace = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_NoEvent);
+                }
+                ctfTraceReader.dispose();
+            }
+            temp.dispose();
+        } catch (final CTFReaderException e) {
+            validTrace = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_ReadingError +": " + e.toString()); //$NON-NLS-1$
+        } catch (final BufferOverflowException e){
+            validTrace = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_ReadingError +": " + Messages.CtfTmfTrace_BufferOverflowErrorMessage); //$NON-NLS-1$
+        }
+
+        return validTrace;
+    }
+
+    /**
+     * Method getCurrentLocation. This is not applicable in CTF
+     *
+     * @return null, since the trace has no knowledge of the current location
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getCurrentLocation()
+     * @since 3.0
+     */
+    @Override
+    public ITmfLocation getCurrentLocation() {
+        return null;
+    }
+
+    /**
+     * @since 3.0
+     */
+    @Override
+    public double getLocationRatio(ITmfLocation location) {
+        final CtfLocation curLocation = (CtfLocation) location;
+        final CtfTmfContext context = new CtfTmfContext(this);
+        context.setLocation(curLocation);
+        context.seek(curLocation.getLocationInfo());
+        final CtfLocationInfo currentTime = ((CtfLocationInfo) context.getLocation().getLocationInfo());
+        final long startTime = getIterator(this, context).getStartTime();
+        final long endTime = getIterator(this, context).getEndTime();
+        return ((double) currentTime.getTimestamp() - startTime)
+                / (endTime - startTime);
+    }
+
+    /**
+     * Method seekEvent.
+     *
+     * @param location
+     *            ITmfLocation<?>
+     * @return ITmfContext
+     * @since 3.0
+     */
+    @Override
+    public synchronized ITmfContext seekEvent(final ITmfLocation location) {
+        CtfLocation currentLocation = (CtfLocation) location;
+        CtfTmfContext context = new CtfTmfContext(this);
+        if (fTrace == null) {
+            context.setLocation(null);
+            context.setRank(ITmfContext.UNKNOWN_RANK);
+            return context;
+        }
+        /*
+         * The rank is set to 0 if the iterator seeks the beginning. If not, it
+         * will be set to UNKNOWN_RANK, since CTF traces don't support seeking
+         * by rank for now.
+         */
+        if (currentLocation == null) {
+            currentLocation = new CtfLocation(new CtfLocationInfo(0L, 0L));
+            context.setRank(0);
+        }
+        if (currentLocation.getLocationInfo() == CtfLocation.INVALID_LOCATION) {
+            currentLocation = new CtfLocation(getEndTime().getValue() + 1, 0L);
+        }
+        context.setLocation(currentLocation);
+        if (location == null) {
+            CtfTmfEvent event = getIterator(this, context).getCurrentEvent();
+            if (event != null) {
+                currentLocation = new CtfLocation(event.getTimestamp().getValue(), 0);
+            }
+        }
+        if (context.getRank() != 0) {
+            context.setRank(ITmfContext.UNKNOWN_RANK);
+        }
+        return context;
+    }
+
+    @Override
+    public synchronized ITmfContext seekEvent(double ratio) {
+        CtfTmfContext context = new CtfTmfContext(this);
+        if (fTrace == null) {
+            context.setLocation(null);
+            context.setRank(ITmfContext.UNKNOWN_RANK);
+            return context;
+        }
+        final long end = this.getEndTime().getValue();
+        final long start = this.getStartTime().getValue();
+        final long diff = end - start;
+        final long ratioTs = Math.round(diff * ratio) + start;
+        context.seek(ratioTs);
+        context.setRank(ITmfContext.UNKNOWN_RANK);
+        return context;
+    }
+
+    /**
+     * Method readNextEvent.
+     *
+     * @param context
+     *            ITmfContext
+     * @return CtfTmfEvent
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getNext(ITmfContext)
+     */
+    @Override
+    public synchronized CtfTmfEvent getNext(final ITmfContext context) {
+        if (fTrace == null) {
+            return null;
+        }
+        CtfTmfEvent event = null;
+        if (context instanceof CtfTmfContext) {
+            if (context.getLocation() == null || CtfLocation.INVALID_LOCATION.equals(context.getLocation().getLocationInfo())) {
+                return null;
+            }
+            CtfTmfContext ctfContext = (CtfTmfContext) context;
+            event = ctfContext.getCurrentEvent();
+
+            if (event != null) {
+                updateAttributes(context, event.getTimestamp());
+                ctfContext.advance();
+                ctfContext.increaseRank();
+            }
+        }
+
+        return event;
+    }
+
+    /**
+     * gets the CTFtrace that this is wrapping
+     *
+     * @return the CTF trace
+     */
+    public CTFTrace getCTFTrace() {
+        return fTrace;
+    }
+
+    /**
+     * Ctf traces have a clock with a unique uuid that will be used to identify
+     * the host. Traces with the same clock uuid will be known to have been made
+     * on the same machine.
+     *
+     * Note: uuid is an optional field, it may not be there for a clock.
+     */
+    @Override
+    public String getHostId() {
+        CTFClock clock = getCTFTrace().getClock();
+        if (clock != null) {
+            String clockHost = (String) clock.getProperty(CLOCK_HOST_PROPERTY);
+            if (clockHost != null) {
+                return clockHost;
+            }
+        }
+        return super.getHostId();
+    }
+
+    // -------------------------------------------
+    // ITmfTraceProperties
+    // -------------------------------------------
+
+    /**
+     * @since 2.0
+     */
+    @Override
+    public Map<String, String> getTraceProperties() {
+        return fTrace.getEnvironment();
+    }
+
+    // -------------------------------------------
+    // Clocks
+    // -------------------------------------------
+
+    /**
+     * gets the clock offset
+     *
+     * @return the clock offset in ns
+     */
+    public long getOffset() {
+        if (fTrace != null) {
+            return fTrace.getOffset();
+        }
+        return 0;
+    }
+
+    /**
+     * Returns whether or not an event is in the metadata of the trace,
+     * therefore if it can possibly be in the trace. It does not verify whether
+     * or not the event is actually in the trace
+     *
+     * @param eventName
+     *            The name of the event to check
+     * @return Whether the event is in the metadata or not
+     * @since 2.1
+     */
+    public boolean hasEvent(final String eventName) {
+        Map<Long, IEventDeclaration> events = fTrace.getEvents(0L);
+        if (events != null) {
+            for (IEventDeclaration decl : events.values()) {
+                if (decl.getName().equals(eventName)) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Return whether all requested events are in the metadata
+     *
+     * @param names
+     *            The array of events to check for
+     * @return Whether all events are in the metadata
+     * @since 2.1
+     */
+    public boolean hasAllEvents(String[] names) {
+        for (String name : names) {
+            if (!hasEvent(name)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Returns whether the metadata contains at least one of the requested
+     * events
+     *
+     * @param names
+     *            The array of event names of check for
+     * @return Whether one of the event is present in trace metadata
+     * @since 2.1
+     */
+    public boolean hasAtLeastOneOfEvents(String[] names) {
+        for (String name : names) {
+            if (hasEvent(name)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    // -------------------------------------------
+    // Parser
+    // -------------------------------------------
+
+    @Override
+    public CtfTmfEvent parseEvent(ITmfContext context) {
+        CtfTmfEvent event = null;
+        if (context instanceof CtfTmfContext) {
+            final ITmfContext tmpContext = seekEvent(context.getLocation());
+            event = getNext(tmpContext);
+        }
+        return event;
+    }
+
+    /**
+     * Sets the cache size for a CtfTmfTrace.
+     */
+    protected void setCacheSize() {
+        setCacheSize(DEFAULT_CACHE_SIZE);
+    }
+
+    // -------------------------------------------
+    // Helpers
+    // -------------------------------------------
+
+    private static CtfIterator getIterator(CtfTmfTrace trace, CtfTmfContext context) {
+        return CtfIteratorManager.getIterator(trace, context);
+    }
+
+    /**
+     * Get an iterator to the trace
+     *
+     * @return an iterator to the trace
+     * @since 2.0
+     */
+    public CtfIterator createIterator() {
+        try {
+            return new CtfIterator(this);
+        } catch (CTFReaderException e) {
+            Activator.getDefault().logError(e.getMessage(), e);
+        }
+        return null;
+    }
+
+    // ------------------------------------------------------------------------
+    // Timestamp transformation functions
+    // ------------------------------------------------------------------------
+
+    /**
+     * @since 3.0
+     */
+    @Override
+    public CtfTmfTimestamp createTimestamp(long ts) {
+        return new CtfTmfTimestamp(getTimestampTransform().transform(ts));
+    }
+
+    private static int fCheckpointSize = -1;
+
+    /**
+     * @since 3.0
+     */
+    @Override
+    public synchronized int getCheckpointSize() {
+        if (fCheckpointSize == -1) {
+            TmfCheckpoint c = new TmfCheckpoint(new CtfTmfTimestamp(0), new CtfLocation(0, 0), 0);
+            ByteBuffer b = ByteBuffer.allocate(ITmfCheckpoint.MAX_SERIALIZE_SIZE);
+            b.clear();
+            c.serialize(b);
+            fCheckpointSize = b.position();
+        }
+
+        return fCheckpointSize;
+    }
+
+    @Override
+    protected ITmfTraceIndexer createIndexer(int interval) {
+        return new TmfBTreeTraceIndexer(this, interval);
+    }
+
+    /**
+     * @since 3.0
+     */
+    @Override
+    public ITmfLocation restoreLocation(ByteBuffer bufferIn) {
+        return new CtfLocation(bufferIn);
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/Messages.java b/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/Messages.java
new file mode 100644 (file)
index 0000000..96460f1
--- /dev/null
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Ericsson.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.core;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Message bundle for tmf.core.ctfadaptor
+ *
+ * @author Matthew Khouzam
+ * @since 2.0
+ */
+public class Messages extends NLS {
+
+    private static final String BUNDLE_NAME = "org.eclipse.linuxtools.tmf.ctf.core.messages"; //$NON-NLS-1$
+
+    /** Buffer overflow detected
+     * @since 2.1*/
+    public static String CtfTmfTrace_BufferOverflowErrorMessage;
+
+    /** Major version number not set */
+    public static String CtfTmfTrace_MajorNotSet;
+
+    /** Reading error */
+    public static String CtfTmfTrace_ReadingError;
+
+    /** No event */
+    public static String CtfTmfTrace_NoEvent;
+
+    /** Unsupported field type */
+    public static String CtfTmfEventField_UnsupportedType;
+
+    static {
+        // initialize resource bundle
+        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+    }
+
+    private Messages() {
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/messages.properties b/org.eclipse.linuxtools.tmf.ctf.core/src/org/eclipse/linuxtools/tmf/ctf/core/messages.properties
new file mode 100644 (file)
index 0000000..7769d7c
--- /dev/null
@@ -0,0 +1,17 @@
+###############################################################################
+# Copyright (c) 2013 Ericsson
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#     Ericsson - Initial API and implementation
+###############################################################################
+
+CtfTmfTrace_BufferOverflowErrorMessage=Buffer overflow exception, trace is malformed
+CtfTmfTrace_MajorNotSet=Major version number not set
+CtfTmfTrace_ReadingError=Reading error
+CtfTmfTrace_NoEvent=Trace has no events
+CtfTmfEventField_UnsupportedType=Unsupported field type:
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.classpath b/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.classpath
new file mode 100644 (file)
index 0000000..098194c
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.gitignore b/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.gitignore
new file mode 100644 (file)
index 0000000..fb60f67
--- /dev/null
@@ -0,0 +1,2 @@
+bin/
+target/
diff --git a/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.project b/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.project
new file mode 100644 (file)
index 0000000..4d596a0
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+               <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+       </natures>
+</projectDescription>
diff --git a/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.settings/org.eclipse.core.resources.prefs b/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.settings/org.eclipse.core.resources.prefs
new file mode 100644 (file)
index 0000000..99f26c0
--- /dev/null
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.settings/org.eclipse.core.runtime.prefs b/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.settings/org.eclipse.core.runtime.prefs
new file mode 100644 (file)
index 0000000..5a0ad22
--- /dev/null
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..42ab4df
--- /dev/null
@@ -0,0 +1,393 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
+org.eclipse.jdt.core.compiler.problem.deadCode=error
+org.eclipse.jdt.core.compiler.problem.deprecation=error
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=error
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=error
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=error
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=enabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=error
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=error
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=error
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=error
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
+org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=false
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=250
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=space
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644 (file)
index 0000000..4fd0c70
--- /dev/null
@@ -0,0 +1,56 @@
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_tmf-style
+formatter_settings_version=12
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=false
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=false
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=false
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.settings/org.eclipse.pde.api.tools.prefs b/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.settings/org.eclipse.pde.api.tools.prefs
new file mode 100644 (file)
index 0000000..acc3abd
--- /dev/null
@@ -0,0 +1,97 @@
+ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
+ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
+API_USE_SCAN_FIELD_SEVERITY=Error
+API_USE_SCAN_METHOD_SEVERITY=Error
+API_USE_SCAN_TYPE_SEVERITY=Error
+CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
+CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
+CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
+CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
+CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
+ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
+ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
+ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
+FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
+FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
+FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
+FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
+ILLEGAL_EXTEND=Warning
+ILLEGAL_IMPLEMENT=Warning
+ILLEGAL_INSTANTIATE=Warning
+ILLEGAL_OVERRIDE=Warning
+ILLEGAL_REFERENCE=Warning
+INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+INVALID_JAVADOC_TAG=Warning
+INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Warning
+LEAK_EXTEND=Warning
+LEAK_FIELD_DECL=Warning
+LEAK_IMPLEMENT=Warning
+LEAK_METHOD_PARAM=Warning
+LEAK_METHOD_RETURN_TYPE=Warning
+METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
+METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+MISSING_EE_DESCRIPTIONS=Ignore
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
+UNUSED_PROBLEM_FILTERS=Warning
+automatically_removed_unused_problem_filters=false
+eclipse.preferences.version=1
+incompatible_api_component_version=Error
+incompatible_api_component_version_include_major_without_breaking_change=Disabled
+incompatible_api_component_version_include_minor_without_api_change=Disabled
+invalid_since_tag_version=Error
+malformed_since_tag=Error
+missing_since_tag=Error
+report_api_breakage_when_major_version_incremented=Disabled
+report_resolution_errors_api_component=Warning
diff --git a/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.settings/org.eclipse.pde.prefs b/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/.settings/org.eclipse.pde.prefs
new file mode 100644 (file)
index 0000000..62cfa90
--- /dev/null
@@ -0,0 +1,32 @@
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=2
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=1
+compilers.p.discouraged-class=1
+compilers.p.internal=1
+compilers.p.missing-packages=2
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=2
+compilers.p.unknown-attribute=1
+compilers.p.unknown-class=1
+compilers.p.unknown-element=1
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=1
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+eclipse.preferences.version=1
diff --git a/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/META-INF/MANIFEST.MF b/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..b5c2388
--- /dev/null
@@ -0,0 +1,24 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-Vendor: %Bundle-Vendor
+Bundle-Version: 3.0.0.qualifier
+Bundle-Localization: plugin
+Bundle-SymbolicName: org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests;singleton:=true
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Export-Package: org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests
+Require-Bundle: org.apache.log4j,
+ org.eclipse.core.resources,
+ org.eclipse.core.runtime,
+ org.eclipse.linuxtools.tmf.ui,
+ org.eclipse.linuxtools.tmf.core,
+ org.eclipse.linuxtools.tmf.core.tests,
+ org.eclipse.linuxtools.tmf.ui.swtbot.tests,
+ org.eclipse.linuxtools.tmf.ctf.core,
+ org.eclipse.linuxtools.tmf.ctf.core.tests,
+ org.eclipse.swtbot.eclipse.finder,
+ org.eclipse.ui,
+ org.eclipse.ui.ide,
+ org.eclipse.ui.views,
+ org.junit
diff --git a/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/about.html b/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/about.html
new file mode 100644 (file)
index 0000000..28737f6
--- /dev/null
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;).  Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;).  A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content.  Check the Redistributor's license that was
+provided with the Content.  If no such license exists, contact the Redistributor.  Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/build.properties b/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/build.properties
new file mode 100644 (file)
index 0000000..98b1bad
--- /dev/null
@@ -0,0 +1,18 @@
+###############################################################################
+# Copyright (c) 2014 Ericsson
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#     Ericsson - Initial API and implementation
+###############################################################################
+
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.properties
+src.includes = about.html
diff --git a/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/plugin.properties b/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/plugin.properties
new file mode 100644 (file)
index 0000000..91395e8
--- /dev/null
@@ -0,0 +1,14 @@
+###############################################################################
+# Copyright (c) 2014 Ericsson
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#     Ericsson - Initial API and implementation
+###############################################################################
+
+Bundle-Vendor = Eclipse Linux Tools
+Bundle-Name = CTF Support for TMF UI SWTBot Tests Plug-in
diff --git a/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/pom.xml b/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/pom.xml
new file mode 100644 (file)
index 0000000..152c511
--- /dev/null
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Copyright (C) 2014 Ericsson
+
+   All rights reserved. This program and the accompanying materials
+   are made available under the terms of the Eclipse Public License v1.0
+   which accompanies this distribution, and is available at
+   http://www.eclipse.org/legal/epl-v10.html
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>linuxtools-lttng-parent</artifactId>
+    <groupId>org.eclipse.linuxtools.lttng</groupId>
+    <version>3.0.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests</artifactId>
+  <version>3.0.0-SNAPSHOT</version>
+  <packaging>eclipse-test-plugin</packaging>
+
+  <name>CTF Support for TMF SWTBot Tests Plug-in</name>
+
+<profiles>
+  <profile>
+    <id>platform-kepler</id>
+    <build>
+    <plugins>
+      <plugin>
+        <groupId>org.eclipse.tycho</groupId>
+        <artifactId>tycho-surefire-plugin</artifactId>
+        <version>${tycho-version}</version>
+        <configuration>
+          <testSuite>org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests</testSuite>
+          <testClass>org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests.AllTests</testClass>
+          <useUIHarness>true</useUIHarness>
+          <useUIThread>false</useUIThread>
+          <argLine>${tycho.testArgLine} ${base.ui.test.vmargs}</argLine>
+          <product>org.eclipse.platform.ide</product>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  </profile>
+  <profile>
+    <id>platform-luna</id>
+    <activation>
+      <activeByDefault>true</activeByDefault>
+    </activation>
+    <build>
+      <plugins>
+        <plugin>
+          <groupId>org.eclipse.tycho</groupId>
+          <artifactId>tycho-surefire-plugin</artifactId>
+          <version>${tycho-version}</version>
+          <configuration>
+            <testSuite>org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests</testSuite>
+            <testClass>org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests.AllTests</testClass>
+            <useUIHarness>true</useUIHarness>
+            <useUIThread>false</useUIThread>
+            <argLine>${tycho.testArgLine} ${base.ui.test.vmargs}</argLine>
+            <product>org.eclipse.platform.ide</product>
+            <environmentVariables>
+              <!-- Disable GTK3 with Luna because it makes the test hang (bug in SWT?)
+                   Note that we can't set this variable to 0 in Kepler because as soon as
+                   it is defined to any value, it gets enabled, see
+                   https://bugs.eclipse.org/bugs/show_bug.cgi?id=423220      -->
+              <SWT_GTK3>0</SWT_GTK3>
+            </environmentVariables>
+          </configuration>
+        </plugin>
+      </plugins>
+    </build>
+  </profile>
+</profiles>
+
+ <groupId>org.eclipse.linuxtools.tmf</groupId>
+</project>
diff --git a/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/src/org/eclipse/linuxtools/tmf/ctf/ui/swtbot/tests/AllTests.java b/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/src/org/eclipse/linuxtools/tmf/ctf/ui/swtbot/tests/AllTests.java
new file mode 100644 (file)
index 0000000..ef1c31e
--- /dev/null
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * SWTBot test suite for tmf.ui
+ *
+ * @author Matthew Khouzam
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+        ImportAndReadSmokeTest.class
+})
+public class AllTests {
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/src/org/eclipse/linuxtools/tmf/ctf/ui/swtbot/tests/ImportAndReadSmokeTest.java b/org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests/src/org/eclipse/linuxtools/tmf/ctf/ui/swtbot/tests/ImportAndReadSmokeTest.java
new file mode 100644 (file)
index 0000000..6ed564c
--- /dev/null
@@ -0,0 +1,386 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Matthew Khouzam - Initial API and implementation
+ *   Marc-Andre Laperle
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests;
+
+import static org.junit.Assert.assertNotNull;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.varia.NullAppender;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfEvent;
+import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.eclipse.linuxtools.tmf.ui.editors.TmfEventsEditor;
+import org.eclipse.linuxtools.tmf.ui.project.wizards.importtrace.BatchImportTraceWizard;
+import org.eclipse.linuxtools.tmf.ui.swtbot.tests.SWTBotUtil;
+import org.eclipse.linuxtools.tmf.ui.swtbot.tests.conditions.ConditionHelpers;
+import org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramView;
+import org.eclipse.linuxtools.tmf.ui.views.statistics.TmfStatisticsView;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
+import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IViewReference;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.views.properties.PropertySheet;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * SWTBot Smoke test. base for other tests
+ *
+ * @author Matthew Khouzam
+ */
+public class ImportAndReadSmokeTest {
+
+
+    private static final String TRACE_PROJECT_NAME = "test";
+    private static final String TRACE_NAME = "synthetic-trace";
+    private static final String TRACE_TYPE_NAME = "Generic CTF Trace";
+    private static final CtfTmfTestTrace fTrace = CtfTmfTestTrace.SYNTHETIC_TRACE;
+
+    private static SWTWorkbenchBot fBot;
+    private static Wizard fWizard;
+
+    /** The Log4j logger instance. */
+    private static final Logger fLogger = Logger.getRootLogger();
+
+    /** Test Class setup */
+    @BeforeClass
+    public static void init() {
+        SWTBotUtil.failIfUIThread();
+
+        /* set up for swtbot */
+        SWTBotPreferences.TIMEOUT = 50000; /* 50 second timeout */
+        fLogger.addAppender(new NullAppender());
+        fBot = new SWTWorkbenchBot();
+
+        SWTBotUtil.closeView("welcome", fBot);
+
+        SWTBotUtil.switchToTracingPerspective();
+        /* finish waiting for eclipse to load */
+        SWTBotUtil.waitForJobs();
+    }
+
+    /**
+     * Main test case
+     */
+    @Test
+    public void test() {
+        createProject();
+
+        batchImportOpenWizard();
+        batchImportSelecTraceType();
+        batchImportAddDirectory();
+        batchImportSelectTrace();
+        batchImportFinish();
+
+        TmfEventsEditor tmfEd = openEditor();
+
+        testHistogramView(getViewPart("Histogram"), tmfEd);
+        testPropertyView(getViewPart("Properties"));
+        testStatisticsView(getViewPart("Statistics"));
+
+        deleteProject();
+    }
+
+    private static void createProject() {
+        SWTBotUtil.focusMainWindow(fBot.shells());
+        fBot.menu("File").menu("New").menu("Project...").click();
+
+        fBot.waitUntil(Conditions.shellIsActive("New Project"));
+        SWTBotTree tree = fBot.tree();
+        assertNotNull(tree);
+        final String tracingKey = "Tracing";
+        fBot.waitUntil(ConditionHelpers.IsTreeNodeAvailable(tracingKey, tree));
+        final SWTBotTreeItem tracingNode = tree.expandNode(tracingKey);
+
+        tracingNode.select();
+        final String projectKey = "Tracing Project";
+        fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(projectKey, tracingNode));
+        final SWTBotTreeItem tracingProject = tracingNode.getNode(projectKey);
+        assertNotNull(tracingProject);
+
+        tracingProject.select();
+        tracingProject.click();
+
+        SWTBotButton nextButton = fBot.button("Next >");
+        fBot.waitUntil(Conditions.widgetIsEnabled(nextButton));
+        nextButton.click();
+        fBot.waitUntil(Conditions.shellIsActive("Tracing Project"));
+
+        final SWTBotText text = fBot.text();
+        text.setText(TRACE_PROJECT_NAME);
+
+        fBot.button("Finish").click();
+        SWTBotUtil.waitForJobs();
+    }
+
+    private static void batchImportOpenWizard() {
+        fWizard = new BatchImportTraceWizard();
+
+        UIThreadRunnable.asyncExec(new VoidResult() {
+            @Override
+            public void run() {
+                final IWorkbench workbench = PlatformUI.getWorkbench();
+                // Fire the Import Trace Wizard
+                if (workbench != null) {
+                    final IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
+                    Shell shell = activeWorkbenchWindow.getShell();
+                    assertNotNull(shell);
+                    ((BatchImportTraceWizard) fWizard).init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY);
+                    WizardDialog dialog = new WizardDialog(shell, fWizard);
+                    dialog.open();
+                }
+            }
+        });
+
+        fBot.waitUntil(ConditionHelpers.isWizardReady(fWizard));
+    }
+
+    private static void batchImportSelecTraceType() {
+        final SWTBotTree tree = fBot.tree();
+        final String ctfId = "Common Trace Format";
+        fBot.waitUntil(ConditionHelpers.IsTreeNodeAvailable(ctfId, tree));
+        fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(TRACE_TYPE_NAME, tree.getTreeItem(ctfId)));
+        tree.getTreeItem(ctfId).getNode(TRACE_TYPE_NAME).check();
+        batchImportClickNext();
+    }
+
+    private static void batchImportAddDirectory() {
+        UIThreadRunnable.syncExec(new VoidResult() {
+            @Override
+            public void run() {
+                ((BatchImportTraceWizard) fWizard).addFileToScan(fTrace.getPath());
+            }
+        });
+        final SWTBotButton removeButton = fBot.button("Remove");
+        fBot.waitUntil(Conditions.widgetIsEnabled(removeButton));
+        removeButton.click();
+        fBot.waitUntil(Conditions.tableHasRows(fBot.table(), 1));
+
+        batchImportClickNext();
+    }
+
+    private static void batchImportSelectTrace() {
+        SWTBotTree tree = fBot.tree();
+        fBot.waitUntil(Conditions.widgetIsEnabled(tree));
+        final SWTBotTreeItem genericCtfTreeItem = tree.getTreeItem(TRACE_TYPE_NAME);
+        fBot.waitUntil(Conditions.widgetIsEnabled(genericCtfTreeItem));
+        genericCtfTreeItem.expand();
+        genericCtfTreeItem.check();
+        batchImportClickNext();
+    }
+
+    private static void batchImportClickNext() {
+        IWizardPage currentPage = fWizard.getContainer().getCurrentPage();
+        IWizardPage desiredPage = fWizard.getNextPage(currentPage);
+        SWTBotButton nextButton = fBot.button("Next >");
+        nextButton.click();
+        fBot.waitUntil(ConditionHelpers.isWizardOnPage(fWizard, desiredPage));
+    }
+
+    private static void batchImportFinish() {
+        SWTBotShell shell = fBot.activeShell();
+        final SWTBotButton finishButton = fBot.button("Finish");
+        finishButton.click();
+        fBot.waitUntil(Conditions.shellCloses(shell));
+        SWTBotUtil.waitForJobs();
+    }
+
+    private static TmfEventsEditor openEditor() {
+        final SWTBotView projectExplorerBot = fBot.viewById(IPageLayout.ID_PROJECT_EXPLORER);
+        projectExplorerBot.setFocus();
+
+        final SWTBotTree tree = fBot.tree();
+        final SWTBotTreeItem treeItem = tree.getTreeItem(TRACE_PROJECT_NAME);
+        treeItem.expand();
+
+        List<String> nodes = treeItem.getNodes();
+        String nodeName = "";
+        for (String node : nodes) {
+            if (node.startsWith("Traces")) {
+                nodeName = node;
+            }
+        }
+        fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(nodeName, treeItem));
+        treeItem.getNode(nodeName).expand();
+        fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(TRACE_NAME, treeItem.getNode(nodeName)));
+        treeItem.getNode(nodeName).getNode(TRACE_NAME).select();
+        treeItem.getNode(nodeName).getNode(TRACE_NAME).doubleClick();
+        SWTBotUtil.delay(1000);
+        SWTBotUtil.waitForJobs();
+
+        final IEditorPart iep[] = new IEditorPart[1];
+        UIThreadRunnable.syncExec(new VoidResult() {
+            @Override
+            public void run() {
+                IEditorReference[] ieds = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
+                assertNotNull(ieds);
+                iep[0] = null;
+                for (IEditorReference ied : ieds) {
+                    if (ied.getTitle().equals(TRACE_NAME)) {
+                        iep[0] = ied.getEditor(true);
+                        break;
+                    }
+                }
+            }
+        });
+        assertNotNull(iep[0]);
+        return (TmfEventsEditor) iep[0];
+    }
+
+    private static void deleteProject() {
+        try {
+            ResourcesPlugin.getWorkspace().getRoot().getProject(TRACE_PROJECT_NAME).refreshLocal(IResource.DEPTH_INFINITE, null);
+        } catch (CoreException e) {
+        }
+
+        SWTBotUtil.waitForJobs();
+
+        final SWTBotView projectViewBot = fBot.viewById(IPageLayout.ID_PROJECT_EXPLORER);
+        projectViewBot.setFocus();
+
+        SWTBotTree treeBot = fBot.tree();
+        SWTBotTreeItem treeItem = treeBot.getTreeItem(TRACE_PROJECT_NAME);
+        SWTBotMenu contextMenu = treeItem.contextMenu("Delete");
+        contextMenu.click();
+
+        String shellText = "Delete Resources";
+        fBot.waitUntil(Conditions.shellIsActive(shellText));
+        final SWTBotButton okButton = fBot.button("OK");
+        fBot.waitUntil(Conditions.widgetIsEnabled(okButton));
+        okButton.click();
+
+        SWTBotUtil.waitForJobs();
+    }
+
+    // ---------------------------------------------
+    // Helpers for testing views
+    // ---------------------------------------------
+
+    private static void testPropertyView(IViewPart vp) {
+        PropertySheet pv = (PropertySheet) vp;
+        assertNotNull(pv);
+    }
+
+    private static void testHistogramView(IViewPart vp, final TmfEventsEditor tmfEd) {
+        final CtfTmfEvent desiredEvent1 = getEvent(100);
+        UIThreadRunnable.syncExec(new VoidResult() {
+            @Override
+            public void run() {
+                tmfEd.setFocus();
+                tmfEd.selectionChanged(new SelectionChangedEvent(tmfEd, new StructuredSelection(desiredEvent1)));
+            }
+        });
+
+        SWTBotUtil.waitForJobs();
+        SWTBotUtil.delay(1000);
+
+        final CtfTmfEvent desiredEvent2 = getEvent(10000);
+        SWTBotView hvBot = fBot.viewById(HistogramView.ID);
+        List<SWTBotToolbarButton> hvTools = hvBot.getToolbarButtons();
+        for (SWTBotToolbarButton hvTool : hvTools) {
+            if (hvTool.getToolTipText().toLowerCase().contains("lost")) {
+                hvTool.click();
+            }
+        }
+        HistogramView hv = (HistogramView) vp;
+        final TmfTimeSynchSignal signal = new TmfTimeSynchSignal(hv, desiredEvent1.getTimestamp());
+        final TmfTimeSynchSignal signal2 = new TmfTimeSynchSignal(hv, desiredEvent2.getTimestamp());
+        hv.updateTimeRange(100000);
+        SWTBotUtil.waitForJobs();
+        hv.currentTimeUpdated(signal);
+        hv.broadcast(signal);
+        SWTBotUtil.waitForJobs();
+        SWTBotUtil.delay(1000);
+
+        hv.updateTimeRange(1000000000);
+        SWTBotUtil.waitForJobs();
+        hv.currentTimeUpdated(signal2);
+        hv.broadcast(signal2);
+        SWTBotUtil.waitForJobs();
+        SWTBotUtil.delay(1000);
+        assertNotNull(hv);
+    }
+
+    private static void testStatisticsView(IViewPart vp) {
+        TmfStatisticsView sv = (TmfStatisticsView) vp;
+        assertNotNull(sv);
+    }
+
+    // ---------------------------------------------
+    // Trace helpers
+    // ---------------------------------------------
+
+    private static CtfTmfEvent getEvent(int rank) {
+        CtfTmfTrace trace = fTrace.getTrace();
+        if (trace == null) {
+            return null;
+        }
+        ITmfContext ctx = trace.seekEvent(0);
+        for (int i = 0; i < rank; i++) {
+            trace.getNext(ctx);
+        }
+        final CtfTmfEvent retVal = trace.getNext(ctx);
+        trace.dispose();
+        return retVal;
+    }
+
+    private static IViewPart getViewPart(final String viewTile) {
+        final IViewPart[] vps = new IViewPart[1];
+        UIThreadRunnable.syncExec(new VoidResult() {
+            @Override
+            public void run() {
+                IViewReference[] viewRefs = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences();
+                for (IViewReference viewRef : viewRefs) {
+                    IViewPart vp = viewRef.getView(true);
+                    if (vp.getTitle().equals(viewTile)) {
+                        vps[0] = vp;
+                        return;
+                    }
+                }
+            }
+        });
+
+        return vps[0];
+    }
+}
diff --git a/org.eclipse.linuxtools.tmf.ctf/.gitignore b/org.eclipse.linuxtools.tmf.ctf/.gitignore
new file mode 100644 (file)
index 0000000..fb60f67
--- /dev/null
@@ -0,0 +1,2 @@
+bin/
+target/
diff --git a/org.eclipse.linuxtools.tmf.ctf/.project b/org.eclipse.linuxtools.tmf.ctf/.project
new file mode 100644 (file)
index 0000000..e5c87f1
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.eclipse.linuxtools.tmf.ctf</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.pde.FeatureBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.FeatureNature</nature>
+       </natures>
+</projectDescription>
diff --git a/org.eclipse.linuxtools.tmf.ctf/.settings/org.eclipse.core.resources.prefs b/org.eclipse.linuxtools.tmf.ctf/.settings/org.eclipse.core.resources.prefs
new file mode 100644 (file)
index 0000000..99f26c0
--- /dev/null
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.eclipse.linuxtools.tmf.ctf/.settings/org.eclipse.core.runtime.prefs b/org.eclipse.linuxtools.tmf.ctf/.settings/org.eclipse.core.runtime.prefs
new file mode 100644 (file)
index 0000000..5a0ad22
--- /dev/null
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.eclipse.linuxtools.tmf.ctf/build.properties b/org.eclipse.linuxtools.tmf.ctf/build.properties
new file mode 100644 (file)
index 0000000..c0db4e0
--- /dev/null
@@ -0,0 +1,15 @@
+###############################################################################
+# Copyright (c) 2013 Ericsson
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#     Ericsson - Initial API and implementation
+###############################################################################
+
+bin.includes = feature.xml,\
+               feature.properties,\
+               p2.inf
diff --git a/org.eclipse.linuxtools.tmf.ctf/feature.properties b/org.eclipse.linuxtools.tmf.ctf/feature.properties
new file mode 100644 (file)
index 0000000..f04cb45
--- /dev/null
@@ -0,0 +1,147 @@
+###############################################################################
+# Copyright (c) 2009, 2013 Ericsson
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#     Ericsson - Initial API and implementation
+###############################################################################
+
+featureName=CTF Support for TMF
+
+description=Plug-ins to add support for reading traces in the \
+Common Trace Format (CTF) to the Tracing and Monitoring Framework (TMF).
+
+featureProvider=Eclipse Linux Tools
+
+copyright=Copyright 2014 Ericsson
+
+licenseURL=license.html
+
+license=\
+Eclipse Foundation Software User Agreement\n\
+February 1, 2011\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW.  BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW.  IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the\n\
+Eclipse Foundation is provided to you under the terms and conditions of\n\
+the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
+provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse Foundation source code\n\
+repository ("Repository") in software modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+       - Content may be structured and packaged into modules to facilitate delivering,\n\
+         extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+         plug-in fragments ("Fragments"), and features ("Features").\n\
+       - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
+         in a directory named "plugins".\n\
+       - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+         Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+         Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+         numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+       - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+         named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+       - The top-level (root) directory\n\
+       - Plug-in and Fragment directories\n\
+       - Inside Plug-ins and Fragments packaged as JARs\n\
+       - Sub-directories of the directory named "src" of certain Plug-ins\n\
+       - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
+Update License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties" found within a Feature.\n\
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
+terms and conditions (or references to such terms and conditions) that\n\
+govern your use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+       - Eclipse Distribution License Version 1.0 (available at http://www.eclipse.org/licenses/edl-v1.0.html)\n\
+       - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+       - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+       - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+       - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+       - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+\n\Use of Provisioning Technology\n\
+\n\
+The Eclipse Foundation makes available provisioning software, examples of which include,\n\
+but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
+the purpose of allowing users to install software, documentation, information and/or\n\
+other materials (collectively "Installable Software"). This capability is provided with\n\
+the intent of allowing such users to install, extend and update Eclipse-based products.\n\
+Information about packaging Installable Software is available at\n\
+http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
+\n\
+You may use Provisioning Technology to allow other parties to install Installable Software.\n\
+You shall be responsible for enabling the applicable license agreements relating to the\n\
+Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
+in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
+making it available in accordance with the Specification, you further acknowledge your\n\
+agreement to, and the acquisition of all necessary rights to permit the following:\n\
+\n\
+       1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
+          the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
+          extending or updating the functionality of an Eclipse-based product.\n\
+       2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
+          Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
+       3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
+          govern the use of the Installable Software ("Installable Software Agreement") and such\n\
+          Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
+          with the Specification. Such Installable Software Agreement must inform the user of the\n\
+          terms and conditions that govern the Installable Software and must solicit acceptance by\n\
+          the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
+          indication of agreement by the user, the provisioning Technology will complete installation\n\
+          of the Installable Software.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use, and\n\
+re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
diff --git a/org.eclipse.linuxtools.tmf.ctf/feature.xml b/org.eclipse.linuxtools.tmf.ctf/feature.xml
new file mode 100644 (file)
index 0000000..743f0b8
--- /dev/null
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- For PDE build, remove "ws" and "arch" -->
+<feature
+      id="org.eclipse.linuxtools.tmf.ctf"
+      label="%featureName"
+      version="3.0.0.qualifier"
+      provider-name="%featureProvider"
+      license-feature="org.eclipse.license"
+      license-feature-version="1.0.0.qualifier">
+
+   <description>
+      %description
+   </description>
+
+   <copyright>
+      %copyright
+   </copyright>
+
+   <license url="%licenseURL">
+      %license
+   </license>
+
+   <url>
+      <update label="Linux Tools Update Site" url="http://download.eclipse.org/linuxtools/update"/>
+   </url>
+
+   <includes
+         id="org.eclipse.linuxtools.tmf"
+         version="0.0.0"
+         name="Tracing and Monitoring Framework (TMF)"/>
+
+   <includes
+         id="org.eclipse.linuxtools.ctf"
+         version="0.0.0"
+         name="Common Trace Format (CTF)"/>
+
+   <requires>
+      <import plugin="org.eclipse.core.runtime"/>
+      <import plugin="org.eclipse.core.resources"/>
+      <import plugin="org.eclipse.linuxtools.ctf.core" version="3.0.0" match="greaterOrEqual"/>
+      <import plugin="org.eclipse.linuxtools.tmf.core" version="3.0.0" match="greaterOrEqual"/>
+      <import plugin="org.eclipse.ui"/>
+      <import plugin="org.eclipse.ui.ide"/>
+      <import plugin="org.eclipse.linuxtools.tmf.ui" version="3.0.0" match="greaterOrEqual"/>
+      <import plugin="org.eclipse.help"/>
+   </requires>
+
+   <plugin
+         id="org.eclipse.linuxtools.tmf.ctf.core"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+</feature>
diff --git a/org.eclipse.linuxtools.tmf.ctf/p2.inf b/org.eclipse.linuxtools.tmf.ctf/p2.inf
new file mode 100644 (file)
index 0000000..014c620
--- /dev/null
@@ -0,0 +1,3 @@
+instructions.configure=\
+org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//download.eclipse.org/linuxtools/updates-nightly,type:0,name:Linux Tools,enabled:false); \
+org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//download.eclipse.org/linuxtools/updates-nightly,type:1,name:Linux Tools,enabled:false);
diff --git a/org.eclipse.linuxtools.tmf.ctf/pom.xml b/org.eclipse.linuxtools.tmf.ctf/pom.xml
new file mode 100644 (file)
index 0000000..c8ba755
--- /dev/null
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Copyright (C) 2011, Red Hat, Inc.
+
+   All rights reserved. This program and the accompanying materials
+   are made available under the terms of the Eclipse Public License v1.0
+   which accompanies this distribution, and is available at
+   http://www.eclipse.org/legal/epl-v10.html
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>linuxtools-lttng-parent</artifactId>
+    <groupId>org.eclipse.linuxtools.lttng</groupId>
+    <version>3.0.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>org.eclipse.linuxtools.tmf.ctf</artifactId>
+  <version>3.0.0-SNAPSHOT</version>
+  <packaging>eclipse-feature</packaging>
+
+  <name>CTF support for TMF Feature</name>
+
+  <groupId>org.eclipse.linuxtools.tmf</groupId>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.eclipse.tycho.extras</groupId>
+        <artifactId>tycho-source-feature-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>source-feature</id>
+            <phase>package</phase>
+            <goals>
+              <goal>source-feature</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.eclipse.tycho</groupId>
+        <artifactId>tycho-p2-plugin</artifactId>
+        <version>${tycho-version}</version>
+        <executions>
+          <execution>
+            <id>attached-p2-metadata</id>
+            <phase>package</phase>
+            <goals>
+              <goal>p2-metadata</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
index 87f311a8b820f8396977e870bbc18536e100ec9b..6ba79c0059dce1747ce57c3726c1abc135ac14d5 100644 (file)
@@ -22,7 +22,6 @@ import org.junit.runners.Suite;
  */
 @RunWith(Suite.class)
 @Suite.SuiteClasses({
-        ImportAndReadSmokeTest.class,
         TestCustomTxtWizard.class,
         TracingPerspectiveChecker.class
 })
diff --git a/org.eclipse.linuxtools.tmf.ui.swtbot.tests/src/org/eclipse/linuxtools/tmf/ui/swtbot/tests/ImportAndReadSmokeTest.java b/org.eclipse.linuxtools.tmf.ui.swtbot.tests/src/org/eclipse/linuxtools/tmf/ui/swtbot/tests/ImportAndReadSmokeTest.java
deleted file mode 100644 (file)
index 2977762..0000000
+++ /dev/null
@@ -1,385 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   Matthew Khouzam - Initial API and implementation
- *   Marc-Andre Laperle
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.ui.swtbot.tests;
-
-import static org.junit.Assert.assertNotNull;
-
-import java.util.List;
-
-import org.apache.log4j.Logger;
-import org.apache.log4j.varia.NullAppender;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
-import org.eclipse.linuxtools.tmf.core.signal.TmfTimeSynchSignal;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
-import org.eclipse.linuxtools.tmf.ui.editors.TmfEventsEditor;
-import org.eclipse.linuxtools.tmf.ui.project.wizards.importtrace.BatchImportTraceWizard;
-import org.eclipse.linuxtools.tmf.ui.swtbot.tests.conditions.ConditionHelpers;
-import org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramView;
-import org.eclipse.linuxtools.tmf.ui.views.statistics.TmfStatisticsView;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
-import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
-import org.eclipse.swtbot.swt.finder.results.VoidResult;
-import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
-import org.eclipse.swtbot.swt.finder.waits.Conditions;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IViewReference;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.PropertySheet;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * SWTBot Smoke test. base for other tests
- *
- * @author Matthew Khouzam
- */
-public class ImportAndReadSmokeTest {
-
-
-    private static final String TRACE_PROJECT_NAME = "test";
-    private static final String TRACE_NAME = "synthetic-trace";
-    private static final String TRACE_TYPE_NAME = "Generic CTF Trace";
-    private static final CtfTmfTestTrace fTrace = CtfTmfTestTrace.SYNTHETIC_TRACE;
-
-    private static SWTWorkbenchBot fBot;
-    private static Wizard fWizard;
-
-    /** The Log4j logger instance. */
-    private static final Logger fLogger = Logger.getRootLogger();
-
-    /** Test Class setup */
-    @BeforeClass
-    public static void init() {
-        SWTBotUtil.failIfUIThread();
-
-        /* set up for swtbot */
-        SWTBotPreferences.TIMEOUT = 50000; /* 50 second timeout */
-        fLogger.addAppender(new NullAppender());
-        fBot = new SWTWorkbenchBot();
-
-        SWTBotUtil.closeView("welcome", fBot);
-
-        SWTBotUtil.switchToTracingPerspective();
-        /* finish waiting for eclipse to load */
-        SWTBotUtil.waitForJobs();
-    }
-
-    /**
-     * Main test case
-     */
-    @Test
-    public void test() {
-        createProject();
-
-        batchImportOpenWizard();
-        batchImportSelecTraceType();
-        batchImportAddDirectory();
-        batchImportSelectTrace();
-        batchImportFinish();
-
-        TmfEventsEditor tmfEd = openEditor();
-
-        testHistogramView(getViewPart("Histogram"), tmfEd);
-        testPropertyView(getViewPart("Properties"));
-        testStatisticsView(getViewPart("Statistics"));
-
-        deleteProject();
-    }
-
-    private static void createProject() {
-        SWTBotUtil.focusMainWindow(fBot.shells());
-        fBot.menu("File").menu("New").menu("Project...").click();
-
-        fBot.waitUntil(Conditions.shellIsActive("New Project"));
-        SWTBotTree tree = fBot.tree();
-        assertNotNull(tree);
-        final String tracingKey = "Tracing";
-        fBot.waitUntil(ConditionHelpers.IsTreeNodeAvailable(tracingKey, tree));
-        final SWTBotTreeItem tracingNode = tree.expandNode(tracingKey);
-
-        tracingNode.select();
-        final String projectKey = "Tracing Project";
-        fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(projectKey, tracingNode));
-        final SWTBotTreeItem tracingProject = tracingNode.getNode(projectKey);
-        assertNotNull(tracingProject);
-
-        tracingProject.select();
-        tracingProject.click();
-
-        SWTBotButton nextButton = fBot.button("Next >");
-        fBot.waitUntil(Conditions.widgetIsEnabled(nextButton));
-        nextButton.click();
-        fBot.waitUntil(Conditions.shellIsActive("Tracing Project"));
-
-        final SWTBotText text = fBot.text();
-        text.setText(TRACE_PROJECT_NAME);
-
-        fBot.button("Finish").click();
-        SWTBotUtil.waitForJobs();
-    }
-
-    private static void batchImportOpenWizard() {
-        fWizard = new BatchImportTraceWizard();
-
-        UIThreadRunnable.asyncExec(new VoidResult() {
-            @Override
-            public void run() {
-                final IWorkbench workbench = PlatformUI.getWorkbench();
-                // Fire the Import Trace Wizard
-                if (workbench != null) {
-                    final IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
-                    Shell shell = activeWorkbenchWindow.getShell();
-                    assertNotNull(shell);
-                    ((BatchImportTraceWizard) fWizard).init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY);
-                    WizardDialog dialog = new WizardDialog(shell, fWizard);
-                    dialog.open();
-                }
-            }
-        });
-
-        fBot.waitUntil(ConditionHelpers.isWizardReady(fWizard));
-    }
-
-    private static void batchImportSelecTraceType() {
-        final SWTBotTree tree = fBot.tree();
-        final String ctfId = "Common Trace Format";
-        fBot.waitUntil(ConditionHelpers.IsTreeNodeAvailable(ctfId, tree));
-        fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(TRACE_TYPE_NAME, tree.getTreeItem(ctfId)));
-        tree.getTreeItem(ctfId).getNode(TRACE_TYPE_NAME).check();
-        batchImportClickNext();
-    }
-
-    private static void batchImportAddDirectory() {
-        UIThreadRunnable.syncExec(new VoidResult() {
-            @Override
-            public void run() {
-                ((BatchImportTraceWizard) fWizard).addFileToScan(fTrace.getPath());
-            }
-        });
-        final SWTBotButton removeButton = fBot.button("Remove");
-        fBot.waitUntil(Conditions.widgetIsEnabled(removeButton));
-        removeButton.click();
-        fBot.waitUntil(Conditions.tableHasRows(fBot.table(), 1));
-
-        batchImportClickNext();
-    }
-
-    private static void batchImportSelectTrace() {
-        SWTBotTree tree = fBot.tree();
-        fBot.waitUntil(Conditions.widgetIsEnabled(tree));
-        final SWTBotTreeItem genericCtfTreeItem = tree.getTreeItem(TRACE_TYPE_NAME);
-        fBot.waitUntil(Conditions.widgetIsEnabled(genericCtfTreeItem));
-        genericCtfTreeItem.expand();
-        genericCtfTreeItem.check();
-        batchImportClickNext();
-    }
-
-    private static void batchImportClickNext() {
-        IWizardPage currentPage = fWizard.getContainer().getCurrentPage();
-        IWizardPage desiredPage = fWizard.getNextPage(currentPage);
-        SWTBotButton nextButton = fBot.button("Next >");
-        nextButton.click();
-        fBot.waitUntil(ConditionHelpers.isWizardOnPage(fWizard, desiredPage));
-    }
-
-    private static void batchImportFinish() {
-        SWTBotShell shell = fBot.activeShell();
-        final SWTBotButton finishButton = fBot.button("Finish");
-        finishButton.click();
-        fBot.waitUntil(Conditions.shellCloses(shell));
-        SWTBotUtil.waitForJobs();
-    }
-
-    private static TmfEventsEditor openEditor() {
-        final SWTBotView projectExplorerBot = fBot.viewById(IPageLayout.ID_PROJECT_EXPLORER);
-        projectExplorerBot.setFocus();
-
-        final SWTBotTree tree = fBot.tree();
-        final SWTBotTreeItem treeItem = tree.getTreeItem(TRACE_PROJECT_NAME);
-        treeItem.expand();
-
-        List<String> nodes = treeItem.getNodes();
-        String nodeName = "";
-        for (String node : nodes) {
-            if (node.startsWith("Traces")) {
-                nodeName = node;
-            }
-        }
-        fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(nodeName, treeItem));
-        treeItem.getNode(nodeName).expand();
-        fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(TRACE_NAME, treeItem.getNode(nodeName)));
-        treeItem.getNode(nodeName).getNode(TRACE_NAME).select();
-        treeItem.getNode(nodeName).getNode(TRACE_NAME).doubleClick();
-        SWTBotUtil.delay(1000);
-        SWTBotUtil.waitForJobs();
-
-        final IEditorPart iep[] = new IEditorPart[1];
-        UIThreadRunnable.syncExec(new VoidResult() {
-            @Override
-            public void run() {
-                IEditorReference[] ieds = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
-                assertNotNull(ieds);
-                iep[0] = null;
-                for (IEditorReference ied : ieds) {
-                    if (ied.getTitle().equals(TRACE_NAME)) {
-                        iep[0] = ied.getEditor(true);
-                        break;
-                    }
-                }
-            }
-        });
-        assertNotNull(iep[0]);
-        return (TmfEventsEditor) iep[0];
-    }
-
-    private static void deleteProject() {
-        try {
-            ResourcesPlugin.getWorkspace().getRoot().getProject(TRACE_PROJECT_NAME).refreshLocal(IResource.DEPTH_INFINITE, null);
-        } catch (CoreException e) {
-        }
-
-        SWTBotUtil.waitForJobs();
-
-        final SWTBotView projectViewBot = fBot.viewById(IPageLayout.ID_PROJECT_EXPLORER);
-        projectViewBot.setFocus();
-
-        SWTBotTree treeBot = fBot.tree();
-        SWTBotTreeItem treeItem = treeBot.getTreeItem(TRACE_PROJECT_NAME);
-        SWTBotMenu contextMenu = treeItem.contextMenu("Delete");
-        contextMenu.click();
-
-        String shellText = "Delete Resources";
-        fBot.waitUntil(Conditions.shellIsActive(shellText));
-        final SWTBotButton okButton = fBot.button("OK");
-        fBot.waitUntil(Conditions.widgetIsEnabled(okButton));
-        okButton.click();
-
-        SWTBotUtil.waitForJobs();
-    }
-
-    // ---------------------------------------------
-    // Helpers for testing views
-    // ---------------------------------------------
-
-    private static void testPropertyView(IViewPart vp) {
-        PropertySheet pv = (PropertySheet) vp;
-        assertNotNull(pv);
-    }
-
-    private static void testHistogramView(IViewPart vp, final TmfEventsEditor tmfEd) {
-        final CtfTmfEvent desiredEvent1 = getEvent(100);
-        UIThreadRunnable.syncExec(new VoidResult() {
-            @Override
-            public void run() {
-                tmfEd.setFocus();
-                tmfEd.selectionChanged(new SelectionChangedEvent(tmfEd, new StructuredSelection(desiredEvent1)));
-            }
-        });
-
-        SWTBotUtil.waitForJobs();
-        SWTBotUtil.delay(1000);
-
-        final CtfTmfEvent desiredEvent2 = getEvent(10000);
-        SWTBotView hvBot = fBot.viewById(HistogramView.ID);
-        List<SWTBotToolbarButton> hvTools = hvBot.getToolbarButtons();
-        for (SWTBotToolbarButton hvTool : hvTools) {
-            if (hvTool.getToolTipText().toLowerCase().contains("lost")) {
-                hvTool.click();
-            }
-        }
-        HistogramView hv = (HistogramView) vp;
-        final TmfTimeSynchSignal signal = new TmfTimeSynchSignal(hv, desiredEvent1.getTimestamp());
-        final TmfTimeSynchSignal signal2 = new TmfTimeSynchSignal(hv, desiredEvent2.getTimestamp());
-        hv.updateTimeRange(100000);
-        SWTBotUtil.waitForJobs();
-        hv.currentTimeUpdated(signal);
-        hv.broadcast(signal);
-        SWTBotUtil.waitForJobs();
-        SWTBotUtil.delay(1000);
-
-        hv.updateTimeRange(1000000000);
-        SWTBotUtil.waitForJobs();
-        hv.currentTimeUpdated(signal2);
-        hv.broadcast(signal2);
-        SWTBotUtil.waitForJobs();
-        SWTBotUtil.delay(1000);
-        assertNotNull(hv);
-    }
-
-    private static void testStatisticsView(IViewPart vp) {
-        TmfStatisticsView sv = (TmfStatisticsView) vp;
-        assertNotNull(sv);
-    }
-
-    // ---------------------------------------------
-    // Trace helpers
-    // ---------------------------------------------
-
-    private static CtfTmfEvent getEvent(int rank) {
-        CtfTmfTrace trace = fTrace.getTrace();
-        if (trace == null) {
-            return null;
-        }
-        ITmfContext ctx = trace.seekEvent(0);
-        for (int i = 0; i < rank; i++) {
-            trace.getNext(ctx);
-        }
-        final CtfTmfEvent retVal = trace.getNext(ctx);
-        trace.dispose();
-        return retVal;
-    }
-
-    private static IViewPart getViewPart(final String viewTile) {
-        final IViewPart[] vps = new IViewPart[1];
-        UIThreadRunnable.syncExec(new VoidResult() {
-            @Override
-            public void run() {
-                IViewReference[] viewRefs = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences();
-                for (IViewReference viewRef : viewRefs) {
-                    IViewPart vp = viewRef.getView(true);
-                    if (vp.getTitle().equals(viewTile)) {
-                        vps[0] = vp;
-                        return;
-                    }
-                }
-            }
-        });
-
-        return vps[0];
-    }
-}
index 96c797dadfafcba983c5a1b3f118b4951c2c8c99..a735ad801593f18859f3ad82c9bfdd60c039831c 100644 (file)
@@ -16,6 +16,5 @@ Require-Bundle: org.junit;bundle-version="4.0.0",
  org.eclipse.linuxtools.tmf.ui;bundle-version="3.0.0",
  org.eclipse.linuxtools.tmf.core.tests;bundle-version="3.0.0",
  org.eclipse.ui.ide
-Export-Package: org.eclipse.linuxtools.tmf.ui.tests,
- org.eclipse.linuxtools.tmf.ui.tests.shared
+Export-Package: org.eclipse.linuxtools.tmf.ui.tests
 Bundle-Activator: org.eclipse.linuxtools.tmf.ui.tests.TmfUITestPlugin
index 2882dc3c3ed51b85c5de18931dffae4ac757ba14..635e585f623c72a41247170f6da646029f00c664 100644 (file)
@@ -17,7 +17,7 @@ Require-Bundle: org.eclipse.core.expressions,
  org.eclipse.ui.navigator,
  org.eclipse.ui.navigator.resources,
  org.swtchart
-Export-Package: org.eclipse.linuxtools.internal.tmf.ui;x-friends:="org.eclipse.linuxtools.tmf.ui.tests",
+Export-Package: org.eclipse.linuxtools.internal.tmf.ui;x-friends:="org.eclipse.linuxtools.tmf.ui.tests,org.eclipse.linuxtools.tmf.ctf.ui.tests",
  org.eclipse.linuxtools.internal.tmf.ui.commands;x-internal:=true,
  org.eclipse.linuxtools.internal.tmf.ui.dialogs;x-internal:=true,
  org.eclipse.linuxtools.internal.tmf.ui.editors.handlers;x-internal:=true,
@@ -26,7 +26,7 @@ Export-Package: org.eclipse.linuxtools.internal.tmf.ui;x-friends:="org.eclipse.l
  org.eclipse.linuxtools.internal.tmf.ui.preferences;x-internal:=true,
  org.eclipse.linuxtools.internal.tmf.ui.project.dialogs;x-internal:=true,
  org.eclipse.linuxtools.internal.tmf.ui.project.handlers;x-friends:="org.eclipse.linuxtools.tmf.ui.tests",
- org.eclipse.linuxtools.internal.tmf.ui.project.model;x-friends:="org.eclipse.linuxtools.lttng2.ui,org.eclipse.linuxtools.tmf.ui.tests",
+ org.eclipse.linuxtools.internal.tmf.ui.project.model;x-friends:="org.eclipse.linuxtools.lttng2.ui,org.eclipse.linuxtools.tmf.ui.tests,org.eclipse.linuxtools.tmf.ctf.ui.tests",
  org.eclipse.linuxtools.internal.tmf.ui.project.wizards.tracepkg;x-internal:=true,
  org.eclipse.linuxtools.internal.tmf.ui.project.wizards.tracepkg.importexport;x-internal:=true,
  org.eclipse.linuxtools.tmf.ui.analysis,
index dee7f748024217500c1bdeb51c690e33bfa56c05..8974ab40f99293137576f1c797d92773f31a2eed 100644 (file)
    </extension>
    <extension
          point="org.eclipse.linuxtools.tmf.ui.tracetypeui">
-      <type
-            icon="icons/eview16/events_view.gif"
-            tracetype="org.eclipse.linuxtools.tmf.ui.type.ctf">
-      </type>
       <experiment
             tracetype="org.eclipse.linuxtools.tmf.core.experiment.generic"
             icon="icons/elcl16/experiment.gif">
diff --git a/pom.xml b/pom.xml
index f3a0e22569cfb6cd91cd3d66effdf5c69142cb83..7aec065704a8fa0df98fc6fd18d7d01a1b8f5ef3 100644 (file)
--- a/pom.xml
+++ b/pom.xml
     <module>org.eclipse.linuxtools.tmf.ui.swtbot.tests</module>
     <module>org.eclipse.linuxtools.tmf.help</module>
 
+    <module>org.eclipse.linuxtools.tmf.ctf</module>
+    <module>org.eclipse.linuxtools.tmf.ctf.core</module>
+    <module>org.eclipse.linuxtools.tmf.ctf.core.tests</module>
+    <module>org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests</module>
+
     <module>org.eclipse.linuxtools.tmf.analysis.xml.core</module>
     <module>org.eclipse.linuxtools.tmf.analysis.xml.core.tests</module>
     <module>org.eclipse.linuxtools.tmf.analysis.xml.ui</module>
This page took 0.234756 seconds and 5 git commands to generate.