ctf: Depend on the tracecompass-test-traces project
[deliverable/tracecompass.git] / ctf / org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests / src / org / eclipse / tracecompass / tmf / ctf / ui / swtbot / tests / AbstractImportAndReadSmokeTest.java
index 20b32ba3bd8078a7ce933e4044f9fc6ee8cd0f21..f81faf05c73a079f56a979c0314b6a433a2b0afb 100644 (file)
 package org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests;
 
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assume.assumeTrue;
 
 import java.util.List;
 
 import org.apache.log4j.Logger;
 import org.apache.log4j.varia.NullAppender;
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jface.viewers.SelectionChangedEvent;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.wizard.Wizard;
@@ -36,16 +36,17 @@ 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.tracecompass.internal.tmf.ui.views.statistics.TmfStatisticsViewImpl;
+import org.eclipse.tracecompass.testtraces.ctf.CtfTestTrace;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
 import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
-import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTraceUtils;
 import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
 import org.eclipse.tracecompass.tmf.ui.editors.TmfEventsEditor;
 import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers;
 import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils;
 import org.eclipse.tracecompass.tmf.ui.views.histogram.HistogramView;
-import org.eclipse.tracecompass.tmf.ui.views.statistics.TmfStatisticsView;
 import org.eclipse.ui.IViewPart;
 import org.eclipse.ui.IViewReference;
 import org.eclipse.ui.PlatformUI;
@@ -69,8 +70,8 @@ public abstract class AbstractImportAndReadSmokeTest {
     protected static final String TRACE_FOLDER = "synctraces";
     /** Trace type name for generic CTF traces */
     protected static final String TRACE_TYPE_NAME = "Generic CTF Trace";
-    /** A Generic CTF Trace*/
-    protected static final CtfTmfTestTrace fTrace = CtfTmfTestTrace.SYNC_DEST;
+    /** A Generic CTF Trace */
+    protected static final @NonNull CtfTestTrace fTrace = CtfTestTrace.SYNC_DEST;
     /** SWT BOT workbench reference */
     protected static SWTWorkbenchBot fBot;
     /** Wizard to use */
@@ -82,7 +83,6 @@ public abstract class AbstractImportAndReadSmokeTest {
     /** Test Class setup */
     @BeforeClass
     public static void init() {
-        assumeTrue(fTrace.exists());
         SWTBotUtils.failIfUIThread();
 
         /* set up for swtbot */
@@ -154,6 +154,7 @@ public abstract class AbstractImportAndReadSmokeTest {
 
     /**
      * Gets the project Name
+     *
      * @return the project name
      */
     protected abstract String getProjectName();
@@ -175,6 +176,7 @@ public abstract class AbstractImportAndReadSmokeTest {
 
     /**
      * Verifies the Histogram View
+     *
      * @param vp
      *            the view part
      * @param tmfEd
@@ -222,11 +224,12 @@ public abstract class AbstractImportAndReadSmokeTest {
 
     /**
      * Verifies the statistics view
+     *
      * @param vp
      *            the view part
      */
     protected void testStatisticsView(IViewPart vp) {
-        TmfStatisticsView sv = (TmfStatisticsView) vp;
+        TmfStatisticsViewImpl sv = (TmfStatisticsViewImpl) vp;
         assertNotNull(sv);
     }
 
@@ -236,24 +239,24 @@ public abstract class AbstractImportAndReadSmokeTest {
 
     /**
      * Gets an event at a given rank
+     *
      * @param rank
      *            a rank
      * @return the event at given rank
      */
     protected CtfTmfEvent getEvent(int rank) {
-        try (CtfTmfTrace trace = fTrace.getTrace()) {
-            ITmfContext ctx = trace.seekEvent(0);
-            for (int i = 0; i < rank; i++) {
-                trace.getNext(ctx);
-            }
-            return trace.getNext(ctx);
-        }
+        CtfTmfTrace trace = CtfTmfTestTraceUtils.getTrace(fTrace);
+        ITmfContext ctx = trace.seekEvent(rank);
+        CtfTmfEvent ret = trace.getNext(ctx);
+        ctx.dispose();
+        return ret;
     }
 
     /**
      * Gets a view part based on view title
+     *
      * @param viewTile
-     *              a view title
+     *            a view title
      * @return the view part
      */
     protected IViewPart getViewPart(final String viewTile) {
This page took 0.025228 seconds and 5 git commands to generate.