Search in sources :

Example 6 with TargetPlatformFilter

use of org.eclipse.tycho.artifacts.TargetPlatformFilter in project tycho by eclipse.

the class TargetPlatformFactoryTest method testConfiguredFiltersOnPomDependencies.

@Test
public void testConfiguredFiltersOnPomDependencies() throws Exception {
    PomDependencyCollector pomDependencies = subject.newPomDependencyCollector();
    pomDependencies.addArtifactWithExistingMetadata(PomDependencyCollectorTest.artifactWithClassifier(null), PomDependencyCollectorTest.existingMetadata());
    TargetPlatformFilter filter = TargetPlatformFilter.removeAllFilter(CapabilityPattern.patternWithoutVersion(CapabilityType.P2_INSTALLABLE_UNIT, "test.unit"));
    tpConfig.addFilters(Arrays.asList(filter));
    P2TargetPlatform preliminaryTP = subject.createTargetPlatform(tpConfig, NOOP_EE_RESOLUTION_HANDLER, null, pomDependencies);
    assertThat(preliminaryTP.getInstallableUnits(), not(hasItem(unitWithId("test.unit"))));
    P2TargetPlatform finalTP = subject.createTargetPlatformWithUpdatedReactorUnits(preliminaryTP, null, REACTOR_ARTIFACTS);
    assertThat(finalTP.getInstallableUnits(), not(hasItem(unitWithId("test.unit"))));
}
Also used : PomDependencyCollector(org.eclipse.tycho.p2.target.facade.PomDependencyCollector) TargetPlatformFilter(org.eclipse.tycho.artifacts.TargetPlatformFilter) Test(org.junit.Test)

Example 7 with TargetPlatformFilter

use of org.eclipse.tycho.artifacts.TargetPlatformFilter in project tycho by eclipse.

the class TargetPlatformFactoryTest method testConfiguredFiltersOnReactorIUsInFinalTP.

@Test
public void testConfiguredFiltersOnReactorIUsInFinalTP() throws Exception {
    TargetPlatformFilter filter = TargetPlatformFilter.removeAllFilter(CapabilityPattern.patternWithoutVersion(CapabilityType.P2_INSTALLABLE_UNIT, "iu.p2.inf"));
    tpConfig.addFilters(Arrays.asList(filter));
    P2TargetPlatform preliminaryTP = subject.createTargetPlatform(tpConfig, NOOP_EE_RESOLUTION_HANDLER, null, null);
    Map<IInstallableUnit, ReactorProjectIdentities> finalUnits = new HashMap<>();
    finalUnits.put(InstallableUnitUtil.createIU("test.feature.feature.group"), DUMMY_PROJECT);
    finalUnits.put(InstallableUnitUtil.createIU("iu.p2.inf"), DUMMY_PROJECT);
    P2TargetPlatform finalTP = subject.createTargetPlatformWithUpdatedReactorUnits(preliminaryTP, finalUnits, REACTOR_ARTIFACTS);
    assertThat(finalTP.getInstallableUnits(), hasItem(unitWithId("test.feature.feature.group")));
    assertThat(finalTP.getInstallableUnits(), not(hasItem(unitWithId("iu.p2.inf"))));
}
Also used : HashMap(java.util.HashMap) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) ReactorProjectIdentities(org.eclipse.tycho.ReactorProjectIdentities) TargetPlatformFilter(org.eclipse.tycho.artifacts.TargetPlatformFilter) Test(org.junit.Test)

Example 8 with TargetPlatformFilter

use of org.eclipse.tycho.artifacts.TargetPlatformFilter in project tycho by eclipse.

the class TargetPlatformFilterEvaluatorTest method testRestrictPackageProvider.

@Test
public void testRestrictPackageProvider() throws Exception {
    TargetPlatformFilter providerFilter = restrictionFilter(patternWithoutVersion(CapabilityType.JAVA_PACKAGE, "javax.persistence"), patternWithoutVersion(CapabilityType.OSGI_BUNDLE, "javax.persistence"));
    subject = newEvaluator(providerFilter);
    subject.filterUnits(workUnits);
    assertThat(removedUnits(), hasItem("com.springsource.javax.persistence_1.0.0"));
    assertThat(removedUnits(), hasSize(1));
}
Also used : TargetPlatformFilter(org.eclipse.tycho.artifacts.TargetPlatformFilter) Test(org.junit.Test)

Example 9 with TargetPlatformFilter

use of org.eclipse.tycho.artifacts.TargetPlatformFilter in project tycho by eclipse.

the class TargetPlatformFilterEvaluatorTest method testRestrictToExactVersion.

@Test
public void testRestrictToExactVersion() throws Exception {
    TargetPlatformFilter versionFilter = restrictionFilter(ALL_MULTIVERSION_BUNDLES, patternWithVersion(null, null, "1.0"));
    subject = newEvaluator(versionFilter);
    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 10 with TargetPlatformFilter

use of org.eclipse.tycho.artifacts.TargetPlatformFilter in project tycho by eclipse.

the class TargetPlatformFilterEvaluatorTest method testRemoveAllOfBundleId.

@Test
public void testRemoveAllOfBundleId() throws Exception {
    TargetPlatformFilter removeAllFilter = removeAllFilter(ALL_MULTIVERSION_BUNDLES);
    subject = newEvaluator(removeAllFilter);
    subject.filterUnits(workUnits);
    assertThat(removedUnits(), hasItem("trf.bundle.multiversion_1.0.0"));
    assertThat(removedUnits(), hasItem("trf.bundle.multiversion_2.0.0"));
    assertThat(removedUnits(), hasSize(2));
}
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