コード例 #1
0
  /**
   * Compares tow MapDomain objects with each other.
   *
   * @param domain MapDomain from the Schema, which should be compared.
   * @param gDomain MapDomain form the SchemaGraph, which should be compared.
   */
  private final void compareDomain(
      de.uni_koblenz.jgralab.schema.MapDomain domain, MapDomain gDomain) {

    // KEY DOMAIN
    HasKeyDomain hasKeyDomain = gDomain.getFirstHasKeyDomainIncidence(OUTGOING);
    assertTrue("There is no key Domain defined.", hasKeyDomain != null);
    Vertex vertex = hasKeyDomain.getThat();
    assertTrue("That should be an instance of Domain.", vertex instanceof Domain);
    assertFalse(
        "There is more than one key Domain.",
        hasKeyDomain.getNextHasKeyDomainIncidence(OUTGOING) != null);
    Domain gKeyDomain = (Domain) vertex;

    // Compares the QualifiedName of the key domain
    assertEquals(
        "Both key Domain objects should have the same QualifiedName.",
        domain.getKeyDomain().getQualifiedName(),
        gKeyDomain.get_qualifiedName());

    // VALUE DOMAIN
    HasValueDomain hasValueDomain = gDomain.getFirstHasValueDomainIncidence(OUTGOING);
    assertTrue("There is no value Domain defined.", hasValueDomain != null);
    vertex = hasValueDomain.getThat();
    assertTrue("That should be an instance of Domain.", vertex instanceof Domain);
    assertFalse(
        "There is more than one value Domain.",
        hasValueDomain.getNextHasValueDomainIncidence(OUTGOING) != null);
    Domain gValueDomain = (Domain) vertex;

    // Compares the QualifiedName
    assertEquals(
        "Both value Domain objects should have an equal QualifiedName.",
        domain.getValueDomain().getQualifiedName(),
        gValueDomain.get_qualifiedName());
  }