Permalink
Browse files

Merge pull request #211 from MarkEWaite/master-add-browser-url-round-…

…trip-test

Test [Fixed JENKINS-22604] - browser setting is lost when config is saved
  • Loading branch information...
MarkEWaite committed Mar 20, 2014
2 parents b46de67 + 6feb17b commit b2a731e62272c93a60f7f45d9d3c5d3b1e57fa11
Showing with 32 additions and 0 deletions.
  1. +6 −0 pom.xml
  2. +26 −0 src/test/java/hudson/plugins/git/GitSCMTest.java
View
@@ -273,6 +273,12 @@
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.3</version>
<scope>test</scope>
</dependency>
<dependency><!-- we contribute AbstractBuildParameters for Git if it's available -->
@@ -4,6 +4,8 @@
import hudson.FilePath;
import hudson.model.*;
import hudson.plugins.git.GitSCM.BuildChooserContextImpl;
import hudson.plugins.git.browser.GitRepositoryBrowser;
import hudson.plugins.git.browser.GithubWeb;
import hudson.plugins.git.extensions.GitSCMExtension;
import hudson.plugins.git.extensions.impl.AuthorInChangelog;
import hudson.plugins.git.extensions.impl.LocalBranch;
@@ -976,6 +978,30 @@ public void buildEnvironmentFor(Run r, EnvVars envs, TaskListener listener) thro
envs.put("CAT","");
}
}
private List<UserRemoteConfig> createRepoList(String url) {
List<UserRemoteConfig> repoList = new ArrayList<UserRemoteConfig>();
repoList.add(new UserRemoteConfig(url, null, null, null));
return repoList;
}
/**
* Makes sure that git browser URL is preserved across config round trip.
*/
@Bug(22604)
public void testConfigRoundtripURLPreserved() throws Exception {
FreeStyleProject p = createFreeStyleProject();
final String url = "https://github.com/jenkinsci/jenkins";
GitRepositoryBrowser browser = new GithubWeb(url);
GitSCM scm = new GitSCM(createRepoList(url),
Collections.singletonList(new BranchSpec("")),
false, Collections.<SubmoduleConfig>emptyList(),
browser, null, null);
p.setScm(scm);
configRoundtrip(p);
assertEqualDataBoundBeans(scm,p.getScm());
}
/**
* Makes sure that the configuration form works.
*/

0 comments on commit b2a731e

Please sign in to comment.