Search in sources :

Example 16 with TmfWindowRangeUpdatedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal in project tracecompass by tracecompass.

the class TmfUml2SDSyncLoaderSignalTest method setUpClass.

/**
 * Initialization
 */
@BeforeClass
public static void setUpClass() {
    fFacility = Uml2SDTestFacility.getInstance();
    fFacility.init();
    fFacility.selectExperiment();
    range = new TmfTimeRange(new Uml2SDTestTimestamp(9789689220871L), new Uml2SDTestTimestamp(9789773881426L));
    // Get range window for tests below
    rangeWindow = (TmfTimestamp) range.getEndTime().getDelta(range.getStartTime());
    TmfTimestamp currentTime = new Uml2SDTestTimestamp(9789773782043L);
    fFacility.getTrace().broadcast(new TmfWindowRangeUpdatedSignal(fFacility, range));
    fFacility.getTrace().broadcast(new TmfSelectionRangeUpdatedSignal(fFacility, currentTime));
    fFacility.delay(IUml2SDTestConstants.BROADCAST_DELAY);
    fTmfComponent = new Uml2SDSignalValidator();
}
Also used : TmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp) TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) BeforeClass(org.junit.BeforeClass)

Example 17 with TmfWindowRangeUpdatedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal in project tracecompass by tracecompass.

the class TmfUml2SDSyncLoaderTimeTest method verifyTimeRangeSamePage.

/**
 * Test Case: 008
 * Description: Verify time range signal (start, end time and current time are in same  page)
 * Verified Methods: loader.synchToTimeRange(), loader.moveToMessage(), loader.moveToMessageInPage()
 * Expected result: Move to correct page(=page of start time of range), set focus on start time of range, but no selection of message.
 */
@Test
public void verifyTimeRangeSamePage() {
    // 9788.642228395 (page 0) -> 9789.164833324 (page 0) with selected time 9788.642228395 (page 0)
    fFacility.getLoader().firstPage();
    TmfTimeRange range = new TmfTimeRange(TC_008_START_TIME_VALUE, TC_008_END_TIME_VALUE);
    fFacility.getLoader().waitForCompletion();
    fFacility.delay(IUml2SDTestConstants.GUI_REFESH_DELAY);
    fFacility.getTrace().broadcast(new TmfWindowRangeUpdatedSignal(this, range));
    assertEquals("synchToTimeRange", TC_008_PAGE_VALUE, fFacility.getLoader().currentPage());
    assertNotNull("synchToTimeRange", fFacility.getLoader().getCurrentTime());
    assertEquals("synchToTimeRange", 0, TC_008_TIME_VALUE.compareTo(fFacility.getLoader().getCurrentTime()));
    selection = fFacility.getSdView().getSDWidget().getSelection();
    // We actually don't want something to be selected!!!
    assertNotNull("synchToTimeRange", selection);
    assertEquals("synchToTimeRange", 0, selection.size());
}
Also used : TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Test(org.junit.Test)

Example 18 with TmfWindowRangeUpdatedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal in project tracecompass by tracecompass.

the class TmfUml2SDSyncLoader method moveToPage.

/**
 * Moves to a certain page.
 *
 * @param notifyAll
 *            true to broadcast time range signal to other signal handlers
 *            else false
 */
protected void moveToPage(boolean notifyAll) {
    TmfTimeRange window = null;
    fLock.lock();
    try {
        // Safety check
        if (fCurrentPage > fCheckPoints.size()) {
            return;
        }
        window = fCheckPoints.get(fCurrentPage);
    } finally {
        fLock.unlock();
    }
    if (window == null) {
        window = TmfTimeRange.ETERNITY;
    }
    fPageRequest = new TmfEventRequest(ITmfEvent.class, window, 0, ITmfEventRequest.ALL_DATA, ITmfEventRequest.ExecutionType.FOREGROUND) {

        private final List<ITmfSyncSequenceDiagramEvent> fSdEvent = new ArrayList<>();

        @Override
        public void handleData(ITmfEvent event) {
            super.handleData(event);
            ITmfSyncSequenceDiagramEvent sdEvent = getSequenceDiagramEvent(event);
            if (sdEvent != null) {
                fSdEvent.add(sdEvent);
            }
        }

        @Override
        public void handleSuccess() {
            fillCurrentPage(fSdEvent);
            super.handleSuccess();
        }
    };
    fTrace.sendRequest(fPageRequest);
    if (notifyAll) {
        TmfTimeRange timeRange = getSignalTimeRange(window.getStartTime());
        broadcast(new TmfWindowRangeUpdatedSignal(this, timeRange, fTrace));
    }
}
Also used : CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) ArrayList(java.util.ArrayList) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) ITmfSyncSequenceDiagramEvent(org.eclipse.tracecompass.tmf.core.uml2sd.ITmfSyncSequenceDiagramEvent) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) TmfEventRequest(org.eclipse.tracecompass.tmf.core.request.TmfEventRequest) ITmfEventRequest(org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest)

Example 19 with TmfWindowRangeUpdatedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal in project tracecompass by tracecompass.

the class TmfUml2SDSyncLoaderTimeTest method verifyTimeRangeDifferentPages.

/**
 * Test Case: 009
 * Description: Verify time range signal (start and end time are across 2 pages)
 * Verified Methods: loader.synchToTimeRange(), loader.moveToMessage(), loader.moveToPage()
 * Expected result: Move to correct page (=page of start time of range), set focus on start time of range, but no selection of message.
 */
@Test
public void verifyTimeRangeDifferentPages() {
    TmfTimeRange range = new TmfTimeRange(TC_009_START_TIME_VALUE, TC_009_END_TIME_VALUE);
    fFacility.getTrace().broadcast(new TmfWindowRangeUpdatedSignal(this, range));
    fFacility.getLoader().waitForCompletion();
    fFacility.delay(IUml2SDTestConstants.GUI_REFESH_DELAY);
    assertEquals("synchToTimeRange", TC_009_PAGE_VALUE, fFacility.getLoader().currentPage());
    assertNotNull("synchToTimeRange", fFacility.getLoader().getCurrentTime());
    assertEquals("synchToTimeRange", 0, TC_009_TIME_VALUE.compareTo(fFacility.getLoader().getCurrentTime()));
    selection = fFacility.getSdView().getSDWidget().getSelection();
    // We actually don't want something to be selected!!!
    assertNotNull("synchToTimeRange", selection);
    assertEquals("synchToTimeRange", 0, selection.size());
}
Also used : TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Test(org.junit.Test)

Example 20 with TmfWindowRangeUpdatedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal in project tracecompass by tracecompass.

the class ResourcesViewTest method testFilter.

/**
 * Test the filter
 */
@Test
public void testFilter() {
    /* change window range to 1 ms */
    TmfTimeRange range = new TmfTimeRange(START_TIME, START_TIME.normalize(1000000L, ITmfTimestamp.NANOSECOND_SCALE));
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range));
    timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME), START_TIME);
    SWTBotToolbarButton filterButton = getViewBot().toolbarButton("Show View Filters");
    filterButton.click();
    SWTBot bot = fBot.shell("Filter").activate().bot();
    /*
         * The filtered tree initialization triggers a delayed refresh job that can
         * interfere with the tree selection. Wait for new refresh jobs to avoid this.
         */
    SWTBotTree treeBot = bot.tree();
    // set filter text
    SWTBotTreeItem treeItem = treeBot.getTreeItem(LttngTraceGenerator.getName());
    bot.text().setText("24");
    fBot.waitUntil(ConditionHelpers.treeItemCount(treeItem, 2));
    // clear filter text
    bot.text().setText(LttngTraceGenerator.getName());
    fBot.waitUntil(ConditionHelpers.treeItemCount(treeItem, 75));
    // get how many items there are
    int checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals("default", 76, checked);
    // test "uncheck all button"
    bot.button(UNCHECK_ALL).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(0, checked);
    // test check all
    bot.button(CHECK_ALL).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(CHECK_ALL, 76, checked);
    // test uncheck inactive
    treeBot.getTreeItem(LttngTraceGenerator.getName()).select("CPU 1 States");
    bot.button(UNCHECK_ALL).click();
    bot.button(CHECK_SELECTED).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(CHECK_SELECTED, 2, checked);
    // test check subtree
    bot.button(UNCHECK_ALL).click();
    bot.button(CHECK_SUBTREE).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(CHECK_SUBTREE, 2, checked);
    // test uncheck selected
    bot.button(CHECK_ALL).click();
    bot.button(UNCHECK_SELECTED).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(UNCHECK_SELECTED, 75, checked);
    // test uncheck subtree
    bot.button(CHECK_ALL).click();
    bot.button(UNCHECK_SUBTREE).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(UNCHECK_SELECTED, 75, checked);
    // test filter
    bot.button(UNCHECK_ALL).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(0, checked);
    bot.text().setText("CPU 2");
    fBot.waitUntil(ConditionHelpers.treeItemCount(treeItem, 75));
    bot.button(CHECK_ALL).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals("Filtered", 76, checked);
    bot.button("OK").click();
}
Also used : SWTBot(org.eclipse.swtbot.swt.finder.SWTBot) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) SWTBotToolbarButton(org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton) Point(org.eclipse.swt.graphics.Point) Test(org.junit.Test)

Aggregations

TmfWindowRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal)31 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)25 Test (org.junit.Test)20 TmfSelectionRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal)9 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)9 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)8 SWTBotTimeGraph (org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph)7 AbstractTimeGraphView (org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView)6 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)6 SWTBotEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor)5 TmfTraceManager (org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager)5 XYDataProviderBaseTest (org.eclipse.tracecompass.tmf.ui.swtbot.tests.views.xychart.XYDataProviderBaseTest)5 TmfCommonXAxisChartViewer (org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfCommonXAxisChartViewer)5 IViewPart (org.eclipse.ui.IViewPart)5 Point (org.eclipse.swt.graphics.Point)4 SWTBot (org.eclipse.swtbot.swt.finder.SWTBot)4 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)4 ITmfTimestamp (org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp)4 TimeGraphControl (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.TimeGraphControl)3 WidgetNotFoundException (org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException)2