mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-16 05:22:22 +00:00
artifact listing became more intelligent. It now prints a part of path if that's necessary to disambiguate them (#1435)
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@7897 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
538ee523e0
commit
8a0a23e02b
3 files changed
+131
-4
No files matched your search
@@ -0,0 +1,42 @@
|
||||
package hudson.model;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class RunTest extends TestCase {
|
||||
private List<Run<?,?>.Artifact> createArtifactList(String... paths) {
|
||||
Run<?,?> r = new Run(null,new GregorianCalendar()) {
|
||||
};
|
||||
Run<?,?>.ArtifactList list = r.new ArtifactList();
|
||||
for (String p : paths) {
|
||||
list.add(r.new Artifact(p));
|
||||
}
|
||||
list.computeDisplayName();
|
||||
return list;
|
||||
}
|
||||
|
||||
public void testArtifactListDisambiguation1() {
|
||||
List<Run<?, ?>.Artifact> a = createArtifactList("a/b/c.xml", "d/f/g.xml", "h/i/j.xml");
|
||||
assertEquals(a.get(0).getDisplayPath(),"c.xml");
|
||||
assertEquals(a.get(1).getDisplayPath(),"g.xml");
|
||||
assertEquals(a.get(2).getDisplayPath(),"j.xml");
|
||||
}
|
||||
|
||||
public void testArtifactListDisambiguation2() {
|
||||
List<Run<?, ?>.Artifact> a = createArtifactList("a/b/c.xml", "d/f/g.xml", "h/i/g.xml");
|
||||
assertEquals(a.get(0).getDisplayPath(),"c.xml");
|
||||
assertEquals(a.get(1).getDisplayPath(),"f/g.xml");
|
||||
assertEquals(a.get(2).getDisplayPath(),"i/g.xml");
|
||||
}
|
||||
|
||||
public void testArtifactListDisambiguation3() {
|
||||
List<Run<?, ?>.Artifact> a = createArtifactList("a.xml","a/a.xml");
|
||||
assertEquals(a.get(0).getDisplayPath(),"a.xml");
|
||||
assertEquals(a.get(1).getDisplayPath(),"a/a.xml");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user