From 41a0759d23867f4ee0da1a23badb1a96c43d8d32 Mon Sep 17 00:00:00 2001 From: strangelookingnerd <49242855+strangelookingnerd@users.noreply.github.com> Date: Fri, 7 Oct 2022 15:05:49 +0200 Subject: [PATCH 1/9] Enable configuration for icons in folders --- .../jobdsl/dsl/AbstractFolder.groovy | 19 +++++++++++++++++++ .../dsl/helpers/icon/FolderIconContext.groovy | 17 +++++++++++++++++ .../javaposse/jobdsl/dsl/FolderSpec.groovy | 17 +++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/icon/FolderIconContext.groovy diff --git a/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/AbstractFolder.groovy b/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/AbstractFolder.groovy index ae2bfe88e..1c1f81181 100644 --- a/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/AbstractFolder.groovy +++ b/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/AbstractFolder.groovy @@ -1,6 +1,7 @@ package javaposse.jobdsl.dsl import javaposse.jobdsl.dsl.helpers.AuthorizationContext +import javaposse.jobdsl.dsl.helpers.icon.FolderIconContext import javaposse.jobdsl.dsl.helpers.properties.FolderPropertiesContext abstract class AbstractFolder extends Item { @@ -54,4 +55,22 @@ abstract class AbstractFolder extends Item { } } } + + /** + * Sets the icon of the folder. + * + * @since 1.82 + */ + void icon(@DslContext(FolderIconContext) Closure closure) { + FolderIconContext context = new FolderIconContext(jobManagement, this) + ContextHelper.executeInContext(closure, context) + + configure { Node folder -> + Node icon = folder / icon + if (icon) { + folder.remove(icon) + } + folder << context.icon + } + } } diff --git a/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/icon/FolderIconContext.groovy b/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/icon/FolderIconContext.groovy new file mode 100644 index 000000000..2550876b9 --- /dev/null +++ b/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/icon/FolderIconContext.groovy @@ -0,0 +1,17 @@ +package javaposse.jobdsl.dsl.helpers.icon + +import javaposse.jobdsl.dsl.* + +@ContextType('com.cloudbees.hudson.plugins.folder.FolderIcon') +class FolderIconContext extends AbstractExtensibleContext { + Node icon + + FolderIconContext(JobManagement jobManagement, Item item) { + super(jobManagement, item) + } + + @Override + protected void addExtensionNode(Node node) { + icon = ContextHelper.toNamedNode('icon', node) + } +} diff --git a/job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/FolderSpec.groovy b/job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/FolderSpec.groovy index 1065340db..907cda85d 100644 --- a/job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/FolderSpec.groovy +++ b/job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/FolderSpec.groovy @@ -127,6 +127,23 @@ class FolderSpec extends Specification { folder.node.properties[0].children()[0].name() == 'hack' } + def 'call icon'() { + when: + folder.icon { + icon = new Node(null, + 'icon', ['class': 'jenkins.plugins.foldericon.CustomFolderIcon', 'plugin': 'custom-folder-icon'], + new Node(null, + 'customFolderIcon', 'test.png')) + } + + then: + folder.node.icon[0].name() == 'icon' + folder.node.icon[0].attribute('class') == 'jenkins.plugins.foldericon.CustomFolderIcon' + folder.node.icon[0].attribute('plugin') == 'custom-folder-icon' + folder.node.icon[0].children()[0].name() == 'customFolderIcon' + folder.node.icon[0].children()[0].value() == 'test.png' + } + def 'configure'() { when: folder.configure { From 03b93b7241d964090dedc1a109148d9c17d15d6e Mon Sep 17 00:00:00 2001 From: strangelookingnerd <49242855+strangelookingnerd@users.noreply.github.com> Date: Fri, 7 Oct 2022 15:23:13 +0200 Subject: [PATCH 2/9] Add example configuration --- .../javaposse/jobdsl/dsl/Folder/icon.groovy | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 job-dsl-core/src/main/docs/examples/javaposse/jobdsl/dsl/Folder/icon.groovy diff --git a/job-dsl-core/src/main/docs/examples/javaposse/jobdsl/dsl/Folder/icon.groovy b/job-dsl-core/src/main/docs/examples/javaposse/jobdsl/dsl/Folder/icon.groovy new file mode 100644 index 000000000..e9ef67ccf --- /dev/null +++ b/job-dsl-core/src/main/docs/examples/javaposse/jobdsl/dsl/Folder/icon.groovy @@ -0,0 +1,28 @@ +// use the stock icon +folder('stock') + +// use https://github.com/jenkinsci/custom-folder-icon-plugin for custom icons +userContent('customFolderIcons/custom.png', streamFileFromWorkspace('custom.png')) +folder('custom') { + icon { + customFolderIcon { + foldericon('custom.png') + } + } +} + +// use https://github.com/jenkinsci/custom-folder-icon-plugin for ionicons +folder('ionicon') { + icon { + ioniconFolderIcon { + ionicon('jenkins') + } + } +} + +// use https://github.com/jenkinsci/custom-folder-icon-plugin for build status icon +folder('build-status') { + icon { + buildStatusFolderIcon() + } +} \ No newline at end of file From fa3dc377591912d7c53097e0fc573cab77d20ecb Mon Sep 17 00:00:00 2001 From: strangelookingnerd <49242855+strangelookingnerd@users.noreply.github.com> Date: Fri, 7 Oct 2022 15:58:33 +0200 Subject: [PATCH 3/9] Fix IDE formatting --- .../docs/examples/javaposse/jobdsl/dsl/Folder/icon.groovy | 2 +- .../jobdsl/dsl/helpers/icon/FolderIconContext.groovy | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/job-dsl-core/src/main/docs/examples/javaposse/jobdsl/dsl/Folder/icon.groovy b/job-dsl-core/src/main/docs/examples/javaposse/jobdsl/dsl/Folder/icon.groovy index e9ef67ccf..92245428c 100644 --- a/job-dsl-core/src/main/docs/examples/javaposse/jobdsl/dsl/Folder/icon.groovy +++ b/job-dsl-core/src/main/docs/examples/javaposse/jobdsl/dsl/Folder/icon.groovy @@ -25,4 +25,4 @@ folder('build-status') { icon { buildStatusFolderIcon() } -} \ No newline at end of file +} diff --git a/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/icon/FolderIconContext.groovy b/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/icon/FolderIconContext.groovy index 2550876b9..625c5d556 100644 --- a/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/icon/FolderIconContext.groovy +++ b/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/icon/FolderIconContext.groovy @@ -1,6 +1,9 @@ package javaposse.jobdsl.dsl.helpers.icon -import javaposse.jobdsl.dsl.* +import javaposse.jobdsl.dsl.AbstractExtensibleContext +import javaposse.jobdsl.dsl.ContextType +import javaposse.jobdsl.dsl.Item +import javaposse.jobdsl.dsl.JobManagement @ContextType('com.cloudbees.hudson.plugins.folder.FolderIcon') class FolderIconContext extends AbstractExtensibleContext { From c240415d755b3e8a6922446608575f3f09bddf8f Mon Sep 17 00:00:00 2001 From: strangelookingnerd <49242855+strangelookingnerd@users.noreply.github.com> Date: Mon, 20 Mar 2023 08:24:59 +0100 Subject: [PATCH 4/9] Fix missing import --- .../javaposse/jobdsl/dsl/helpers/icon/FolderIconContext.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/icon/FolderIconContext.groovy b/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/icon/FolderIconContext.groovy index 625c5d556..2321243a0 100644 --- a/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/icon/FolderIconContext.groovy +++ b/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/icon/FolderIconContext.groovy @@ -1,6 +1,7 @@ package javaposse.jobdsl.dsl.helpers.icon import javaposse.jobdsl.dsl.AbstractExtensibleContext +import javaposse.jobdsl.dsl.ContextHelper import javaposse.jobdsl.dsl.ContextType import javaposse.jobdsl.dsl.Item import javaposse.jobdsl.dsl.JobManagement From b90adee1276825a904c274386e7f88d1d400a210 Mon Sep 17 00:00:00 2001 From: strangelookingnerd <49242855+strangelookingnerd@users.noreply.github.com> Date: Mon, 20 Mar 2023 09:02:56 +0100 Subject: [PATCH 5/9] Fix tests Remove icon examples in doc as it does not work by any means We keep a link to custom-folder-icon --- .../javaposse/jobdsl/dsl/Folder/icon.groovy | 29 ++----------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/job-dsl-core/src/main/docs/examples/javaposse/jobdsl/dsl/Folder/icon.groovy b/job-dsl-core/src/main/docs/examples/javaposse/jobdsl/dsl/Folder/icon.groovy index 92245428c..580f49fdd 100644 --- a/job-dsl-core/src/main/docs/examples/javaposse/jobdsl/dsl/Folder/icon.groovy +++ b/job-dsl-core/src/main/docs/examples/javaposse/jobdsl/dsl/Folder/icon.groovy @@ -1,28 +1,3 @@ // use the stock icon -folder('stock') - -// use https://github.com/jenkinsci/custom-folder-icon-plugin for custom icons -userContent('customFolderIcons/custom.png', streamFileFromWorkspace('custom.png')) -folder('custom') { - icon { - customFolderIcon { - foldericon('custom.png') - } - } -} - -// use https://github.com/jenkinsci/custom-folder-icon-plugin for ionicons -folder('ionicon') { - icon { - ioniconFolderIcon { - ionicon('jenkins') - } - } -} - -// use https://github.com/jenkinsci/custom-folder-icon-plugin for build status icon -folder('build-status') { - icon { - buildStatusFolderIcon() - } -} +// see https://github.com/jenkinsci/custom-folder-icon-plugin for custom icons +folder('stock') \ No newline at end of file From ed1e1fc42baa8669d68ad12c02bb35764f7a43f7 Mon Sep 17 00:00:00 2001 From: strangelookingnerd <49242855+strangelookingnerd@users.noreply.github.com> Date: Mon, 20 Mar 2023 14:20:20 +0100 Subject: [PATCH 6/9] Fix IDE formatting --- .../main/docs/examples/javaposse/jobdsl/dsl/Folder/icon.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/job-dsl-core/src/main/docs/examples/javaposse/jobdsl/dsl/Folder/icon.groovy b/job-dsl-core/src/main/docs/examples/javaposse/jobdsl/dsl/Folder/icon.groovy index 580f49fdd..899e5fbd7 100644 --- a/job-dsl-core/src/main/docs/examples/javaposse/jobdsl/dsl/Folder/icon.groovy +++ b/job-dsl-core/src/main/docs/examples/javaposse/jobdsl/dsl/Folder/icon.groovy @@ -1,3 +1,3 @@ // use the stock icon // see https://github.com/jenkinsci/custom-folder-icon-plugin for custom icons -folder('stock') \ No newline at end of file +folder('stock') From b4b0a503530324201fa5cabfc6f0cb24fedd9fdd Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Tue, 21 Mar 2023 11:42:08 -0700 Subject: [PATCH 7/9] Update `@since` version --- .../src/main/groovy/javaposse/jobdsl/dsl/AbstractFolder.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/AbstractFolder.groovy b/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/AbstractFolder.groovy index 1c1f81181..a788bfe2a 100644 --- a/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/AbstractFolder.groovy +++ b/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/AbstractFolder.groovy @@ -59,7 +59,7 @@ abstract class AbstractFolder extends Item { /** * Sets the icon of the folder. * - * @since 1.82 + * @since 1.83 */ void icon(@DslContext(FolderIconContext) Closure closure) { FolderIconContext context = new FolderIconContext(jobManagement, this) From b4987b1201badb9f62e666fdc0cf16a666c8f37d Mon Sep 17 00:00:00 2001 From: strangelookingnerd <49242855+strangelookingnerd@users.noreply.github.com> Date: Tue, 21 Mar 2023 21:59:26 +0100 Subject: [PATCH 8/9] Add tests for custom folder icons --- job-dsl-plugin/pom.xml | 5 + .../plugin/ExecuteDslScriptsSpec.groovy | 123 +++++++++++++++++- 2 files changed, 127 insertions(+), 1 deletion(-) diff --git a/job-dsl-plugin/pom.xml b/job-dsl-plugin/pom.xml index c74df3634..1bb7cc829 100644 --- a/job-dsl-plugin/pom.xml +++ b/job-dsl-plugin/pom.xml @@ -132,6 +132,11 @@ test-harness test + + io.jenkins.plugins + custom-folder-icon + test + org.jenkins-ci.plugins credentials diff --git a/job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/ExecuteDslScriptsSpec.groovy b/job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/ExecuteDslScriptsSpec.groovy index 11ff191ee..8a407fe40 100644 --- a/job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/ExecuteDslScriptsSpec.groovy +++ b/job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/ExecuteDslScriptsSpec.groovy @@ -1,9 +1,12 @@ package javaposse.jobdsl.plugin import com.cloudbees.hudson.plugins.folder.Folder +import com.cloudbees.hudson.plugins.folder.FolderIcon +import com.cloudbees.hudson.plugins.folder.icons.StockFolderIcon import hudson.FilePath import hudson.model.AbstractItem import hudson.model.AbstractProject +import hudson.model.BallColor import hudson.model.Computer import hudson.model.FreeStyleBuild import hudson.model.FreeStyleProject @@ -25,13 +28,18 @@ import javaposse.jobdsl.plugin.actions.GeneratedViewsAction import javaposse.jobdsl.plugin.actions.GeneratedViewsBuildAction import javaposse.jobdsl.plugin.actions.SeedJobAction import javaposse.jobdsl.plugin.fixtures.ExampleJobDslExtension +import jenkins.branch.MetadataActionFolderIcon import jenkins.model.Jenkins +import jenkins.plugins.foldericon.BuildStatusFolderIcon +import jenkins.plugins.foldericon.CustomFolderIcon +import jenkins.plugins.foldericon.IoniconFolderIcon import jenkins.security.QueueItemAuthenticator import jenkins.security.QueueItemAuthenticatorConfiguration import org.acegisecurity.Authentication import org.jenkinsci.plugins.configfiles.GlobalConfigFiles import org.jenkinsci.plugins.configfiles.custom.CustomConfig import org.jenkinsci.plugins.managedscripts.PowerShellConfig +import org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval import org.jenkinsci.plugins.scriptsecurity.scripts.languages.GroovyLanguage import org.junit.ClassRule import org.junit.Rule @@ -43,7 +51,6 @@ import org.jvnet.hudson.test.WithoutJenkins import spock.lang.Shared import spock.lang.Specification import spock.lang.Unroll -import org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval import static hudson.model.Result.FAILURE import static hudson.model.Result.SUCCESS @@ -104,6 +111,37 @@ folder('folder-a/folder-b') { description('lorem ipsum') }""" + private static final String FOLDER_WITH_STOCK_ICON_SCRIPT = """folder('stock') { + icon { + stockFolderIcon() + } +}""" + + private static final String FOLDER_WITH_METADATA_ICON_SCRIPT = """folder('metadata') { + icon { + metadataActionFolderIcon() + } +}""" + private static final String FOLDER_WITH_CUSTOM_ICON_SCRIPT = """folder('custom') { + icon { + customFolderIcon { + foldericon('custom.png') + } + } +}""" + private static final String FOLDER_WITH_IONICON_ICON_SCRIPT = """folder('ionicon') { + icon { + ioniconFolderIcon { + ionicon('jenkins') + } + } +}""" + private static final String FOLDER_WITH_BUILD_STATUS_ICON_SCRIPT = """folder('build-status') { + icon { + buildStatusFolderIcon() + } +}""" + @Shared @ClassRule @SuppressWarnings('JUnitPublicField') @@ -877,6 +915,89 @@ folder('folder-a/folder-b') { SeedJobAction).isConfigChanged() } + def createFolderWithStockIcon() { + setup: + FreeStyleProject job = jenkinsRule.createFreeStyleProject('seed') + job.buildersList.add(new ExecuteDslScripts(FOLDER_WITH_STOCK_ICON_SCRIPT)) + + when: + FreeStyleBuild freeStyleBuild = job.scheduleBuild2(0).get() + + then: + freeStyleBuild.result == SUCCESS + Item item = jenkinsRule.instance.getItemByFullName('stock') + item instanceof Folder + FolderIcon icon = ((Folder) item).getIcon() + icon instanceof StockFolderIcon + } + + def createFolderWithMetadataIcon() { + setup: + FreeStyleProject job = jenkinsRule.createFreeStyleProject('seed') + job.buildersList.add(new ExecuteDslScripts(FOLDER_WITH_METADATA_ICON_SCRIPT)) + + when: + FreeStyleBuild freeStyleBuild = job.scheduleBuild2(0).get() + + then: + freeStyleBuild.result == SUCCESS + Item item = jenkinsRule.instance.getItemByFullName('metadata') + item instanceof Folder + FolderIcon icon = ((Folder) item).getIcon() + icon instanceof MetadataActionFolderIcon + } + + def createFolderWithCustomIcon() { + setup: + FreeStyleProject job = jenkinsRule.createFreeStyleProject('seed') + job.buildersList.add(new ExecuteDslScripts(FOLDER_WITH_CUSTOM_ICON_SCRIPT)) + + when: + FreeStyleBuild freeStyleBuild = job.scheduleBuild2(0).get() + + then: + freeStyleBuild.result == SUCCESS + Item item = jenkinsRule.instance.getItemByFullName('custom') + item instanceof Folder + FolderIcon icon = ((Folder) item).getIcon() + icon instanceof CustomFolderIcon + ((CustomFolderIcon) icon).getFoldericon() == 'custom.png' + } + + def createFolderWithIoniconIcon() { + setup: + FreeStyleProject job = jenkinsRule.createFreeStyleProject('seed') + job.buildersList.add(new ExecuteDslScripts(FOLDER_WITH_IONICON_ICON_SCRIPT)) + + when: + FreeStyleBuild freeStyleBuild = job.scheduleBuild2(0).get() + + then: + freeStyleBuild.result == SUCCESS + Item item = jenkinsRule.instance.getItemByFullName('ionicon') + item instanceof Folder + FolderIcon icon = ((Folder) item).getIcon() + icon instanceof IoniconFolderIcon + ((IoniconFolderIcon) icon).getIonicon() == 'jenkins' + } + + def createFolderWithBuildStatusIcon() { + setup: + FreeStyleProject job = jenkinsRule.createFreeStyleProject('seed') + job.buildersList.add(new ExecuteDslScripts(FOLDER_WITH_BUILD_STATUS_ICON_SCRIPT)) + + when: + FreeStyleBuild freeStyleBuild = job.scheduleBuild2(0).get() + + then: + freeStyleBuild.result == SUCCESS + Item item = jenkinsRule.instance.getItemByFullName('build-status') + item instanceof Folder + FolderIcon icon = ((Folder) item).getIcon() + icon instanceof BuildStatusFolderIcon + ((BuildStatusFolderIcon) icon).getIconClassName() == BallColor.NOTBUILT.getIconClassName() + } + def createJobInFolder() { setup: FreeStyleProject job = jenkinsRule.createFreeStyleProject('seed') From 05bdb397fa6a562212861b5cb64e1539be4556f3 Mon Sep 17 00:00:00 2001 From: strangelookingnerd <49242855+strangelookingnerd@users.noreply.github.com> Date: Wed, 22 Mar 2023 09:47:38 +0100 Subject: [PATCH 9/9] Add test for EmojiFolderIcon --- job-dsl-plugin/pom.xml | 2 +- .../plugin/ExecuteDslScriptsSpec.groovy | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/job-dsl-plugin/pom.xml b/job-dsl-plugin/pom.xml index 2fa6abe25..503e94458 100644 --- a/job-dsl-plugin/pom.xml +++ b/job-dsl-plugin/pom.xml @@ -54,7 +54,7 @@ io.jenkins.tools.bom bom-2.387.x - 1887.vda_d0ddb_c15c4 + 1935.v530f4395930f pom import diff --git a/job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/ExecuteDslScriptsSpec.groovy b/job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/ExecuteDslScriptsSpec.groovy index 8a407fe40..024953582 100644 --- a/job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/ExecuteDslScriptsSpec.groovy +++ b/job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/ExecuteDslScriptsSpec.groovy @@ -32,6 +32,7 @@ import jenkins.branch.MetadataActionFolderIcon import jenkins.model.Jenkins import jenkins.plugins.foldericon.BuildStatusFolderIcon import jenkins.plugins.foldericon.CustomFolderIcon +import jenkins.plugins.foldericon.EmojiFolderIcon import jenkins.plugins.foldericon.IoniconFolderIcon import jenkins.security.QueueItemAuthenticator import jenkins.security.QueueItemAuthenticatorConfiguration @@ -122,6 +123,7 @@ folder('folder-a/folder-b') { metadataActionFolderIcon() } }""" + private static final String FOLDER_WITH_CUSTOM_ICON_SCRIPT = """folder('custom') { icon { customFolderIcon { @@ -129,6 +131,7 @@ folder('folder-a/folder-b') { } } }""" + private static final String FOLDER_WITH_IONICON_ICON_SCRIPT = """folder('ionicon') { icon { ioniconFolderIcon { @@ -136,12 +139,21 @@ folder('folder-a/folder-b') { } } }""" + private static final String FOLDER_WITH_BUILD_STATUS_ICON_SCRIPT = """folder('build-status') { icon { buildStatusFolderIcon() } }""" + private static final String FOLDER_WITH_EMOJI_ICON_SCRIPT = """folder('emoji') { + icon { + emojiFolderIcon { + emoji('sloth') + } + } +}""" + @Shared @ClassRule @SuppressWarnings('JUnitPublicField') @@ -998,6 +1010,23 @@ folder('folder-a/folder-b') { ((BuildStatusFolderIcon) icon).getIconClassName() == BallColor.NOTBUILT.getIconClassName() } + def createFolderWithEmojiIcon() { + setup: + FreeStyleProject job = jenkinsRule.createFreeStyleProject('seed') + job.buildersList.add(new ExecuteDslScripts(FOLDER_WITH_EMOJI_ICON_SCRIPT)) + + when: + FreeStyleBuild freeStyleBuild = job.scheduleBuild2(0).get() + + then: + freeStyleBuild.result == SUCCESS + Item item = jenkinsRule.instance.getItemByFullName('emoji') + item instanceof Folder + FolderIcon icon = ((Folder) item).getIcon() + icon instanceof EmojiFolderIcon + ((EmojiFolderIcon) icon).getEmoji() == 'sloth' + } + def createJobInFolder() { setup: FreeStyleProject job = jenkinsRule.createFreeStyleProject('seed')