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

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


        assertEquals("number of downloaded artifacts not correct.", 1, dReports.length);
        assertEquals(
            "download status not correct: should not download the artifact in useOrigin mode.",
            DownloadStatus.NO, dReports[0].getDownloadStatus());

        Artifact artifact = dReports[0].getArtifact();
        assertNotNull(artifact);

        String expectedLocation = new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar")
                .getAbsolutePath();
View Full Code Here


    // helper methods to ease the tests
    // //////////////////////////////////////////////////////////

    private void assertContainsArtifact(String org, String module, String rev, String artName,
            String type, String ext, ConfigurationResolveReport conf) {
        Artifact art = getArtifact(org, module, rev, artName, type, ext);
        assertContainsArtifact(conf, art);
    }
View Full Code Here

        }
    }

    private void assertDoesntContainArtifact(String org, String module, String rev, String artName,
            String type, String ext, ConfigurationResolveReport conf) {
        Artifact art = getArtifact(org, module, rev, artName, type, ext);
        if (containsArtifact(art, conf.getDownloadedArtifactsReports())) {
            fail("artifact " + art + " should NOT be part of " + conf.getConfiguration() + " from "
                    + conf.getModuleDescriptor().getModuleRevisionId());
        }
    }
View Full Code Here

                artName, type, ext);
    }

    private boolean containsArtifact(Artifact art, ArtifactDownloadReport[] adr) {
        for (int i = 0; i < adr.length; i++) {
            Artifact artifact = adr[i].getArtifact();
            if (artifact.getModuleRevisionId().equals(art.getModuleRevisionId())
                    && artifact.getName().equals(art.getName())
                    && artifact.getType().equals(art.getType())
                    && artifact.getExt().equals(art.getExt())) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

        RepositoryCacheManager cacheManager = getRepositoryCacheManager();
       
        final ModuleDescriptorParser parser = systemMd.getParser();
       
        // the metadata artifact which was used to cache the original metadata file
        Artifact requestedMetadataArtifact =
            ivyRef == null
            ? systemMd.getMetadataArtifact()
            : parser.getMetadataArtifact(
                ModuleRevisionId.newInstance(systemMrid, ivyRef.getRevision()),
                ivyRef.getResource());
View Full Code Here

                    return node.getModuleRevision();
                }
            }
        }

        Artifact moduleArtifact = parser.getMetadataArtifact(resolvedMrid, mdRef.getResource());
        return getRepositoryCacheManager().cacheModuleDescriptor(
            this, mdRef, dd, moduleArtifact, downloader,
            getCacheOptions(data));
    }
View Full Code Here

        attempts.add(attempt);
        Message.verbose("\t\ttried " + attempt);
    }

    protected void logAttempt(String attempt) {
        Artifact currentArtifact = (Artifact) IvyContext.getContext().get(getName() + ".artifact");
        if (currentArtifact != null) {
            logArtifactAttempt(currentArtifact, attempt);
        } else {
            logIvyAttempt(attempt);
        }
View Full Code Here

        for (ListIterator iter = ivyattempts.listIterator(); iter.hasNext();) {
            String m = (String) iter.next();
            Message.warn("  " + m);
        }
        for (Iterator iter = artattempts.keySet().iterator(); iter.hasNext();) {
            Artifact art = (Artifact) iter.next();
            List attempts = (List) artattempts.get(art);
            if (attempts != null) {
                Message.warn("  -- artifact " + art + ":");
                for (ListIterator iterator = attempts.listIterator(); iterator.hasNext();) {
                    String m = (String) iterator.next();
View Full Code Here

                                    "extra-"));
                            mrids.add(mrid);
                            if (isDefault) {
                                defaultMrids.add(mrid);
                            } else {
                                Artifact metadataArtifact =
                                    DefaultArtifact.newIvyArtifact(mrid, pubdate);
                                MetadataArtifactDownloadReport madr =
                                    new MetadataArtifactDownloadReport(metadataArtifact);
                                metadataReports.put(mrid, madr);
                                realMrids.add(mrid);
                            }
                            try {
                                pubdate = Ivy.DATE_FORMAT.parse(attributes.getValue("pubdate"));
                                skip = false;
                            } catch (ParseException e) {
                                throw new IllegalArgumentException("invalid publication date for "
                                        + organisation + " " + module + " " + revision + ": "
                                        + attributes.getValue("pubdate"));
                            }
                        }
                    } else if ("metadata-artifact".equals(qName)) {
                        if (skip) {
                            return;
                        }
                        MetadataArtifactDownloadReport madr =
                            (MetadataArtifactDownloadReport) metadataReports.get(mrid);
                        if (madr != null) {
                            madr.setDownloadStatus(
                                DownloadStatus.fromString(attributes.getValue("status")));
                            madr.setDownloadDetails(attributes.getValue("details"));
                            madr.setSize(Long.parseLong(attributes.getValue("size")));
                            madr.setDownloadTimeMillis(Long.parseLong(attributes.getValue("time")));
                            madr.setSearched(parseBoolean(attributes.getValue("searched")));
                            if (attributes.getValue("location") != null) {
                                madr.setLocalFile(new File(attributes.getValue("location")));
                            }
                            if (attributes.getValue("original-local-location") != null) {
                                madr.setOriginalLocalFile(
                                    new File(attributes.getValue("original-local-location")));
                            }
                            if (attributes.getValue("origin-location") != null) {
                                if (ArtifactOrigin.UNKNOWN.getLocation().equals(
                                        attributes.getValue("origin-location"))) {
                                    madr.setArtifactOrigin(ArtifactOrigin.UNKNOWN);
                                } else {
                                    madr.setArtifactOrigin(
                                        new ArtifactOrigin(
                                            parseBoolean(attributes.getValue("origin-is-local")),
                                            attributes.getValue("origin-location")));
                                }
                            }
                        }
                    } else if ("artifact".equals(qName)) {
                        if (skip) {
                            return;
                        }
                        String status = attributes.getValue("status");
                        String artifactName = attributes.getValue("name");
                        String type = attributes.getValue("type");
                        String ext = attributes.getValue("ext");
                        Artifact artifact = new DefaultArtifact(mrid, pubdate, artifactName,
                                type, ext, ExtendableItemHelper.getExtraAttributes(attributes,
                                    "extra-"));
                        ArtifactDownloadReport aReport = new ArtifactDownloadReport(artifact);
                        aReport.setDownloadStatus(DownloadStatus.fromString(status));
                        aReport.setDownloadDetails(attributes.getValue("details"));
View Full Code Here

    public void originalToCachedModuleDescriptor(
            DependencyResolver resolver, ResolvedResource orginalMetadataRef,
            Artifact requestedMetadataArtifact,
            ResolvedModuleRevision rmr, ModuleDescriptorWriter writer) {
        ModuleDescriptor md = rmr.getDescriptor();
        Artifact originalMetadataArtifact = getOriginalMetadataArtifact(requestedMetadataArtifact);
        File mdFileInCache = getIvyFileInCache(md.getResolvedModuleRevisionId());

        ModuleRevisionId mrid = requestedMetadataArtifact.getModuleRevisionId();
        if (!lockMetadataArtifact(mrid)) {
            Message.warn("impossible to acquire lock for: " + mrid);
View Full Code Here

TOP

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

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.