diff --git a/src/test/java/org/jenkinsci/plugins/configfiles/GlobalConfigFilesTest.java b/src/test/java/org/jenkinsci/plugins/configfiles/GlobalConfigFilesTest.java index af7d85ee..b44762aa 100644 --- a/src/test/java/org/jenkinsci/plugins/configfiles/GlobalConfigFilesTest.java +++ b/src/test/java/org/jenkinsci/plugins/configfiles/GlobalConfigFilesTest.java @@ -12,7 +12,7 @@ import org.jvnet.hudson.test.recipes.LocalData; /** - * Test for GlobalConfigFiles to ensure reading data.
+ * Test for {@link GlobalConfigFiles} to ensure reading data. */ public class GlobalConfigFilesTest { @@ -28,9 +28,8 @@ public class GlobalConfigFilesTest { @LocalData @Test public void verifyLoadWithAnonymousInnerClassComparatorVar1() { - GlobalConfigFiles store = j.getInstance().getExtensionList(GlobalConfigFiles.class).get(GlobalConfigFiles.class); + ConfigFileStore store = j.getInstance().getExtensionList(GlobalConfigFiles.class).get(GlobalConfigFiles.class); Collection configs = store.getConfigs(); assertThat(configs, hasSize(2)); } - } diff --git a/src/test/java/org/jenkinsci/plugins/configfiles/folder/FolderConfigFilesTest.java b/src/test/java/org/jenkinsci/plugins/configfiles/folder/FolderConfigFilesTest.java new file mode 100644 index 00000000..b18a0993 --- /dev/null +++ b/src/test/java/org/jenkinsci/plugins/configfiles/folder/FolderConfigFilesTest.java @@ -0,0 +1,37 @@ +package org.jenkinsci.plugins.configfiles.folder; + +import static org.hamcrest.Matchers.hasSize; +import static org.junit.Assert.assertThat; + +import java.util.Collection; + +import com.cloudbees.hudson.plugins.folder.Folder; +import org.jenkinsci.lib.configprovider.model.Config; +import org.jenkinsci.plugins.configfiles.ConfigFileStore; +import org.junit.Rule; +import org.junit.Test; +import org.jvnet.hudson.test.JenkinsRule; +import org.jvnet.hudson.test.recipes.LocalData; + +/** + * Test for {@link FolderConfigFileProperty} to ensure reading data. + */ +public class FolderConfigFilesTest { + + @Rule + public JenkinsRule j = new JenkinsRule(); + + /** + * Read data produced by Jenkins ver. 2.141 and plugin version 2.18.
+ * The only change I made is to downgrade XML version to 1.0 because of this:
+ * + * XML version of descriptor are upgraded from 1.0 to 1.1 in 2.105 https://jenkins.io/changelog/#v2.105 (JENKINS-48463) + */ + @LocalData + @Test + public void verifyLoadWithAnonymousInnerClassComparatorVar1() { + ConfigFileStore store = ((Folder) j.jenkins.getItemByFullName("test-folder")).getAction(FolderConfigFileAction.class).getStore(); + Collection configs = store.getConfigs(); + assertThat(configs, hasSize(2)); + } +} diff --git a/src/test/resources/org/jenkinsci/plugins/configfiles/GlobalConfigFilesTest/verifyLoadWithAnonymousInnerClassComparatorVar1/org.jenkinsci.plugins.configfiles.GlobalConfigFiles.xml b/src/test/resources/org/jenkinsci/plugins/configfiles/GlobalConfigFilesTest/verifyLoadWithAnonymousInnerClassComparatorVar1/org.jenkinsci.plugins.configfiles.GlobalConfigFiles.xml index 5a75e20f..bb1ffe48 100644 --- a/src/test/resources/org/jenkinsci/plugins/configfiles/GlobalConfigFilesTest/verifyLoadWithAnonymousInnerClassComparatorVar1/org.jenkinsci.plugins.configfiles.GlobalConfigFiles.xml +++ b/src/test/resources/org/jenkinsci/plugins/configfiles/GlobalConfigFilesTest/verifyLoadWithAnonymousInnerClassComparatorVar1/org.jenkinsci.plugins.configfiles.GlobalConfigFiles.xml @@ -4,8 +4,8 @@ e61a40f3-9d03-4448-bca1-e874f3fb1c45 - dummyCustomConfig1 - Dummy Custom Config 1 + custom-config + Dummy Custom Config dummy content org.jenkinsci.plugins.configfiles.custom.CustomConfig @@ -17,21 +17,10 @@ <settings> <interactiveMode>false</interactiveMode> <localRepository>${env.WORKSPACE}/.repository</localRepository> - <!-- - <proxies> - <proxy> - <id>dummy-proxy</id> - <active>true</active> - <protocol>http</protocol> - <port>8888</port> - <nonProxyHosts>localhost</nonProxyHosts> - </proxy> - </proxies> - --> </settings> org.jenkinsci.plugins.configfiles.maven.GlobalMavenSettingsConfig true - \ No newline at end of file + diff --git a/src/test/resources/org/jenkinsci/plugins/configfiles/folder/FolderConfigFilesTest/verifyLoadWithAnonymousInnerClassComparatorVar1/jobs/test-folder/config.xml b/src/test/resources/org/jenkinsci/plugins/configfiles/folder/FolderConfigFilesTest/verifyLoadWithAnonymousInnerClassComparatorVar1/jobs/test-folder/config.xml new file mode 100644 index 00000000..48c20892 --- /dev/null +++ b/src/test/resources/org/jenkinsci/plugins/configfiles/folder/FolderConfigFilesTest/verifyLoadWithAnonymousInnerClassComparatorVar1/jobs/test-folder/config.xml @@ -0,0 +1,44 @@ + + + + + + + + + + e47beadf-b379-4d8a-9db9-ea373600d8eb + custom-config + Dummy Custom Config + dummy content + org.jenkinsci.plugins.configfiles.custom.CustomConfig + + + de351ee6-bf92-43e1-b0af-0c31f5819b68 + global-maven-settings + Dummy global Maven settings + <?xml version="1.0" encoding="UTF-8"?> +<settings> + <interactiveMode>false</interactiveMode> + <localRepository>${env.WORKSPACE}/.repository</localRepository> +</settings> + org.jenkinsci.plugins.configfiles.maven.GlobalMavenSettingsConfig + + true + + + + + + + + All + false + false + + + + + + +