diff mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/VcsRootBuilder.java @ 356:53b430731041 remote-run/TW-19984

TW-19984 ensure map file cleaned as well
author Dmitry Neverov <dmitry.neverov@jetbrains.com>
date Fri, 27 Jan 2012 19:34:03 +0400
parents 33305b2022c2
children 24d926f22e85
line wrap: on
line diff
--- a/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/VcsRootBuilder.java	Fri Jan 27 15:27:49 2012 +0400
+++ b/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/VcsRootBuilder.java	Fri Jan 27 19:34:03 2012 +0400
@@ -1,7 +1,10 @@
 package jetbrains.buildServer.buildTriggers.vcs.mercurial;
 
+import jetbrains.buildServer.vcs.SVcsRoot;
 import jetbrains.buildServer.vcs.impl.VcsRootImpl;
 import org.jetbrains.annotations.NotNull;
+import org.jmock.Expectations;
+import org.jmock.Mockery;
 
 import java.io.IOException;
 
@@ -28,37 +31,53 @@
   }
 
 
-  public VcsRootBuilder repository(@NotNull String repository) {
+  public SVcsRoot build(Mockery context) {
+    final SVcsRoot root = context.mock(SVcsRoot.class, "SVcsRoot" + myRootId);
+    context.checking(new Expectations() {{
+      allowing(root).getVcsName(); will(returnValue(Constants.VCS_NAME));
+      allowing(root).getProperty(with(Constants.REPOSITORY_PROP)); will(returnValue(myRepository));
+      allowing(root).getProperty(with(Constants.HG_COMMAND_PATH_PROP)); will(returnValue(myHgPath));
+      allowing(root).getProperty(with(Constants.BRANCH_NAME_PROP)); will(returnValue(myBranch));
+      allowing(root).getProperty(with(Constants.SERVER_CLONE_PATH_PROP)); will(returnValue(null));
+      allowing(root).getProperty(with(Constants.USERNAME)); will(returnValue(myUsername));
+      allowing(root).getProperty(with(Constants.PASSWORD)); will(returnValue(myPassword));
+      allowing(root).getProperty(with(Constants.UNCOMPRESSED_TRANSFER)); will(returnValue(null));
+    }});
+    return root;
+  }
+
+
+  public VcsRootBuilder withUrl(@NotNull String repository) {
     myRepository = repository;
     return this;
   }
 
 
-  public VcsRootBuilder username(@NotNull String username) {
+  public VcsRootBuilder withUserName(@NotNull String username) {
     myUsername = username;
     return this;
   }
 
 
-  public VcsRootBuilder password(@NotNull String password) {
+  public VcsRootBuilder withPassword(@NotNull String password) {
     myPassword = password;
     return this;
   }
 
 
-  public VcsRootBuilder branch(@NotNull String branch) {
+  public VcsRootBuilder withBranch(@NotNull String branch) {
     myBranch = branch;
     return this;
   }
 
 
-  public VcsRootBuilder rootId(long rootId) {
+  public VcsRootBuilder withId(long rootId) {
     myRootId = rootId;
     return this;
   }
 
 
-  public VcsRootBuilder hgPath(String hgPath) {
+  public VcsRootBuilder withHgPath(String hgPath) {
     myHgPath = hgPath;
     return this;
   }