tmf: Add waitUntil / condition to tmf.ui.tests
[deliverable/tracecompass.git] / ctf / org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests / src / org / eclipse / tracecompass / tmf / ctf / ui / swtbot / tests / TestInvalidCtfTrace.java
index ae1a251ff04dddfd8dd4d428ae1c03210c6b9ebc..192cda95a7838834dd165ae56aebd48ff8d5500d 100644 (file)
@@ -38,8 +38,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.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils;
+import org.eclipse.tracecompass.tmf.ui.tests.shared.WaitUtils;
 import org.junit.After;
-import org.junit.Before;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -68,11 +70,11 @@ public class TestInvalidCtfTrace {
     private static final Map<String, String> ERRORS = new HashMap<>();
     static {
         // metadata
-        ERRORS.put("array-redefinition", "MismatchedTokenException(57!=72)");
+        ERRORS.put("array-redefinition", "MismatchedTokenException(56!=71)");
         ERRORS.put("array-size-identifier", "Is not an integer: x");
-        ERRORS.put("array-size-keyword", "NoViableAltException(75@[])");
+        ERRORS.put("array-size-keyword", "NoViableAltException(74@[])");
         ERRORS.put("array-size-negative", "Array length is negative");
-        ERRORS.put("array-size-not-present", "NoViableAltException(14@[])");
+        ERRORS.put("array-size-not-present", "NoViableAltException(13@[])");
         ERRORS.put("array-size-string", "Is not an integer: x");
         ERRORS.put("array-size-type-field", "Is not an integer: uint32_t");
         ERRORS.put("array-size-type", "Is not an integer: uint32_t");
@@ -80,10 +82,10 @@ public class TestInvalidCtfTrace {
         ERRORS.put("integer-encoding-invalid", "Invalid value for encoding");
         ERRORS.put("integer-negative-bit-size", "Invalid value for size");
         ERRORS.put("integer-range", "Invalid integer format: 23452397856348975623897562893746589237465289374658923764598237645897234658723648579236");
-        ERRORS.put("integer-signed-as-string", "org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions.ParseException");
+        ERRORS.put("integer-signed-as-string", "Invalid boolean value");
         ERRORS.put("integer-signed-invalid", "Invalid boolean value svp");
         ERRORS.put("integer-size-as-string", "Invalid value for size");
-        ERRORS.put("integer-size-missing", "org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions.ParseException");
+        ERRORS.put("integer-size-missing", "Invalid boolean value");
         ERRORS.put("struct-align-enum", "Invalid value for alignment");
         ERRORS.put("struct-align-huge", "Invalid integer format: 0xFFFFFFFFU");
         ERRORS.put("struct-align-negative", "Invalid value for alignment : -8");
@@ -91,7 +93,7 @@ public class TestInvalidCtfTrace {
         ERRORS.put("struct-align-zero", "Invalid value for alignment : 0");
         ERRORS.put("struct-duplicate-field-name", "Identifier has already been defined:xxx");
         ERRORS.put("struct-duplicate-struct-name", "struct a already defined.");
-        ERRORS.put("struct-field-name-keyword", "NoViableAltException(73@[])");
+        ERRORS.put("struct-field-name-keyword", "NoViableAltException(72@[])");
         // streams
         ERRORS.put("content-size-larger-than-packet-size", "UNKNOWN"); //FIXME
         ERRORS.put("cross-packet-event-alignment-empty-struct", "UNKNOWN"); //FIXME
@@ -164,9 +166,9 @@ public class TestInvalidCtfTrace {
     /**
      * Initialization
      */
-    @Before
-    public void init() {
-        SWTBotUtils.failIfUIThread();
+    @BeforeClass
+    public static void beforeClass() {
+        SWTBotUtils.initialize();
         Thread.currentThread().setName("SWTBot Thread"); // for the debugger
         /* set up for swtbot */
         SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
@@ -178,16 +180,25 @@ public class TestInvalidCtfTrace {
 
         SWTBotUtils.switchToTracingPerspective();
         /* finish waiting for eclipse to load */
-        SWTBotUtils.waitForJobs();
+        WaitUtils.waitForJobs();
         SWTBotUtils.createProject(PROJET_NAME);
 
     }
 
     /**
-     * Delete file
+     * Delete traces
      */
     @After
-    public void cleanup() {
+    public void teardown() {
+        SWTBotUtils.clearTracesFolder(fBot, PROJET_NAME);
+        SWTBotUtils.closeSecondaryShells(fBot);
+    }
+
+    /**
+     * Delete project
+     */
+    @AfterClass
+    public static void afterClass() {
         SWTBotUtils.deleteProject(PROJET_NAME, fBot);
         fLogger.removeAllAppenders();
     }
@@ -198,7 +209,7 @@ public class TestInvalidCtfTrace {
     @Test
     public void testOpen() {
         SWTBotUtils.selectTracesFolder(fBot, PROJET_NAME);
-        SWTBotUtils.openTrace(PROJET_NAME, fLocation.getAbsolutePath(), "org.eclipse.linuxtools.tmf.ui.type.ctf");
+        SWTBotUtils.openTrace(PROJET_NAME, fLocation.getAbsolutePath(), "org.eclipse.linuxtools.tmf.ui.type.ctf", false);
         fBot.waitUntil(Conditions.shellIsActive("Open Trace"));
         final SWTBotShell shell = fBot.activeShell();
         final SWTBot dialogBot = shell.bot();
This page took 0.028653 seconds and 5 git commands to generate.