use of org.apache.karaf.features.internal.model.Feature 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.Feature 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.Feature in project karaf by apache.
the class BlacklistTest method testBlacklistFeatureWithRange.
@Test
public void testBlacklistFeatureWithRange() {
URL url = getClass().getResource("f02.xml");
Features features = JaxbUtil.unmarshal(url.toExternalForm(), true);
List<String> blacklist = new ArrayList<>();
blacklist.add("spring;range=\"[2,3)\"");
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.Feature in project karaf by apache.
the class ExportFeatureMetaDataMojo method mergeFeatureOneVersion.
private Feature mergeFeatureOneVersion(Set<Feature> featuresSet) throws MojoExecutionException {
Feature merged = new Feature("merged");
Map<String, Bundle> bundleVersions = new HashMap<>();
for (Feature feature : featuresSet) {
for (Bundle bundle : feature.getBundle()) {
String symbolicName = getBundleSymbolicName(bundle);
if (symbolicName == null) {
logIgnored(bundle);
continue;
}
Bundle existingBundle = bundleVersions.get(symbolicName);
if (existingBundle != null) {
Version existingVersion = new Version(getBundleVersion(existingBundle));
Version newVersion = new Version(getBundleVersion(bundle));
if (newVersion.compareTo(existingVersion) > 0) {
bundleVersions.put(symbolicName, bundle);
}
} else {
bundleVersions.put(symbolicName, bundle);
}
}
}
for (Bundle bundle : bundleVersions.values()) {
merged.getBundle().add(bundle);
}
return merged;
}
use of org.apache.karaf.features.internal.model.Feature in project karaf by apache.
the class GenerateDescriptorMojo method toFeatures.
private Features toFeatures(Collection<Bundle> addedBundles, Collection<Dependency> addedDependencys, ObjectFactory objectFactory) {
Features features = objectFactory.createFeaturesRoot();
Feature feature = objectFactory.createFeature();
feature.getBundle().addAll(addedBundles);
feature.getFeature().addAll(addedDependencys);
features.getFeature().add(feature);
return features;
}
Aggregations