tmf: Fix TestRefreshTextTrace failure because of bad time zone reset
authorMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Tue, 16 Feb 2016 22:36:01 +0000 (17:36 -0500)
committerMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Fri, 19 Feb 2016 18:39:13 +0000 (13:39 -0500)
Commit 6941941dae56 (https://git.eclipse.org/r/#/c/66579/)
changed tests to set explicitly a time zone but it doesn't
reset it properly. Because of this, TestRefreshTextTrace had
mismatching time stamps.

This can reproduced by running FilterViewerTest first then
running TestRefreshTextTrace. The easiest way is to modify
SWTBotStressTests to have this:

s.addTest(new JUnit4TestAdapter(FilterViewerTest.class));
s.addTest(new JUnit4TestAdapter(TestRefreshTextTrace.class));

To fix it, we reset the time zone to the time zone id, not the label.
The safest way to do this is to use what we decided to use in the
default preference map.

Change-Id: I9b25e2c3a458cee62b74cfde61043270b62b1c01
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/66723
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
lttng/org.eclipse.tracecompass.lttng2.kernel.ui.swtbot.tests/src/org/eclipse/tracecompass/lttng2/kernel/ui/swtbot/tests/ControlFlowViewSortingTest.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/timestamp/TmfTimePreferences.java
tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/shared/org/eclipse/tracecompass/tmf/ui/swtbot/tests/shared/ConditionHelpers.java
tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ui/swtbot/tests/viewers/events/FilterViewerTest.java
tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ui/swtbot/tests/viewers/events/TestTraceOffsetting.java

index 04e6cff94b1bdc42225a083c10b59ea5655e22a0..2c5bb77d808426b93e5848d00a547e8a67ba21bf 100644 (file)
@@ -30,6 +30,7 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
 import org.eclipse.tracecompass.internal.tmf.core.Activator;
 import org.eclipse.tracecompass.testtraces.ctf.CtfTestTrace;
 import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimePreferencesConstants;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimePreferences;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestampFormat;
 import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers.SWTBotTestCondition;
 import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils;
@@ -113,7 +114,7 @@ public class ControlFlowViewSortingTest extends KernelTestBase {
     @Override
     public void after() {
         IEclipsePreferences defaultPreferences = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
-        defaultPreferences.put(ITmfTimePreferencesConstants.TIME_ZONE, "Local Time");
+        defaultPreferences.put(ITmfTimePreferencesConstants.TIME_ZONE, TmfTimePreferences.getDefaultPreferenceMap().get(ITmfTimePreferencesConstants.TIME_ZONE));
         TmfTimestampFormat.updateDefaultFormats();
         super.after();
     }
index 553d5cb09a3ed153a6e844a35c84ec18eb4a5416..3dc7e7817868c68f4e3df6975a128f0e7a4d9da9 100644 (file)
@@ -146,6 +146,7 @@ public final class TmfTimePreferences {
         prefToMap(prefs, prefsMap, ITmfTimePreferencesConstants.SSEC_DELIMITER, SSEC_DELIMITER_DEFAULT);
         prefToMap(prefs, prefsMap, ITmfTimePreferencesConstants.DATIME, DATIME_DEFAULT);
         prefToMap(prefs, prefsMap, ITmfTimePreferencesConstants.DATE_DELIMITER, DATE_DELIMITER_DEFAULT);
+        prefToMap(prefs, prefsMap, ITmfTimePreferencesConstants.TIME_ZONE, TIME_ZONE_DEFAULT);
         return prefsMap;
     }
 
index 5bb3256e1d7a765322989130edbb84f5fbe67ee8..00a67656442ac297723be4186e7b2d85ab777fa7 100644 (file)
@@ -434,6 +434,7 @@ public final class ConditionHelpers {
     private static class EventsTableSelectionCondition extends DefaultCondition {
         private long fSelectionTime;
         private SWTWorkbenchBot fBot;
+        private long fCurValue;
 
         private EventsTableSelectionCondition(SWTWorkbenchBot bot, long selectionTime) {
             fBot = bot;
@@ -446,12 +447,13 @@ public final class ConditionHelpers {
             if (eventsTableSelection.isEmpty()) {
                 return false;
             }
-            return ((ITmfEvent) eventsTableSelection.getFirstElement()).getTimestamp().getValue() == fSelectionTime;
+            fCurValue = ((ITmfEvent) eventsTableSelection.getFirstElement()).getTimestamp().getValue();
+            return fCurValue == fSelectionTime;
         }
 
         @Override
         public String getFailureMessage() {
-            return "The selection in the table was not an event with timestamp " + fSelectionTime;
+            return "The selection in the table was not an event with timestamp " + fSelectionTime + ". Actual is " + fCurValue;
         }
 
         private StructuredSelection getEventsTableSelection() {
index c64642ac1802e6b040acbd9fd71b7b69e0d140c7..70c9f71876da0d3b1cc1ab940ba402bcdb6d6f55 100644 (file)
@@ -35,6 +35,7 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
 import org.eclipse.tracecompass.internal.tmf.core.Activator;
 import org.eclipse.tracecompass.tmf.core.io.BufferedRandomAccessFile;
 import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimePreferencesConstants;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimePreferences;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestampFormat;
 import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers;
 import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils;
@@ -139,7 +140,7 @@ public class FilterViewerTest {
         SWTBotUtils.closeViewById(FilterView.ID, fBot);
 
         IEclipsePreferences defaultPreferences = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
-        defaultPreferences.put(ITmfTimePreferencesConstants.TIME_ZONE, "Local Time");
+        defaultPreferences.put(ITmfTimePreferencesConstants.TIME_ZONE, TmfTimePreferences.getDefaultPreferenceMap().get(ITmfTimePreferencesConstants.TIME_ZONE));
         TmfTimestampFormat.updateDefaultFormats();
     }
 
index 231b8a0050f3f897250a0b633263e1a7ff3aa354..fe8640641670eeaad28f5d71935eb2d0578460e7 100644 (file)
@@ -38,6 +38,7 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
 import org.eclipse.tracecompass.internal.tmf.core.Activator;
 import org.eclipse.tracecompass.tmf.core.io.BufferedRandomAccessFile;
 import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimePreferencesConstants;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimePreferences;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestampFormat;
 import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers;
 import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils;
@@ -117,7 +118,7 @@ public class TestTraceOffsetting {
         fLogger.removeAllAppenders();
 
         IEclipsePreferences defaultPreferences = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
-        defaultPreferences.put(ITmfTimePreferencesConstants.TIME_ZONE, "Local Time");
+        defaultPreferences.put(ITmfTimePreferencesConstants.TIME_ZONE, TmfTimePreferences.getDefaultPreferenceMap().get(ITmfTimePreferencesConstants.TIME_ZONE));
         TmfTimestampFormat.updateDefaultFormats();
     }
 
This page took 0.028932 seconds and 5 git commands to generate.