Search in sources :

Example 51 with TestFor

use of jetbrains.buildServer.util.TestFor in project teamcity-git by JetBrains.

the class ServerPluginConfigTest method ssh_proxy_settings.

@TestFor(issues = "TW-26507")
public void ssh_proxy_settings() {
    final String sshProxyHost = "acme.org";
    final String sshProxyPort = "3128";
    final String sshProxyType = "http";
    System.setProperty("teamcity.git.sshProxyType", sshProxyType);
    System.setProperty("teamcity.git.sshProxyHost", sshProxyHost);
    System.setProperty("teamcity.git.sshProxyPort", sshProxyPort);
    ServerPluginConfig config = new PluginConfigImpl();
    Proxy sshProxy = config.getJschProxy();
    assertNotNull(sshProxy);
    assertTrue(sshProxy instanceof ProxyHTTP);
    List<String> separateProcessOptions = config.getOptionsForSeparateProcess();
    assertThat(separateProcessOptions, hasItem("-Dteamcity.git.sshProxyType=" + sshProxyType));
    assertThat(separateProcessOptions, hasItem("-Dteamcity.git.sshProxyHost=" + sshProxyHost));
    assertThat(separateProcessOptions, hasItem("-Dteamcity.git.sshProxyPort=" + sshProxyPort));
}
Also used : Proxy(com.jcraft.jsch.Proxy) ProxyHTTP(com.jcraft.jsch.ProxyHTTP) PluginConfigImpl(jetbrains.buildServer.buildTriggers.vcs.git.PluginConfigImpl) ServerPluginConfig(jetbrains.buildServer.buildTriggers.vcs.git.ServerPluginConfig) TestFor(jetbrains.buildServer.util.TestFor)

Example 52 with TestFor

use of jetbrains.buildServer.util.TestFor in project teamcity-git by JetBrains.

the class GitPatchTest method submodules_and_checkout_rules3.

@TestFor(issues = "TW-50097")
@Test(dataProvider = "patchInSeparateProcess")
public void submodules_and_checkout_rules3(boolean patchInSeparateProcess) throws Exception {
    myConfigBuilder.setSeparateProcessForPatch(patchInSeparateProcess);
    VcsRoot root = getRoot("sub-submodule", true);
    checkPatch(root, "submodules_and_checkout_rules3", null, "ce6044093939bb47283439d97a1c80f759669ff5", new CheckoutRules("-:first-level-submodule/sub-sub/file.txt"));
}
Also used : CheckoutRules(jetbrains.buildServer.vcs.CheckoutRules) VcsRoot(jetbrains.buildServer.vcs.VcsRoot) Test(org.testng.annotations.Test) TestFor(jetbrains.buildServer.util.TestFor)

Example 53 with TestFor

use of jetbrains.buildServer.util.TestFor in project teamcity-git by JetBrains.

the class GitPatchTest method submodules_and_checkout_rules.

@TestFor(issues = "TW-50097")
@Test(dataProvider = "patchInSeparateProcess")
public void submodules_and_checkout_rules(boolean patchInSeparateProcess) throws Exception {
    myConfigBuilder.setSeparateProcessForPatch(patchInSeparateProcess);
    VcsRoot root = getRoot("sub-submodule", true);
    checkPatch(root, "submodules_and_checkout_rules", null, "ce6044093939bb47283439d97a1c80f759669ff5", new CheckoutRules("+:first-level-submodule"));
}
Also used : CheckoutRules(jetbrains.buildServer.vcs.CheckoutRules) VcsRoot(jetbrains.buildServer.vcs.VcsRoot) Test(org.testng.annotations.Test) TestFor(jetbrains.buildServer.util.TestFor)

Example 54 with TestFor

use of jetbrains.buildServer.util.TestFor in project teamcity-git by JetBrains.

the class GitPatchTest method build_patch_should_respect_autocrlf.

@TestFor(issues = "TW-16530")
@Test(dataProvider = "patchInSeparateProcess")
public void build_patch_should_respect_autocrlf(boolean patchInSeparateProcess) throws Exception {
    myConfigBuilder.setSeparateProcessForPatch(patchInSeparateProcess);
    VcsRoot root = vcsRoot().withAutoCrlf(true).withFetchUrl(myMainRepositoryDir.getAbsolutePath()).build();
    setExpectedSeparator("\r\n");
    checkPatch(root, "patch-eol", null, "465ad9f630e451b9f2b782ffb09804c6a98c4bb9", new CheckoutRules("-:dir"));
    String content = new String(getSupport().getContentProvider().getContent("readme.txt", root, "465ad9f630e451b9f2b782ffb09804c6a98c4bb9"));
    assertEquals(content, "Test repository for teamcity.change 1\r\nadd feature\r\n");
}
Also used : CheckoutRules(jetbrains.buildServer.vcs.CheckoutRules) VcsRoot(jetbrains.buildServer.vcs.VcsRoot) Test(org.testng.annotations.Test) TestFor(jetbrains.buildServer.util.TestFor)

Example 55 with TestFor

use of jetbrains.buildServer.util.TestFor in project teamcity-git by JetBrains.

the class GitVcsSupportTest method test_non_fast_forward_update.

@TestFor(issues = "TW-16351")
@Test(dataProvider = "doFetchInSeparateProcess", dataProviderClass = FetchOptionsDataProvider.class)
public void test_non_fast_forward_update(boolean fetchInSeparateProcess) throws Exception {
    File remoteRepositoryDir = new File(myTmpDir, "repo_for_fetch");
    copyRepository(dataFile("repo_for_fetch.1"), remoteRepositoryDir);
    myConfigBuilder.setSeparateProcessForFetch(fetchInSeparateProcess);
    GitVcsSupport support = getSupport();
    VcsRoot root = getRoot("master", false, remoteRepositoryDir);
    RepositoryStateData state = support.getCurrentState(root);
    String v1 = GitUtils.versionRevision(state.getBranchRevisions().get(state.getDefaultBranchName()));
    assertEquals(v1, "add81050184d3c818560bdd8839f50024c188586");
    // fast-forward update
    copyRepository(dataFile("repo_for_fetch.2"), remoteRepositoryDir);
    state = support.getCurrentState(root);
    String v2 = GitUtils.versionRevision(state.getBranchRevisions().get(state.getDefaultBranchName()));
    assertEquals(v2, "d47dda159b27b9a8c4cee4ce98e4435eb5b17168");
    // non-fast-forward update
    copyRepository(dataFile("repo_for_fetch.3"), remoteRepositoryDir);
    state = support.getCurrentState(root);
    String v3 = GitUtils.versionRevision(state.getBranchRevisions().get(state.getDefaultBranchName()));
    assertEquals("bba7fbcc200b4968e6abd2f7d475dc15306cafc6", v3);
}
Also used : GitTestUtil.dataFile(jetbrains.buildServer.buildTriggers.vcs.git.tests.GitTestUtil.dataFile) FileUtil.writeFile(jetbrains.buildServer.util.FileUtil.writeFile) File(java.io.File) LockFile(org.eclipse.jgit.internal.storage.file.LockFile) Test(org.testng.annotations.Test) TestFor(jetbrains.buildServer.util.TestFor)

Aggregations

TestFor (jetbrains.buildServer.util.TestFor)129 Test (org.testng.annotations.Test)81 File (java.io.File)65 GitTestUtil.dataFile (jetbrains.buildServer.buildTriggers.vcs.git.tests.GitTestUtil.dataFile)56 VcsRootImpl (jetbrains.buildServer.vcs.impl.VcsRootImpl)26 CheckoutRules (jetbrains.buildServer.vcs.CheckoutRules)21 VcsRoot (jetbrains.buildServer.vcs.VcsRoot)17 SFinishedBuild (jetbrains.buildServer.serverSide.SFinishedBuild)12 VcsException (jetbrains.buildServer.vcs.VcsException)11 URIish (org.eclipse.jgit.transport.URIish)11 Repository (org.eclipse.jgit.lib.Repository)9 BaseFinderTest (jetbrains.buildServer.server.rest.data.BaseFinderTest)7 AfterMethod (org.testng.annotations.AfterMethod)7 BeforeMethod (org.testng.annotations.BeforeMethod)7 Method (java.lang.reflect.Method)6 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)6 GitTestUtil.copyRepository (jetbrains.buildServer.buildTriggers.vcs.git.tests.GitTestUtil.copyRepository)6 Build (jetbrains.buildServer.server.rest.model.build.Build)6 BuildTypeImpl (jetbrains.buildServer.serverSide.impl.BuildTypeImpl)6 FileUtil.writeFile (jetbrains.buildServer.util.FileUtil.writeFile)6