-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JENKINS-53399] Add deserialization test for FolderConfigFileProperty
The config files for the new test have been set up as similar as possible to the existing one, only ids differ. The existing test was cleaned a bit.
- Loading branch information
Showing
4 changed files
with
86 additions
and
17 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
37 changes: 37 additions & 0 deletions
37
src/test/java/org/jenkinsci/plugins/configfiles/folder/FolderConfigFilesTest.java
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,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.<br> | ||
* The only change I made is to downgrade XML version to 1.0 because of this:<br> | ||
* | ||
* 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<Config> configs = store.getConfigs(); | ||
assertThat(configs, hasSize(2)); | ||
} | ||
} |
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
44 changes: 44 additions & 0 deletions
44
...nfigFilesTest/verifyLoadWithAnonymousInnerClassComparatorVar1/jobs/test-folder/config.xml
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,44 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<com.cloudbees.hudson.plugins.folder.Folder plugin="cloudbees-folder@5.12"> | ||
<actions/> | ||
<description/> | ||
<properties> | ||
<org.jenkinsci.plugins.configfiles.folder.FolderConfigFileProperty plugin="config-file-provider@2.18"> | ||
<configs class="sorted-set"> | ||
<comparator class="org.jenkinsci.plugins.configfiles.folder.FolderConfigFileProperty$1"/> | ||
<org.jenkinsci.plugins.configfiles.custom.CustomConfig> | ||
<id>e47beadf-b379-4d8a-9db9-ea373600d8eb</id> | ||
<name>custom-config</name> | ||
<comment>Dummy Custom Config</comment> | ||
<content>dummy content</content> | ||
<providerId>org.jenkinsci.plugins.configfiles.custom.CustomConfig</providerId> | ||
</org.jenkinsci.plugins.configfiles.custom.CustomConfig> | ||
<org.jenkinsci.plugins.configfiles.maven.GlobalMavenSettingsConfig> | ||
<id>de351ee6-bf92-43e1-b0af-0c31f5819b68</id> | ||
<name>global-maven-settings</name> | ||
<comment>Dummy global Maven settings</comment> | ||
<content><?xml version="1.0" encoding="UTF-8"?> | ||
<settings> | ||
<interactiveMode>false</interactiveMode> | ||
<localRepository>${env.WORKSPACE}/.repository</localRepository> | ||
</settings></content> | ||
<providerId>org.jenkinsci.plugins.configfiles.maven.GlobalMavenSettingsConfig</providerId> | ||
<serverCredentialMappings/> | ||
<isReplaceAll>true</isReplaceAll> | ||
</org.jenkinsci.plugins.configfiles.maven.GlobalMavenSettingsConfig> | ||
</configs> | ||
</org.jenkinsci.plugins.configfiles.folder.FolderConfigFileProperty> | ||
</properties> | ||
<views> | ||
<hudson.model.AllView> | ||
<owner class="com.cloudbees.hudson.plugins.folder.Folder" reference="../../.."/> | ||
<name>All</name> | ||
<filterExecutors>false</filterExecutors> | ||
<filterQueue>false</filterQueue> | ||
<properties class="hudson.model.View$PropertyList"/> | ||
</hudson.model.AllView> | ||
</views> | ||
<viewsTabBar class="hudson.views.DefaultViewsTabBar"/> | ||
<healthMetrics/> | ||
<icon class="com.cloudbees.hudson.plugins.folder.icons.StockFolderIcon"/> | ||
</com.cloudbees.hudson.plugins.folder.Folder> |