Package org.apache.karaf.features.internal.service

Examples of org.apache.karaf.features.internal.service.RepositoryImpl



public class ConditionalTest extends TestCase {

    public void testLoad() throws Exception {
        RepositoryImpl r = new RepositoryImpl(getClass().getResource("internal/service/f06.xml").toURI());
        // Check repo
        Feature[] features = r.getFeatures();
        assertNotNull(features);
        assertEquals(1, features.length);
        Feature feature = features[0];

        assertNotNull(feature.getConditional());
View Full Code Here



public class RepositoryTest extends TestCase {

    public void testLoad() throws Exception {
        RepositoryImpl r = new RepositoryImpl(getClass().getResource("repo1.xml").toURI());
        // Check repo
        URI[] repos = r.getRepositories();
        assertNotNull(repos);
        assertEquals(1, repos.length);
        assertEquals(URI.create("urn:r1"), repos[0]);
        // Check features
        Feature[] features = r.getFeatures();
        assertNotNull(features);
        assertEquals(3, features.length);
        assertNotNull(features[0]);
        assertEquals("f1", features[0].getName());
        assertNotNull(features[0].getConfigurations());
View Full Code Here

        assertEquals(true, features[2].getConfigurationFiles().get(0).isOverride());
        assertEquals("cfloc", features[2].getConfigurationFiles().get(0).getLocation());
    }

    public void testLoadFormattedRepo() throws Exception {
        RepositoryImpl r = new RepositoryImpl(getClass().getResource("repo2.xml").toURI());
        // Check repo
        URI[] repos = r.getRepositories();
        assertNotNull(repos);
        assertEquals(1, repos.length);
        assertEquals(URI.create("urn:r1"), repos[0]);
        // Check features
        Feature[] features = r.getFeatures();
        assertNotNull(features);
        assertEquals(3, features.length);
        assertNotNull(features[0]);
        assertEquals("f1", features[0].getName());
        assertNotNull(features[0].getConfigurations());
View Full Code Here

        assertEquals(true, features[2].getConfigurationFiles().get(0).isOverride());
        assertEquals("cfloc", features[2].getConfigurationFiles().get(0).getLocation());
    }
   
    public void testLoadConfigAppend() throws Exception {
        RepositoryImpl r = new RepositoryImpl(getClass().getResource("repo4.xml").toURI());
        // Check repo
        URI[] repos = r.getRepositories();
        assertNotNull(repos);
        assertEquals(1, repos.length);
        assertEquals(URI.create("urn:r1"), repos[0]);
        // Check features
        Feature[] features = r.getFeatures();
        assertNotNull(features);
        assertEquals(3, features.length);
        assertNotNull(features[0]);
        assertEquals("f1", features[0].getName());
        assertNotNull(features[0].getConfigurations());
View Full Code Here

        assertEquals(true, features[2].getConfigurationFiles().get(0).isOverride());
        assertEquals("cfloc", features[2].getConfigurationFiles().get(0).getLocation());
    }

    public void testLoadRepoWithCapabilitiesAndRequirement() throws Exception {
        RepositoryImpl r = new RepositoryImpl(getClass().getResource("repo3.xml").toURI());
        // Check features
        Feature[] features = r.getFeatures();
        assertNotNull(features);
        assertEquals(1, features.length);
        assertNotNull(features[0]);
        assertEquals("f1", features[0].getName());
        assertEquals(1, features[0].getCapabilities().size());
View Full Code Here

        assertEquals(1, res.getRequirements("req").size());
    }

    public void testShowWrongUriInException() throws Exception {
        String uri = "src/test/resources/org/apache/karaf/shell/features/repo1.xml";
        RepositoryImpl r = new RepositoryImpl(new URI(uri));
        try {
            r.load();
        } catch (Exception e) {
            assertTrue(e.getMessage().contains(uri));
        }
    }
View Full Code Here

public class AppendTest extends TestCase {

  public void testLoad() throws Exception {
    System.setProperty("karaf.data", "data");

    RepositoryImpl r = new RepositoryImpl(getClass().getResource("internal/service/f08.xml").toURI());
    // Check repo
    Feature[] features = r.getFeatures();
    assertNotNull(features);
    assertEquals(1, features.length);
    Feature feature = features[0];

    ConfigInfo configInfo = feature.getConfigurations().get(0);
View Full Code Here

public class SubsystemTest {

    @Test
    public void test1() throws Exception {
        RepositoryImpl repo = new RepositoryImpl(getClass().getResource("data1/features.xml").toURI());

        Map<String, Set<String>> features = new HashMap<String, Set<String>>();
        addToMapSet(features, "root", "f1");
        addToMapSet(features, "root/apps1", "f2");

        Map<String, Set<String>> expected = new HashMap<String, Set<String>>();
        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(new TestDownloadManager(getClass(), "data1"));
        resolver.prepare(Arrays.asList(repo.getFeatures()),
                         features,
                         Collections.<String, Set<BundleRevision>>emptyMap());
        resolver.resolve(Collections.<String>emptySet(),
                         FeaturesService.DEFAULT_FEATURE_RESOLUTION_RANGE,
                         null);
View Full Code Here

    }

    @Test
    public void test2() throws Exception {

        RepositoryImpl repo = new RepositoryImpl(getClass().getResource("data2/features.xml").toURI());

        Map<String, Set<String>> features = new HashMap<String, Set<String>>();
        addToMapSet(features, "root/apps1", "f1");
        addToMapSet(features, "root/apps1", "f3");
        addToMapSet(features, "root/apps2", "f1");

        Map<String, Set<String>> expected = new HashMap<String, Set<String>>();
        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(new TestDownloadManager(getClass(), "data2"));
        resolver.prepare(Arrays.asList(repo.getFeatures()),
                         features,
                         Collections.<String, Set<BundleRevision>>emptyMap());
        resolver.resolve(Collections.<String>emptySet(),
                         FeaturesService.DEFAULT_FEATURE_RESOLUTION_RANGE,
                         null);
View Full Code Here

        verify(resolver, expected);
    }

    @Test
    public void testOverrides() throws Exception {
        RepositoryImpl repo = new RepositoryImpl(getClass().getResource("data3/features.xml").toURI());

        Map<String, Set<String>> features = new HashMap<String, Set<String>>();
        addToMapSet(features, "root/apps1", "f1");

        Map<String, Set<String>> expected = new HashMap<String, Set<String>>();
        addToMapSet(expected, "root/apps1", "a/1.0.1");

        SubsystemResolver resolver = new SubsystemResolver(new TestDownloadManager(getClass(), "data3"));
        resolver.prepare(Arrays.asList(repo.getFeatures()),
                         features,
                         Collections.<String, Set<BundleRevision>>emptyMap());
        resolver.resolve(Collections.singleton("b"),
                         FeaturesService.DEFAULT_FEATURE_RESOLUTION_RANGE,
                         null);
View Full Code Here

TOP

Related Classes of org.apache.karaf.features.internal.service.RepositoryImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.