Package com.aragost.javahg

Examples of com.aragost.javahg.Repository


        Assert.assertTrue(csets.isEmpty());
    }

    @Test
    public void testNonEmpty() throws IOException {
        Repository repo = getTestRepository();
        Repository repo2 = getTestRepository2();

        writeFile("a");
        Changeset cs = commit();

        List<Changeset> csets = OutgoingCommand.on(repo).execute(repo2);
View Full Code Here


public class LocateCommandTest extends AbstractTestCase {

    @Test
    public void test() throws IOException {
        Repository repo = getTestRepository();
        writeFile("a");
        writeFile("b");
        commit();
        List<File> files = LocateCommand.on(repo).execute();
        Assert.assertEquals(2, files.size());
View Full Code Here

        Assert.assertEquals("b", files.get(1).getName());
    }

    @Test
    public void testSingleRevision() throws IOException {
        Repository repo = getTestRepository();
        writeFile("a");
        commit();
        writeFile("b");
        commit();
        LocateCommand cmd = LocateCommand.on(repo).rev("0");
View Full Code Here

        Assert.assertEquals("a", files.get(0).getName());
    }

    @Test
    public void testPattern() throws IOException {
        Repository repo = getTestRepository();
        writeFile("a");
        writeFile("b");
        commit();
        deleteFile("a");
        commit();
View Full Code Here

     * Commit the changes in the test repository
     *
     * @throws IOException
     */
    public Changeset commit() throws IOException {
        Repository repo = getTestRepository();
        AddCommand.on(repo).execute();
        CommitCommand cmd = CommitCommand.on(repo).user("testcase").message("testcase: " + getClass().getName());
        return cmd.execute();
    }
View Full Code Here

public class IncomingCommandTest extends AbstractTestCase {

    @Test
    public void testEmpty() throws IOException {
        Repository repo = getTestRepository();
        Repository repo2 = getTestRepository2();

        Bundle bundle = IncomingCommand.on(repo).execute(repo2.getDirectory().getPath());
        Assert.assertNull(bundle);
    }
View Full Code Here

        Assert.assertNull(bundle);
    }

    @Test
    public void testNonEmpty() throws IOException {
        Repository repo = getTestRepository();
        Changeset cs0 = createChangeset();
        Changeset cs1 = createChangeset();

        Repository repo2 = getTestRepository2();

        Bundle bundle = IncomingCommand.on(repo2).execute(repo);
        List<Changeset> changesets = bundle.getChangesets();
        Assert.assertEquals(2, changesets.size());
        // The changesets are not the same objects, because one set is
View Full Code Here

        bundle.close();
    }
   
    @Test
    public void testHTTPIncoming() throws IOException {
        Repository repoA = getTestRepository();

        writeFile("x", "abc");

        AddCommand add = AddCommand.on(repoA);
        add.execute();

        CommitCommand commit = CommitCommand.on(repoA);
        commit.message("added x").user("user");
        commit.execute();

        ServeState serveState = startServing(repoA);
        try {
            int port = serveState.getPort();

            Repository repoB = getTestRepository2();
            Bundle b = IncomingCommand.on(repoB).execute("http://localhost:" + port);
            List<Changeset> changesets = b.getChangesets();
            Assert.assertEquals(1, changesets.size());
            Changeset cs = changesets.get(0);
            Assert.assertEquals("user", cs.getUser());
View Full Code Here

        deleteTempDir(dir);
    }

    @Test
    public void testStopWhileProducingOutput() throws IOException {
        Repository repo = getTestRepository();
        Server server = getFirstServer(repo);
        InputStream stdout = server.runCommand(Lists.newArrayList("version"), VersionCommand.on(repo));

        // Nothing is yet read from stdout, stop the server. You
        // should then get
        // an IOException reading from stdout.
        server.stop();
        try {
            stdout.read();
            Assert.fail("IOException expected");
        } catch (IOException e) {
            // success
        }

        server.start(repo.getDirectory(), null, empty, null, null);

        VersionCommand.on(repo).execute();
    }
View Full Code Here

        VersionCommand.on(repo).execute();
    }

    @Test
    public void testLock() throws IOException, InterruptedException {
        Repository repo = getTestRepository();
        TestableCommand command = new TestableCommand(repo, "version");

        // The command must produce output so that it wont finish
        // before we empty the stdout. That way we can keep two
        // commands running at the same time and trigger the
View Full Code Here

TOP

Related Classes of com.aragost.javahg.Repository

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.