use of org.apache.karaf.features.internal.service.RepositoryImpl in project karaf by apache.
the class FeaturesDependenciesTest method doTestFeatureDependency.
private void doTestFeatureDependency(String[] features, String[] bundles) throws Exception {
RepositoryImpl repo = new RepositoryImpl(getClass().getResource("data8/features.xml").toURI());
Map<String, Set<String>> requirements = new HashMap<>();
for (String feature : features) {
addToMapSet(requirements, "root", feature);
}
Map<String, Set<String>> expected = new HashMap<>();
for (String bundle : bundles) {
addToMapSet(expected, "root", bundle);
}
SubsystemResolver resolver = new SubsystemResolver(this.resolver, new TestDownloadManager(getClass(), "data8"));
resolver.prepare(Arrays.asList(repo.getFeatures()), requirements, Collections.emptyMap());
resolver.resolve(Collections.emptySet(), FeaturesService.DEFAULT_FEATURE_RESOLUTION_RANGE, null, null, null);
verify(resolver, expected);
}
use of org.apache.karaf.features.internal.service.RepositoryImpl in project karaf by apache.
the class SubsystemTest method testFeatureOptional.
@Test
public void testFeatureOptional() throws Exception {
RepositoryImpl repo = new RepositoryImpl(getClass().getResource("data5/features.xml").toURI());
Map<String, Set<String>> features = new HashMap<>();
addToMapSet(features, "root", "f1");
Map<String, Set<String>> expected = new HashMap<>();
addToMapSet(expected, "root", "a/1.0.0");
addToMapSet(expected, "root", "b/1.0.0");
SubsystemResolver resolver = new SubsystemResolver(this.resolver, new TestDownloadManager(getClass(), "data5"));
resolver.prepare(Arrays.asList(repo.getFeatures()), features, Collections.emptyMap());
resolver.resolve(Collections.emptySet(), FeaturesService.DEFAULT_FEATURE_RESOLUTION_RANGE, null, null, null);
verify(resolver, expected);
}
use of org.apache.karaf.features.internal.service.RepositoryImpl in project karaf by apache.
the class SubsystemTest method testFeatureOptionalAlreadyProvided.
@Test
public void testFeatureOptionalAlreadyProvided() throws Exception {
RepositoryImpl repo = new RepositoryImpl(getClass().getResource("data5/features.xml").toURI());
Map<String, Set<String>> features = new HashMap<>();
addToMapSet(features, "root", "f1");
addToMapSet(features, "root", "f3");
Map<String, Set<String>> expected = new HashMap<>();
addToMapSet(expected, "root", "a/1.0.0");
addToMapSet(expected, "root", "c/1.0.0");
SubsystemResolver resolver = new SubsystemResolver(this.resolver, new TestDownloadManager(getClass(), "data5"));
resolver.prepare(Arrays.asList(repo.getFeatures()), features, Collections.emptyMap());
resolver.resolve(Collections.emptySet(), FeaturesService.DEFAULT_FEATURE_RESOLUTION_RANGE, null, null, null);
verify(resolver, expected);
}
use of org.apache.karaf.features.internal.service.RepositoryImpl in project karaf by apache.
the class SubsystemTest method testConditionalSatisfiedWithOptional.
@Test
public void testConditionalSatisfiedWithOptional() throws Exception {
RepositoryImpl repo = new RepositoryImpl(getClass().getResource("data4/features.xml").toURI());
Map<String, Set<String>> features = new HashMap<>();
addToMapSet(features, "root/apps1", "f1");
addToMapSet(features, "root/apps1", "f2");
Map<String, Set<String>> expected = new HashMap<>();
addToMapSet(expected, "root/apps1", "a/1.0.0");
addToMapSet(expected, "root/apps1", "b/1.0.0");
SubsystemResolver resolver = new SubsystemResolver(this.resolver, new TestDownloadManager(getClass(), "data4"));
resolver.prepare(Arrays.asList(repo.getFeatures()), features, Collections.emptyMap());
resolver.resolve(Collections.emptySet(), FeaturesService.DEFAULT_FEATURE_RESOLUTION_RANGE, null, null, null);
verify(resolver, expected);
}
use of org.apache.karaf.features.internal.service.RepositoryImpl in project ddf by codice.
the class ApplicationServiceImplTest method createRepo.
/**
* Creates a {@code Repository} from a features.xml file
*
* @param featuresFile The features.xml file from which to create a
* {@code Repository}
* @return A {@link Repository} created from the received features.xml file
* @throws Exception
*/
private static Repository createRepo(String featuresFile) throws Exception {
RepositoryImpl repo = new RepositoryImpl(ApplicationServiceImplTest.class.getClassLoader().getResource(featuresFile).toURI());
repo.load();
return repo;
}
Aggregations