Package com.puppetlabs.geppetto.semver

Examples of com.puppetlabs.geppetto.semver.VersionRange


        ? mnd
        : nonModularNode;
  }

  public String getVersionLabel(ModuleEdge edge) {
    VersionRange vreq = edge.dependency.getVersionRequirement();
    if(vreq == null)
      return "unversioned";
    return vreq.toString();

  }
View Full Code Here


                }
                candidateVersions.add(cv);
              }

            // if the dependency has no version requirement use ">=0"
            final VersionRange versionRequirement = d.getVersionRequirement();
            if(versionRequirement == null) {
              // find best match for >= 0 if there are candidates with versions
              // the best will always win over unversioned.
              if(candidateVersions.size() > 0) {
                Collections.sort(candidateVersions);
View Full Code Here

*/
public class VersionRangeTest {

  @Test
  public void dashRange() {
    VersionRange range = VersionRange.create("1.2.0 - 1.3.0");
    assertTrue(range.isIncluded(Version.create(1, 2, 0)));
    assertTrue(range.isIncluded(Version.create(1, 3, 0, "alpha")));
    assertTrue(range.isIncluded(Version.create(1, 3, 0)));
    assertFalse(range.isIncluded(Version.create(1, 2, 0, "alpha")));
    assertFalse(range.isIncluded(Version.create(1, 3, 1)));

    range = VersionRange.create("1.2.0 - 1.3.0-");
    assertTrue(range.isIncluded(Version.create(1, 2, 0)));
    assertFalse(range.isIncluded(Version.create(1, 3, 0, "alpha")));
    assertFalse(range.isIncluded(Version.create(1, 3, 0)));

    range = VersionRange.create("1.2.0- - 1.3.0");
    assertTrue(range.isIncluded(Version.create(1, 2, 0)));
    assertTrue(range.isIncluded(Version.create(1, 3, 0, "alpha")));
    assertTrue(range.isIncluded(Version.create(1, 3, 0)));
    assertTrue(range.isIncluded(Version.create(1, 2, 0, "alpha")));
  }
View Full Code Here

  }

  @Test
  public void greater() {
    try {
      VersionRange range = VersionRange.create(">1.2.0");
      assertTrue(range.isIncluded(Version.create(1, 3, 0, "alpha")));
      assertTrue(range.isIncluded(Version.create(1, 2, 9, "alpha")));
      assertTrue(range.isIncluded(Version.create(1, 2, 1)));
      assertFalse(range.isIncluded(Version.create(1, 2, 0, "alpha")));
      assertFalse(range.isIncluded(Version.create(1, 2, 0)));

      range = VersionRange.create(">1.2.0--");
      assertTrue(range.isIncluded(Version.create(1, 2, 0, "alpha")));
      assertTrue(range.isIncluded(Version.create(1, 2, 0)));
      assertFalse(range.isIncluded(Version.create(1, 1, 9)));
    }
    catch(IllegalArgumentException e) {
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

  }

  @Test
  public void greaterEqual() {
    try {
      VersionRange range = VersionRange.create(">=1.2.0");
      assertTrue(range.isIncluded(Version.create(1, 2, 0)));
      assertTrue(range.isIncluded(Version.create(1, 3, 0, "alpha")));
      assertTrue(range.isIncluded(Version.create(1, 2, 9, "alpha")));
      assertTrue(range.isIncluded(Version.create(1, 2, 1)));
      assertFalse(range.isIncluded(Version.create(1, 2, 0, "alpha")));

      range = VersionRange.create(">=1.2.0--");
      assertTrue(range.isIncluded(Version.create(1, 2, 0, "alpha")));
      assertTrue(range.isIncluded(Version.create(1, 2, 0)));
      assertTrue(range.isIncluded(Version.create(1, 2, 0, "-")));
    }
    catch(IllegalArgumentException e) {
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

  }

  @Test
  public void intersection() {
    try {
      VersionRange range1 = VersionRange.create(">1.2.0");
      VersionRange range2 = VersionRange.create("<1.2.0");
      assertNull(range1.intersect(range2));

      range1 = VersionRange.create(">1.2.0");
      range2 = VersionRange.create("<=1.2.0");
      assertNull(range1.intersect(range2));
View Full Code Here

  }

  @Test
  public void less() {
    try {
      VersionRange range = VersionRange.create("<1.2.0");
      assertTrue(range.isIncluded(Version.create(1, 2, 0, "alpha")));
      assertTrue(range.isIncluded(Version.create(1, 1, 9, "alpha")));
      assertTrue(range.isIncluded(Version.create(1, 1, 9)));
      assertFalse(range.isIncluded(Version.create(1, 3, 0, "alpha")));
      assertFalse(range.isIncluded(Version.create(1, 2, 0)));

      range = VersionRange.create("<1.2.0--");
      assertFalse(range.isIncluded(Version.create(1, 2, 0, "alpha")));
      assertTrue(range.isIncluded(Version.create(1, 1, 9, "alpha")));
    }
    catch(IllegalArgumentException e) {
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

  }

  @Test
  public void lessEqual() {
    try {
      VersionRange range = VersionRange.create("<=1.2.0");
      assertTrue(range.isIncluded(Version.create(1, 2, 0, "alpha")));
      assertTrue(range.isIncluded(Version.create(1, 1, 9, "alpha")));
      assertTrue(range.isIncluded(Version.create(1, 1, 9)));
      assertFalse(range.isIncluded(Version.create(1, 3, 0, "alpha")));
      assertTrue(range.isIncluded(Version.create(1, 2, 0)));

      range = VersionRange.create("<=1.2.0--");
      assertFalse(range.isIncluded(Version.create(1, 2, 0, "alpha")));
      assertTrue(range.isIncluded(Version.create(1, 2, 0, "-")));
      assertTrue(range.isIncluded(Version.create(1, 1, 9, "alpha")));
    }
    catch(IllegalArgumentException e) {
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

  }

  @Test
  public void majorMinorX() {
    try {
      VersionRange range = VersionRange.create("1.2.x");
      assertFalse(range.isIncluded(Version.create(1, 1, 9)));
      assertFalse(range.isIncluded(Version.create(1, 3, 0, "alpha")));
      assertFalse(range.isIncluded(Version.create(1, 2, 0, "alpha")));
      assertTrue(range.isIncluded(Version.create(1, 2, 0)));
      assertTrue(range.isIncluded(Version.create(1, 2, 2)));
    }
    catch(IllegalArgumentException e) {
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

  }

  @Test
  public void majorX() {
    try {
      VersionRange range = VersionRange.create("1.x");
      assertFalse(range.isIncluded(Version.create(0, 9, 9)));
      assertFalse(range.isIncluded(Version.create(2, 0, 0, "alpha")));
      assertFalse(range.isIncluded(Version.create(1, 0, 0, "alpha")));
      assertTrue(range.isIncluded(Version.create(1, 0, 0)));
      assertTrue(range.isIncluded(Version.create(1, 0, 2)));
      assertTrue(range.isIncluded(Version.create(1, 2, 0)));
    }
    catch(IllegalArgumentException e) {
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

TOP

Related Classes of com.puppetlabs.geppetto.semver.VersionRange

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.