当前位置: 首页>>代码示例>>Java>>正文


Java ArtifactDownloadReport.getArtifact方法代码示例

本文整理汇总了Java中org.apache.ivy.core.report.ArtifactDownloadReport.getArtifact方法的典型用法代码示例。如果您正苦于以下问题:Java ArtifactDownloadReport.getArtifact方法的具体用法?Java ArtifactDownloadReport.getArtifact怎么用?Java ArtifactDownloadReport.getArtifact使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ivy.core.report.ArtifactDownloadReport的用法示例。


在下文中一共展示了ArtifactDownloadReport.getArtifact方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getConflictResolvingPolicy

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
/**
 * The returned comparator should consider greater the artifact which gains the conflict battle.
 * This is used only during retrieve... prefer resolve conflict manager to resolve conflicts.
 *
 * @return Comparator<ArtifactDownloadReport>
 */
private Comparator<ArtifactDownloadReport> getConflictResolvingPolicy() {
    return new Comparator<ArtifactDownloadReport>() {
        // younger conflict resolving policy
        public int compare(ArtifactDownloadReport o1, ArtifactDownloadReport o2) {
            Artifact a1 = o1.getArtifact();
            Artifact a2 = o2.getArtifact();
            if (a1.getPublicationDate().after(a2.getPublicationDate())) {
                // a1 is after a2 <=> a1 is younger than a2 <=> a1 wins the conflict battle
                return +1;
            } else if (a1.getPublicationDate().before(a2.getPublicationDate())) {
                // a1 is before a2 <=> a2 is younger than a1 <=> a2 wins the conflict battle
                return -1;
            } else {
                return 0;
            }
        }
    };
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:25,代码来源:RetrieveEngine.java

示例2: testSHA256Checksum

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
/**
 * Tests that <code>SHA-256</code> algorithm can be used for checksums on resolvers
 *
 * @throws Exception if something goes wrong
 */
@Test
public void testSHA256Checksum() throws Exception {
    final FileSystemResolver resolver = new FileSystemResolver();
    resolver.setName("sha256-checksum-resolver");
    resolver.setSettings(settings);

    resolver.addIvyPattern(settings.getBaseDir()
            + "/test/repositories/checksums/[module]/[revision]/[artifact]-[revision].[ext]");
    resolver.addArtifactPattern(settings.getBaseDir()
            + "/test/repositories/checksums/[module]/[revision]/[artifact]-[revision].[ext]");

    resolver.setChecksums("SHA-256");
    final ModuleRevisionId mrid = ModuleRevisionId.newInstance("test", "allright", "2.0");
    final ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid, false), data);
    assertNotNull("Resolved module revision was null for " + mrid, rmr);
    final DownloadReport dr = resolver.download(rmr.getDescriptor().getAllArtifacts(), getDownloadOptions());
    final ArtifactDownloadReport[] successfulDownloadReports = dr.getArtifactsReports(DownloadStatus.SUCCESSFUL);
    assertNotNull("No artifacts were downloaded successfully", successfulDownloadReports);
    assertEquals("Unexpected number of successfully downloaded artifacts", 1, successfulDownloadReports.length);
    final ArtifactDownloadReport successfulDownloadReport = successfulDownloadReports[0];
    final Artifact downloadedArtifact = successfulDownloadReport.getArtifact();
    assertEquals("Unexpected organization of downloaded artifact", "test", downloadedArtifact.getModuleRevisionId().getOrganisation());
    assertEquals("Unexpected module of downloaded artifact", "allright", downloadedArtifact.getModuleRevisionId().getModuleId().getName());
    assertEquals("Unexpected revision of downloaded artifact", "2.0", downloadedArtifact.getModuleRevisionId().getRevision());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:31,代码来源:FileSystemResolverTest.java

示例3: testSHA512Checksum

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
/**
 * Tests that <code>SHA-512</code> algorithm can be used for checksums on resolvers
 *
 * @throws Exception if something goes wrong
 */
@Test
public void testSHA512Checksum() throws Exception {
    final FileSystemResolver resolver = new FileSystemResolver();
    resolver.setName("sha256-checksum-resolver");
    resolver.setSettings(settings);

    resolver.addIvyPattern(settings.getBaseDir()
            + "/test/repositories/checksums/[module]/[revision]/[artifact]-[revision].[ext]");
    resolver.addArtifactPattern(settings.getBaseDir()
            + "/test/repositories/checksums/[module]/[revision]/[artifact]-[revision].[ext]");

    resolver.setChecksums("SHA-512");
    final ModuleRevisionId mrid = ModuleRevisionId.newInstance("test", "allright", "3.0");
    final ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid, false), data);
    assertNotNull("Resolved module revision was null for " + mrid, rmr);
    final DownloadReport dr = resolver.download(rmr.getDescriptor().getAllArtifacts(), getDownloadOptions());
    final ArtifactDownloadReport[] successfulDownloadReports = dr.getArtifactsReports(DownloadStatus.SUCCESSFUL);
    assertNotNull("No artifacts were downloaded successfully", successfulDownloadReports);
    assertEquals("Unexpected number of successfully downloaded artifacts", 1, successfulDownloadReports.length);
    final ArtifactDownloadReport successfulDownloadReport = successfulDownloadReports[0];
    final Artifact downloadedArtifact = successfulDownloadReport.getArtifact();
    assertEquals("Unexpected organization of downloaded artifact", "test", downloadedArtifact.getModuleRevisionId().getOrganisation());
    assertEquals("Unexpected module of downloaded artifact", "allright", downloadedArtifact.getModuleRevisionId().getModuleId().getName());
    assertEquals("Unexpected revision of downloaded artifact", "3.0", downloadedArtifact.getModuleRevisionId().getRevision());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:31,代码来源:FileSystemResolverTest.java

示例4: of

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
static IvyArtifactContainer of(ArtifactDownloadReport[] artifactDownloadReports) {
    IvyArtifactContainer result = new IvyArtifactContainer();
    for (ArtifactDownloadReport report : artifactDownloadReports) {
        if (report.getLocalFile() == null) {
            throw new IllegalStateException("File for " + report.getArtifact() + " hasn't been downloaded.");
        }
        result.put(report.getArtifact().getModuleRevisionId(), report.getLocalFile().toPath());
    }
    return result;
}
 
开发者ID:jerkar,项目名称:jerkar,代码行数:11,代码来源:IvyArtifactContainer.java

示例5: containsArtifact

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
private boolean containsArtifact(Artifact art, ArtifactDownloadReport[] adrs) {
    for (ArtifactDownloadReport adr : adrs) {
        Artifact artifact = adr.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;
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:13,代码来源:ResolveTest.java


注:本文中的org.apache.ivy.core.report.ArtifactDownloadReport.getArtifact方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。