Search in sources :

Example 16 with TestDownloadManager

use of org.apache.karaf.features.internal.support.TestDownloadManager in project karaf by apache.

the class SubsystemTest method testConditionalUnsatisfiedWithOptional.

@Test
public void testConditionalUnsatisfiedWithOptional() throws Exception {
    RepositoryImpl repo = new RepositoryImpl(getClass().getResource("data4/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.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);
}
Also used : Set(java.util.Set) MapUtils.addToMapSet(org.apache.karaf.features.internal.util.MapUtils.addToMapSet) HashMap(java.util.HashMap) TestDownloadManager(org.apache.karaf.features.internal.support.TestDownloadManager) RepositoryImpl(org.apache.karaf.features.internal.service.RepositoryImpl) Test(org.junit.Test)

Example 17 with TestDownloadManager

use of org.apache.karaf.features.internal.support.TestDownloadManager in project karaf by apache.

the class SubsystemTest method testResourceRepositories.

@Test
public void testResourceRepositories() throws Exception {
    RepositoryImpl repo = new RepositoryImpl(getClass().getResource("data7/features.xml").toURI());
    Map<String, Set<String>> features = new HashMap<>();
    addToMapSet(features, "root", "f1");
    addToMapSet(features, "root/apps1", "f2");
    Map<String, Set<String>> expected = new HashMap<>();
    addToMapSet(expected, "root", "a/1.0.0");
    addToMapSet(expected, "root", "c/1.0.0");
    addToMapSet(expected, "root/apps1", "b/1.0.0");
    SubsystemResolver resolver = new SubsystemResolver(this.resolver, new TestDownloadManager(getClass(), "data7"));
    resolver.prepare(Arrays.asList(repo.getFeatures()), features, Collections.emptyMap());
    resolver.resolve(Collections.emptySet(), FeaturesService.DEFAULT_FEATURE_RESOLUTION_RANGE, null, null, null);
    verify(resolver, expected);
}
Also used : Set(java.util.Set) MapUtils.addToMapSet(org.apache.karaf.features.internal.util.MapUtils.addToMapSet) HashMap(java.util.HashMap) TestDownloadManager(org.apache.karaf.features.internal.support.TestDownloadManager) RepositoryImpl(org.apache.karaf.features.internal.service.RepositoryImpl) Test(org.junit.Test)

Aggregations

TestDownloadManager (org.apache.karaf.features.internal.support.TestDownloadManager)17 Test (org.junit.Test)15 HashMap (java.util.HashMap)13 Set (java.util.Set)13 MapUtils.addToMapSet (org.apache.karaf.features.internal.util.MapUtils.addToMapSet)13 RepositoryImpl (org.apache.karaf.features.internal.service.RepositoryImpl)12 Feature (org.apache.karaf.features.Feature)6 TestBundle (org.apache.karaf.features.internal.support.TestBundle)5 IMocksControl (org.easymock.IMocksControl)5 Bundle (org.osgi.framework.Bundle)4 VersionRange (org.apache.felix.utils.version.VersionRange)2 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 EnumSet (java.util.EnumSet)1 HashSet (java.util.HashSet)1 Hashtable (java.util.Hashtable)1 Map (java.util.Map)1 Manifest (java.util.jar.Manifest)1