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

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


            getClass().getResource("test-entity.pom"), true);
        assertNotNull(md);
    }

    public void testModel() throws Exception {
        ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
            getClass().getResource("test-model.pom"), false);
        assertNotNull(md);

        ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.apache", "test", "1.0");
        assertEquals(mrid, md.getModuleRevisionId());

        assertNotNull(md.getConfigurations());
        assertEquals(Arrays.asList(PomModuleDescriptorBuilder.MAVEN2_CONFIGURATIONS),
            Arrays.asList(md.getConfigurations()));

        Artifact[] artifact = md.getArtifacts("master");
        assertEquals(1, artifact.length);
        assertEquals(mrid, artifact[0].getModuleRevisionId());
        assertEquals("test", artifact[0].getName());
        assertEquals("jar", artifact[0].getExt());
        assertEquals("jar", artifact[0].getType());
View Full Code Here


                + "test-with-comments.xml").toURI().toURL();
        XmlModuleDescriptorUpdater.update(settingsUrl, new BufferedOutputStream(buffer, 1024),
            getUpdateOptions("release", "mynewrev"));

        XmlModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
        ModuleDescriptor updatedMd = parser.parseDescriptor(new IvySettings(),
            new ByteArrayInputStream(buffer.toByteArray()), new BasicResource("test", false, 0, 0,
                    false), true);

        DependencyDescriptor[] dependencies = updatedMd.getDependencies();
        assertNotNull(dependencies);
        assertEquals(3, dependencies.length);
    }
View Full Code Here

        assertFalse(PomModuleDescriptorParser.getInstance().accept(
            new URLResource(XmlModuleDescriptorParserTest.class.getResource("test.xml"))));
    }

    public void testSimple() throws Exception {
        ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
            getClass().getResource("test-simple.pom"), false);
        assertNotNull(md);

        ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.apache", "test", "1.0");
        assertEquals(mrid, md.getModuleRevisionId());

        assertNotNull(md.getConfigurations());
        assertEquals(Arrays.asList(PomModuleDescriptorBuilder.MAVEN2_CONFIGURATIONS),
            Arrays.asList(md.getConfigurations()));

        Artifact[] artifact = md.getArtifacts("master");
        assertEquals(1, artifact.length);
        assertEquals(mrid, artifact[0].getModuleRevisionId());
        assertEquals("test", artifact[0].getName());
        assertEquals("jar", artifact[0].getExt());
        assertEquals("jar", artifact[0].getType());
View Full Code Here

                + "test-update-excludedconfs1.xml").toURI().toURL();
        XmlModuleDescriptorUpdater.update(settingsUrl, buffer,
            getUpdateOptions("release", "mynewrev").setConfsToExclude(new String[] {"myconf2"}));

        XmlModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
        ModuleDescriptor updatedMd = parser.parseDescriptor(new IvySettings(),
            new ByteArrayInputStream(buffer.toByteArray()), new BasicResource("test", false, 0, 0,
                    false), true);

        // test the number of configurations
        Configuration[] configs = updatedMd.getConfigurations();
        assertNotNull("Configurations shouldn't be null", configs);
        assertEquals("Number of configurations incorrect", 3, configs.length);

        // test that the correct configuration has been removed
        assertNull("myconf2 hasn't been removed", updatedMd.getConfiguration("myconf2"));

        // test that the other configurations aren't removed
        assertNotNull("myconf1 has been removed", updatedMd.getConfiguration("myconf1"));
        assertNotNull("myconf3 has been removed", updatedMd.getConfiguration("myconf3"));
        assertNotNull("myconf4 has been removed", updatedMd.getConfiguration("myconf4"));
    }
View Full Code Here

            buffer,
            getUpdateOptions("release", "mynewrev").setConfsToExclude(
                new String[] {"myconf2", "conf2"}));

        XmlModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
        ModuleDescriptor updatedMd = parser.parseDescriptor(new IvySettings(),
            new ByteArrayInputStream(buffer.toByteArray()), new BasicResource("test", false, 0, 0,
                    false), true);

        // test the number of configurations
        Configuration[] configs = updatedMd.getConfigurations();
        assertNotNull("Configurations shouldn't be null", configs);
        assertEquals("Number of configurations incorrect", 4, configs.length);

        // test that the correct configuration has been removed
        assertNull("myconf2 hasn't been removed", updatedMd.getConfiguration("myconf2"));
        assertNull("conf2 hasn't been removed", updatedMd.getConfiguration("conf2"));

        // test that the other configurations aren't removed
        assertNotNull("conf1 has been removed", updatedMd.getConfiguration("conf1"));
        assertNotNull("myconf1 has been removed", updatedMd.getConfiguration("myconf1"));
        assertNotNull("myconf3 has been removed", updatedMd.getConfiguration("myconf3"));
        assertNotNull("myconf4 has been removed", updatedMd.getConfiguration("myconf4"));
    }
View Full Code Here

        assertEquals("jar", artifact[0].getExt());
        assertEquals("jar", artifact[0].getType());
    }

    public void testLargePom() throws Exception {
        ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
            getClass().getResource("test-large-pom.pom"), false);
        assertNotNull(md);

        ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.apache.myfaces", "myfaces", "6");
        assertEquals(mrid, md.getModuleRevisionId());
    }
View Full Code Here

                + "test-update-excludedconfs4.xml").toURI().toURL();
        XmlModuleDescriptorUpdater.update(settingsUrl, buffer,
            getUpdateOptions("release", "mynewrev").setConfsToExclude(new String[] {"myconf2"}));

        XmlModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
        ModuleDescriptor updatedMd = parser.parseDescriptor(new IvySettings(),
            new ByteArrayInputStream(buffer.toByteArray()), new BasicResource("test", false, 0, 0,
                    false), true);

        // test the number of configurations
        Artifact[] artifacts = updatedMd.getAllArtifacts();
        assertNotNull("Published artifacts shouldn't be null", artifacts);
        assertEquals("Number of published artifacts incorrect", 4, artifacts.length);

        // test that the correct configuration has been removed
        for (int i = 0; i < artifacts.length; i++) {
View Full Code Here

                + "test-update-excludedconfs5.xml").toURI().toURL();
        XmlModuleDescriptorUpdater.update(settingsUrl, buffer,
            getUpdateOptions("release", "mynewrev").setConfsToExclude(new String[] {"myconf2"}));

        XmlModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
        ModuleDescriptor updatedMd = parser.parseDescriptor(new IvySettings(),
            new ByteArrayInputStream(buffer.toByteArray()), new BasicResource("test", false, 0, 0,
                    false), true);

        DependencyDescriptor[] deps = updatedMd.getDependencies();
        assertNotNull("Dependencies shouldn't be null", deps);
        assertEquals("Number of dependencies is incorrect", 8, deps.length);

        // check that none of the dependencies contains myconf2
        for (int i = 0; i < deps.length; i++) {
View Full Code Here

    // IVY-1356
    public void testMergedUpdateWithExtendsAndExcludes() throws Exception {
        URL url = XmlModuleUpdaterTest.class.getResource("test-extends-dependencies-exclude.xml");

        XmlModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
        ModuleDescriptor md = parser.parseDescriptor(new IvySettings(), url, true);

        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        XmlModuleDescriptorUpdater.update(url, buffer, getUpdateOptions("release", "mynewrev")
                .setMerge(true).setMergedDescriptor(md));

        ModuleDescriptor updatedMd = parser.parseDescriptor(new IvySettings(),
            new ByteArrayInputStream(buffer.toByteArray()), new BasicResource("test", false, 0, 0,
                    false), true);

        DependencyDescriptor[] deps = updatedMd.getDependencies();
        assertNotNull("Dependencies shouldn't be null", deps);
        assertEquals("Number of dependencies is incorrect", 2, deps.length);

        // test indentation
        String updatedXml = buffer.toString();
View Full Code Here

        ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.apache.myfaces", "myfaces", "6");
        assertEquals(mrid, md.getModuleRevisionId());
    }

    public void testPackaging() throws Exception {
        ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
            getClass().getResource("test-packaging.pom"), false);
        assertNotNull(md);

        ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.apache", "test", "1.0");
        assertEquals(mrid, md.getModuleRevisionId());

        Artifact[] artifact = md.getArtifacts("master");
        assertEquals(1, artifact.length);
        assertEquals(mrid, artifact[0].getModuleRevisionId());
        assertEquals("test", artifact[0].getName());
        assertEquals("war", artifact[0].getExt());
        assertEquals("war", artifact[0].getType());
View Full Code Here

TOP

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

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.