Package org.eclipse.uml2.uml

Examples of org.eclipse.uml2.uml.Slot


  @Test
  public void testFindSlotByNameNotFound() {
    EnumerationLiteral enumLiteral = mock(EnumerationLiteral.class);
    EList<Slot> slots = mock(EList.class, Answers.RETURNS_DEEP_STUBS.get());
    Iterator<Slot> slotIter = mock(Iterator.class);
    Slot slot1 = mock(Slot.class);
    Slot slot2 = mock(Slot.class);
    Property property1 = mock(Property.class);
    Property property2 = mock(Property.class);

    when(enumLiteral.getSlots()).thenReturn(slots);
    when(slots.iterator()).thenReturn(slotIter);
    when(slotIter.hasNext()).thenReturn(true).thenReturn(true)
        .thenReturn(false);
    when(slotIter.next()).thenReturn(slot1).thenReturn(slot2);
    when(slot1.getDefiningFeature()).thenReturn(property1);
    when(slot2.getDefiningFeature()).thenReturn(property2);
    when(property1.getName()).thenReturn("test1");
    when(property2.getName()).thenReturn("test2");

    Slot slotResult = enumGenerator.findSlotByName("test3", enumLiteral);

    assertEquals(null, slotResult);
  }
View Full Code Here


    Iterator<EnumerationLiteral> enumIter = mock(Iterator.class);
    EnumerationLiteral enumLiteral = mock(EnumerationLiteral.class);

    EList<Slot> slots = mock(EList.class);
    Iterator<Slot> slotIter = mock(Iterator.class);
    Slot slot1 = mock(Slot.class);
    Slot slot2 = mock(Slot.class);

    Property property1 = mock(Property.class);
    Property property2 = mock(Property.class);
    Type type1 = mock(Type.class);
    Type type2 = mock(Type.class);

    EList<ValueSpecification> valueSpecifications1 = mock(EList.class);
    Iterator<ValueSpecification> valueSpecificationIter1 = mock(Iterator.class);
    EList<ValueSpecification> valueSpecifications2 = mock(EList.class);
    Iterator<ValueSpecification> valueSpecificationIter2 = mock(Iterator.class);
    ValueSpecification valueSpecification1 = mock(ValueSpecification.class);
    ValueSpecification valueSpecification2 = mock(ValueSpecification.class);

    when(enumeration.getOwnedLiterals()).thenReturn(enumLiterals);
    when(enumLiterals.iterator()).thenReturn(enumIter);
    when(enumIter.hasNext()).thenReturn(true).thenReturn(false);
    when(enumIter.next()).thenReturn(enumLiteral);
    when(enumLiteral.getName()).thenReturn("Home");

    when(enumLiteral.getSlots()).thenReturn(slots);
    when(slots.iterator()).thenReturn(slotIter);
    when(slotIter.hasNext()).thenReturn(true).thenReturn(true)
        .thenReturn(false);
    when(slotIter.next()).thenReturn(slot1).thenReturn(slot2);
    when(slot1.getDefiningFeature()).thenReturn(property1);
    when(slot2.getDefiningFeature()).thenReturn(property2);

    when(property1.getType()).thenReturn(type1);
    when(property2.getType()).thenReturn(type2);
    when(property1.getName()).thenReturn("type");
    when(property2.getName()).thenReturn("name");
    when(type1.getName()).thenReturn("boolean");
    when(type2.getName()).thenReturn("String");

    when(slot1.getValues()).thenReturn(valueSpecifications1);
    when(slot2.getValues()).thenReturn(valueSpecifications2);
    when(valueSpecifications1.iterator()).thenReturn(
        valueSpecificationIter1);
    when(valueSpecifications2.iterator()).thenReturn(
        valueSpecificationIter2);
    when(valueSpecificationIter1.hasNext()).thenReturn(true).thenReturn(
View Full Code Here

    EList<Slot> slots1 = mock(EList.class);
    EList<Slot> slots2 = mock(EList.class);
    Iterator<Slot> slotIter1 = mock(Iterator.class);
    Iterator<Slot> slotIter2 = mock(Iterator.class);
    Slot slot1 = mock(Slot.class);
    Slot slot2 = mock(Slot.class);

    Property property1 = mock(Property.class);
    Property property2 = mock(Property.class);
    Type type1 = mock(Type.class);
    Type type2 = mock(Type.class);

    EList<ValueSpecification> valueSpecifications1 = mock(EList.class);
    Iterator<ValueSpecification> valueSpecificationIter1 = mock(Iterator.class);
    EList<ValueSpecification> valueSpecifications2 = mock(EList.class);
    Iterator<ValueSpecification> valueSpecificationIter2 = mock(Iterator.class);
    ValueSpecification valueSpecification1 = mock(ValueSpecification.class);
    ValueSpecification valueSpecification2 = mock(ValueSpecification.class);

    when(enumeration.getOwnedLiterals()).thenReturn(enumLiterals);
    when(enumLiterals.iterator()).thenReturn(enumIter);
    when(enumIter.hasNext()).thenReturn(true).thenReturn(false);
    when(enumIter.next()).thenReturn(enumLiteral);
    when(enumLiteral.getName()).thenReturn("Home");

    when(enumLiteral.getSlots()).thenReturn(slots1).thenReturn(slots2);
    when(slots1.iterator()).thenReturn(slotIter1);
    when(slots2.iterator()).thenReturn(slotIter2);
    when(slotIter1.hasNext()).thenReturn(true).thenReturn(true)
        .thenReturn(false);
    when(slotIter2.hasNext()).thenReturn(true).thenReturn(true)
        .thenReturn(false);
    when(slotIter1.next()).thenReturn(slot1).thenReturn(slot2);
    when(slotIter2.next()).thenReturn(slot1).thenReturn(slot2);
    when(slot1.getDefiningFeature()).thenReturn(property1);
    when(slot2.getDefiningFeature()).thenReturn(property2);

    when(property1.getType()).thenReturn(type1);
    when(property2.getType()).thenReturn(type2);
    when(property1.getName()).thenReturn("type");
    when(property2.getName()).thenReturn("name");
    when(type1.getName()).thenReturn("boolean");
    when(type2.getName()).thenReturn("String");

    when(slot1.getValues()).thenReturn(valueSpecifications1);
    when(slot2.getValues()).thenReturn(valueSpecifications2);
    when(valueSpecifications1.iterator()).thenReturn(
        valueSpecificationIter1);
    when(valueSpecifications2.iterator()).thenReturn(
        valueSpecificationIter2);
    when(valueSpecificationIter1.hasNext()).thenReturn(true).thenReturn(
View Full Code Here

    applySysMLProfile(e.getModel(), profileQualifiedName);

    final Element element = e;
    final String stereotypeQualifiedName = profileQualifiedName + "::" + stereotypeName;

    final Stereotype stereotype = element.getApplicableStereotype(stereotypeQualifiedName);
    final EList<Stereotype> appliedStereotypes = element.getAppliedStereotypes();

    if (stereotype == null) {
      final String message = "Can't apply the setereotype " + stereotypeQualifiedName + " on "
          + element.toString();
      Activator.log(Status.WARNING, message, null);
    } else if (appliedStereotypes != null && appliedStereotypes.contains(stereotype)) {
      final String message = "The stereotype " + stereotype.getQualifiedName()
          + " is already applied on " + element.toString();
      Activator.log(Status.INFO, message, null);
    } else {
      element.applyStereotype(stereotype);
    }
View Full Code Here

   */
  public void deleteAssociatedStereotype(Element e, String steQualified) {
    final Element element = e;

    if (element != null && steQualified != null) {
      final Stereotype stereotype = element.getAppliedStereotype(steQualified);
      if (stereotype != null) {
        element.unapplyStereotype(stereotype);
      }
    } else {
      final String message = "Can't delete the stereotype application because the element or the stereotypeName keys are not correct";
View Full Code Here

   * @param is
   *            : the new Dimension (an InstanceSpecification stereotyped with a Dimension).
   */
  public void setDimensionForPrimitiveType(Element pt, InstanceSpecification is) {
    if (is != null && pt != null) {
      final Stereotype valueType = pt.getAppliedStereotype("SysML::Blocks::ValueType");
      final Dimension newDimension = (Dimension)is.getStereotypeApplication(is
          .getAppliedStereotype("SysML::Blocks::Dimension"));
      pt.setValue(valueType, "dimension", newDimension);
    }
  }
View Full Code Here

   * @param is
   *            : the new Unit (an InstanceSpecification stereotyped with a Unit).
   */
  public void setUnitForPrimitiveType(Element pt, InstanceSpecification is) {
    if (is != null && pt != null) {
      final Stereotype valueType = pt.getAppliedStereotype("SysML::Blocks::ValueType");
      final Unit newUnit = (Unit)is.getStereotypeApplication(is
          .getAppliedStereotype("SysML::Blocks::Unit"));
      pt.setValue(valueType, "unit", newUnit);
    }
  }
View Full Code Here

   * @param id
   *            : the new id (a string).
   */
  public void setIdForRequirement(Element r, String id) {
    if (r != null && id != null) {
      final Stereotype requirement = r.getAppliedStereotype(SYSML_REQUIREMENT);
      r.setValue(requirement, "id", id);
    }
  }
View Full Code Here

   * @param text
   *            : the new text (a string).
   */
  public void setTextForRequirement(Element r, String text) {
    if (r != null && text != null) {
      final Stereotype requirement = r.getAppliedStereotype(SYSML_REQUIREMENT);
      r.setValue(requirement, "text", text);
    }
  }
View Full Code Here

    for (final Iterator<EObject> iterator = root.eAllContents(); iterator.hasNext();) {
      final EObject object = iterator.next();
      if (object instanceof Abstraction) {
        final Element supplier = ((Abstraction)object).getSupplier(e.getName());
        if (supplier != null) {
          Stereotype s = ((Abstraction)object).getAppliedStereotype("SysML::Requirements::Satisfy");
          if (s != null) {
            deleteAssociatedStereotype((Abstraction)object, "SysML::Requirements::Satisfy");
          } else {
            s = ((Abstraction)object).getAppliedStereotype("SysML::Requirements::DeriveReqt");
            if (s != null) {
View Full Code Here

TOP

Related Classes of org.eclipse.uml2.uml.Slot

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.