本文整理汇总了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;
}
}
};
}
示例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());
}
示例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());
}
示例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;
}
示例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;
}