Skip to content
Permalink
Browse files

Merge pull request #45 from jenkinsci/feature/JENKINS-26799

Multiple SCMs plugin support
  • Loading branch information...
klimas7 committed Feb 6, 2017
2 parents 570bf0f + 131b82c commit 6336b41960434597180ab883b81d8e26e03b3641
@@ -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;
@@ -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);
}

0 comments on commit 6336b41

Please sign in to comment.
You can’t perform that action at this time.