Search in sources :

Example 1 with TmfSyncMessage

use of org.eclipse.tracecompass.tmf.ui.views.uml2sd.loader.TmfSyncMessage in project tracecompass by tracecompass.

the class TmfUml2SDSyncLoaderFindTest method verifyFirstMessage.

/**
 * Verify 1st message find within page.
 *
 * Verified Methods: loader.find(), loader.moveToMessage()
 * Expected result: Correct message is selected
 */
@Test
public void verifyFirstMessage() {
    fTmfComponent.setWindowRangeSignalReceived(false);
    fFacility.firstPage();
    WaitUtils.waitUntil(validator -> validator.isWindowRangeSignalReceived(), fTmfComponent, "Window range signal not received");
    criteria = new Criteria();
    criteria.setSyncMessageSelected(true);
    criteria.setExpression("GAME_.*");
    fTmfComponent.setSignalError(false);
    fTmfComponent.setSourceError(false);
    fTmfComponent.setCurrentTimeError(false);
    fTmfComponent.setSelectionRangeSignalReceived(false);
    // set expected values
    fTmfComponent.setSource(fFacility.getLoader());
    fTmfComponent.setCurrentTime(TC_002_TIME_VALUE);
    fFacility.getLoader().find(criteria);
    WaitUtils.waitUntil(validator -> validator.isSelectionRangeSignalReceived(), fTmfComponent, "Selection range signal not received");
    assertFalse("find", fTmfComponent.isSignalError());
    assertFalse("find", fTmfComponent.isSourceError());
    assertFalse("find", fTmfComponent.isCurrentTimeError());
    assertEquals("find", TC_002_PAGE_VALUE, fFacility.getLoader().currentPage());
    selection = fFacility.getSdView().getSDWidget().getSelection();
    assertNotNull(selection);
    assertEquals("find", 1, selection.size());
    assertTrue(selection.get(0) instanceof TmfSyncMessage);
    msg = (TmfSyncMessage) selection.get(0);
    assertEquals("find", TC_002_MESSAGE_NAME, msg.getName());
    assertEquals("find", 0, TC_002_TIME_VALUE.compareTo(msg.getStartTime()));
    assertEquals("find", TC_002_START_OCCURRANCE, msg.getStartOccurrence());
    assertEquals("find", TC_002_END_OCCURRANCE, msg.getEndOccurrence());
    assertEquals("find", TC_002_START_LIFELINE, msg.getStartLifeline().getName());
    assertEquals("find", TC_002_END_LIFELINE, msg.getEndLifeline().getName());
    /**
     * Verify 2nd message find within page.
     *
     * Verified Methods: loader.find(), loader.moveToMessage()
     * Expected result: Correct message is selected
     */
    fTmfComponent.setSignalError(false);
    fTmfComponent.setSourceError(false);
    fTmfComponent.setCurrentTimeError(false);
    fTmfComponent.setSelectionRangeSignalReceived(false);
    // set expected values
    fTmfComponent.setSource(fFacility.getLoader());
    fTmfComponent.setCurrentTime(TC_003_TIME_VALUE);
    fFacility.getLoader().find(criteria);
    WaitUtils.waitUntil(validator -> validator.isSelectionRangeSignalReceived(), fTmfComponent, "Selection range signal not received");
    assertFalse("find", fTmfComponent.isSignalError());
    assertFalse("find", fTmfComponent.isSourceError());
    assertFalse("find", fTmfComponent.isCurrentTimeError());
    assertEquals("find", TC_003_PAGE_VALUE, fFacility.getLoader().currentPage());
    selection = fFacility.getSdView().getSDWidget().getSelection();
    assertNotNull(selection);
    assertEquals("find", 1, selection.size());
    assertTrue(selection.get(0) instanceof TmfSyncMessage);
    msg = (TmfSyncMessage) selection.get(0);
    assertEquals("find", TC_003_MESSAGE_NAME, msg.getName());
    assertEquals("find", 0, TC_003_TIME_VALUE.compareTo(msg.getStartTime()));
    assertEquals("find", TC_003_START_OCCURRANCE, msg.getStartOccurrence());
    assertEquals("find", TC_003_END_OCCURRANCE, msg.getEndOccurrence());
    assertEquals("find", TC_003_START_LIFELINE, msg.getStartLifeline().getName());
    assertEquals("find", TC_003_END_LIFELINE, msg.getEndLifeline().getName());
    /**
     * Verify 1st message across page.
     *
     * Verified Methods: loader.find(), loader.moveToPage(), loader.moveToMessage()
     * Expected result: Correct message is selected
     */
    fTmfComponent.setSignalError(false);
    fTmfComponent.setSourceError(false);
    fTmfComponent.setCurrentTimeError(false);
    fTmfComponent.setSelectionRangeSignalReceived(false);
    // set expected values
    fTmfComponent.setSource(fFacility.getLoader());
    fTmfComponent.setCurrentTime(TC_004_TIME_VALUE);
    fFacility.getLoader().find(criteria);
    // find across pages uses a job
    fFacility.waitForJobs();
    // to make sure pageRequest has been started before calling waitforCompletion()
    fFacility.delay(IUml2SDTestConstants.GUI_REFESH_DELAY);
    fFacility.getLoader().waitForCompletion();
    WaitUtils.waitUntil(validator -> validator.isSelectionRangeSignalReceived(), fTmfComponent, "Selection range signal not received");
    assertFalse("find", fTmfComponent.isSignalError());
    assertFalse("find", fTmfComponent.isSourceError());
    assertFalse("find", fTmfComponent.isCurrentTimeError());
    assertEquals("find", TC_004_PAGE_VALUE, fFacility.getLoader().currentPage());
    selection = fFacility.getSdView().getSDWidget().getSelection();
    assertNotNull(selection);
    assertEquals("find", 1, selection.size());
    assertTrue(selection.get(0) instanceof TmfSyncMessage);
    msg = (TmfSyncMessage) selection.get(0);
    assertEquals("find", TC_004_MESSAGE_NAME, msg.getName());
    assertEquals("find", 0, TC_004_TIME_VALUE.compareTo(msg.getStartTime()));
    assertEquals("find", TC_004_START_OCCURRANCE, msg.getStartOccurrence());
    assertEquals("find", TC_004_END_OCCURRANCE, msg.getEndOccurrence());
    assertEquals("find", TC_004_START_LIFELINE, msg.getStartLifeline().getName());
    assertEquals("find", TC_004_END_LIFELINE, msg.getEndLifeline().getName());
    // cancel find and go back to first page
    fFacility.getLoader().cancel();
}
Also used : Criteria(org.eclipse.tracecompass.tmf.ui.views.uml2sd.dialogs.Criteria) TmfSyncMessage(org.eclipse.tracecompass.tmf.ui.views.uml2sd.loader.TmfSyncMessage) Test(org.junit.Test)

Example 2 with TmfSyncMessage

use of org.eclipse.tracecompass.tmf.ui.views.uml2sd.loader.TmfSyncMessage in project tracecompass by tracecompass.

the class TmfUml2SDSyncLoaderTimeTest method verifySynchToTimeOutsidePage.

/**
 * Test Case: 002
 * Description: Verify synchToTime (exact time outside of page), selection of message in page
 * Verified Methods: loader.syncToTime(), loader.moveToMessage(), loader.moveToPage()
 * Expected result: Correct message is selected.
 */
@Test
public void verifySynchToTimeOutsidePage() {
    fFacility.getTrace().broadcast(new TmfSelectionRangeUpdatedSignal(this, TC_002_TIME_VALUE));
    fFacility.getLoader().waitForCompletion();
    fFacility.delay(IUml2SDTestConstants.GUI_REFESH_DELAY);
    assertEquals("synchToTime", TC_002_PAGE_VALUE, fFacility.getLoader().currentPage());
    selection = fFacility.getSdView().getSDWidget().getSelection();
    assertNotNull("synchToTime", selection);
    assertEquals("synchToTime", 1, selection.size());
    assertTrue("synchToTime", selection.get(0) instanceof TmfSyncMessage);
    msg = (TmfSyncMessage) selection.get(0);
    assertEquals("synchToTime", TC_002_MESSAGE_NAME, msg.getName());
    assertEquals(0, TC_002_TIME_VALUE.compareTo(msg.getStartTime()));
    assertEquals("synchToTime", TC_002_START_OCCURRANCE, msg.getStartOccurrence());
    assertEquals("synchToTime", TC_002_END_OCCURRANCE, msg.getEndOccurrence());
    assertEquals(TC_002_START_LIFELINE, msg.getStartLifeline().getName());
    assertEquals(TC_002_END_LIFELINE, msg.getEndLifeline().getName());
}
Also used : TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) TmfSyncMessage(org.eclipse.tracecompass.tmf.ui.views.uml2sd.loader.TmfSyncMessage) Test(org.junit.Test)

Example 3 with TmfSyncMessage

use of org.eclipse.tracecompass.tmf.ui.views.uml2sd.loader.TmfSyncMessage in project tracecompass by tracecompass.

the class TmfUml2SDSyncLoaderTimeTest method verifySynchToTimeInPage.

/**
 * Test Case: 001
 * Description: Verify synchToTime (exact time in page), selection of message in page
 * Verified Methods: loader.syncToTime(), loader.moveToMessage(), loader.moveToMessageInPage()
 * Expected result: Correct message is selected.
 */
@Test
public void verifySynchToTimeInPage() {
    fFacility.getTrace().broadcast(new TmfSelectionRangeUpdatedSignal(this, TC_001_TIME_VALUE));
    fFacility.getLoader().waitForCompletion();
    fFacility.delay(IUml2SDTestConstants.GUI_REFESH_DELAY);
    assertEquals("synchToTime", TC_001_PAGE_VALUE, fFacility.getLoader().currentPage());
    selection = fFacility.getSdView().getSDWidget().getSelection();
    assertNotNull(selection);
    assertEquals("synchToTime", 1, selection.size());
    assertTrue(selection.get(0) instanceof TmfSyncMessage);
    msg = (TmfSyncMessage) selection.get(0);
    assertEquals("synchToTime", TC_001_MESSAGE_NAME, msg.getName());
    assertEquals("synchToTime", 0, TC_001_TIME_VALUE.compareTo(msg.getStartTime()));
    assertEquals("synchToTime", TC_001_START_OCCURRANCE, msg.getStartOccurrence());
    assertEquals("synchToTime", TC_001_END_OCCURRANCE, msg.getEndOccurrence());
    assertEquals("synchToTime", TC_001_START_LIFELINE, msg.getStartLifeline().getName());
    assertEquals("synchToTime", TC_001_END_LIFELINE, msg.getEndLifeline().getName());
}
Also used : TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) TmfSyncMessage(org.eclipse.tracecompass.tmf.ui.views.uml2sd.loader.TmfSyncMessage) Test(org.junit.Test)

Example 4 with TmfSyncMessage

use of org.eclipse.tracecompass.tmf.ui.views.uml2sd.loader.TmfSyncMessage in project tracecompass by tracecompass.

the class TmfUml2SDSyncLoaderFilterTest method verifyMessageFilter.

/**
 * Verify filter of messages
 *
 * Verified Methods: loader.filter(), loader.fillCurrentPage()
 * Expected result: Only particular messages are shown
 */
@Test
public void verifyMessageFilter() {
    // Initialize the filter
    filterToSave.get(2).setActive(true);
    // Run the filter
    fFacility.getLoader().filter(filterToSave);
    fFacility.delay(IUml2SDTestConstants.GUI_REFESH_DELAY);
    assertEquals("filter", 2, fFacility.getSdView().getFrame().lifeLinesCount());
    assertEquals("filter", 6, fFacility.getSdView().getFrame().syncMessageCount());
    String[] messages = { "REGISTER_PLAYER_REQUEST", "REGISTER_PLAYER_REPLY", "GAME_REQUEST", "GAME_REPLY", "START_GAME_REQUEST", "START_GAME_REPLY" };
    for (int i = 0; i < messages.length; i++) {
        SyncMessage msg = fFacility.getSdView().getFrame().getSyncMessage(i);
        assertTrue("filter", msg instanceof TmfSyncMessage);
        assertEquals("filter", messages[i], msg.getName());
    }
}
Also used : SyncMessage(org.eclipse.tracecompass.tmf.ui.views.uml2sd.core.SyncMessage) TmfSyncMessage(org.eclipse.tracecompass.tmf.ui.views.uml2sd.loader.TmfSyncMessage) TmfSyncMessage(org.eclipse.tracecompass.tmf.ui.views.uml2sd.loader.TmfSyncMessage) Test(org.junit.Test)

Aggregations

TmfSyncMessage (org.eclipse.tracecompass.tmf.ui.views.uml2sd.loader.TmfSyncMessage)4 Test (org.junit.Test)4 TmfSelectionRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal)2 SyncMessage (org.eclipse.tracecompass.tmf.ui.views.uml2sd.core.SyncMessage)1 Criteria (org.eclipse.tracecompass.tmf.ui.views.uml2sd.dialogs.Criteria)1