本文整理汇总了Java中hudson.plugins.git.UserRemoteConfig类的典型用法代码示例。如果您正苦于以下问题:Java UserRemoteConfig类的具体用法?Java UserRemoteConfig怎么用?Java UserRemoteConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserRemoteConfig类属于hudson.plugins.git包,在下文中一共展示了UserRemoteConfig类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: oneBuildBasicMergeFailure
import hudson.plugins.git.UserRemoteConfig; //导入依赖的package包/类
@Test
public void oneBuildBasicMergeFailure() throws Exception {
repository = TestUtilsFactory.createRepositoryWithMergeConflict("test-repo");
File workDir = new File(TestUtilsFactory.WORKDIR,"test-repo");
Git.cloneRepository().setURI("file:///" + repository.getDirectory().getAbsolutePath()).setDirectory(workDir)
.setBare(false)
.setCloneAllBranches(true)
.setNoCheckout(false)
.call().close();
MatrixProjectBuilder builder = new MatrixProjectBuilder()
.setGitRepos(Collections.singletonList(new UserRemoteConfig("file://" + repository.getDirectory().getAbsolutePath(), null, null, null)))
.setUseSlaves(true).setRule(jenkinsRule)
.setStrategy(TestUtilsFactory.STRATEGY_TYPE.ACCUMULATED);
builder.setJobType(MatrixProject.class);
MatrixProject project = (MatrixProject)builder.generateJenkinsJob();
TestUtilsFactory.triggerProject(project);
jenkinsRule.waitUntilNoActivityUpTo(60000);
jenkinsRule.assertBuildStatus(Result.FAILURE, project.getLastBuild());
assertEquals("3 runs for this particular matrix build", 3, project.getLastBuild().getRuns().size());
}
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:21,代码来源:MatrixProjectCompatibilityTestIT.java
示例2: configurePretestedIntegrationPlugin
import hudson.plugins.git.UserRemoteConfig; //导入依赖的package包/类
private FreeStyleProject configurePretestedIntegrationPlugin(IntegrationStrategy integrationStrategy, String repositoryUrl) throws IOException, ANTLRException, InterruptedException {
FreeStyleProject project = jenkinsRule.createFreeStyleProject();
List<UserRemoteConfig> repoList = new ArrayList<>();
repoList.add(new UserRemoteConfig(repositoryUrl, null, null, null));
List<GitSCMExtension> gitSCMExtensions = new ArrayList<>();
gitSCMExtensions.add(new PretestedIntegrationAsGitPluginExt(integrationStrategy, "master", "origin"));
gitSCMExtensions.add(new PruneStaleBranch());
gitSCMExtensions.add(new CleanCheckout());
GitSCM gitSCM = new GitSCM(repoList,
Collections.singletonList(new BranchSpec("origin/ready/**")),
false, Collections.<SubmoduleConfig>emptyList(),
null, null, gitSCMExtensions);
project.setScm(gitSCM);
project.getPublishersList().add(new PretestedIntegrationPostCheckout());
return project;
}
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:21,代码来源:TwoBranchHeadsIT.java
示例3: configurePretestedIntegrationPlugin
import hudson.plugins.git.UserRemoteConfig; //导入依赖的package包/类
public static FreeStyleProject configurePretestedIntegrationPlugin(JenkinsRule rule, STRATEGY_TYPE type, List<UserRemoteConfig> repoList, String repoName, boolean runOnSlave, String integrationBranch) throws Exception {
FreeStyleProject project = rule.createFreeStyleProject();
if (runOnSlave) {
DumbSlave onlineSlave = rule.createOnlineSlave();
project.setAssignedNode(onlineSlave);
}
List<GitSCMExtension> gitSCMExtensions = new ArrayList<>();
gitSCMExtensions.add(new PretestedIntegrationAsGitPluginExt(type == STRATEGY_TYPE.SQUASH ? new SquashCommitStrategy() : new AccumulatedCommitStrategy(), integrationBranch, repoName));
gitSCMExtensions.add(new PruneStaleBranch());
gitSCMExtensions.add(new CleanCheckout());
project.getPublishersList().add(new PretestedIntegrationPostCheckout());
GitSCM gitSCM = new GitSCM(repoList,
Collections.singletonList(new BranchSpec("*/ready/**")),
false, Collections.<SubmoduleConfig>emptyList(),
null, null, gitSCMExtensions);
project.setScm(gitSCM);
project.save();
return project;
}
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:27,代码来源:TestUtilsFactory.java
示例4: getRemotes
import hudson.plugins.git.UserRemoteConfig; //导入依赖的package包/类
@Nonnull
List<UserRemoteConfig> getRemotes(@Nonnull GitLabSCMSource source) throws GitLabAPIException {
return singletonList(
new UserRemoteConfig(
getProject(projectId, source).getRemote(source),
"origin", getRefSpec().delegate().toString(),
source.getCredentialsId()));
}
开发者ID:Argelbargel,项目名称:gitlab-branch-source-plugin,代码行数:9,代码来源:GitLabSCMHeadImpl.java
示例5: getRemotes
import hudson.plugins.git.UserRemoteConfig; //导入依赖的package包/类
@Nonnull
@Override
List<UserRemoteConfig> getRemotes(@Nonnull GitLabSCMSource source) throws GitLabAPIException {
List<UserRemoteConfig> remotes = new ArrayList<>(2);
remotes.add(new UserRemoteConfig(
getProject(getProjectId(), source).getRemote(source),
"merge-request", "",
source.getCredentialsId()));
if (merge) {
remotes.addAll(targetBranch.getRemotes(source));
}
return remotes;
}
开发者ID:Argelbargel,项目名称:gitlab-branch-source-plugin,代码行数:15,代码来源:GitLabSCMMergeRequestHead.java
示例6: getSSHCredentials
import hudson.plugins.git.UserRemoteConfig; //导入依赖的package包/类
public static SSHUserPrivateKey getSSHCredentials(BuildContext context, EnvVars envVars) {
SCM scm = context.build.getProject().getScm();
if (!(scm instanceof GitSCM)) {
context.listener.getLogger().println("Error: SCM is not a GitSCM: " + scm.getType());
return null;
}
GitSCM git = (GitSCM) scm;
SSHUserPrivateKey theCreds = null;
for (UserRemoteConfig uc : git.getUserRemoteConfigs()) {
if (uc.getCredentialsId() != null) {
String url = uc.getUrl();
url = GitSCM.getParameterString(url, envVars);
theCreds = CredentialsMatchers
.firstOrNull(
CredentialsProvider.lookupCredentials(SSHUserPrivateKey.class, context.build.getProject(),
ACL.SYSTEM, URIRequirementBuilder.fromUri(url).build()),
CredentialsMatchers.allOf(CredentialsMatchers.withId(uc.getCredentialsId()),
GitClient.CREDENTIALS_MATCHER));
// just choose the first one. there should only be one...
if (theCreds != null) {
break;
}
}
}
return theCreds;
}
开发者ID:tanium,项目名称:pyjenkins,代码行数:31,代码来源:GitSSHKeyHelper.java
示例7: Git
import hudson.plugins.git.UserRemoteConfig; //导入依赖的package包/类
public Git(GitSCM gitSCM, AbstractBuild<?, ?> build, BuildListener listener)
throws IOException, InterruptedException {
String gitExe = gitSCM.getGitExe(build.getBuiltOn(), listener);
EnvVars environment = build.getEnvironment(listener);
this.gitClient = org.jenkinsci.plugins.gitclient.Git.with(listener, environment).in(build.getWorkspace())
.using(gitExe) // only if you want to use Git CLI
.getClient();
// get remote configurations, e.g., URL
List<UserRemoteConfig> remotes = gitSCM.getUserRemoteConfigs();
UserRemoteConfig remoteConfig = remotes.get(0);
this.remote = remoteConfig.getUrl();
listener.getLogger().println(EvoSuiteRecorder.LOG_PREFIX + "Remote config " + remoteConfig.toString());
// get key's (i.e., username-password, ssh key, etc) hash
String credentialID = remoteConfig.getCredentialsId();
if (credentialID == null || credentialID.equals("null")) {
listener.getLogger().println(EvoSuiteRecorder.LOG_PREFIX + "No credentials defined.");
// TODO: should we throw an exception and make the build fail?
} else {
// get key (i.e., username-password or ssh key / passphrase)
StandardUsernameCredentials credentials = this.getCredentials(credentialID);
this.gitClient.setCredentials(credentials);
this.gitClient.addDefaultCredentials(credentials);
}
}
开发者ID:EvoSuite,项目名称:evosuite,代码行数:29,代码来源:Git.java
示例8: provideGitSCM
import hudson.plugins.git.UserRemoteConfig; //导入依赖的package包/类
public static GitSCM provideGitSCM() {
return new GitSCM(newArrayList(
new UserRemoteConfig("https://github.com/user/dropwizard",
"", "+refs/pull/*:refs/remotes/origin/pr/*", "")),
newArrayList(new BranchSpec("${sha1}")),
false,
null,
null,
"",
null);
}
开发者ID:bratchenko,项目名称:jenkins-github-pull-request-comments,代码行数:12,代码来源:GhprcTestUtil.java
示例9: testBasicMerge
import hudson.plugins.git.UserRemoteConfig; //导入依赖的package包/类
@Test
public void testBasicMerge() throws Exception {
FreeStyleProject p = j.createFreeStyleProject();
List<UserRemoteConfig> remotes = new ArrayList<UserRemoteConfig>();
remotes.add(new UserRemoteConfig(repo.getPath(), "origin", "master", null));
List<BranchSpec> branches = new ArrayList<BranchSpec>();
branches.add(new BranchSpec("master"));
p.setScm(new GitSCM(remotes, branches, false, null, null, null, null));
// Init repo with release and feature branch.
GitClient client = g.gitClient(repo);
client.init();
g.touchAndCommit(repo, "init");
client.checkout("HEAD", "r1336");
g.touchAndCommit(repo, "r1336");
client.checkout("HEAD", "c3");
g.touchAndCommit(repo, "c3");
// Custom builder that merges feature branch with release branch using AdvancedSCMManager.
p.getBuildersList().add(new TestBuilder() {
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
try {
AdvancedSCMManager amm = SCMManagerFactory.getManager(build, launcher, listener);
amm.update("r1336");
amm.mergeWorkspaceWith("c3", null);
amm.commit("merge c3", "test <[email protected]>");
return true;
} catch (Exception e) {
e.printStackTrace(listener.getLogger());
return false;
}
}
});
// Assert file is here (should be after successful merge)
g.buildAndCheck(p, "c3");
}
开发者ID:jenkinsci,项目名称:gatekeeper-plugin,代码行数:39,代码来源:BasicGitTest.java
示例10: createRevisionParameterAction_pushCommitRequestWith2Remotes
import hudson.plugins.git.UserRemoteConfig; //导入依赖的package包/类
@Theory
public void createRevisionParameterAction_pushCommitRequestWith2Remotes(GitLabPushRequestSamples samples) throws Exception {
PushHook hook = samples.pushCommitRequest();
GitSCM gitSCM = new GitSCM(Arrays.asList(new UserRemoteConfig("[email protected]:test.git", null, null, null),
new UserRemoteConfig("[email protected]:fork.git", "fork", null, null)),
Collections.singletonList(new BranchSpec("")),
false, Collections.<SubmoduleConfig>emptyList(),
null, null, null);
RevisionParameterAction revisionParameterAction = new PushHookTriggerHandlerImpl().createRevisionParameter(hook, gitSCM);
assertThat(revisionParameterAction, is(notNullValue()));
assertThat(revisionParameterAction.commit, is(hook.getAfter()));
assertFalse(revisionParameterAction.canOriginateFrom(new ArrayList<RemoteConfig>()));
}
开发者ID:jenkinsci,项目名称:gitlab-plugin,代码行数:16,代码来源:PushHookTriggerHandlerGitlabServerTest.java
示例11: succesWithDefaultConfiguration2RepositoriesWithoutNames
import hudson.plugins.git.UserRemoteConfig; //导入依赖的package包/类
/**
* Test case 1-1:
* <p>
* * Two git repositories is configured in the git scm plugin
* * repo1 will default be named 'origin' by the git scm plugin
* * repo2 will default be named 'origin1' by the git scm plugin
* * pretested integration plugin is not configured, so default to:
* * integration branch: master
* * integration repo: origin
* * job should be a success the default plugin configuration matches
*
* @throws java.lang.Exception
*/
// This test should also be working, and should integrate repository 'repo1' as this should default be given the name 'origin' by the git scm and this is also our default name we use in the plugin when nothing else stated.
@Test
public void succesWithDefaultConfiguration2RepositoriesWithoutNames() throws Exception {
repository = TestUtilsFactory.createValidRepository("repo1");
Repository repo2 = TestUtilsFactory.createValidRepository("repo2");
List<UserRemoteConfig> userRemoteConfig = new ArrayList<>();
userRemoteConfig.add(new UserRemoteConfig("file://" + repository.getDirectory().getAbsolutePath(), null, null, null));
userRemoteConfig.add(new UserRemoteConfig("file://" + repo2.getDirectory().getAbsolutePath(), null, null, null));
FreeStyleProject project = TestUtilsFactory.configurePretestedIntegrationPlugin(jenkinsRule, TestUtilsFactory.STRATEGY_TYPE.SQUASH, userRemoteConfig, null, true);
TestUtilsFactory.triggerProject(project);
jenkinsRule.waitUntilNoActivityUpTo(60000);
TestUtilsFactory.destroyRepo(repo2);
Iterator<FreeStyleBuild> biterator = project.getBuilds().iterator();
while (biterator.hasNext()) {
FreeStyleBuild bitstuff = biterator.next();
String text = jenkinsRule.createWebClient().getPage(bitstuff, "console").asText();
System.out.println("=====BUILD-LOG=====");
System.out.println(text);
System.out.println("=====BUILD-LOG=====");
if (text.contains("push origin :origin/ready/feature_1")) {
assertEquals("Unexpected build result.", bitstuff.getResult(), Result.SUCCESS);
} else {
assertEquals("Unexpected build result.", bitstuff.getResult(), Result.NOT_BUILT);
}
}
}
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:47,代码来源:JENKINS_24754_IT.java
示例12: failWith2RepositoriesWithNoMatchingName
import hudson.plugins.git.UserRemoteConfig; //导入依赖的package包/类
/**
* When more than 1 git repository is chosen, and the user has specified
* repository names which do not match what is configured in the pretested
* integration plugin. We should fail the build.
*
* @throws java.lang.Exception
*/
@Test
public void failWith2RepositoriesWithNoMatchingName() throws Exception {
repository = TestUtilsFactory.createValidRepository("repo1");
Repository repo2 = TestUtilsFactory.createValidRepository("repo2");
List<UserRemoteConfig> userRemoteConfig = new ArrayList<>();
userRemoteConfig.add(new UserRemoteConfig("file://" + repository.getDirectory().getAbsolutePath(), "repo1", null, null));
userRemoteConfig.add(new UserRemoteConfig("file://" + repo2.getDirectory().getAbsolutePath(), "repo2", null, null));
FreeStyleProject project = TestUtilsFactory.configurePretestedIntegrationPlugin(jenkinsRule, TestUtilsFactory.STRATEGY_TYPE.SQUASH, userRemoteConfig, null, true);
TestUtilsFactory.triggerProject(project);
jenkinsRule.waitUntilNoActivityUpTo(60000);
TestUtilsFactory.destroyRepo(repo2);
// FIXME when this test works with first build, we should loop over all builds and improve the test
FreeStyleBuild build = project.getBuilds().getFirstBuild();
String text = jenkinsRule.createWebClient().getPage(build, "console").asText();
System.out.println("=====BUILD-LOG=====");
System.out.println(text);
System.out.println("=====BUILD-LOG=====");
assertEquals("Unexpected build result.", Result.FAILURE, build.getResult());
}
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:34,代码来源:JENKINS_24754_IT.java
示例13: successWithMatchingRepositoryNames
import hudson.plugins.git.UserRemoteConfig; //导入依赖的package包/类
/**
* TODO: isn't this a copy of
* {@link GeneralBehaviourIT#remoteOrigin1WithMoreThan1RepoShouldBeSuccessfulFirstRepo()}
* <p>
* When more than 1 git repository is chosen, and the user has specified
* repository names which do match what is configured in the pretested
* integration plugin. We should get 2 builds, one of which should be
* NOT_BUILT, the other one should be SUCCESS.
*
* @throws java.lang.Exception
*/
//FIXME this test fails in as the plugin tries to merge changes from repository 2 into repository 1.
// So a bug in the plugin allows for trying to run integration, without checking that we're started with the correct
// repository, which is the one we configure in our pretested integration part of the job.
// The configuration below should only allow us to integrate things on repo1.
@Test
public void successWithMatchingRepositoryNames() throws Exception {
Repository repo1 = TestUtilsFactory.createValidRepository("repo1");
Repository repo2 = TestUtilsFactory.createValidRepository("repo2");
List<UserRemoteConfig> userRemoteConfig = new ArrayList<>();
userRemoteConfig.add(new UserRemoteConfig("file://" + repo1.getDirectory().getAbsolutePath(), "repo1", null, null));
userRemoteConfig.add(new UserRemoteConfig("file://" + repo2.getDirectory().getAbsolutePath(), "repo2", null, null));
FreeStyleProject project = TestUtilsFactory.configurePretestedIntegrationPlugin(jenkinsRule, TestUtilsFactory.STRATEGY_TYPE.SQUASH, userRemoteConfig, "repo1", true);
TestUtilsFactory.triggerProject(project);
jenkinsRule.waitUntilNoActivityUpTo(60000);
TestUtilsFactory.destroyRepo(repo1, repo2);
Iterator<FreeStyleBuild> biterator = project.getBuilds().iterator();
while (biterator.hasNext()) {
FreeStyleBuild bitstuff = biterator.next();
String text = jenkinsRule.createWebClient().getPage(bitstuff, "console").asText();
System.out.println("=====BUILD-LOG=====");
System.out.println(text);
System.out.println("=====BUILD-LOG=====");
if (text.contains("No revision matches configuration in 'Integration repository'")) {
assertEquals("Unexpected build result.", Result.NOT_BUILT, bitstuff.getResult());
} else {
assertEquals("Unexpected build result.", Result.SUCCESS, bitstuff.getResult());
}
}
}
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:50,代码来源:JENKINS_24754_IT.java
示例14: successWithDefaultConfiguration
import hudson.plugins.git.UserRemoteConfig; //导入依赖的package包/类
/**
* TODO: This one is very much redundant. We've covered the case multiple
* times
* <p>
* We should work with out of the box default configuration. This one should
* finish successfully with the merge going well.
* <p>
* Expect: Build success.
*
* @throws Exception
*/
@Test
public void successWithDefaultConfiguration() throws Exception {
Repository repo1 = TestUtilsFactory.createValidRepository("repo1");
List<UserRemoteConfig> userRemoteConfig = new ArrayList<>();
userRemoteConfig.add(new UserRemoteConfig("file://" + repo1.getDirectory().getAbsolutePath(), null, null, null));
FreeStyleProject project = TestUtilsFactory.configurePretestedIntegrationPlugin(jenkinsRule, TestUtilsFactory.STRATEGY_TYPE.SQUASH, userRemoteConfig, null, true);
TestUtilsFactory.triggerProject(project);
jenkinsRule.waitUntilNoActivityUpTo(60000);
Iterator<FreeStyleBuild> biterator = project.getBuilds().iterator();
while (biterator.hasNext()) {
FreeStyleBuild bitstuff = biterator.next();
String text = jenkinsRule.createWebClient().getPage(bitstuff, "console").asText();
System.out.println("=====BUILD-LOG=====");
System.out.println(text);
System.out.println("=====BUILD-LOG=====");
}
TestUtilsFactory.destroyRepo(repo1);
Result buildResult = project.getBuilds().getFirstBuild().getResult();
assertEquals("Unexpected build result.", buildResult, Result.SUCCESS);
}
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:38,代码来源:JENKINS_24754_IT.java
示例15: testCredentialsSupportForAbstractProjectTypes
import hudson.plugins.git.UserRemoteConfig; //导入依赖的package包/类
@Test
public void testCredentialsSupportForAbstractProjectTypes() throws Exception {
assumeTrue(pw != null && repo != null && uName != null);
cloneTestRepositoryAndPrepareABranch();
SystemCredentialsProvider scp = (SystemCredentialsProvider)jenkinsRule.getInstance().getExtensionList("com.cloudbees.plugins.credentials.SystemCredentialsProvider").get(0);
UsernamePasswordCredentialsImpl unpwCred = new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, "pipCredentials","description", uName, pw);
scp.getCredentials().add(unpwCred);
scp.save();
List<UserRemoteConfig> urcList = new ArrayList<>();
UserRemoteConfig urc = new UserRemoteConfig(repo,null,null,"pipCredentials");
urcList.add(urc);
FreeStyleProject freeStyle = TestUtilsFactory.configurePretestedIntegrationPlugin(jenkinsRule, TestUtilsFactory.STRATEGY_TYPE.SQUASH, urcList,"origin", false);
jenkinsRule.buildAndAssertSuccess(freeStyle);
}
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:15,代码来源:GHI98_SupportForCredentialsIT.java
示例16: defaultGitConfigurationTwoRemotes1_NOT_BUILT_1_SUCCESS
import hudson.plugins.git.UserRemoteConfig; //导入依赖的package包/类
/**
* Git Plugin
* <p>
* Test that we operate using a default configuration, with two repositories
* in a single Git Plugin configuration.
* <p>
* Pretested integration:
* - 'Integration branch' : master (default)
* - 'Repository name' : origin (default)
* - 'Strategy' : Accumulated commit
* <p>
* GitSCM:
* - 'Name' : (empty)
* - 'Name' : (empty)
* <p>
* Workflow
* - Create two repositories each containing a 'ready' branch.
* - The build is triggered.
* <p>
* Results
* - Two builds. One NOT_BUILT and one SUCCESS.
*
* @throws Exception
*/
@Test
public void defaultGitConfigurationTwoRemotes1_NOT_BUILT_1_SUCCESS() throws Exception {
Repository repository = TestUtilsFactory.createValidRepository("test-repo");
Repository repository2 = TestUtilsFactory.createValidRepository("test-repo2");
List<UserRemoteConfig> config = Arrays.asList(new UserRemoteConfig("file://" + repository.getDirectory().getAbsolutePath(), null, null, null), new UserRemoteConfig("file://" + repository2.getDirectory().getAbsolutePath(), null, null, null));
FreeStyleProject project = TestUtilsFactory.configurePretestedIntegrationPlugin(jenkinsRule, TestUtilsFactory.STRATEGY_TYPE.ACCUMULATED, config, null, true);
TestUtilsFactory.triggerProject(project);
assertEquals(1, jenkinsRule.jenkins.getQueue().getItems().length);
jenkinsRule.waitUntilNoActivityUpTo(60000);
TestUtilsFactory.destroyRepo(repository2, repository);
for (AbstractBuild<?, ?> b : project.getBuilds()) {
String text = jenkinsRule.createWebClient().getPage(b, "console").asText();
System.out.println("=====BUILD-LOG=====");
System.out.println(text);
System.out.println("=====BUILD-LOG=====");
if (text.contains("push origin :origin/ready/feature_1")) {
assertEquals("Unexpected build result.", Result.SUCCESS, b.getResult());
} else {
assertEquals("Unexpected build result.", Result.NOT_BUILT, b.getResult());
}
}
}
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:53,代码来源:GeneralBehaviourIT.java
示例17: remoteOrigin1WithMoreThan1RepoShouldBeSuccessfulFirstRepo
import hudson.plugins.git.UserRemoteConfig; //导入依赖的package包/类
/**
* Git Plugin
* <p>
* Test that we operate using a default configuration, with two repositories
* in a single Git Plugin configuration.
* <p>
* Pretested integration:
* - 'Integration branch' : master (default)
* - 'Repository name' : origin1
* - 'Strategy' : Accumulated commit
* <p>
* GitSCM:
* - 'Name' : origin1
* - 'Name' : magic
* <p>
* Workflow
* - Create two repositories each containing a 'ready' branch.
* - The build is triggered.
* <p>
* Results
* - One Build. That should be successful.
*
* @throws Exception
*/
@Test
public void remoteOrigin1WithMoreThan1RepoShouldBeSuccessfulFirstRepo() throws Exception {
Repository repository = TestUtilsFactory.createValidRepository("test-repo");
Repository repository2 = TestUtilsFactory.createValidRepository("test-repo2");
List<UserRemoteConfig> config = Arrays.asList(new UserRemoteConfig("file://" + repository.getDirectory().getAbsolutePath(), "origin1", null, null), new UserRemoteConfig("file://" + repository2.getDirectory().getAbsolutePath(), "magic", null, null));
List<GitSCMExtension> gitSCMExtensions = new ArrayList<>();
gitSCMExtensions.add(new PruneStaleBranch());
gitSCMExtensions.add(new CleanCheckout());
GitSCM gitSCM = new GitSCM(config,
Collections.singletonList(new BranchSpec("*/ready/**")),
false, Collections.<SubmoduleConfig>emptyList(),
null, null, gitSCMExtensions);
FreeStyleProject project = TestUtilsFactory.configurePretestedIntegrationPlugin(jenkinsRule, TestUtilsFactory.STRATEGY_TYPE.ACCUMULATED, config, "origin1", true);
project.setScm(gitSCM);
TestUtilsFactory.triggerProject(project);
assertEquals(1, jenkinsRule.jenkins.getQueue().getItems().length);
jenkinsRule.waitUntilNoActivityUpTo(60000);
int nextBuildNumber = project.getNextBuildNumber();
FreeStyleBuild build = project.getBuildByNumber(nextBuildNumber - 1);
//Show the log for the latest build
String text = jenkinsRule.createWebClient().getPage(build, "console").asText();
System.out.println("=====BUILD-LOG=====");
System.out.println(text);
System.out.println("=====BUILD-LOG=====");
assertTrue(build.getResult().isWorseOrEqualTo(Result.SUCCESS));
TestUtilsFactory.destroyRepo(repository2, repository);
}
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:61,代码来源:GeneralBehaviourIT.java
示例18: remoteOrigin1WithMoreThan1RepoShouldBeSuccessfulSecondRepo
import hudson.plugins.git.UserRemoteConfig; //导入依赖的package包/类
/**
* Git Plugin
* <p>
* Test that we operate using a default configuration, with two repositories
* in a single Git Plugin configuration.
* <p>
* Pretested integration:
* - 'Integration branch' : master (default)
* - 'Repository name' : origin1
* - 'Strategy' : Accumulated commit
* <p>
* GitSCM:
* - 'Name' : magic
* - 'Name' : origin1
* <p>
* Workflow
* - Create two repositories each containing a 'ready' branch.
* - The build is triggered.
* <p>
* Results
* - One Build. That should be successful. We merge feature_1 from origin1 into
* master.
*
* @throws Exception
*/
@Test
public void remoteOrigin1WithMoreThan1RepoShouldBeSuccessfulSecondRepo() throws Exception {
Repository repository = TestUtilsFactory.createValidRepository("test-repo");
Repository repository2 = TestUtilsFactory.createValidRepository("test-repo2");
List<UserRemoteConfig> config = Arrays.asList(new UserRemoteConfig("file://" + repository.getDirectory().getAbsolutePath(), "magic", null, null), new UserRemoteConfig("file://" + repository2.getDirectory().getAbsolutePath(), "orgin1", null, null));
List<GitSCMExtension> gitSCMExtensions = new ArrayList<>();
gitSCMExtensions.add(new PruneStaleBranch());
gitSCMExtensions.add(new CleanCheckout());
GitSCM gitSCM = new GitSCM(config,
Collections.singletonList(new BranchSpec("*/ready/**")),
false, Collections.<SubmoduleConfig>emptyList(),
null, null, gitSCMExtensions);
FreeStyleProject project = TestUtilsFactory.configurePretestedIntegrationPlugin(jenkinsRule, TestUtilsFactory.STRATEGY_TYPE.ACCUMULATED, config, "origin1", true);
project.setScm(gitSCM);
TestUtilsFactory.triggerProject(project);
assertEquals(1, jenkinsRule.jenkins.getQueue().getItems().length);
jenkinsRule.waitUntilNoActivityUpTo(60000);
TestUtilsFactory.destroyRepo(repository, repository2);
int nextBuildNumber = project.getNextBuildNumber();
FreeStyleBuild build = project.getBuildByNumber(nextBuildNumber - 1);
//Show the log for the latest build
String text = jenkinsRule.createWebClient().getPage(build, "console").asText();
System.out.println("=====BUILD-LOG=====");
System.out.println(text);
System.out.println("=====BUILD-LOG=====");
assertTrue(build.getResult().isWorseOrEqualTo(Result.SUCCESS));
}
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:63,代码来源:GeneralBehaviourIT.java
示例19: remoteNoRepoSpecifiedWithMoreThan1RepoShouldNotBeSuccessful
import hudson.plugins.git.UserRemoteConfig; //导入依赖的package包/类
/**
* TODO: isn't this a copy of
* {@link #defaultGitConfigurationTwoRemotes1_NOT_BUILT_1_SUCCESS()}
* <p>
* Git Plugin
* <p>
* Test that we operate using a default configuration, with two repositories
* in a single Git Plugin configuration.
* <p>
* Pretested integration:
* - 'Integration branch' : master (default)
* - 'Repository name' : origin1
* - 'Strategy' : Accumulated commit
* <p>
* GitSCM:
* - 'Name' : (default)
* - 'Name' : (default)
* <p>
* Workflow
* - Create two repositories each containing a 'ready' branch.
* - The build is triggered.
* <p>
* Results
* - One Build. That should be successful. We merge feature_1 from origin1 into
* master.
*
* @throws Exception
*/
@Test
public void remoteNoRepoSpecifiedWithMoreThan1RepoShouldNotBeSuccessful() throws Exception {
Repository repository = TestUtilsFactory.createValidRepository("test-repo");
Repository repository2 = TestUtilsFactory.createValidRepository("test-repo2");
List<UserRemoteConfig> config = Arrays.asList(new UserRemoteConfig("file://" + repository.getDirectory().getAbsolutePath(), null, null, null), new UserRemoteConfig("file://" + repository2.getDirectory().getAbsolutePath(), null, null, null));
FreeStyleProject project = TestUtilsFactory.configurePretestedIntegrationPlugin(jenkinsRule, TestUtilsFactory.STRATEGY_TYPE.ACCUMULATED, config, null, true);
TestUtilsFactory.triggerProject(project);
jenkinsRule.waitUntilNoActivityUpTo(60000);
TestUtilsFactory.destroyRepo(repository2, repository);
//Show the log for the latest build
for (AbstractBuild<?, ?> b : project.getBuilds()) {
String text = jenkinsRule.createWebClient().getPage(b, "console").asText();
System.out.println("=====BUILD-LOG=====");
System.out.println(text);
System.out.println("=====BUILD-LOG=====");
if (text.contains("push origin :origin/ready/feature_1")) {
assertEquals("Unexpected build result.", Result.SUCCESS, b.getResult());
} else {
assertEquals("Unexpected build result.", Result.NOT_BUILT, b.getResult());
}
}
}
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:58,代码来源:GeneralBehaviourIT.java
示例20: testOriginAndEmptyInDualConfig
import hudson.plugins.git.UserRemoteConfig; //导入依赖的package包/类
/**
* Incorrect check of origin (repo) lead to wrongful merge attempt on
* unwanted remote, which was the auto generated remote origin1 by the git
* plugin.
*
* @throws Exception
*/
@Bug(25545)
@Test
public void testOriginAndEmptyInDualConfig() throws Exception {
Repository repository1 = TestUtilsFactory.createValidRepository("test-repo1");
Repository repository2 = TestUtilsFactory.createValidRepository("test-repo2");
FreeStyleProject project = TestUtilsFactory.configurePretestedIntegrationPlugin(jenkinsRule,
TestUtilsFactory.STRATEGY_TYPE.SQUASH,
Arrays.asList(new UserRemoteConfig(repository1.getDirectory().getAbsolutePath(), "origin", null, null),
new UserRemoteConfig(repository2.getDirectory().getAbsolutePath(), null, null, null)), null, true);
TestUtilsFactory.triggerProject(project);
jenkinsRule.waitUntilNoActivityUpTo(60000);
TestUtilsFactory.destroyRepo(repository1, repository2);
Iterator<FreeStyleBuild> bs = project.getBuilds().iterator();
while (bs.hasNext()) {
FreeStyleBuild build = bs.next();
String text = jenkinsRule.createWebClient().getPage(build, "console").asText();
System.out.println("=====BUILD-LOG=====");
System.out.println(text);
System.out.println("=====BUILD-LOG=====");
if (text.contains("push origin :origin/ready/feature_1")) {
assertEquals("Unexpected build result.", build.getResult(), Result.SUCCESS);
} else {
assertEquals("Unexpected build result.", build.getResult(), Result.NOT_BUILT);
}
}
}
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:40,代码来源:GeneralBehaviourIT.java
注:本文中的hudson.plugins.git.UserRemoteConfig类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论