Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
sort generated items by name on the seed job's summary and build pages
[FIXES JENKINS-38648]
- Loading branch information
Showing
19 changed files
with
151 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/GeneratedUserContentSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package javaposse.jobdsl.dsl | ||
|
||
import spock.lang.Specification | ||
|
||
class GeneratedUserContentSpec extends Specification { | ||
def 'test toString'() { | ||
when: | ||
GeneratedUserContent generatedUserContent = new GeneratedUserContent('test') | ||
|
||
then: | ||
generatedUserContent.toString() == "GeneratedUserContent{path='test'}" | ||
} | ||
|
||
@SuppressWarnings('ChangeToOperator') | ||
def 'test compare'() { | ||
when: | ||
GeneratedUserContent userContent1 = new GeneratedUserContent('foo') | ||
GeneratedUserContent userContent2 = new GeneratedUserContent('other') | ||
|
||
then: | ||
userContent1.compareTo(userContent1) == 0 | ||
userContent1.compareTo(userContent2) < 0 | ||
userContent2.compareTo(userContent1) > 0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/actions/Comparators.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package javaposse.jobdsl.plugin.actions | ||
|
||
import groovy.transform.PackageScope | ||
import hudson.model.Item | ||
import hudson.model.View | ||
|
||
@PackageScope | ||
class Comparators { | ||
static final Comparator<Item> ITEM_COMPARATOR = new Comparator<Item>() { | ||
@Override | ||
int compare(Item o1, Item o2) { | ||
o1.fullDisplayName <=> o2.fullDisplayName | ||
} | ||
} | ||
|
||
static final Comparator<View> VIEW_COMPARATOR = new Comparator<View>() { | ||
@Override | ||
int compare(View o1, View o2) { | ||
getFullDisplayName(o1) <=> getFullDisplayName(o2) | ||
} | ||
|
||
private static String getFullDisplayName(View view) { | ||
String ownerDisplayName = view.ownerItemGroup.fullDisplayName | ||
ownerDisplayName.length() == 0 ? view.displayName : "${ownerDisplayName} » ${view.displayName}" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters