use of org.apache.karaf.features.internal.service.RepositoryImpl in project karaf by apache.
the class SubsystemTest method testMultipleVersionsForFeatureDependency.
@Test
public void testMultipleVersionsForFeatureDependency() throws Exception {
RepositoryImpl repo1 = new RepositoryImpl(getClass().getResource("data9/pax-web-6.0.3.xml").toURI());
RepositoryImpl repo2 = new RepositoryImpl(getClass().getResource("data9/pax-web-6.0.4.xml").toURI());
List<Feature> allFeatures = new ArrayList<>();
allFeatures.addAll(Arrays.asList(repo1.getFeatures()));
allFeatures.addAll(Arrays.asList(repo2.getFeatures()));
Map<String, Set<String>> features = new HashMap<>();
addToMapSet(features, "root", "pax-war-tomcat");
Map<String, Set<String>> expected = new HashMap<>();
addToMapSet(expected, "root", "pax-url-war/2.5.0");
addToMapSet(expected, "root", "pax-web-extender-war/6.0.4");
addToMapSet(expected, "root", "pax-web-tomcat/6.0.4");
addToMapSet(expected, "root", "pax-web-api/6.0.4");
SubsystemResolver resolver = new SubsystemResolver(this.resolver, new TestDownloadManager(getClass(), "data9"));
resolver.prepare(allFeatures, 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 testBundle.
@Test
public void testBundle() throws Exception {
RepositoryImpl repo = new RepositoryImpl(getClass().getResource("data1/features.xml").toURI());
Map<String, Set<String>> features = new HashMap<>();
addToMapSet(features, "root/apps1", "bundle:a");
addToMapSet(features, "root/apps1", "bundle:c;dependency=true");
Map<String, Set<String>> expected = new HashMap<>();
addToMapSet(expected, "root/apps1", "a/1.0.0");
addToMapSet(expected, "root/apps1", "c/1.0.0");
SubsystemResolver resolver = new SubsystemResolver(this.resolver, new TestDownloadManager(getClass(), "data1"));
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 testOverrides.
@Test
public void testOverrides() throws Exception {
RepositoryImpl repo = new RepositoryImpl(getClass().getResource("data3/features.xml").toURI());
Map<String, Set<String>> features = new HashMap<>();
addToMapSet(features, "root/apps1", "f1");
Map<String, Set<String>> expected = new HashMap<>();
addToMapSet(expected, "root/apps1", "a/1.0.1");
SubsystemResolver resolver = new SubsystemResolver(this.resolver, new TestDownloadManager(getClass(), "data3"));
resolver.prepare(Arrays.asList(repo.getFeatures()), features, Collections.emptyMap());
resolver.resolve(Collections.singleton("b"), 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 testFeatureOptionalAlreadyProvided2.
@Test
public void testFeatureOptionalAlreadyProvided2() throws Exception {
RepositoryImpl repo = new RepositoryImpl(getClass().getResource("data6/features.xml").toURI());
Map<String, Set<String>> features = new HashMap<>();
addToMapSet(features, "root", "pax-http");
addToMapSet(features, "root", "pax-http-tomcat");
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(), "data6"));
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 test2.
@Test
public void test2() throws Exception {
RepositoryImpl repo = new RepositoryImpl(getClass().getResource("data2/features.xml").toURI());
Map<String, Set<String>> features = new HashMap<>();
addToMapSet(features, "root/apps1", "f1");
addToMapSet(features, "root/apps1", "f3");
addToMapSet(features, "root/apps2", "f1");
Map<String, Set<String>> expected = new HashMap<>();
addToMapSet(expected, "root/apps1", "c/1.0.0");
addToMapSet(expected, "root/apps1", "b/1.0.0");
addToMapSet(expected, "root/apps1", "e/1.0.0");
addToMapSet(expected, "root/apps1#f1", "a/1.0.0");
addToMapSet(expected, "root/apps1#f1", "d/1.0.0");
addToMapSet(expected, "root/apps2", "b/1.0.0");
addToMapSet(expected, "root/apps2", "c/1.0.0");
addToMapSet(expected, "root/apps2#f1", "a/1.0.0");
SubsystemResolver resolver = new SubsystemResolver(this.resolver, new TestDownloadManager(getClass(), "data2"));
resolver.prepare(Arrays.asList(repo.getFeatures()), features, Collections.emptyMap());
resolver.resolve(Collections.emptySet(), FeaturesService.DEFAULT_FEATURE_RESOLUTION_RANGE, null, null, null);
verify(resolver, expected);
}
Aggregations