Skip to content

Commit

Permalink
Merge pull request #45 from jenkinsci/feature/JENKINS-26799
Browse files Browse the repository at this point in the history
Multiple SCMs plugin support
  • Loading branch information
klimas7 committed Feb 6, 2017
2 parents 570bf0f + 131b82c commit 6336b41
Showing 1 changed file with 29 additions and 0 deletions.
Expand Up @@ -25,6 +25,7 @@
import hudson.model.Result;
import hudson.plugins.git.GitSCM;
import hudson.plugins.git.UserRemoteConfig;
import hudson.plugins.git.extensions.impl.RelativeTargetDirectory;
import hudson.plugins.templateproject.ProxySCM;
import hudson.scm.SCM;
import hudson.tasks.Shell;
Expand Down Expand Up @@ -767,6 +768,34 @@ public void testMultiSCM() throws IOException, InterruptedException {
assertTrue(isListBoxItem(items, "origin/master"));
}

@Test
public void testMultiSCM_forSubdirectoryForRepo() throws IOException, InterruptedException {
project = jenkins.createFreeStyleProject("projectHaveMultiSCM");
project.getBuildersList().add(new Shell("echo test"));
GitSCM gitSCM = (GitSCM) getGitSCM(GIT_CLIENT_REPOSITORY_URL);
gitSCM.getExtensions().add(new RelativeTargetDirectory("subDirectory"));
MultiSCM multiSCM = new MultiSCM(Arrays.asList(getGitSCM(), gitSCM));
project.setScm(multiSCM);

GitParameterDefinition def = new GitParameterDefinition("testName",
GitParameterDefinition.PARAMETER_TYPE_BRANCH,
null,
"testDescription",
null,
".*",
"*",
SortMode.ASCENDING, SelectedValue.TOP, null, false);

project.addProperty(new ParametersDefinitionProperty(def));
ListBoxModel items = def.getDescriptor().doFillValueItems(project, def.getName());
assertTrue(isListBoxItem(items, "origin/master"));

def.setUseRepository(".*git-client-plugin.git");
items = def.getDescriptor().doFillValueItems(project, def.getName());
assertTrue(isListBoxItem(items, "origin/master"));
}


private void setupGit() throws IOException {
setupGit(GIT_PARAMETER_REPOSITORY_URL);
}
Expand Down

0 comments on commit 6336b41

Please sign in to comment.