changeset 204:883f1efbcf27

Add clone,incoming and outging tests
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 26 Apr 2011 23:58:15 +0200
parents 66fd2c73c56f
children ffc5f6d59f7e
files build.xml src/org/tmatesoft/hg/core/HgCloneCommand.java test/org/tmatesoft/hg/test/Configuration.java test/org/tmatesoft/hg/test/TestClone.java test/org/tmatesoft/hg/test/TestIncoming.java test/org/tmatesoft/hg/test/TestOutgoing.java
diffstat 6 files changed, 15 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/build.xml	Tue Apr 26 15:52:33 2011 +0200
+++ b/build.xml	Tue Apr 26 23:58:15 2011 +0200
@@ -80,11 +80,15 @@
 			<formatter type="xml" />
 			<formatter type="plain" usefile="no" />
 			<sysproperty key="hg4j.tests.repos" value="${test-repos-root}"/>
+			<sysproperty key="hg4j.tests.remote" value="http://hg.serpentine.com/tutorial/hello"/>
 			<test name="org.tmatesoft.hg.test.TestHistory" />
 			<test name="org.tmatesoft.hg.test.TestManifest" />
 			<test name="org.tmatesoft.hg.test.TestStatus" />
 			<test name="org.tmatesoft.hg.test.TestStorePath" />
 			<test name="org.tmatesoft.hg.test.TestByteChannel" />
+			<test name="org.tmatesoft.hg.test.TestClone" />
+			<test name="org.tmatesoft.hg.test.TestIncoming" />
+			<test name="org.tmatesoft.hg.test.TestOutgoing" />
 		</junit>
 	</target>
 
--- a/src/org/tmatesoft/hg/core/HgCloneCommand.java	Tue Apr 26 15:52:33 2011 +0200
+++ b/src/org/tmatesoft/hg/core/HgCloneCommand.java	Tue Apr 26 23:58:15 2011 +0200
@@ -56,6 +56,11 @@
 	public HgCloneCommand() {
 	}
 	
+	/**
+	 * @param folder location to become root of the repository (i.e. where <em>.hg</em> folder would reside). Either 
+	 * shall not exist or be empty otherwise. 
+	 * @return <code>this</code> for convenience
+	 */
 	public HgCloneCommand destination(File folder) {
 		destination = folder;
 		return this;
--- a/test/org/tmatesoft/hg/test/Configuration.java	Tue Apr 26 15:52:33 2011 +0200
+++ b/test/org/tmatesoft/hg/test/Configuration.java	Tue Apr 26 23:58:15 2011 +0200
@@ -21,7 +21,6 @@
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.List;
 
 import org.tmatesoft.hg.repo.HgLookup;
@@ -81,7 +80,9 @@
 
 	public List<HgRemoteRepository> allRemote() throws Exception {
 		if (remoteServers == null) {
-			remoteServers = Collections.singletonList("hg4j-gc"); // just a default
+			String rr = System.getProperty("hg4j.tests.remote");
+			assertNotNull("System property hg4j.tests.remote is undefined", rr);
+			remoteServers = Arrays.asList(rr.split(" "));
 		}
 		ArrayList<HgRemoteRepository> rv = new ArrayList<HgRemoteRepository>(remoteServers.size());
 		for (String key : remoteServers) {
--- a/test/org/tmatesoft/hg/test/TestClone.java	Tue Apr 26 15:52:33 2011 +0200
+++ b/test/org/tmatesoft/hg/test/TestClone.java	Tue Apr 26 23:58:15 2011 +0200
@@ -24,6 +24,7 @@
 
 import org.hamcrest.CoreMatchers;
 import org.junit.Rule;
+import org.junit.Test;
 import org.tmatesoft.hg.core.HgCloneCommand;
 import org.tmatesoft.hg.repo.HgRemoteRepository;
 
@@ -46,6 +47,7 @@
 	public TestClone() {
 	}
 	
+	@Test
 	public void testSimpleClone() throws Exception {
 		int x = 0;
 		final File tempDir = Configuration.get().getTempDir();
--- a/test/org/tmatesoft/hg/test/TestIncoming.java	Tue Apr 26 15:52:33 2011 +0200
+++ b/test/org/tmatesoft/hg/test/TestIncoming.java	Tue Apr 26 23:58:15 2011 +0200
@@ -70,7 +70,7 @@
 			// hg pull total/2
 			// hg in, hg4j in, compare
 			List<Nodeid> incoming = runAndCompareIncoming(localRepo, hgRemote);
-			Assert.assertTrue("Need remote repository of reasonable size to test incoming command for partially filled case", incoming.size() > 5);
+			Assert.assertTrue("Need remote repository of reasonable size to test incoming command for partially filled case", incoming.size() >= 5);
 			//
 			Nodeid median = incoming.get(incoming.size() / 2); 
 			System.out.println("About to pull up to revision " + median.shortNotation());
--- a/test/org/tmatesoft/hg/test/TestOutgoing.java	Tue Apr 26 15:52:33 2011 +0200
+++ b/test/org/tmatesoft/hg/test/TestOutgoing.java	Tue Apr 26 23:58:15 2011 +0200
@@ -48,7 +48,6 @@
 	}
 
 	public TestOutgoing() {
-		Configuration.get().remoteServers("http://localhost:8000/");
 	}
 
 	@Test