use of org.eclipse.tycho.artifacts.TargetPlatformFilter in project tycho by eclipse.
the class TargetPlatformFilterEvaluatorTest method testWarningIfRestrictionRemovesAll.
@Test
public void testWarningIfRestrictionRemovesAll() throws Exception {
TargetPlatformFilter versionFilter = restrictionFilter(ALL_MULTIVERSION_BUNDLES, patternWithVersion(null, null, "3.0.0"));
subject = newEvaluator(versionFilter);
subject.filterUnits(workUnits);
// 3.0.0 doesn't exist, so all applicable units shall be removed...
assertThat(removedUnits(), hasItem("trf.bundle.multiversion_1.0.0"));
assertThat(removedUnits(), hasItem("trf.bundle.multiversion_2.0.0"));
assertThat(removedUnits(), hasSize(2));
// ... but this yields a warning
logVerifier.expectWarning(allOf(containsString("Removed all units"), containsString("trf.bundle.multiversion")));
}
use of org.eclipse.tycho.artifacts.TargetPlatformFilter in project tycho by eclipse.
the class TargetPlatformFilterEvaluatorTest method testRestrictToVersionRange.
@Test
public void testRestrictToVersionRange() throws Exception {
TargetPlatformFilter versionRangeFilter = restrictionFilter(ALL_MULTIVERSION_BUNDLES, patternWithVersionRange(null, null, "[1.0.0,2)"));
subject = newEvaluator(versionRangeFilter);
subject.filterUnits(workUnits);
assertThat(removedUnits(), hasItem("trf.bundle.multiversion_2.0.0"));
assertThat(removedUnits(), hasSize(1));
}
use of org.eclipse.tycho.artifacts.TargetPlatformFilter in project tycho by eclipse.
the class TargetPlatformFilterEvaluatorTest method testNonParsableVersionRange.
@Test(expected = TargetPlatformFilterSyntaxException.class)
public void testNonParsableVersionRange() throws Exception {
TargetPlatformFilter invalidFilter = restrictionFilter(ALL_MULTIVERSION_BUNDLES, // "[1.0.0," is invalid; "1.0.0" is the range from 1 to infinity
patternWithVersionRange(null, null, "[1.0.0,"));
subject = newEvaluator(invalidFilter);
subject.filterUnits(workUnits);
}
use of org.eclipse.tycho.artifacts.TargetPlatformFilter in project tycho by eclipse.
the class TargetPlatformFilterEvaluatorTest method testRestrictPackageVersionInShortNotation.
@Test
public void testRestrictPackageVersionInShortNotation() throws Exception {
TargetPlatformFilter packageVersionFilter = restrictionFilter(patternWithoutVersion(CapabilityType.JAVA_PACKAGE, "javax.persistence"), // inherit attributes from scope pattern
patternWithVersion(null, null, "1.0.0"));
subject = newEvaluator(packageVersionFilter);
subject.filterUnits(workUnits);
// provides *a* package in version 1.0.0, but not the package javax.persistence
assertThat(removedUnits(), hasItem("javax.persistence_2.0.3.v201010191057"));
assertThat(removedUnits(), hasSize(1));
}
use of org.eclipse.tycho.artifacts.TargetPlatformFilter in project tycho by eclipse.
the class TargetPlatformFilterEvaluatorTest method testNonParsableVersion.
@Test(expected = TargetPlatformFilterSyntaxException.class)
public void testNonParsableVersion() throws Exception {
TargetPlatformFilter invalidFilter = restrictionFilter(ALL_MULTIVERSION_BUNDLES, patternWithVersion(null, null, "1.a"));
subject = newEvaluator(invalidFilter);
subject.filterUnits(workUnits);
}
Aggregations