Search in sources :

Example 11 with TeamCitySshKey

use of jetbrains.buildServer.ssh.TeamCitySshKey in project teamcity-git by JetBrains.

the class GitUrlSupportTest method scp_syntax_use_uploaded_key.

@Test
public void scp_syntax_use_uploaded_key() throws Exception {
    VcsUrl url = new VcsUrl("git@github.com:user/repo.git");
    myTestKeys.add(new TeamCitySshKey("key1", new byte[0], true));
    myTestKeys.add(new TeamCitySshKey("key2", new byte[0], false));
    // Mock vcsRoot = mock(SVcsRoot.class);
    // myProjectMock.expects(once()).method("createDummyVcsRoot").with(eq(Constants.VCS_NAME), mapContaining(VcsRootSshKeyManager.VCS_ROOT_TEAMCITY_SSH_KEY_NAME, "key2")).will(returnValue(vcsRoot.proxy()));
    myTestConnectionMocked = true;
    GitVcsRoot root = toGitRoot(url);
    assertEquals(AuthenticationMethod.TEAMCITY_SSH_KEY, root.getAuthSettings().getAuthMethod());
    assertEquals("key2", root.getAuthSettings().getTeamCitySshKeyId());
    assertEquals("git", root.getAuthSettings().toMap().get(Constants.USERNAME));
}
Also used : TeamCitySshKey(jetbrains.buildServer.ssh.TeamCitySshKey) Test(org.testng.annotations.Test)

Aggregations

TeamCitySshKey (jetbrains.buildServer.ssh.TeamCitySshKey)11 File (java.io.File)8 GitTestUtil.dataFile (jetbrains.buildServer.buildTriggers.vcs.git.tests.GitTestUtil.dataFile)7 Test (org.testng.annotations.Test)6 IOException (java.io.IOException)2 VcsException (jetbrains.buildServer.vcs.VcsException)2 VcsRoot (jetbrains.buildServer.vcs.VcsRoot)2 URIish (org.eclipse.jgit.transport.URIish)2 NotNull (org.jetbrains.annotations.NotNull)2 Nullable (org.jetbrains.annotations.Nullable)2 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)1 SystemInfo (com.intellij.openapi.util.SystemInfo)1 JSch (com.jcraft.jsch.JSch)1 Files (java.nio.file.Files)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Callable (java.util.concurrent.Callable)1 Collectors (java.util.stream.Collectors)1 BaseTestCase (jetbrains.buildServer.BaseTestCase)1