Package org.apache.ivy.core.module.descriptor

Examples of org.apache.ivy.core.module.descriptor.Configuration


        assertNotNull(md);

        // should have imported configurations and added the one defined in the file itself
        assertNotNull(md.getConfigurations());
        assertEquals(Arrays.asList(new Configuration[] {
                new Configuration("conf1", Visibility.PUBLIC, "", new String[0]),
                new Configuration("conf2", Visibility.PRIVATE, "", new String[0]),
                new Configuration("conf3", Visibility.PUBLIC, "", new String[0])}), Arrays
                .asList(md.getConfigurations()));

        DependencyDescriptor[] dependencies = md.getDependencies();
        assertNotNull(dependencies);
        assertEquals(2, dependencies.length);
View Full Code Here


        assertNotNull(md);

        // should have imported configurations
        assertNotNull(md.getConfigurations());
        assertEquals(Arrays.asList(new Configuration[] {
                new Configuration("conf1", Visibility.PUBLIC, "", new String[0]),
                new Configuration("conf2", Visibility.PRIVATE, "", new String[0])}), Arrays
                .asList(md.getConfigurations()));

        DependencyDescriptor[] dependencies = md.getDependencies();
        assertNotNull(dependencies);
        assertEquals(2, dependencies.length);
View Full Code Here

        assertNotNull(md);

        // should have imported configurations
        assertNotNull(md.getConfigurations());
        assertEquals(Arrays.asList(new Configuration[] {
                new Configuration("conf1", Visibility.PUBLIC, "", new String[0]),
                new Configuration("conf2", Visibility.PRIVATE, "", new String[0])}), Arrays
                .asList(md.getConfigurations()));

        DependencyDescriptor[] dependencies = md.getDependencies();
        assertNotNull(dependencies);
        assertEquals(2, dependencies.length);
View Full Code Here

        ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(_settings,
            getClass().getResource("test-configextendsothers1.xml"), true);
        assertNotNull(md);

        // has an 'all-public' configuration
        Configuration allPublic = md.getConfiguration("all-public");
        assertNotNull(allPublic);

        // 'all-public' extends all other public configurations
        String[] allPublicExt = allPublic.getExtends();
        assertEquals(Arrays.asList(new String[] {"default", "test"}), Arrays.asList(allPublicExt));
    }
View Full Code Here

        ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(_settings,
            getClass().getResource("test-configextendsothers2.xml"), true);
        assertNotNull(md);

        // has an 'all-public' configuration
        Configuration allPublic = md.getConfiguration("all-public");
        assertNotNull(allPublic);

        // 'all-public' extends all other public configurations
        String[] allPublicExt = allPublic.getExtends();
        assertEquals(Arrays.asList(new String[] {"default", "test", "extra"}), Arrays
                .asList(allPublicExt));
    }
View Full Code Here

    private boolean handleConfiguration(boolean loaded, String rootModuleConf, IvyNode parent,
            String parentConf, String conf, boolean shouldBePublic) {
        if (md != null) {
            String[] confs = getRealConfs(conf);
            for (int i = 0; i < confs.length; i++) {
                Configuration c = md.getConfiguration(confs[i]);
                if (c == null) {
                    confsToFetch.remove(conf);
                    if (!conf.equals(confs[i])) {
                        problem = new RuntimeException("configuration(s) not found in " + this
                                + ": " + conf + ". Missing configuration: " + confs[i]
                                + ". It was required from " + parent + " " + parentConf);
                    } else {
                        problem = new RuntimeException("configuration(s) not found in " + this
                                + ": " + confs[i] + ". It was required from " + parent + " "
                                + parentConf);
                    }
                    return false;
                } else if (shouldBePublic && !isRoot()
                        && c.getVisibility() != Configuration.Visibility.PUBLIC) {
                    confsToFetch.remove(conf);
                    problem = new RuntimeException("configuration not public in " + this + ": " + c
                            + ". It was required from " + parent + " " + parentConf);
                    return false;
                }
View Full Code Here

            throw new IllegalStateException(
                    "impossible to get configuration when data has not been loaded");
        }
        String defaultConf = getDefaultConf(conf);
        conf = getMainConf(conf);
        Configuration configuration = md.getConfiguration(conf);
        if (configuration == null) {
            configuration = md.getConfiguration(defaultConf);
        }
        return configuration;
    }
View Full Code Here

            depConfs = new HashSet();
            rootModuleConfs.put(rootModuleConf, depConfs);
        }
        if (md != null) {
            // remove all given dependency configurations to the set + extended ones
            Configuration c = md.getConfiguration(conf);
            if (conf != null) {
                String[] exts = c.getExtends();
                for (int i = 0; i < exts.length; i++) {
                    discardConf(rootModuleConf, exts[i]); // recursive remove of extended
                    // configurations
                }
                depConfs.remove(c.getName());
            } else {
                Message.warn("unknown configuration in " + getId() + ": " + conf);
            }
        } else {
            depConfs.remove(conf);
View Full Code Here

            rootModuleConfs.put(rootModuleConf, depConfs);
        }
        if (md != null) {
            // add all given dependency configurations to the set + extended ones
            for (int i = 0; i < dependencyConfs.length; i++) {
                Configuration conf = md.getConfiguration(dependencyConfs[i]);
                if (conf != null) {
                    String[] exts = conf.getExtends();
                    addRootModuleConfigurations(rootModuleConf, exts); // recursive add of extended
                    // configurations
                    depConfs.add(conf.getName());
                } else {
                    Message.warn("unknown configuration in " + getId() + ": " + dependencyConfs[i]);
                }
            }
        } else {
View Full Code Here

         */
        protected void mergeConfigurations(ModuleDescriptor parent) {
            ModuleRevisionId sourceMrid = parent.getModuleRevisionId();
            Configuration[] configurations = parent.getConfigurations();
            for (int i = 0; i < configurations.length; i++) {
                Configuration configuration = configurations[i];
                Message.debug("Merging configuration with: " + configuration.getName());
                //copy configuration from parent descriptor
                getMd().addConfiguration(new Configuration(configuration, sourceMrid));
            }

            if (parent instanceof DefaultModuleDescriptor) {
                setDefaultConfMapping(((DefaultModuleDescriptor) parent).getDefaultConfMapping());
                setDefaultConf(((DefaultModuleDescriptor) parent).getDefaultConf());
View Full Code Here

TOP

Related Classes of org.apache.ivy.core.module.descriptor.Configuration

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.