Package buri.ddmsence.util

Examples of buri.ddmsence.util.DDMSVersion


 
  /**
   * Returns the expected XML output for this unit test
   */
  private String getExpectedXMLOutput() {
    DDMSVersion version = DDMSVersion.getCurrentVersion();
    StringBuffer xml = new StringBuffer();
    xml.append("<ddms:type ").append(getXmlnsDDMS()).append(" ");
    if (version.isAtLeast("4.0.1")) {
      xml.append(getXmlnsISM()).append(" ");
    }
    xml.append("ddms:qualifier=\"").append(TEST_QUALIFIER).append("\" ");
    xml.append("ddms:value=\"").append(TEST_VALUE).append("\"");
    if (version.isAtLeast("4.0.1")) {
      xml.append(" ism:classification=\"U\" ism:ownerProducer=\"USA\">Description</ddms:type>");
    }
    else
      xml.append(" />");
    return (xml.toString());
View Full Code Here


  }

  @Test
  public void testNameAndNamespace() {
    for (String sVersion : getSupportedVersions()) {
      DDMSVersion version = DDMSVersion.setCurrentVersion(sVersion);

      assertNameAndNamespace(getInstance(getValidElement(sVersion), SUCCESS), DEFAULT_DDMS_PREFIX,
        Type.getName(version));
      getInstance(getWrongNameElementFixture(), WRONG_NAME_MESSAGE);
    }
View Full Code Here

  }

  @Test
  public void testConstructorsMinimal() {
    for (String sVersion : getSupportedVersions()) {
      DDMSVersion version = DDMSVersion.setCurrentVersion(sVersion);

      // Element-based, No optional fields
      Element element = Util.buildDDMSElement(Type.getName(version), null);
      Type elementComponent = getInstance(element, SUCCESS);
View Full Code Here

  }

  @Test
  public void testValidationWarnings() {
    for (String sVersion : getSupportedVersions()) {
      DDMSVersion version = DDMSVersion.setCurrentVersion(sVersion);

      // No warnings
      Type component = getInstance(getValidElement(sVersion), SUCCESS);
      assertEquals(0, component.getValidationWarnings().size());
View Full Code Here

  }

  @Test
  public void testEquality() throws InvalidDDMSException {
    for (String sVersion : getSupportedVersions()) {
      DDMSVersion version = DDMSVersion.setCurrentVersion(sVersion);

      // Base equality
      Type elementComponent = getInstance(getValidElement(sVersion), SUCCESS);
      Type builderComponent = new Type.Builder(elementComponent).commit();
      assertEquals(elementComponent, builderComponent);
      assertEquals(elementComponent.hashCode(), builderComponent.hashCode());

      // Different values in each field
      Type.Builder builder = getBaseBuilder();
      builder.setQualifier(DIFFERENT_VALUE);
      assertFalse(elementComponent.equals(builder.commit()));

      builder = getBaseBuilder();
      builder.setValue(DIFFERENT_VALUE);
      assertFalse(elementComponent.equals(builder.commit()));

      if (version.isAtLeast("4.0.1")) {
        builder = getBaseBuilder();
        builder.setDescription(DIFFERENT_VALUE);
        assertFalse(elementComponent.equals(builder.commit()));
      }
    }
View Full Code Here

   * Returns a builder, pre-populated with base data from the XML sample.
   *
   * This builder can then be modified to test various conditions.
   */
  private SubjectCoverage.Builder getBaseBuilder() {
    DDMSVersion version = DDMSVersion.getCurrentVersion();
    SubjectCoverage component = getInstance(getValidElement(version.getVersion()), SUCCESS);
    return (new SubjectCoverage.Builder(component));
  }
View Full Code Here

   * Returns a builder, pre-populated with base data from the XML sample.
   *
   * This builder can then be modified to test various conditions.
   */
  private IndividualValue.Builder getBaseBuilder() {
    DDMSVersion version = DDMSVersion.getCurrentVersion();
    IndividualValue component = getInstance(getValidElement(version.getVersion()), SUCCESS);
    return (new IndividualValue.Builder(component));
  }
View Full Code Here

   *
   * @param innerElement the element containing the guts of this component
   * @return the element itself in DDMS 4.0.1 or later, or the element wrapped in another element
   */
  private Element wrapInnerElement(Element innerElement) {
    DDMSVersion version = DDMSVersion.getCurrentVersion();
    String name = SubjectCoverage.getName(version);
    if (version.isAtLeast("4.0.1")) {
      innerElement.setLocalName(name);
      return (innerElement);
    }
    Element element = Util.buildDDMSElement(name, null);
    element.appendChild(innerElement);
View Full Code Here

  }

  @Test
  public void testNameAndNamespace() {
    for (String sVersion : getSupportedVersions()) {
      DDMSVersion version = DDMSVersion.setCurrentVersion(sVersion);

      assertNameAndNamespace(getInstance(getValidElement(sVersion), SUCCESS), DEFAULT_NTK_PREFIX,
        IndividualValue.getName(version));
      getInstance(getWrongNameElementFixture(), WRONG_NAME_MESSAGE);
    }
View Full Code Here

   * Returns a builder, pre-populated with base data from the XML sample.
   *
   * This builder can then be modified to test various conditions.
   */
  private Publisher.Builder getBaseBuilder() {
    DDMSVersion version = DDMSVersion.getCurrentVersion();
    Publisher component = getInstance(getValidElement(version.getVersion()), SUCCESS);
    return (new Publisher.Builder(component));
  }
View Full Code Here

TOP

Related Classes of buri.ddmsence.util.DDMSVersion

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.