public void testRenameInterfaceNoName() {
   createElement("Newinterface", testPackage);
   Interface_c[] is =
       Interface_c.getManyC_IsOnR8001(PackageableElement_c.getManyPE_PEsOnR8000(testPackage));
   Interface_c i = is[is.length - 1];
   UITestingUtilities.addElementToGraphicalSelection(i);
   doRenameTest(Messages.resources_nameEmpty, "");
 }
 public void testInterfaceRenameWithInvalidCharacter() {
   createElement("Newinterface", testPackage);
   Interface_c[] is =
       Interface_c.getManyC_IsOnR8001(PackageableElement_c.getManyPE_PEsOnR8000(testPackage));
   Interface_c i = is[is.length - 1];
   UITestingUtilities.addElementToGraphicalSelection(i);
   doRenameTest(INVALID_CHAR_ERROR, "*");
 }
 public void testInterfaceSignalWithSpaces() {
   createElement("Newinterface", testPackage);
   Interface_c[] ifaces =
       Interface_c.getManyC_IsOnR8001(PackageableElement_c.getManyPE_PEsOnR8000(testPackage));
   Interface_c iface = ifaces[ifaces.length - 1];
   UITestingUtilities.addElementToGraphicalSelection(iface);
   doNewCMETest("Signal", CorePlugin.INVALID_NAME_SPACES);
 }
 public void testRenameInterfaceExistingFolder() throws CoreException {
   // create existing folder first
   ResourcesPlugin.getWorkspace()
       .getRoot()
       .getFolder(new Path(testPackage.getFile().getParent().getFullPath() + "/" + getName()))
       .create(true, true, new NullProgressMonitor());
   BaseTest.dispatchEvents(0);
   createElement("Newinterface", testPackage);
   Interface_c[] is =
       Interface_c.getManyC_IsOnR8001(PackageableElement_c.getManyPE_PEsOnR8000(testPackage));
   Interface_c i = is[is.length - 1];
   UITestingUtilities.addElementToGraphicalSelection(i);
   doRenameTest(EXISTING_FOLDER_ERROR, getName());
 }
예제 #5
0
 private void configureRGOReference(NonRootModelElement rgo, NonRootModelElement rto) {
   TransactionManager manager = TransactionManager.getSingleton();
   Transaction transaction = null;
   String association = ElementMap.getAssociationFor(getMethodName().replaceAll("test", ""));
   NonRootModelElement newRto =
       getElement(getMethodName().replaceAll("test", ""), rto.getClass(), true);
   try {
     transaction =
         manager.startTransaction("Adjust RGO", new Ooaofooa[] {Ooaofooa.getDefaultInstance()});
     if (rgo instanceof ProvidedExecutableProperty_c) {
       // need to reassign the provision
       Interface_c iface = Interface_c.getOneC_IOnR4003((ExecutableProperty_c) newRto);
       Provision_c provision = Provision_c.getOneC_POnR4501((ProvidedExecutableProperty_c) rgo);
       provision.Unformalize(false);
       provision.Formalize(iface.getId(), false);
       this.rgo = ProvidedExecutableProperty_c.getOneSPR_PEPOnR4501(provision);
     } else if (rgo instanceof RequiredExecutableProperty_c) {
       // need to reassign the requirement
       Interface_c iface = Interface_c.getOneC_IOnR4003((ExecutableProperty_c) newRto);
       Requirement_c requirement =
           Requirement_c.getOneC_ROnR4500((RequiredExecutableProperty_c) rgo);
       requirement.Unformalize(false);
       requirement.Formalize(iface.getId(), false);
       // need to reset the RGO
       this.rgo = RequiredExecutableProperty_c.getOneSPR_REPOnR4500(requirement);
     } else {
       Method getMethod = getAccessorMethod(rgo, rto);
       NonRootModelElement existing =
           (NonRootModelElement) getMethod.invoke(rto, new Object[] {rgo});
       Method method = getUnrelateMethod(association, existing, rgo);
       method.invoke(existing, new Object[] {rgo});
       method = getRelateMethod(association, newRto, rgo);
       method.invoke(newRto, new Object[] {rgo});
     }
   } catch (Exception e) {
     fail(e.getMessage());
     if (transaction != null) {
       manager.cancelTransaction(transaction);
     }
   } finally {
     if (transaction != null) {
       manager.endTransaction(transaction);
       rgoUpdateSuccessful = true;
     }
   }
   BaseTest.dispatchEvents(0);
 }
예제 #6
0
  private Object[] getCuttableElements(NonRootModelElement rto) {
    List<Object> elements = new ArrayList<Object>();
    if (rto instanceof InterfaceReference_c) {
      // need to include self and the parent component
      elements.add(rto.getFirstParentComponent());
      // and add the provision or requirement
      Provision_c pro = Provision_c.getOneC_POnR4009((InterfaceReference_c) rto);
      Requirement_c req = Requirement_c.getOneC_ROnR4009((InterfaceReference_c) rto);
      if (pro != null) {
        elements.add(pro);
      } else {
        elements.add(req);
      }
    }

    if (rto instanceof Port_c) {
      // need to include self and the parent component
      elements.add(rto.getFirstParentComponent());
      // and add the provision or requirement
      Provision_c pro =
          Provision_c.getOneC_POnR4009(InterfaceReference_c.getOneC_IROnR4016((Port_c) rto));
      Requirement_c req =
          Requirement_c.getOneC_ROnR4009(InterfaceReference_c.getOneC_IROnR4016((Port_c) rto));
      if (pro != null) {
        elements.add(pro);
      } else {
        elements.add(req);
      }
    } else if (rto instanceof ExecutableProperty_c) {
      // need to cut the interface
      Interface_c iface = Interface_c.getOneC_IOnR4003((ExecutableProperty_c) rto);
      elements.add(iface);
    } else {
      elements.add(getSelectableElement(rto));
    }
    return elements.toArray();
  }