use of org.apache.karaf.features.Feature in project ddf by codice.
the class ProfileInstallCommand method uninstallFeatures.
private void uninstallFeatures(FeaturesService featuresService, List<String> uninstallFeatures) throws Exception {
if (uninstallFeatures != null) {
printSectionHeading("Uninstalling Features");
Set<String> uniqueValues = new HashSet<>();
for (String feature : uninstallFeatures) {
if (uniqueValues.add(feature)) {
printItemStatusPending("Uninstalling: ", feature);
Feature featureObject = null;
try {
featureObject = featuresService.getFeature(feature);
} catch (Exception e) {
printError(String.format(FEATURE_FAILURE_MESSAGE, feature));
throw e;
}
if (featureObject == null) {
printItemStatusFailure("Uninstall Failed: ", feature);
printError(String.format(FEATURE_FAILURE_MESSAGE, feature));
throw new IllegalArgumentException(String.format(FEATURE_FAILURE_MESSAGE, feature));
}
uninstallFeature(featuresService, featureObject);
printItemStatusSuccess("Uninstalled: ", feature);
}
}
}
}
use of org.apache.karaf.features.Feature in project ddf by codice.
the class ApplicationServiceBeanTest method testGetInstallationProfiles.
/**
* Tests the {@link ApplicationServiceBean#getInstallationProfiles()} method
*
* @throws Exception
*/
@Test
public void testGetInstallationProfiles() throws Exception {
Feature testFeature1 = mock(Feature.class);
Feature testFeature2 = mock(Feature.class);
Dependency testDependency1 = mock(Dependency.class);
Dependency testDependency2 = mock(Dependency.class);
when(testFeature1.getName()).thenReturn(TEST_FEATURE_NAME);
when(testFeature2.getName()).thenReturn(TEST_FEATURE_NAME);
when(testDependency1.getName()).thenReturn(TEST_FEATURE_NAME);
when(testDependency2.getName()).thenReturn(TEST_FEATURE_NAME);
when(testFeature1.getDescription()).thenReturn(TEST_FEATURE_DESCRIPTION);
when(testFeature2.getDescription()).thenReturn(TEST_FEATURE_DESCRIPTION);
List<Dependency> dependencies1 = new ArrayList<>();
dependencies1.add(testDependency1);
List<Dependency> dependencies2 = new ArrayList<>();
dependencies2.add(testDependency2);
when(testFeature1.getDependencies()).thenReturn(dependencies1);
when(testFeature2.getDependencies()).thenReturn(dependencies2);
List<Feature> featureList = new ArrayList<>();
featureList.add(testFeature1);
featureList.add(testFeature2);
when(testAppService.getInstallationProfiles()).thenReturn(featureList);
ApplicationServiceBean serviceBean = newApplicationServiceBean();
List<Map<String, Object>> result = serviceBean.getInstallationProfiles();
assertThat("Should contain the nodes set up previously.", (String) result.get(0).get("name"), is(TEST_FEATURE_NAME));
assertThat("Should have two entries.", result.size(), is(2));
}
use of org.apache.karaf.features.Feature in project ddf by codice.
the class FeatureDetailsTest method testFeatureDetails.
/**
* Tests the {@link FeatureDetails#FeatureDetails(Feature, String, String)} constructor, and all
* associated getters
*/
@Test
public void testFeatureDetails() {
Feature testFeature = mock(Feature.class);
when(testFeature.getName()).thenReturn(TEST_FEATURE_NAME);
when(testFeature.getId()).thenReturn(TEST_FEATURE_ID);
when(testFeature.getVersion()).thenReturn(TEST_FEATURE_VERSION);
when(testFeature.getInstall()).thenReturn(TEST_FEATURE_INSTALL);
when(testFeature.getDescription()).thenReturn(TEST_FEATURE_DESCRIP);
when(testFeature.getDetails()).thenReturn(TEST_FEATURE_DETAILS);
when(testFeature.getResolver()).thenReturn(TEST_FEATURE_RESOLVER);
FeatureDetails testDetails = new FeatureDetails(testFeature, TEST_FEATURE_STATUS, TEST_FEATURE_REPO);
assertEquals(TEST_FEATURE_NAME, testDetails.getName());
assertEquals(TEST_FEATURE_ID, testDetails.getId());
assertEquals(TEST_FEATURE_VERSION, testDetails.getVersion());
assertEquals(TEST_FEATURE_INSTALL, testDetails.getInstall());
assertEquals(TEST_FEATURE_DESCRIP, testDetails.getDescription());
assertEquals(TEST_FEATURE_DETAILS, testDetails.getDetails());
assertEquals(TEST_FEATURE_RESOLVER, testDetails.getResolver());
assertEquals(TEST_FEATURE_REPO, testDetails.getRepository());
assertEquals(TEST_FEATURE_STATUS, testDetails.getStatus());
}
use of org.apache.karaf.features.Feature in project ddf by codice.
the class ProfileListCommandTest 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 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);
}
}
Aggregations