use of org.apache.karaf.features.internal.model.Features in project karaf by apache.
the class FeaturesValidationTest method testNs10Unmarshall.
@Test
public void testNs10Unmarshall() throws Exception {
URL url = getClass().getResource("f02.xml");
Features features = JaxbUtil.unmarshal(url.toExternalForm(), true);
assertNotNull(features);
}
use of org.apache.karaf.features.internal.model.Features in project karaf by apache.
the class BlacklistTest method testBlacklistFeatureWithoutVersion.
@Test
public void testBlacklistFeatureWithoutVersion() {
URL url = getClass().getResource("f02.xml");
Features features = JaxbUtil.unmarshal(url.toExternalForm(), true);
List<String> blacklist = new ArrayList<>();
blacklist.add("spring");
Blacklist.blacklist(features, blacklist);
for (Feature feature : features.getFeature()) {
assertFalse(feature.getId().startsWith("spring/"));
}
}
use of org.apache.karaf.features.internal.model.Features in project karaf by apache.
the class BlacklistTest method testBlacklistBundle.
@Test
public void testBlacklistBundle() {
URL url = getClass().getResource("f02.xml");
Features features = JaxbUtil.unmarshal(url.toExternalForm(), true);
List<String> blacklist = new ArrayList<>();
blacklist.add("mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jasypt/1.7_1");
Blacklist.blacklist(features, blacklist);
for (Feature feature : features.getFeature()) {
for (Bundle bundle : feature.getBundle()) {
assertNotEquals("mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jasypt/1.7_1", bundle.getLocation());
}
}
}
use of org.apache.karaf.features.internal.model.Features in project karaf by apache.
the class BlacklistTest method testBlacklistFeatureWithVersion.
@Test
public void testBlacklistFeatureWithVersion() {
URL url = getClass().getResource("f02.xml");
Features features = JaxbUtil.unmarshal(url.toExternalForm(), true);
List<String> blacklist = new ArrayList<>();
blacklist.add("spring;range=2.5.6.SEC02");
Blacklist.blacklist(features, blacklist);
for (Feature feature : features.getFeature()) {
assertNotEquals("spring/2.5.6.SEC02", feature.getId());
}
}
use of org.apache.karaf.features.internal.model.Features in project karaf by apache.
the class FeaturesServiceImpl method computeFeaturesToAdd.
private Set<FeatureReq> computeFeaturesToAdd(EnumSet<Option> options, Set<FeatureReq> toInstall) throws Exception {
Map<String, Map<String, Feature>> allFeatures = getFeatureCache();
Feature[] installedFeatures = listInstalledFeatures();
Set<FeatureReq> toAdd = new HashSet<>();
for (FeatureReq featureReq : toInstall) {
Collection<Feature> matching = featureReq.getMatchingFeatures(allFeatures).collect(toSet());
for (Feature f : matching) {
toAdd.add(new FeatureReq(f));
Arrays.stream(installedFeatures).filter(fi -> isSameFeature(f, fi)).forEach(this::logInstalledOrUpdated);
}
if (matching.isEmpty() && !options.contains(Option.NoFailOnFeatureNotFound)) {
throw new IllegalArgumentException("No matching features for " + featureReq);
}
}
return toAdd;
}
Aggregations