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

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


        verify(resolver, expected);
    }

    @Test
    public void testConditionalUnsatisfiedWithOptional() throws Exception {
        RepositoryImpl repo = new RepositoryImpl(getClass().getResource("data4/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.0");

        SubsystemResolver resolver = new SubsystemResolver(new TestDownloadManager(getClass(), "data4"));
        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 testConditionalSatisfiedWithOptional() throws Exception {
        RepositoryImpl repo = new RepositoryImpl(getClass().getResource("data4/features.xml").toURI());

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

        SubsystemResolver resolver = new SubsystemResolver(new TestDownloadManager(getClass(), "data4"));
        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 testBundle() 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/apps1", "bundle:a");
        addToMapSet(features, "root/apps1", "bundle:c;dependency=true");
        Map<String, Set<String>> expected = new HashMap<String, Set<String>>();
        addToMapSet(expected, "root/apps1", "a/1.0.0");
        addToMapSet(expected, "root/apps1", "c/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

        verify(resolver, expected);
    }

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

        Map<String, Set<String>> features = new HashMap<String, Set<String>>();
        addToMapSet(features, "root", "f1");
        Map<String, Set<String>> expected = new HashMap<String, Set<String>>();
        addToMapSet(expected, "root", "a/1.0.0");
        addToMapSet(expected, "root", "b/1.0.0");

        SubsystemResolver resolver = new SubsystemResolver(new TestDownloadManager(getClass(), "data5"));
        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 testFeatureOptionalAlreadyProvided() throws Exception {
        RepositoryImpl repo = new RepositoryImpl(getClass().getResource("data5/features.xml").toURI());

        Map<String, Set<String>> features = new HashMap<String, Set<String>>();
        addToMapSet(features, "root", "f1");
        addToMapSet(features, "root", "f3");
        Map<String, Set<String>> expected = new HashMap<String, Set<String>>();
        addToMapSet(expected, "root", "a/1.0.0");
        addToMapSet(expected, "root", "c/1.0.0");

        SubsystemResolver resolver = new SubsystemResolver(new TestDownloadManager(getClass(), "data5"));
        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

     */
    public void execute() throws MojoExecutionException, MojoFailureException {
        try {
            prepare();
            URI uri = file.toURI();
            Repository repository = new RepositoryImpl(uri);
            schemaCheck(repository, uri);
            analyze(repository);
            validate(repository);
        } catch (Exception e) {
            throw new MojoExecutionException(String.format("Unable to validate %s: %s", file.getAbsolutePath(), e.getMessage()), e);
View Full Code Here

        // add the repositories from the plugin configuration
        if (repositories != null) {
            for (String uri : repositories) {
                getLog().info(String.format(" - adding repository from %s", uri));
                Repository dependency = new RepositoryImpl(URI.create(translateFromMaven(uri)));
                schemaCheck(dependency, URI.create(uri));
                features.add(dependency.getFeatures());
                validateBundlesAvailable(dependency);
                analyzeExports(dependency);
            }
        }

        for (URI uri : repository.getRepositories()) {
            Artifact artifact = (Artifact) resolve(uri.toString());
            Repository dependency = new RepositoryImpl(new File(localRepo.getBasedir(), localRepo.pathOf(artifact)).toURI());

            schemaCheck(dependency, uri);
            getLog().info(String.format(" - adding %d known features from %s", dependency.getFeatures().length, uri));
            features.add(dependency.getFeatures());
            // we need to do this to get all the information ready for further processing
            validateBundlesAvailable(dependency);
            analyzeExports(dependency);
        }
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.