Mercurial > hg > mercurial
view mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialUrlSupportTest.java @ 715:be86907926ae
new approach: remember hg sub-state file hash per commit,
dump hash -> file, and log with refs
author | eugene.petrenko@jetbrains.com |
---|---|
date | Mon, 13 Jan 2014 18:51:13 +0100 |
parents | fd0c1e91bd46 |
children | 31a1aca3305c |
line wrap: on
line source
package jetbrains.buildServer.buildTriggers.vcs.mercurial; import jetbrains.buildServer.BaseTestCase; import jetbrains.buildServer.vcs.Credentials; import jetbrains.buildServer.vcs.VcsException; import jetbrains.buildServer.vcs.VcsUrl; import junit.framework.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import java.util.Map; import static jetbrains.buildServer.buildTriggers.vcs.mercurial.MercurialSupportBuilder.mercurialSupport; import static junit.framework.Assert.*; @Test public class MercurialUrlSupportTest extends BaseMercurialTestCase { private MercurialUrlSupport myUrlSupport; @BeforeMethod @Override public void setUp() throws Exception { super.setUp(); ServerPluginConfig myPluginConfig = new ServerPluginConfigBuilder() .cachesDir(myTempFiles.createTempDir()) .build(); MercurialVcsSupport vcsSupport = mercurialSupport().withConfig(myPluginConfig).build(); myUrlSupport = new MercurialUrlSupport(vcsSupport); } public void maven_like_url() throws VcsException { VcsUrl url = new VcsUrl("scm:hg:http://host/v3", new Credentials("user1", "pass1")); Map<String, String> props = myUrlSupport.convertToVcsRootProperties(url); assertNotNull(props); assertEquals("http://host/v3", props.get(Constants.REPOSITORY_PROP)); assertEquals("user1", props.get(Constants.USERNAME)); assertEquals("pass1", props.get(Constants.PASSWORD)); } public void http_protocol_mercurial_repo() throws VcsException { VcsUrl url = new VcsUrl("http://hg.jetbrains.org/hg/mercurial/", new Credentials("user1", "pass1")); Map<String, String> props = myUrlSupport.convertToVcsRootProperties(url); assertNotNull(props); assertEquals("http://hg.jetbrains.org/hg/mercurial/", props.get(Constants.REPOSITORY_PROP)); assertEquals("user1", props.get(Constants.USERNAME)); assertEquals("pass1", props.get(Constants.PASSWORD)); } public void http_protocol_svn_repo() throws VcsException { VcsUrl url = new VcsUrl("http://svn.jetbrains.org/teamcity/plugins/xml-tests-reporting/trunk"); Map<String, String> props = myUrlSupport.convertToVcsRootProperties(url); assertNull(props); } }