Search in sources :

Example 56 with VcsRoot

use of jetbrains.buildServer.vcs.VcsRoot in project teamcity-git by JetBrains.

the class AutoCheckoutTest method client_found_by_path_from_environment.

public void client_found_by_path_from_environment() throws IOException, VcsException {
    myVcsSupport = vcsSupportWithRealGit();
    VcsRoot vcsRoot = vcsRootWithAgentGitPath(null);
    AgentRunningBuild build = runningBuild().sharedEnvVariable(Constants.TEAMCITY_AGENT_GIT_PATH, getGitPath()).addRoot(vcsRoot).withAgentConfiguration(myAgentConfiguration).build();
    verifyCanCheckout(vcsRoot, CheckoutRules.DEFAULT, build);
}
Also used : AgentRunningBuild(jetbrains.buildServer.agent.AgentRunningBuild) VcsRoot(jetbrains.buildServer.vcs.VcsRoot)

Example 57 with VcsRoot

use of jetbrains.buildServer.vcs.VcsRoot in project teamcity-git by JetBrains.

the class AuthSettingsTest method should_take_username_from_URL_into_account.

@TestFor(issues = "TW-27506")
public void should_take_username_from_URL_into_account() throws URISyntaxException {
    String user = "usr";
    String url = "http://" + user + "@acme.org/repository.git";
    VcsRoot root = vcsRoot().withFetchUrl(url).withAuthMethod(AuthenticationMethod.PASSWORD).withPassword("pwd").build();
    CredentialsProvider c = new AuthCredentialsProvider(new AuthSettingsImpl(root, new URIishHelperImpl()));
    CredentialItem.Username username = new CredentialItem.Username();
    c.get(new URIish(url), username, new CredentialItem.Password());
    assertEquals(user, username.getValue());
}
Also used : URIish(org.eclipse.jgit.transport.URIish) CredentialItem(org.eclipse.jgit.transport.CredentialItem) VcsRoot(jetbrains.buildServer.vcs.VcsRoot) CredentialsProvider(org.eclipse.jgit.transport.CredentialsProvider) TestFor(jetbrains.buildServer.util.TestFor)

Example 58 with VcsRoot

use of jetbrains.buildServer.vcs.VcsRoot in project teamcity-git by JetBrains.

the class AuthSettingsTest method should_not_fail_when_password_is_empty.

@TestFor(issues = { "TW-24499", "TW-30655" })
public void should_not_fail_when_password_is_empty() throws Exception {
    VcsRoot root = vcsRoot().withFetchUrl("http://some.org/repository").withAuthMethod(AuthenticationMethod.PASSWORD).withUsername("user").build();
    CredentialsProvider c = new AuthCredentialsProvider(new AuthSettingsImpl(root, new URIishHelperImpl()));
    assertFalse(c.supports(new CredentialItem.Username(), new CredentialItem.Password()));
    c.get(new URIish("http://some.org/repository"), new CredentialItem.Username(), new CredentialItem.Password());
}
Also used : URIish(org.eclipse.jgit.transport.URIish) CredentialItem(org.eclipse.jgit.transport.CredentialItem) VcsRoot(jetbrains.buildServer.vcs.VcsRoot) CredentialsProvider(org.eclipse.jgit.transport.CredentialsProvider) TestFor(jetbrains.buildServer.util.TestFor)

Example 59 with VcsRoot

use of jetbrains.buildServer.vcs.VcsRoot in project teamcity-git by JetBrains.

the class AuthSettingsTest method should_take_username_in_URL_into_account2.

@TestFor(issues = "TW-27226")
public void should_take_username_in_URL_into_account2() {
    VcsRoot root = vcsRoot().withFetchUrl("git@github.com:name/repo.git").withAuthMethod(AuthenticationMethod.PRIVATE_KEY_DEFAULT).build();
    assertEquals("git", new AuthSettingsImpl(root, new URIishHelperImpl()).getUserName());
}
Also used : VcsRoot(jetbrains.buildServer.vcs.VcsRoot) TestFor(jetbrains.buildServer.util.TestFor)

Aggregations

VcsRoot (jetbrains.buildServer.vcs.VcsRoot)59 CheckoutRules (jetbrains.buildServer.vcs.CheckoutRules)25 TestFor (jetbrains.buildServer.util.TestFor)17 Test (org.testng.annotations.Test)16 GitVcsSupport (jetbrains.buildServer.buildTriggers.vcs.git.GitVcsSupport)15 AgentCheckoutAbility (jetbrains.buildServer.agent.vcs.AgentCheckoutAbility)10 AgentRunningBuild (jetbrains.buildServer.agent.AgentRunningBuild)9 File (java.io.File)8 VcsException (jetbrains.buildServer.vcs.VcsException)8 URIish (org.eclipse.jgit.transport.URIish)5 RevWalk (org.eclipse.jgit.revwalk.RevWalk)3 CredentialsProvider (org.eclipse.jgit.transport.CredentialsProvider)3 NotNull (org.jetbrains.annotations.NotNull)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 GitVersion (jetbrains.buildServer.buildTriggers.vcs.git.GitVersion)2 GitExec (jetbrains.buildServer.buildTriggers.vcs.git.command.GitExec)2 GitTestUtil.dataFile (jetbrains.buildServer.buildTriggers.vcs.git.tests.GitTestUtil.dataFile)2 TeamCitySshKey (jetbrains.buildServer.ssh.TeamCitySshKey)2 BulkPatchBuilder (jetbrains.buildServer.vcs.BulkPatchService.BulkPatchBuilder)2 RepositoryStateData (jetbrains.buildServer.vcs.RepositoryStateData)2