tmf: Add SWTBot tests for manually refresh of traces
authorMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Tue, 29 Sep 2015 21:01:27 +0000 (17:01 -0400)
committerMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Fri, 2 Oct 2015 14:38:01 +0000 (10:38 -0400)
Change-Id: I6e52066382b958e2c50ebdd9982e8651bdc87889
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/57138
Reviewed-by: Hudson CI
lttng/org.eclipse.tracecompass.lttng2.ust.ui.swtbot.tests/src/org/eclipse/tracecompass/lttng2/ust/ui/swtbot/tests/CallStackViewTest.java
tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/META-INF/MANIFEST.MF
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/AllTests.java
tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ui/swtbot/tests/viewers/events/TestRefreshCustomTextTrace.java [new file with mode: 0644]
tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ui/swtbot/tests/viewers/events/TestRefreshTextTrace.java [new file with mode: 0644]
tmf/org.eclipse.tracecompass.tmf.ui.tests/build.properties

index 147011fb325905bbba607a2d69dfe6c17cd46c8c..5228de6017124c973af2d68325ae1cb93335d941 100644 (file)
@@ -24,25 +24,19 @@ import java.util.List;
 import org.apache.log4j.ConsoleAppender;
 import org.apache.log4j.Logger;
 import org.apache.log4j.SimpleLayout;
-import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
 import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
-import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
 import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
-import org.eclipse.swtbot.swt.finder.results.Result;
 import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
-import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
 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.tmf.core.event.ITmfEvent;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
 import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
 import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
-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.callstack.CallStackView;
 import org.junit.After;
@@ -222,7 +216,7 @@ public class CallStackViewTest {
         for (int i = 0; i < 10; i++) {
             viewBot.toolbarPushButton(SELECT_NEXT_EVENT).click();
             currentEventOffset++;
-            fBot.waitUntil(new EventsTableSelectionCondition(TIMESTAMPS[currentEventOffset]));
+            fBot.waitUntil(ConditionHelpers.selectionInEventsTable(fBot, TIMESTAMPS[currentEventOffset]));
             SWTBotUtils.waitForJobs();
             assertArrayEquals(STACK_FRAMES[currentEventOffset], getVisibleStackFrames(viewBot).toArray());
 
@@ -231,7 +225,7 @@ public class CallStackViewTest {
         for (int i = 0; i < 2; i++) {
             viewBot.toolbarPushButton(SELECT_PREVIOUS_EVENT).click();
             currentEventOffset--;
-            fBot.waitUntil(new EventsTableSelectionCondition(TIMESTAMPS[currentEventOffset]));
+            fBot.waitUntil(ConditionHelpers.selectionInEventsTable(fBot, TIMESTAMPS[currentEventOffset]));
             SWTBotUtils.waitForJobs();
             assertArrayEquals(STACK_FRAMES[currentEventOffset], getVisibleStackFrames(viewBot).toArray());
         }
@@ -283,45 +277,7 @@ public class CallStackViewTest {
         SWTBotTable table = fBot.activeEditor().bot().table();
         table.setFocus();
         TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(table.widget, new TmfNanoTimestamp(timestamp)));
-        fBot.waitUntil(new EventsTableSelectionCondition(timestamp));
-    }
-
-    /**
-     * Wait until the events table selection matches the specified time stamp.
-     */
-    private static class EventsTableSelectionCondition extends DefaultCondition {
-        private long fSelectionTime;
-
-        private EventsTableSelectionCondition(long selectionTime) {
-            fSelectionTime = selectionTime;
-        }
-
-        @Override
-        public boolean test() throws Exception {
-            StructuredSelection eventsTableSelection = getEventsTableSelection();
-            if (eventsTableSelection.isEmpty()) {
-                return false;
-            }
-            return ((ITmfEvent) eventsTableSelection.getFirstElement()).getTimestamp().getValue() == fSelectionTime;
-        }
-
-        @Override
-        public String getFailureMessage() {
-            return "failed";
-        }
-
-        private static StructuredSelection getEventsTableSelection() {
-            return UIThreadRunnable.syncExec(new Result<StructuredSelection>() {
-
-                @Override
-                public StructuredSelection run() {
-                    SWTBotEditor eventsEditor = SWTBotUtils.activeEventsEditor(fBot);
-                    TmfEventsEditor part = (TmfEventsEditor) eventsEditor.getReference().getPart(false);
-                    StructuredSelection selection = (StructuredSelection) part.getSelection();
-                    return selection;
-                }
-            });
-        }
+        fBot.waitUntil(ConditionHelpers.selectionInEventsTable(fBot, timestamp));
     }
 
     /**
index 8a4139503f813fd0399b08ffefa4ba88fc764433..3bb4527fe27a87a592b40d6d77fef7451f911b6e 100644 (file)
@@ -16,6 +16,7 @@ Require-Bundle: org.junit;bundle-version="4.0.0",
  org.eclipse.tracecompass.tmf.ui,
  org.eclipse.tracecompass.tmf.core,
  org.eclipse.tracecompass.tmf.core.tests,
+ org.eclipse.tracecompass.tmf.ui.tests,
  org.eclipse.swtbot.junit4_x,
  org.eclipse.swtbot.swt.finder
 Import-Package: com.google.common.collect,
index 5af7e4fbc357f342bbb0cb76f23857669084d6d1..ace7f1bff9adad98e311fb9dae6334786b0228e8 100644 (file)
 
 package org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared;
 
-
 import static org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory.withPartName;
 
 import java.util.Arrays;
 
+import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.wizard.IWizardContainer;
 import org.eclipse.jface.wizard.IWizardPage;
 import org.eclipse.jface.wizard.Wizard;
 import org.eclipse.osgi.util.NLS;
 import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
 import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
 import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.Result;
 import org.eclipse.swtbot.swt.finder.utils.TableCollection;
 import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
 import org.eclipse.swtbot.swt.finder.waits.ICondition;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
+import org.eclipse.tracecompass.tmf.ui.editors.TmfEventsEditor;
 import org.eclipse.ui.IEditorReference;
 import org.hamcrest.Matcher;
 
@@ -394,4 +399,55 @@ public final class ConditionHelpers {
             }
         };
     }
+
+    private static class EventsTableSelectionCondition extends DefaultCondition {
+        private long fSelectionTime;
+        private SWTWorkbenchBot fBot;
+
+        private EventsTableSelectionCondition(SWTWorkbenchBot bot, long selectionTime) {
+            fBot = bot;
+            fSelectionTime = selectionTime;
+        }
+
+        @Override
+        public boolean test() throws Exception {
+            StructuredSelection eventsTableSelection = getEventsTableSelection();
+            if (eventsTableSelection.isEmpty()) {
+                return false;
+            }
+            return ((ITmfEvent) eventsTableSelection.getFirstElement()).getTimestamp().getValue() == fSelectionTime;
+        }
+
+        @Override
+        public String getFailureMessage() {
+            return "The selection in the table was not an event with timestamp " + fSelectionTime;
+        }
+
+        private StructuredSelection getEventsTableSelection() {
+            return UIThreadRunnable.syncExec(new Result<StructuredSelection>() {
+
+                @Override
+                public StructuredSelection run() {
+                    SWTBotEditor eventsEditor = SWTBotUtils.activeEventsEditor(fBot);
+                    TmfEventsEditor part = (TmfEventsEditor) eventsEditor.getReference().getPart(false);
+                    StructuredSelection selection = (StructuredSelection) part.getSelection();
+                    return selection;
+                }
+            });
+        }
+    }
+
+    /**
+     * Wait until the events table selection matches the specified time stamp.
+     *
+     * @param bot
+     *            a workbench bot
+     *
+     * @param selectionTime
+     *            the selection time
+     * @return ICondition for verification
+     */
+    public static ICondition selectionInEventsTable(final SWTWorkbenchBot bot, long selectionTime) {
+        return new EventsTableSelectionCondition(bot, selectionTime);
+    }
 }
index 5d3f2ecf773ae6f089ad6f2159f12ed0e82233ee..1396915c5578352972e2a55da3ce5338807e1b08 100644 (file)
@@ -31,8 +31,9 @@ import org.junit.runners.Suite;
         MovableColumnEventsEditorTest.class,
         SDViewTest.class,
         TestTraceOffsetting.class,
-        TmfAlignTimeAxisTest.class
-
+        TmfAlignTimeAxisTest.class,
+        TestRefreshTextTrace.class,
+        TestRefreshCustomTextTrace.class,
 })
 public class AllTests {
 }
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ui/swtbot/tests/viewers/events/TestRefreshCustomTextTrace.java b/tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ui/swtbot/tests/viewers/events/TestRefreshCustomTextTrace.java
new file mode 100644 (file)
index 0000000..c0e7cb5
--- /dev/null
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ui.swtbot.tests.viewers.events;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTxtTraceDefinition;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
+import org.eclipse.tracecompass.tmf.ui.tests.TmfUITestPlugin;
+import org.junit.runner.RunWith;
+import org.osgi.framework.Bundle;
+
+/**
+ * Test refreshing a custom text trace after new content was added.
+ */
+@RunWith(SWTBotJunit4ClassRunner.class)
+public class TestRefreshCustomTextTrace extends TestRefreshTextTrace {
+
+    private static final String TRACE_LOCATION = TmfTraceManager.getTemporaryDirPath() + File.separator + "test.txt";
+    private static final String DEFINITION_PATH = "tracesets" + File.separator + "txt" + File.separator + "testTxtDefinition.xml";
+    private static final String TRACE_TYPE_CUSTOM_TEXT = "custom.txt.trace:Custom Text:testtxt";
+    private static final String TIMESTAMP_FORMAT = "dd/MM/yyyy HH:mm:ss:SSS";
+
+    private static final long SECOND_TO_MILLISECOND = 1000;
+    private static final long SECOND_TO_NANOSECOND = 1000000000;
+
+    private long fNbWrittenEvents = 0;
+
+    @Override
+    protected String createTrace(long nbEvents) throws Exception {
+        createDefinition();
+        writeToTrace(nbEvents, false);
+
+        return TRACE_LOCATION;
+    }
+
+    private static void createDefinition() throws URISyntaxException, IOException {
+        File file = getBundleFile(TmfUITestPlugin.getDefault().getBundle(), new Path(DEFINITION_PATH));
+        CustomTxtTraceDefinition[] definitions = CustomTxtTraceDefinition.loadAll(file.toString());
+        for (CustomTxtTraceDefinition text : definitions) {
+            text.save();
+        }
+    }
+
+    private static File getBundleFile(Bundle bundle, IPath relativePath) throws URISyntaxException, IOException {
+        return new File(FileLocator.toFileURL(FileLocator.find(bundle, relativePath, null)).toURI());
+    }
+
+    @Override
+    protected void appendToTrace(long nbEVents) throws IOException {
+        writeToTrace(nbEVents, true);
+    }
+
+    private void writeToTrace(long nbEVents, boolean append) throws IOException {
+        final File file = new File(TRACE_LOCATION);
+        try (FileWriter writer = new FileWriter(file, append)) {
+            for (int i = 0; i < nbEVents; ++i) {
+                SimpleDateFormat f = new SimpleDateFormat(TIMESTAMP_FORMAT);
+                String eventStr = f.format(new Date(fNbWrittenEvents * SECOND_TO_MILLISECOND)) + " hello world\n";
+                writer.write(eventStr);
+                fNbWrittenEvents++;
+            }
+        }
+    }
+
+    @Override
+    protected long getExpectedEndTimeStamp() {
+        return (fNbWrittenEvents - 1) * SECOND_TO_NANOSECOND;
+    }
+
+    @Override
+    protected String getTraceType() {
+        return TRACE_TYPE_CUSTOM_TEXT;
+    }
+
+    @Override
+    protected long getNbWrittenEvents() {
+        return fNbWrittenEvents;
+    }
+}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ui/swtbot/tests/viewers/events/TestRefreshTextTrace.java b/tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ui/swtbot/tests/viewers/events/TestRefreshTextTrace.java
new file mode 100644 (file)
index 0000000..9e1c41a
--- /dev/null
@@ -0,0 +1,231 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ui.swtbot.tests.viewers.events;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.varia.NullAppender;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.keyboard.Keystrokes;
+import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
+import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
+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.ConditionHelpers;
+import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Test refreshing a text trace after new content was added.
+ */
+@RunWith(SWTBotJunit4ClassRunner.class)
+public class TestRefreshTextTrace {
+
+    private static final String PROJECT_NAME = "Test";
+    private static final String TRACE_TYPE_SYSLOG = "org.eclipse.linuxtools.tmf.tests.stubs.trace.text.testsyslog";
+    private static final String TIMESTAMP_FORMAT = "MMM dd HH:mm:ss";
+
+    private static final long INITIAL_NB_EVENTS = 100;
+    private static final int NEW_EVENTS_PER_REFRESH = 40000;
+    private static final int NB_REFRESH = 3;
+    private static final long SECOND_TO_MILLISECOND = 1000;
+    private static final long MICROSECOND_TO_NANOSECOND = 1000000;
+
+    private static final Calendar CURRENT = Calendar.getInstance();
+    private static final String TRACE_LOCATION = TmfTraceManager.getTemporaryDirPath() + File.separator + "test.txt";
+    private static SWTWorkbenchBot fBot;
+
+    private long fNbWrittenEvents = 0;
+
+    /** Test Class setup */
+    @BeforeClass
+    public static void init() {
+        SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
+        SWTBotUtils.failIfUIThread();
+        SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
+        Logger.getRootLogger().addAppender(new NullAppender());
+        fBot = new SWTWorkbenchBot();
+
+        SWTBotUtils.closeView("welcome", fBot);
+
+        SWTBotUtils.switchToTracingPerspective();
+        /* finish waiting for eclipse to load */
+        SWTBotUtils.waitForJobs();
+    }
+
+    /**
+     * Test setup
+     *
+     * @throws Exception on error
+     */
+    @Before
+    public void before() throws Exception {
+        SWTBotUtils.createProject(PROJECT_NAME);
+        SWTBotUtils.openTrace(PROJECT_NAME, createTrace(INITIAL_NB_EVENTS), getTraceType());
+        SWTBotUtils.waitForJobs();
+    }
+
+    /**
+     * Test tear down
+     */
+    @After
+    public void after() {
+        SWTBotUtils.deleteProject(PROJECT_NAME, fBot);
+    }
+
+    /**
+     * Test refreshing a trace after new content was added.
+     *
+     * @throws IOException
+     *             on error
+     */
+    @Test
+    public void testRefresh() throws IOException {
+        ITmfTrace activeTrace = TmfTraceManager.getInstance().getActiveTrace();
+
+        fBot.waitUntil(new NumberOfEventsCondition(activeTrace, INITIAL_NB_EVENTS));
+
+        for (int i = 0; i < NB_REFRESH; i++) {
+            appendToTrace(NEW_EVENTS_PER_REFRESH);
+
+            // Refresh
+            SWTBotTreeItem tracesFolder = SWTBotUtils.selectTracesFolder(fBot, PROJECT_NAME);
+            SWTBotTreeItem traceItem = SWTBotUtils.getTraceProjectItem(fBot, tracesFolder, activeTrace.getName());
+            traceItem.contextMenu("Refresh").click();
+
+            // Make sure the refresh is completed
+            fBot.waitUntil(new NumberOfEventsCondition(activeTrace, getNbWrittenEvents()));
+        }
+
+        // Make sure the end of the table matches what we expect
+        goToTableEnd();
+        fBot.waitUntil(ConditionHelpers.selectionInEventsTable(fBot, getExpectedEndTimeStamp()));
+    }
+
+    private static class NumberOfEventsCondition extends DefaultCondition {
+
+        private ITmfTrace fTrace;
+        private long fNbEvents;
+
+        private NumberOfEventsCondition(ITmfTrace trace, long nbEvents) {
+            fTrace = trace;
+            fNbEvents = nbEvents;
+        }
+
+        @Override
+        public boolean test() throws Exception {
+            return fTrace.getNbEvents() == fNbEvents;
+        }
+
+        @Override
+        public String getFailureMessage() {
+            return fTrace.getName() + " did not contain the expected number of " + fNbEvents + " events";
+        }
+    }
+
+    /**
+     * Create a trace with a number of events.
+     *
+     * @param nbEvents
+     *            the number of events to generate
+     * @return the path to the created trace
+     * @throws Exception
+     *             on error
+     */
+    protected String createTrace(long nbEvents) throws Exception {
+        writeToTrace(nbEvents, false);
+        return TRACE_LOCATION;
+    }
+
+    /**
+     * Append a number of events to the trace.
+     *
+     * @param nbEvents
+     *            the number of events to append
+     * @throws IOException
+     *             on error
+     */
+    protected void appendToTrace(long nbEvents) throws IOException {
+        writeToTrace(nbEvents, true);
+    }
+
+    private void writeToTrace(long nbEvents, boolean append) throws IOException {
+        final File file = new File(TRACE_LOCATION);
+        try (FileWriter writer = new FileWriter(file, append)) {
+            for (int i = 0; i < nbEvents; ++i) {
+                writeEvent(writer);
+            }
+        }
+    }
+
+    private void writeEvent(FileWriter fw) throws IOException {
+        SimpleDateFormat f = new SimpleDateFormat(TIMESTAMP_FORMAT);
+        String timeStampStr = f.format(new Date(fNbWrittenEvents * SECOND_TO_MILLISECOND));
+        fw.write(timeStampStr + " HostF LoggerF: SourceFileF:9 Message F\n");
+        fNbWrittenEvents++;
+    }
+
+    /**
+     * Get the trace type for the test.
+     *
+     * @return the trace type
+     */
+    protected String getTraceType() {
+        return TRACE_TYPE_SYSLOG;
+    }
+
+    /**
+     * Get the expected time in nanosecs at the end of the trace, after
+     * refreshing.
+     *
+     * @return the expected time in nanosecs at the end of the trace
+     */
+    protected long getExpectedEndTimeStamp() {
+        Date date = new Date((fNbWrittenEvents - 1) * SECOND_TO_MILLISECOND);
+        // Syslog fills in the year when parsing so we have to do it for the
+        // expected time stamp as well
+        GregorianCalendar calendar = new GregorianCalendar();
+        calendar.setTime(date);
+        calendar.set(Calendar.YEAR, CURRENT.get(Calendar.YEAR));
+        if (calendar.after(CURRENT)) {
+            calendar.set(Calendar.YEAR, CURRENT.get(Calendar.YEAR) - 1);
+        }
+        return calendar.getTimeInMillis() * MICROSECOND_TO_NANOSECOND;
+    }
+
+    private static void goToTableEnd() {
+        SWTBotEditor eventsEditor = SWTBotUtils.activeEventsEditor(fBot);
+        eventsEditor.setFocus();
+        eventsEditor.bot().table().pressShortcut(Keystrokes.END);
+    }
+
+    /**
+     * Get the number of events written so far.
+     *
+     * @return the number of events written so far
+     */
+    protected long getNbWrittenEvents() {
+        return fNbWrittenEvents;
+    }
+}
index 02e71ab620ecdb04712747258245d0b363fe5ef4..a546457d62f0f15b971c174ea43385367bc5d9f0 100644 (file)
@@ -18,7 +18,8 @@ bin.includes = META-INF/,\
                .,\
                plugin.properties,\
                plugin.xml,\
-               about.html
+               about.html,\
+               tracesets/txt/testTxtDefinition.xml
 src.includes = about.html
 additional.bundles = org.eclipse.jdt.annotation
 jars.extra.classpath = platform:/plugin/org.eclipse.jdt.annotation
This page took 0.034 seconds and 5 git commands to generate.