Search in sources :

Example 76 with TmfTimeRange

use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.

the class TmfUml2SDSyncLoaderSignalTest method verifyFirstPageSignal.

/**
 * Test Case: 001
 * Description: Verify that time range signal is send with correct values when going to first page
 * Verified Methods: broadcast()
 * Expected result: Time range sync signal is sent with correct range and current time.
 */
@Test
public void verifyFirstPageSignal() {
    TmfTimestamp currentTime = new Uml2SDTestTimestamp(9788641608418L);
    range = new TmfTimeRange(currentTime, new Uml2SDTestTimestamp(currentTime.getValue() + rangeWindow.getValue()));
    fTmfComponent.setSignalError(false);
    fTmfComponent.setSourceError(false);
    fTmfComponent.setRangeError(false);
    fTmfComponent.setWindowRangeSignalReceived(false);
    // set expected values
    fTmfComponent.setSource(fFacility.getLoader());
    fTmfComponent.setCurrentRange(range);
    fFacility.firstPage();
    WaitUtils.waitUntil(validator -> validator.isWindowRangeSignalReceived(), fTmfComponent, "Window range signal not received");
    assertFalse("TmfRangeSynchSignal", fTmfComponent.isSignalError());
    assertFalse("TmfRangeSynchSignal", fTmfComponent.isSourceError());
    assertFalse("TmfRangeSynchSignal", fTmfComponent.isRangeError());
}
Also used : TmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Test(org.junit.Test)

Example 77 with TmfTimeRange

use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange 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 78 with TmfTimeRange

use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange 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 79 with TmfTimeRange

use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.

the class RefreshTraceContentHandler method refreshTrace.

private static void refreshTrace(ITmfTrace trace) {
    TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
    TmfTraceRangeUpdatedSignal signal = new TmfTraceRangeUpdatedSignal(trace, trace, range);
    trace.broadcastAsync(signal);
}
Also used : TmfTraceRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceRangeUpdatedSignal) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)

Example 80 with TmfTimeRange

use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange 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)

Aggregations

TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)168 Test (org.junit.Test)98 ITmfTimestamp (org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp)53 TmfWindowRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal)29 ITmfEvent (org.eclipse.tracecompass.tmf.core.event.ITmfEvent)24 TmfEventRequest (org.eclipse.tracecompass.tmf.core.request.TmfEventRequest)24 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)21 TmfSignalHandler (org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)20 TmfSelectionRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal)19 ITmfEventRequest (org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest)16 SWTBotTimeGraph (org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph)16 Vector (java.util.Vector)13 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)12 TmfTraceManager (org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager)10 ITmfEventProvider (org.eclipse.tracecompass.tmf.core.component.ITmfEventProvider)9 AbstractTimeGraphView (org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView)9 TmfTraceContext (org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext)8 TmfExperiment (org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment)8 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)8 Point (org.eclipse.swt.graphics.Point)7