Add dependency range info

This commit improves the `info` endpoint to contain a
`dependency-ranges` entry that is similar than the `bom-ranges` entry
for BOMs.

Each dependency that has a version mapping is listed with the range and
the related version. Some dependencies weren't managed and are now. For
those a `managed` version is used to indicate which Spring Boot versions
do not require to specify a version for the dependency.

Closes gh-453
This commit is contained in:
Stephane Nicoll
2017-06-25 10:34:23 +02:00
parent 2205ab381e
commit 8832201c43
5 changed files with 275 additions and 0 deletions

View File

@@ -55,6 +55,10 @@ public class VersionRange {
this.higherInclusive = higherInclusive;
}
public VersionRange(Version startingVersion) {
this(startingVersion, true, null, false);
}
/**
* Specify if the {@link Version} matches this range. Returns {@code true}
* if the version is contained within this range, {@code false} otherwise.

View File

@@ -25,6 +25,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.core.IsNot.not;
import static org.junit.Assert.assertThat;
@@ -36,6 +37,12 @@ public class VersionRangeTests {
@Rule
public final ExpectedException thrown = ExpectedException.none();
@Test
public void simpleStartingRange() {
assertThat(new VersionRange(Version.parse("1.3.0.RELEASE")).toString(),
equalTo(">=1.3.0.RELEASE"));
}
@Test
public void matchSimpleRange() {
assertThat("1.2.0.RC3", match("[1.2.0.RC1,1.2.0.RC5]"));