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"))));
}
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"))));
}
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));
}
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));
}
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));
}
Aggregations