Search in sources :

Example 11 with TargetPlatformFilter

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")));
}
Also used : TargetPlatformFilter(org.eclipse.tycho.artifacts.TargetPlatformFilter) Test(org.junit.Test)

Example 12 with TargetPlatformFilter

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));
}
Also used : TargetPlatformFilter(org.eclipse.tycho.artifacts.TargetPlatformFilter) Test(org.junit.Test)

Example 13 with TargetPlatformFilter

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);
}
Also used : TargetPlatformFilter(org.eclipse.tycho.artifacts.TargetPlatformFilter) Test(org.junit.Test)

Example 14 with TargetPlatformFilter

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));
}
Also used : TargetPlatformFilter(org.eclipse.tycho.artifacts.TargetPlatformFilter) Test(org.junit.Test)

Example 15 with TargetPlatformFilter

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);
}
Also used : TargetPlatformFilter(org.eclipse.tycho.artifacts.TargetPlatformFilter) Test(org.junit.Test)

Aggregations

TargetPlatformFilter (org.eclipse.tycho.artifacts.TargetPlatformFilter)15 Test (org.junit.Test)11 Xpp3Dom (org.codehaus.plexus.util.xml.Xpp3Dom)3 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)2 ReactorProjectIdentities (org.eclipse.tycho.ReactorProjectIdentities)2 HashMap (java.util.HashMap)1 ReactorProject (org.eclipse.tycho.ReactorProject)1 CapabilityPattern (org.eclipse.tycho.artifacts.TargetPlatformFilter.CapabilityPattern)1 TargetPlatformFilterSyntaxException (org.eclipse.tycho.artifacts.TargetPlatformFilterSyntaxException)1 MavenRepositoryLocation (org.eclipse.tycho.core.resolver.shared.MavenRepositoryLocation)1 PomDependencyCollector (org.eclipse.tycho.p2.target.facade.PomDependencyCollector)1 TargetPlatformFilterEvaluator (org.eclipse.tycho.p2.target.filters.TargetPlatformFilterEvaluator)1 IRawArtifactFileProvider (org.eclipse.tycho.repository.p2base.artifact.provider.IRawArtifactFileProvider)1 ProviderOnlyArtifactRepository (org.eclipse.tycho.repository.p2base.artifact.repository.ProviderOnlyArtifactRepository)1 RepositoryBlackboardKey (org.eclipse.tycho.repository.registry.facade.RepositoryBlackboardKey)1