use of org.apache.karaf.features.Feature in project ddf by codice.
the class SystemStateManager method captureSystemState.
private void captureSystemState() {
LOGGER.info("Capturing system state");
try {
baseFeatures = Arrays.stream(features.listInstalledFeatures()).map(Feature::getName).collect(Collectors.toList());
Configuration[] configs = adminConfig.listConfigurations(CONFIGURATION_FILTER);
for (Configuration config : configs) {
baseConfigurations.put(config.getPid(), config);
}
console.runCommand("catalog:export --provider --force --skip-signature-verification --delete=false --output \"./itest-catalog-entries.zip\" --cql \"\\\"metacard-tags\\\" not like 'geonames'\"");
LOGGER.info("Feature Count: {}", baseFeatures.size());
LOGGER.info("Configuration Count: {}", baseConfigurations.size());
} catch (Exception e) {
LOGGER.error("Error capturing system configuration.", e);
}
}
use of org.apache.karaf.features.Feature in project camel by apache.
the class CamelKarafTestSupport method assertFeatureInstalled.
public void assertFeatureInstalled(String featureName, String featureVersion) {
Feature[] features = featuresService.listInstalledFeatures();
for (Feature feature : features) {
if (featureName.equals(feature.getName()) && featureVersion.equals(feature.getVersion())) {
return;
}
}
fail("Feature " + featureName + "/" + featureVersion + " should be installed but is not");
}
use of org.apache.karaf.features.Feature in project karaf by apache.
the class FeaturesServiceImpl method getFeatures.
@Override
public Feature[] getFeatures(String name, String version) throws Exception {
List<Feature> features = new ArrayList<>();
Pattern pattern = Pattern.compile(name);
Map<String, Map<String, Feature>> allFeatures = getFeatures();
for (String featureName : allFeatures.keySet()) {
Matcher matcher = pattern.matcher(featureName);
if (matcher.matches()) {
Map<String, Feature> versions = allFeatures.get(featureName);
Feature matchingFeature = getFeatureMatching(versions, version);
if (matchingFeature != null) {
features.add(matchingFeature);
}
}
}
return features.toArray(new Feature[features.size()]);
}
use of org.apache.karaf.features.Feature in project karaf by apache.
the class FeaturesServiceImpl method getFeatureMatching.
private Feature getFeatureMatching(Map<String, Feature> versions, String version) {
if (version != null) {
version = version.trim();
if (version.equals(org.apache.karaf.features.internal.model.Feature.DEFAULT_VERSION)) {
version = "";
}
} else {
version = "";
}
if (versions == null || versions.isEmpty()) {
return null;
} else {
Feature feature = version.isEmpty() ? null : versions.get(version);
if (feature == null) {
// Compute version range. If an version has been given, assume exact range
VersionRange versionRange = version.isEmpty() ? new VersionRange(Version.emptyVersion) : new VersionRange(version, true, true);
Version latest = Version.emptyVersion;
for (String available : versions.keySet()) {
Version availableVersion = VersionTable.getVersion(available);
if (availableVersion.compareTo(latest) >= 0 && versionRange.contains(availableVersion)) {
feature = versions.get(available);
latest = availableVersion;
}
}
}
return feature;
}
}
use of org.apache.karaf.features.Feature in project karaf by apache.
the class FeaturesServiceImplTest method testRemoveRepo2.
@Test
public void testRemoveRepo2() throws Exception {
final FeaturesService featureService = createTestFeatureService();
URI repoA = URI.create("custom:remove/a.xml");
URI repoB = URI.create("custom:remove/b.xml");
featureService.addRepository(repoA);
featureService.addRepository(repoB);
Feature a1Feature = featureService.getFeature("a1");
installFeature(featureService, a1Feature);
Feature b1Feature = featureService.getFeature("b1");
installFeature(featureService, b1Feature);
featureService.removeRepository(repoA);
assertNotInstalled(featureService, a1Feature);
assertInstalled(featureService, b1Feature);
}
Aggregations