tmf: Mark TmfTraceManager @NonNullByDefault
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.ui.swtbot.tests / src / org / eclipse / tracecompass / tmf / ui / swtbot / tests / wizards / TestImportExportPackageWizard.java
index b0c8f1ac48e0ccfe43f81a54ab1cc4b75f0a96e6..21d9bbd986a64dd3d4c145acaa85acea494d4db6 100644 (file)
@@ -33,8 +33,10 @@ import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
 import org.eclipse.swtbot.swt.finder.waits.Conditions;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
 import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
 import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils;
+import org.eclipse.tracecompass.tmf.ui.tests.shared.WaitUtils;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -66,10 +68,6 @@ public class TestImportExportPackageWizard {
     private static final String PROJECT_NAME = "Test";
     private static final String XMLSTUB_ID = "org.eclipse.linuxtools.tmf.core.tests.xmlstub";
 
-    /*
-     * FIXME: bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=477508, we
-     * shouldn't need so many events.
-     */
     private static final String TRACE_CONTENT = "<trace>" +
             "<event timestamp=\"100\" name=\"event\"><field name=\"field\" value=\"1\" type=\"int\" /></event>" +
             "<event timestamp=\"200\" name=\"event1\"><field name=\"field\" value=\"2\" type=\"int\" /></event>" +
@@ -105,7 +103,7 @@ public class TestImportExportPackageWizard {
 
         SWTBotUtils.switchToTracingPerspective();
         /* finish waiting for eclipse to load */
-        SWTBotUtils.waitForJobs();
+        WaitUtils.waitForJobs();
 
     }
 
@@ -129,8 +127,10 @@ public class TestImportExportPackageWizard {
         assertTrue("Trace :" + f.getAbsolutePath() + " does not exist, aborting test", f.exists());
         SWTBotUtils.createProject(PROJECT_NAME);
         SWTBotUtils.openTrace(PROJECT_NAME, f.getAbsolutePath(), XMLSTUB_ID);
-        SWTBotUtils.waitForJobs();
-        assertEquals("Incorrect opened trace!", f.getAbsolutePath(), (new File(TmfTraceManager.getInstance().getActiveTrace().getPath())).getAbsolutePath());
+        WaitUtils.waitForJobs();
+        ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
+        assertNotNull(trace);
+        assertEquals("Incorrect opened trace!", f.getAbsolutePath(), (new File(trace.getPath())).getAbsolutePath());
         SWTBotView projectExplorerBot = fBot.viewByTitle(PROJECT_EXPLORER);
         assertNotNull("Cannot find " + PROJECT_EXPLORER, projectExplorerBot);
         projectExplorerBot.show();
@@ -157,7 +157,7 @@ public class TestImportExportPackageWizard {
         SWTBotShell shell = fBot.activeShell();
         shellBot.button(FINISH).click();
         // finished exporting
-        SWTBotUtils.waitForJobs();
+        WaitUtils.waitForJobs();
         fBot.waitUntil(Conditions.shellCloses(shell));
         fBot = new SWTWorkbenchBot();
         exportPackage = new File(EXPORT_LOCATION);
@@ -180,10 +180,12 @@ public class TestImportExportPackageWizard {
         fBot.waitUntil(Conditions.shellCloses(shell));
         fBot = new SWTWorkbenchBot();
         SWTBotUtils.openEditor(fBot, PROJECT_NAME, new Path(f.getName()));
-        assertEquals("Test if import matches", f.getName(), TmfTraceManager.getInstance().getActiveTrace().getName());
-        assertFalse("Test if import files don't match", f.getAbsolutePath().equals(TmfTraceManager.getInstance().getActiveTrace().getPath()));
+        trace = TmfTraceManager.getInstance().getActiveTrace();
+        assertNotNull(trace);
+        assertEquals("Test if import matches", f.getName(), trace.getName());
+        assertFalse("Test if import files don't match", f.getAbsolutePath().equals(trace.getPath()));
         SWTBotUtils.deleteProject(PROJECT_NAME, fBot);
-        SWTBotUtils.waitForJobs();
+        WaitUtils.waitForJobs();
     }
 
 }
This page took 0.02718 seconds and 5 git commands to generate.