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());
}
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();
}
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());
}
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);
}
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));
}
}
Aggregations