コード例 #1
0
  public void testSendInterfaceOperationWithReturnOutOfLongDele() {
    ModelRoot[] roots = Ooaofooa.getInstancesUnderSystem(projectName);
    Function_c testFunc = null;
    for (int i = 0; i < roots.length; i++) {
      testFunc = Function_c.FunctionInstance(roots[i], new Function_by_name_c("LongDelegation"));
      if (testFunc != null) {
        break;
      }
    }
    assertNotNull(testFunc);

    Selection.getInstance().setSelection(new StructuredSelection(m_sys));
    runVerifier();

    BPDebugUtils.executeElement(testFunc);

    DebugUITestUtilities.waitForExecution();

    DebugUITestUtilities.waitForBPThreads(m_sys);
    DebugUITestUtilities.waitForExecution();

    String expectedConsoleText =
        "User invoked function: LongDelegation"
            + "\r\nLogSuccess:  TestDriverComponent has consumed the messsage as expected"
            + "\r\nLogSuccess:  Correct return value from delegated message\r\n";
    String actualConsoleText = DebugUITestUtilities.getConsoleText("null");
    assertEquals(expectedConsoleText, actualConsoleText);
  }
コード例 #2
0
  public void testSendInterfaceSignalOverDele() {
    ModelRoot root = Ooaofooa.getInstance("/Delegation/models/Delegation/System/System.xtuml");
    Function_c testFunc = Function_c.FunctionInstance(root, new Function_by_name_c("sendSignal"));
    assertNotNull(testFunc);

    Selection.getInstance().setSelection(new StructuredSelection(m_sys));
    runVerifier();

    BPDebugUtils.executeElement(testFunc);

    DebugUITestUtilities.waitForExecution();

    DebugUITestUtilities.waitForBPThreads(m_sys);
    DebugUITestUtilities.waitForExecution();

    String expectedConsoleText =
        "User invoked function: sendSignal\r\nLogSuccess:  LevelOneDelegationComponent has consumed the messsage as expected\r\nLogSuccess:  LevelTwoDelegationComponent has consumed the messsage as expected\r\n";
    String actualConsoleText = DebugUITestUtilities.getConsoleText("null");
    assertEquals(expectedConsoleText, actualConsoleText);
  }
コード例 #3
0
  public void testSendInterfaceOperationWithReturnOverLongDele() {
    ModelRoot root = Ooaofooa.getInstance("/Delegation/models/Delegation/System/System.xtuml");
    Function_c testFunc =
        Function_c.FunctionInstance(root, new Function_by_name_c("longdelegationWithReturn"));
    assertNotNull(testFunc);

    Selection.getInstance().setSelection(new StructuredSelection(m_sys));
    runVerifier();

    BPDebugUtils.executeElement(testFunc);

    DebugUITestUtilities.waitForExecution();

    DebugUITestUtilities.waitForBPThreads(m_sys);
    DebugUITestUtilities.waitForExecution();

    String expectedConsoleText =
        "User invoked function: longdelegationWithReturn"
            + "\r\nLogSuccess:  FourOfFourDelegation has consumed the messsage as expected"
            + "\r\nLogSuccess:  Correct return value from delegated message\r\n";
    String actualConsoleText = DebugUITestUtilities.getConsoleText("null");
    assertEquals(expectedConsoleText, actualConsoleText);
  }
コード例 #4
0
  private void checkTransitionActionBreakPoint(final String transName, String expResultFile) {
    Package_c cp =
        Package_c.getOneEP_PKGOnR1405(
            m_sys,
            new ClassQueryInterface_c() {

              @Override
              public boolean evaluate(Object candidate) {
                return ((Package_c) candidate).getName().equals("Components");
              }
            });
    assertNotNull(cp);

    Component_c component =
        Component_c.getOneC_COnR8001(
            PackageableElement_c.getManyPE_PEsOnR8000(cp),
            new ClassQueryInterface_c() {

              @Override
              public boolean evaluate(Object candidate) {
                return ((Component_c) candidate).getName().equals("TransitionActionTestGlobals");
              }
            });
    assertNotNull(component);

    // launch the component
    DebugUITestUtilities.setLogActivityAndLaunchForElement(
        component, m_bp_tree.getControl().getMenu(), m_sys.getName());
    // select the transition to be tested
    Transition_c trans =
        Transition_c.TransitionInstance(
            component.getModelRoot(),
            new ClassQueryInterface_c() {
              public boolean evaluate(Object candidate) {
                return ((Transition_c) candidate).Get_name().contains(transName);
              }
            });
    assertNotNull(trans);
    Selection.getInstance().clear();
    Selection.getInstance().addToSelection(trans);
    // set a breakpoint at line 2
    ActivityEditor editor = DebugUITestUtilities.openActivityEditorForSelectedElement();

    DebugUITestUtilities.setBreakpointAtLine(editor, 2);

    Function_c setup =
        Function_c.getOneS_SYNCOnR8001(
            PackageableElement_c.getManyPE_PEsOnR8000(
                Package_c.getManyEP_PKGsOnR8001(
                    PackageableElement_c.getManyPE_PEsOnR8003(component))),
            new ClassQueryInterface_c() {

              public boolean evaluate(Object candidate) {
                return ((Function_c) candidate).getName().equals("setup");
              }
            });
    assertNotNull(setup);

    openPerspectiveAndView(
        "com.mentor.nucleus.bp.debug.ui.DebugPerspective",
        BridgePointPerspective.ID_MGC_BP_EXPLORER);

    BPDebugUtils.executeElement(setup);

    DebugUITestUtilities.waitForExecution();

    Function_c test =
        Function_c.getOneS_SYNCOnR8001(
            PackageableElement_c.getManyPE_PEsOnR8000(
                Package_c.getManyEP_PKGsOnR8001(
                    PackageableElement_c.getManyPE_PEsOnR8003(component))),
            new ClassQueryInterface_c() {

              public boolean evaluate(Object candidate) {
                return ((Function_c) candidate).getName().equals("test");
              }
            });
    assertNotNull(test);

    BPDebugUtils.executeElement(test);

    DebugUITestUtilities.waitForExecution();

    ComponentInstance_c engine = ComponentInstance_c.getOneI_EXEOnR2955(component);
    assertNotNull(engine);

    // wait for the execution to complete
    DebugUITestUtilities.waitForBPThreads(m_sys);

    // compare the trace
    File expectedResults =
        new File(m_workspace_path + "expected_results/verifier/" + expResultFile);
    String expected_results = TestUtil.getTextFileContents(expectedResults);
    // get the text representation of the debug tree
    String actual_results = DebugUITestUtilities.getConsoleText(expected_results);
    assertEquals(expected_results, actual_results);
  }