コード例 #1
0
  public void testExternalEntityPackageConversion() {
    Package_c domPkg =
        Package_c.getOneEP_PKGOnR1401(
            m_sys,
            new ClassQueryInterface_c() {

              @Override
              public boolean evaluate(Object candidate) {
                return ((Package_c) candidate).getName().equals("domain");
              }
            });
    assertNotNull("Could not locate test package", domPkg);
    Package_c seqPackage =
        Package_c.getOneEP_PKGOnR8001(
            PackageableElement_c.getManyPE_PEsOnR8000(domPkg),
            new ClassQueryInterface_c() {

              @Override
              public boolean evaluate(Object candidate) {
                return ((Package_c) candidate).getName().equals("External Entities");
              }
            });
    assertNotNull("Could not locate converted external entity package.", seqPackage);
    performDiagramTest(seqPackage, 4);
    performPETest(seqPackage, 4);
  }
コード例 #2
0
  public void testSubsystemConversion() {
    Package_c pkg =
        Package_c.getOneEP_PKGOnR1401(
            m_sys,
            new ClassQueryInterface_c() {

              @Override
              public boolean evaluate(Object candidate) {
                return ((Package_c) candidate).getName().equals("domain");
              }
            });
    assertNotNull("Could not locate host package.", pkg);
    Package_c ss =
        Package_c.getOneEP_PKGOnR8001(
            PackageableElement_c.getManyPE_PEsOnR8000(pkg),
            new ClassQueryInterface_c() {

              @Override
              public boolean evaluate(Object candidate) {
                return ((Package_c) candidate).getName().equals("subsystem");
              }
            });
    assertNotNull("Could not locate converted subsystem.", ss);
    performDiagramTest(ss, 9);
    performPETest(ss, 11);
  }
コード例 #3
0
  public void testDomainAsComponentConversion() {
    Package_c pkg =
        Package_c.getOneEP_PKGOnR1401(
            m_sys,
            new ClassQueryInterface_c() {

              @Override
              public boolean evaluate(Object candidate) {
                return ((Package_c) candidate).getName().equals("ComponentPackage");
              }
            });
    assertNotNull("Could not locate host package.", pkg);
    Component_c comp =
        Component_c.getOneC_COnR8001(
            PackageableElement_c.getManyPE_PEsOnR8000(pkg),
            new ClassQueryInterface_c() {

              @Override
              public boolean evaluate(Object candidate) {
                return ((Component_c) candidate).getName().equals("component");
              }
            });
    assertNotNull("Could not locate converted component.", comp);
    performDiagramTest(comp, 6);
    performPETest(comp, 4);
  }
コード例 #4
0
  private void runVerifier() {
    Package_c[] pkgs = Package_c.getManyEP_PKGsOnR1401(m_sys);
    NonRootModelElement[] selectedElement = null;
    NonRootModelElement[] compRefs = null;
    NonRootModelElement[] components = null;
    for (Package_c pkg : pkgs) {
      if (pkg.getName().equalsIgnoreCase("system")) {
        components = Component_c.getManyC_CsOnR8001(PackageableElement_c.getManyPE_PEsOnR8000(pkg));
        assertNotNull(components);
        compRefs =
            ComponentReference_c.getManyCL_ICsOnR8001(
                PackageableElement_c.getManyPE_PEsOnR8000(pkg));
        assertNotNull(compRefs);
        selectedElement = new NonRootModelElement[components.length + compRefs.length];
        System.arraycopy(components, 0, selectedElement, 0, components.length);
        System.arraycopy(compRefs, 0, selectedElement, components.length, compRefs.length);
      }
    }
    openPerspectiveAndView(
        "com.mentor.nucleus.bp.debug.ui.DebugPerspective",
        BridgePointPerspective.ID_MGC_BP_EXPLORER);
    Selection.getInstance().setSelection(new StructuredSelection(components));
    Menu menu = m_bp_tree.getControl().getMenu();
    assertTrue(
        "The Launch Verifier action was not present for a component.",
        UITestingUtilities.checkItemStatusInContextMenu(menu, "Launch Verifier", "", false));
    MenuItem launchVerifierItem = DebugUITestUtilities.getLaunchVerifierItem(menu);
    assertNotNull(launchVerifierItem);
    ComponentInstance_c[] engines =
        ComponentInstance_c.ComponentInstanceInstances(components[0].getModelRoot());
    assertTrue(
        "Unexpected test state, there should be no Component Instances.", engines.length == 0);
    TestUtil.debugToDialog(200);
    launchVerifierItem.notifyListeners(SWT.Selection, null);
    TestingUtilities.processDisplayEvents();

    menu = m_bp_tree.getControl().getMenu();
    assertFalse(
        "The Launch Verifier action was present for an unassigned imported component.",
        UITestingUtilities.menuItemExists(menu, "", "Launch Verifier"));
  }
コード例 #5
0
  public void testDataTypePackageConversion() {
    Package_c pkg =
        Package_c.getOneEP_PKGOnR1401(
            m_sys,
            new ClassQueryInterface_c() {

              @Override
              public boolean evaluate(Object candidate) {
                return ((Package_c) candidate).getName().equals("Datatypes");
              }
            });
    assertNotNull("Could not locate converted data type package.", pkg);
    performDiagramTest(pkg, 5);
    performPETest(pkg, 5);
  }
コード例 #6
0
  public void testInterfacePackageConversion() {
    Package_c ip =
        Package_c.getOneEP_PKGOnR1401(
            m_sys,
            new ClassQueryInterface_c() {

              @Override
              public boolean evaluate(Object candidate) {
                return ((Package_c) candidate).getName().equals("InterfacePackage");
              }
            });
    assertNotNull("Could not locate converted interface package.", ip);
    performDiagramTest(ip, 2);
    performPETest(ip, 2);
  }
コード例 #7
0
  public void testDomainConversion() {
    Package_c domPkg =
        Package_c.getOneEP_PKGOnR1401(
            m_sys,
            new ClassQueryInterface_c() {

              @Override
              public boolean evaluate(Object candidate) {
                return ((Package_c) candidate).getName().equals("domain");
              }
            });
    assertNotNull("Could not locate a converted domain", domPkg);
    performDiagramTest(domPkg, 9);
    performPETest(domPkg, 9);
  }
コード例 #8
0
  public void testCanRenameAndCanDeleteReferentialAttribute() {
    class findModelClassUsingName implements ClassQueryInterface_c {

      findModelClassUsingName(String aname) {
        name = aname;
      }

      private String name;

      public boolean evaluate(Object candidate) {
        ModelClass_c selected = (ModelClass_c) candidate;
        return selected.getName().equals(name);
      }
    }

    class findPackageUsingName implements ClassQueryInterface_c {
      findPackageUsingName(String aname) {
        name = aname;
      }

      private String name;

      public boolean evaluate(Object candidate) {
        Package_c selected = (Package_c) candidate;
        return selected.getName().equals(name);
      }
    }

    testClass =
        ModelClass_c.getOneO_OBJOnR8001(
            PackageableElement_c.getManyPE_PEsOnR8000(
                Package_c.PackageInstance(
                    modelRoot, new findPackageUsingName("CanRenameCanDelete Data"))),
            new findModelClassUsingName("Class D")); // $NON-NLS-1$ //$NON-NLS-2$
    Attribute_c attr =
        Attribute_c.getOneO_ATTROnR102(testClass, new findAttributeUsingName("id")); // $NON-NLS-1$

    assertFalse(attr.Canrename());
    assertFalse(attr.Candelete());

    Attribute_c attr_ren =
        Attribute_c.getOneO_ATTROnR102(
            testClass,
            new findAttributeUsingName("renamedRefId")); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    assertTrue(attr_ren.Canrename());
    assertFalse(attr_ren.Candelete());
  }
コード例 #9
0
 /** @see ITreeContentProvider#getParent(Object) Returns the parent of this node */
 public Object getParent(Object arg) {
   Activity_c result150 =
       Activity_c.getOneA_AOnR1101(
           ActivityNode_c.getOneA_NOnR1105(
               ActionNode_c.getOneA_ACTOnR1107(
                   AcceptEvent_c.getOneA_AEOnR1112((AcceptEventAction_c) arg))));
   if (result150 != null) {
     return result150;
   }
   Package_c result151 =
       Package_c.getOneEP_PKGOnR8000(
           PackageableElement_c.getOnePE_PEOnR8001(
               ActivityNode_c.getOneA_NOnR1105(
                   ActionNode_c.getOneA_ACTOnR1107(
                       AcceptEvent_c.getOneA_AEOnR1112((AcceptEventAction_c) arg)))));
   if (result151 != null) {
     return result151;
   }
   return null;
 }
コード例 #10
0
  public void testCanRenameAndCanDeleteUserDatatype() {

    class findUserDatatype implements ClassQueryInterface_c {
      findUserDatatype(String aname) {
        name = aname;
      }

      private String name;

      public boolean evaluate(Object candidate) {
        UserDataType_c selected = (UserDataType_c) candidate;
        return selected.Get_name().equals(name);
      }
    }

    UserDataType_c udt1 =
        UserDataType_c.getOneS_UDTOnR17(
            DataType_c.getManyS_DTsOnR8001(
                PackageableElement_c.getManyPE_PEsOnR8000(Package_c.getManyEP_PKGsOnR1405(m_sys))),
            new findUserDatatype("test")); // $NON-NLS-1$

    assertTrue(udt1.Canrename());
    assertTrue(udt1.Candelete());
  }
コード例 #11
0
 public boolean evaluate(Object candidate) {
   Package_c selected = (Package_c) candidate;
   return selected.getName().equals(name);
 }
コード例 #12
0
  public boolean performFinish() {
    TransactionUtil.TransactionGroup transactionGroup = null;
    ModelRoot modelRoot = v_asyncMessage.getModelRoot();
    try {
      transactionGroup =
          TransactionUtil.startTransactionsOnSelectedModelRoots(
              "Instance Event Formalize"); //$NON-NLS-1$
      Message_c v_message = Message_c.getOneMSG_MOnR1018(v_asyncMessage);

      InteractionParticipant_c v_participant =
          InteractionParticipant_c.getOneSQ_POnR1007(v_message);

      Lifespan_c v_ls = Lifespan_c.getOneSQ_LSOnR930(v_participant);

      ClassInstanceParticipant_c v_cip =
          ClassInstanceParticipant_c.getOneSQ_CIPOnR930(
              InteractionParticipant_c.getOneSQ_POnR940(v_ls));

      ModelClass_c v_cipclass =
          (ModelClass_c)
              modelRoot.getInstanceList(ModelClass_c.class).getGlobal(null, Gd_c.Null_unique_id());

      if (((v_cip != null))) {

        v_cipclass = ModelClass_c.getOneO_OBJOnR934(v_cip);

      } else {

        v_cip =
            ClassInstanceParticipant_c.getOneSQ_CIPOnR930(
                InteractionParticipant_c.getOneSQ_POnR1007(v_message));

        if (((v_cip != null))) {

          Communication_c v_communication =
              Communication_c.getOneCOMM_COMMOnR1126(
                  ParticipantInCommunication_c.getOneCOMM_PICOnR1126(
                      InteractionParticipant_c.getOneSQ_POnR930(v_cip)));

          if (((v_communication != null))) {

            v_cipclass = ModelClass_c.getOneO_OBJOnR934(v_cip);
          }
        }
      }

      if (((v_cipclass != null))) {

        StateMachineEvent_c v_evt =
            StateMachineEvent_c.getOneSM_EVTOnR1009(
                EventMessage_c.getOneMSG_EOnR1019(v_asyncMessage));

        java.util.UUID v_existingId = Gd_c.Null_unique_id();

        if (((v_evt != null))) {

          v_existingId = v_evt.getSmevt_id();
        }

        StateMachine_c v_stateMachine =
            StateMachine_c.getOneSM_SMOnR517(InstanceStateMachine_c.getOneSM_ISMOnR518(v_cipclass));

        StateMachine_c[] v_machines =
            StateMachine_c.getManySM_SMsOnR517(
                InstanceStateMachine_c.getManySM_ISMsOnR518(
                    ModelClass_c.getManyO_OBJsOnR8001(
                        PackageableElement_c.getManyPE_PEsOnR8000(
                            Package_c.getManyEP_PKGsOnR1405(
                                SystemModel_c.getManyS_SYSsOnR1405(
                                    Package_c.getManyEP_PKGsOnR8000(
                                        PackageableElement_c.getManyPE_PEsOnR8001(
                                            v_cipclass))))))));

        if (((v_machines.length == 0))) {

          v_machines =
              StateMachine_c.getManySM_SMsOnR517(
                  InstanceStateMachine_c.getManySM_ISMsOnR518(
                      ModelClass_c.getManyO_OBJsOnR2(
                          Subsystem_c.getManyS_SSsOnR1(
                              Domain_c.getManyS_DOMsOnR1(
                                  Subsystem_c.getManyS_SSsOnR2(v_cipclass))))));
        }

        if (((v_Message != null))) {

          if (v_asyncMessage != null) {
            v_asyncMessage.Formalizewithevent(v_Message.getSmevt_id());
          } else {
            Throwable t = new Throwable();
            t.fillInStackTrace();
            CorePlugin.logError("Attempted to call an operation on a null instance.", t);
          }
        }
      }

      // catch all exceptions and cancel the transaction
    } catch (Exception e) {
      if (transactionGroup != null) TransactionUtil.cancelTransactions(transactionGroup, e);
      CorePlugin.logError("Transaction: Instance Event Formalize failed", e); // $NON-NLS-1$
      // return true so that the wizard will
      // close
      return true;
    }
    if (transactionGroup != null) TransactionUtil.endTransactions(transactionGroup);
    if (m_viewer != null) {
      if (m_viewer instanceof StructuredViewer) {
        ((StructuredViewer) m_viewer).refresh(v_asyncMessage);
      } else {
        m_viewer.refresh();
      }
    }
    return true;
  }
  public void onPageEntry() {
    Ooaofooa modelRoot =
        Selection.getModelRoot(
            (StructuredSelection)
                ((CommunicationInstanceEventFormalizeOnMSG_AMWizard) getWizard()).getSelection());

    // cache for previous user selections
    StateMachineEvent_c v_Message =
        ((CommunicationInstanceEventFormalizeOnMSG_AMWizard) getWizard()).v_Message;

    // cache for context
    AsynchronousMessage_c v_asyncMessage =
        ((CommunicationInstanceEventFormalizeOnMSG_AMWizard) getWizard()).v_asyncMessage;
    ClassInstanceParticipant_c v_cip =
        ((CommunicationInstanceEventFormalizeOnMSG_AMWizard) getWizard()).v_cip;

    if (((v_asyncMessage != null))) {

      if (((v_cip != null))) {

        Message_c v_message = Message_c.getOneMSG_MOnR1018(v_asyncMessage);

        InteractionParticipant_c v_participant = InteractionParticipant_c.getOneSQ_POnR930(v_cip);

        ModelClass_c v_mclass = ModelClass_c.getOneO_OBJOnR934(v_cip);

        if (((v_mclass != null))) {

          StateMachineEvent_c v_evt =
              StateMachineEvent_c.getOneSM_EVTOnR1009(
                  EventMessage_c.getOneMSG_EOnR1019(v_asyncMessage));

          java.util.UUID v_existingId = Gd_c.Null_unique_id();

          if (((v_evt != null))) {

            v_existingId = v_evt.getSmevt_id();
          }

          StateMachine_c v_stateMachine =
              StateMachine_c.getOneSM_SMOnR517(InstanceStateMachine_c.getOneSM_ISMOnR518(v_mclass));

          StateMachine_c[] v_machines =
              StateMachine_c.getManySM_SMsOnR517(
                  InstanceStateMachine_c.getManySM_ISMsOnR518(
                      ModelClass_c.getManyO_OBJsOnR8001(
                          PackageableElement_c.getManyPE_PEsOnR8000(
                              Package_c.getManyEP_PKGsOnR1405(
                                  SystemModel_c.getManyS_SYSsOnR1405(
                                      Package_c.getManyEP_PKGsOnR8000(
                                          PackageableElement_c.getManyPE_PEsOnR8001(
                                              v_mclass))))))));

          if (((v_machines.length == 0))) {

            v_machines =
                StateMachine_c.getManySM_SMsOnR517(
                    InstanceStateMachine_c.getManySM_ISMsOnR518(
                        ModelClass_c.getManyO_OBJsOnR2(
                            Subsystem_c.getManyS_SSsOnR1(
                                Domain_c.getManyS_DOMsOnR1(
                                    Subsystem_c.getManyS_SSsOnR2(v_mclass))))));
          }

          if (((v_Message != null))) {}
        }
      }
    }
  }
コード例 #14
0
 public void testSystemModelConversion() {
   Package_c[] packages = Package_c.getManyEP_PKGsOnR1401(m_sys);
   assertEquals("Unexpected package count under system model after upgrade.", packages.length, 8);
   performDiagramTest(m_sys, 8);
 }
コード例 #15
0
 /* (non-Javadoc)
  * @see org.eclipse.ui.IActionFilter#testAttribute(java.lang.Object, java.lang.String, java.lang.String)
  */
 public boolean testAttribute(Object target, String name, String value) {
   Package_c x = (Package_c) target;
   return x.Actionfilter(name, value);
 }
コード例 #16
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);
  }