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

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


        DefaultDependenciesToModuleDescriptorConverter converter = new DefaultDependenciesToModuleDescriptorConverter(
                dependencyDescriptorFactoryStub, excludeRuleConverterStub);
        Configuration configurationStub1 = createNamedConfigurationStubWithDependenciesAndExcludeRules("conf1", GRADLE_EXCLUDE_RULE_DUMMY_1, dependencyDummy1, similarDependency1);
        Configuration configurationStub2 = createNamedConfigurationStubWithDependenciesAndExcludeRules("conf2", GRADLE_EXCLUDE_RULE_DUMMY_2, dependencyDummy2, similarDependency2);
        Configuration configurationStub3 = createNamedConfigurationStubWithDependenciesAndExcludeRules("conf3", null, similarDependency3);
        DefaultModuleDescriptor moduleDescriptor = HelperUtil.createModuleDescriptor(toSet(configurationStub1.getName(),
                configurationStub2.getName()));
        associateDependencyWithDescriptor(dependencyDummy1, moduleDescriptor, configurationStub1);
        associateDependencyWithDescriptor(dependencyDummy2, moduleDescriptor, configurationStub2);
        associateDependencyWithDescriptor(similarDependency1, moduleDescriptor, configurationStub1);
        associateDependencyWithDescriptor(similarDependency2, moduleDescriptor, configurationStub2);
        associateDependencyWithDescriptor(similarDependency3, moduleDescriptor, configurationStub3);
        associateGradleExcludeRuleWithIvyExcludeRule(GRADLE_EXCLUDE_RULE_DUMMY_1, ivyExcludeRuleStub1, configurationStub1);
        associateGradleExcludeRuleWithIvyExcludeRule(GRADLE_EXCLUDE_RULE_DUMMY_2, ivyExcludeRuleStub2, configurationStub2);

        converter.addDependencyDescriptors(moduleDescriptor, toSet(configurationStub1, configurationStub2, configurationStub3),
                ivySettingsDummy);
               
        assertThat(moduleDescriptor.getExcludeRules(toArray(configurationStub1.getName())), equalTo(toArray(
                ivyExcludeRuleStub1)));
        assertThat(moduleDescriptor.getExcludeRules(toArray(configurationStub2.getName())), equalTo(toArray(
                ivyExcludeRuleStub2)));
        assertIsCorrectConflictResolver(moduleDescriptor);
       
    }
View Full Code Here


        @Override
        public ModuleDescriptor parseDescriptor(ParserSettings settings, URL xmlURL,
            Resource res, boolean validate) throws ParseException, IOException
        {
            String cacheKey = xmlURL.toString() + settings.hashCode();
            DefaultModuleDescriptor dmd = augmentedCache.get(cacheKey);

            if (dmd == null)
            {
                dmd = rawCache.get(cacheKey);
                if (dmd == null)
                {
                    dmd = delegateParse(settings, xmlURL, res, validate);
                }

                if (!quiet)
                    Log.info("augmenting module=" + dmd.getModuleRevisionId().getName()
                        + " ant.project.name="
                        + settings.substitute("${ant.project.name}"));

                addDependenciesToDescriptor(res, dmd);
                augmentedCache.put(cacheKey, dmd);

                Log.verbose("augmented dependencies: "
                    + Arrays.asList(dmd.getDependencies()));
            }

            return dmd;
        }
View Full Code Here

                defaultSettings = ivy.getSettings();
            }

            URL ivyURL = new URL(projectURL, ivyFile);
            String cacheKey = ivyURL.toString() + defaultSettings.hashCode();
            DefaultModuleDescriptor dmd = rawCache.get(cacheKey);

            if (dmd == null)
            {
                URLResource res = new URLResource(ivyURL);
                // Note: this doesn't contain the augmented dependencies, which is OK,
View Full Code Here

                && (KEEP_ALL.equals(keepDependencyPattern)))
            {
                return (DefaultModuleDescriptor) md;
            }

            DefaultModuleDescriptor dmd = new DefaultModuleDescriptor(this, res);

            dmd.setModuleRevisionId(md.getModuleRevisionId());
            dmd.setPublicationDate(md.getPublicationDate());

            for (Configuration c : md.getConfigurations())
            {
                String conf = c.getName();

                dmd.addConfiguration(c);

                for (Artifact a : md.getArtifacts(conf))
                {
                    dmd.addArtifact(conf, a);
                }
            }

            if (keepDependencyPattern != null)
            {
                for (DependencyDescriptor dependency : md.getDependencies())
                {
                    String name = dependency.getDependencyId().getName();
                    if (keepDependencyPattern.matcher(name).matches())
                    {
                        dmd.addDependency(dependency);
                    }
                }
            }

            return dmd;
View Full Code Here

        JarInputStream in = new JarInputStream(new FileInputStream("test/test-repo/bundlerepo/"
                + jarName));
        BundleInfo bundleInfo = ManifestParser.parseManifest(in.getManifest());
        bundleInfo.addArtifact(new BundleArtifact(false, new File("test/test-repo/bundlerepo/"
                + jarName).toURI(), null));
        DefaultModuleDescriptor md = BundleInfoAdapter.toModuleDescriptor(
            OSGiManifestParser.getInstance(), null, bundleInfo, profileProvider);
        ResolveReport resolveReport = ivy.resolve(md,
            new ResolveOptions().setConfs(new String[] {conf}).setOutputReport(false));
        assertFalse("resolve failed " + resolveReport.getAllProblemMessages(),
            resolveReport.hasError());
View Full Code Here

        JarInputStream in = new JarInputStream(new FileInputStream("test/test-repo/bundlerepo/"
                + jarName));
        BundleInfo bundleInfo = ManifestParser.parseManifest(in.getManifest());
        bundleInfo.addArtifact(new BundleArtifact(false, new File("test/test-repo/bundlerepo/"
                + jarName).toURI(), null));
        DefaultModuleDescriptor md = BundleInfoAdapter.toModuleDescriptor(
            OSGiManifestParser.getInstance(), null, bundleInfo, profileProvider);
        ResolveReport resolveReport = ivy.resolve(md,
            new ResolveOptions().setConfs(new String[] {conf}).setOutputReport(false));
        assertTrue(resolveReport.hasError());
    }
View Full Code Here

    private class MockedDependencyResolver extends MockResolver {
        public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data)
                throws ParseException {
            // TODO make it a real mock and check that dd and data are the one that are expected
            DefaultModuleDescriptor moduleDesc = DefaultModuleDescriptor.newDefaultInstance(dd
                    .getDependencyRevisionId());
            ResolvedModuleRevision r = new ResolvedModuleRevision(this, this, moduleDesc, null);
            return r;
        }
View Full Code Here

    }

    private File dest = new File("build/test/test-write.xml");

    public void testSimple() throws Exception {
        DefaultModuleDescriptor md = (DefaultModuleDescriptor) XmlModuleDescriptorParser
                .getInstance().parseDescriptor(new IvySettings(),
                    XmlModuleDescriptorWriterTest.class.getResource("test-simple.xml"), true);
        md.setResolvedPublicationDate(new GregorianCalendar(2005, 4, 1, 11, 0, 0).getTime());
        md.setResolvedModuleRevisionId(new ModuleRevisionId(md.getModuleRevisionId().getModuleId(),
                "NONE"));
        XmlModuleDescriptorWriter.write(md, LICENSE, dest);

        assertTrue(dest.exists());
        String wrote = FileUtil.readEntirely(new BufferedReader(new FileReader(dest)))
View Full Code Here

            '\r', '\n');
        assertEquals(expected, wrote);
    }

    public void testInfo() throws Exception {
        DefaultModuleDescriptor md = (DefaultModuleDescriptor) XmlModuleDescriptorParser
                .getInstance().parseDescriptor(new IvySettings(),
                    XmlModuleDescriptorWriterTest.class.getResource("test-info.xml"), true);
        md.setResolvedPublicationDate(new GregorianCalendar(2005, 4, 1, 11, 0, 0).getTime());
        md.setResolvedModuleRevisionId(new ModuleRevisionId(md.getModuleRevisionId().getModuleId(),
                "NONE"));
        XmlModuleDescriptorWriter.write(md, LICENSE, dest);

        assertTrue(dest.exists());
        String wrote = FileUtil.readEntirely(new BufferedReader(new FileReader(dest)))
View Full Code Here

     * @see <a href="https://issues.apache.org/jira/browse/IVY-1207">IVY-1207</a>
     * @throws Exception
     */
    public void testTransitiveAttributeForNonTransitiveConfs() throws Exception {
        // Given a ModuleDescriptor with a non-transitive configuration
        DefaultModuleDescriptor md = new DefaultModuleDescriptor(new ModuleRevisionId(new ModuleId(
                "myorg", "myname"), "1.0"), "integration", new Date());
        Configuration conf = new Configuration("conf", Visibility.PUBLIC, "desc", null, false, null);
        md.addConfiguration(conf);

        // When the ModuleDescriptor is written
        XmlModuleDescriptorWriter.write(md, LICENSE, dest);

        // Then the transitive attribute must be set to false
View Full Code Here

TOP

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

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.