use of org.apache.karaf.features.Feature in project controller by opendaylight.
the class ConfigPushingRunnable method run.
@Override
@SuppressWarnings("IllegalCatch")
public void run() {
List<Feature> toInstall = new ArrayList<>();
FeatureEvent event = null;
boolean interrupted = false;
while (true) {
try {
if (!interrupted) {
if (toInstall.isEmpty()) {
event = queue.take();
} else {
event = queue.poll(POLL_TIME, TimeUnit.MILLISECONDS);
}
if (event != null && event.getFeature() != null) {
processFeatureEvent(event, toInstall);
}
} else if (toInstall.isEmpty()) {
LOG.error("ConfigPushingRunnable - exiting");
return;
}
} catch (final InterruptedException e) {
LOG.error("ConfigPushingRunnable - interrupted");
interrupted = true;
} catch (final Exception e) {
LOG.error("Exception while processing features {} event {}", toInstall, event, e);
}
}
}
use of org.apache.karaf.features.Feature in project admin-console-beta by connexta.
the class CreateFeatureDependencyGraph method createFeatureDependenciesGraph.
private DirectedGraph<Field, DependencyEdge> createFeatureDependenciesGraph(List<FeatureField> features) {
DirectedGraph<Field, DependencyEdge> graph = new DirectedPseudograph<>(DependencyEdge.class);
FEATURE_BUNDLE_VERTEX_PROV.getAttributes().forEach(attri -> exporter.registerAttribute(attri.getAttriName(), attri.getCategory(), attri.getType()));
features.forEach(graph::addVertex);
Map<String, FeatureField> featuresById = features.stream().collect(Collectors.toMap(FeatureField::id, f -> f));
for (FeatureField feature : features) {
for (String featId : feature.featDeps()) {
try {
Feature feat = featureUtils.getFeature(featId);
if (feat != null && featuresById.containsKey(feat.getId())) {
graph.addEdge(feature, featuresById.get(feat.getId()), DependencyEdge.create(null));
} else {
LOGGER.error("Failed to find feature {} while creating feature dependency graph.", featId);
}
} catch (Exception e) {
LOGGER.error("Failed to find feature {} while creating feature dependency graph.", featId, e);
}
}
feature.bundleDeps().forEach(dep -> {
graph.addVertex(dep);
graph.addEdge(feature, dep, DependencyEdge.create(null));
});
}
return graph;
}
use of org.apache.karaf.features.Feature in project ignite by apache.
the class IgniteKarafFeaturesInstallationTest method testAllBundlesActiveAndFeaturesInstalled.
/**
* @throws Exception
*/
@Test
public void testAllBundlesActiveAndFeaturesInstalled() throws Exception {
// Asssert all bundles except fragments are ACTIVE.
for (Bundle b : bundleCtx.getBundles()) {
System.out.println(String.format("Checking state of bundle [symbolicName=%s, state=%s]", b.getSymbolicName(), b.getState()));
if (b.getHeaders().get(Constants.FRAGMENT_HOST) == null)
assertTrue(b.getState() == Bundle.ACTIVE);
}
// Check that according to the FeaturesService, all Ignite features except ignite-log4j are installed.
Feature[] features = featuresSvc.getFeatures(IGNITE_FEATURES_NAME_REGEX);
assertNotNull(features);
assertEquals(EXPECTED_FEATURES, features.length);
for (Feature f : features) {
if (IGNORED_FEATURES.contains(f.getName()))
continue;
boolean installed = featuresSvc.isInstalled(f);
System.out.println(String.format("Checking if feature is installed [featureName=%s, installed=%s]", f.getName(), installed));
assertTrue(installed);
assertEquals(PROJECT_VERSION.replaceAll("-", "."), f.getVersion().replaceAll("-", "."));
}
}
use of org.apache.karaf.features.Feature in project ddf by codice.
the class ProfileInstallCommandTest method createMockFeature.
private Feature createMockFeature(String name) {
Feature feature = mock(Feature.class);
when(feature.getName()).thenReturn(name);
when(feature.getVersion()).thenReturn("0.0.0");
return feature;
}
use of org.apache.karaf.features.Feature in project ddf by codice.
the class ProfileInstallCommandTest method testUninstallInstallerFailure.
@Test(expected = Exception.class)
public void testUninstallInstallerFailure() throws Exception {
Feature installerFeature = createMockFeature("admin-modules-installer");
this.featuresService = mock(FeaturesService.class);
when(featuresService.getFeature(anyString())).thenReturn(installerFeature);
when(featuresService.isInstalled(installerFeature)).thenReturn(true);
doThrow(Exception.class).when(featuresService).uninstallFeature("admin-modules-installer", "0.0.0", NO_AUTO_REFRESH);
profileInstallCommand.profileName = "invalidStopBundles";
profileInstallCommand.doExecute(applicationService, featuresService, bundleService);
}
Aggregations