Package com.aragost.javahg

Examples of com.aragost.javahg.Repository


        BaseRepository repo = getTestRepository();
        BaseRepository repo2 = getTestRepository2();
        writeFile("a");
        commit();
        Bundle bundle = IncomingCommand.on(repo2).execute(repo);
        Repository repo3 = bundle.getOverlayRepository();
        Assert.assertSame(repo2.getServerPool(), repo3.getServerPool());
        ServerPool pool = repo2.getServerPool();
        Assert.assertEquals(1, pool.getServers().size());
        Assert.assertNotNull(pool.getServers().get(0).getProcess());
        repo2.close();
        Assert.assertNotNull(pool.getServers().get(0).getProcess());
View Full Code Here


    @Test
    public void testKillServerProcess() throws IOException {
        File dir = Files.createTempDir();
        RepositoryConfiguration repoConfig = new RepositoryConfiguration();
        repoConfig.addExtension(JavaHgTestExtension.class);
        Repository repo = Repository.create(repoConfig, dir);
        Process process = getFirstServer(repo).getProcess();
        process.destroy();
        // Process is dead and we can't send command
        try {
            VersionCommand cmd = VersionCommand.on(repo);
            cmd.execute();
            assertFailedExecution(cmd);
        } catch (UnexpectedServerTerminationException e) {
            // success
        }
        repo.close();

        repo = Repository.open(repoConfig, dir);
        String longStringThatDoesntFitInBuffers = Strings.repeat("x", 10 * 1000 * 1000);
        GenericCommand cmd = new GenericCommand(repo, "javahg-write");
        HgInputStream stream = cmd.launchStream("o", longStringThatDoesntFitInBuffers);
        boolean killed = killProcess(process);
        if (killed) {
            // Command is now sent, but we can't read output
            try {
                // String s =
                Utils.readStream(stream, repo.getServerPool().newDecoder());
                // TODO This doesn't work on Linux, why?
                // Assert.fail("Exception expected. Read " +
                // s.length() + " bytes");
            } catch (UnexpectedServerTerminationException e) {
                System.err.println("Exit value in testKillServerProcess: " + e.getExitValue());
                // success
            }
        }
        repo.close();

        deleteTempDir(dir);
    }
View Full Code Here

public class AddCommandTest extends AbstractTestCase {

    @Test
    public void test() throws IOException {
        Repository repo = getTestRepository();
        writeFile("a", "");
        new File(repo.getDirectory(), "dir").mkdir();
        writeFile("dir/a", "");
        writeFile("dir/b", "");

        List<File> files = AddCommand.on(repo).execute(new File("dir"));
        Assert.assertEquals(2, files.size());
View Full Code Here

        Assert.assertEquals(repoFile(repo, "dir", "b"), files.get(1));
    }

    @Test
    public void testAlreadyTracked() throws IOException {
        Repository repo = getTestRepository();
        writeFile("a", "");

        AddCommand addCommand = AddCommand.on(repo);
        addCommand.execute();
        addCommand.execute("a");
View Full Code Here

        Assert.assertEquals("", addCommand.getErrorString());
    }

    @Test
    public void testNoSuchFile() throws IOException {
        Repository repo = getTestRepository();

        AddCommand addCommand = AddCommand.on(repo);
        addCommand.execute("a");
        Assert.assertEquals("a: " + getMissingFileErrorText() + "\n", addCommand.getErrorString());
    }
View Full Code Here

public class TagsCommandTest extends AbstractTestCase {

    @Test
    public void test() throws IOException {
        Repository repo = getTestRepository();
        List<Changeset> changesets = createTags(repo);

        List<Tag> tags = TagsCommand.on(repo).execute();

        Collections.sort(tags);
View Full Code Here

        // list
    }

    @Test
    public void testReverse() throws IOException {
        Repository repo = getTestRepository();
        List<Changeset> changesets = createTags(repo);

        Map<Changeset, List<Tag>> map = TagsCommand.on(repo).executeReverse();

        Assert.assertEquals(3, map.size());
View Full Code Here

public class AbstractCommandTest extends AbstractTestCase {

    @Test
    public void testGetErrorStringTwice() throws IOException {
        Repository repo = getTestRepository();
        LogCommand cmd = LogCommand.on(repo).branch("no such branch");
        try {
            cmd.execute();
            assertFailedExecution(cmd);
        } catch (ExecutionException e) {
View Full Code Here

        }
    }

    @Test
    public void testUnknownCommand() {
        Repository repo = getTestRepository();
        HgVersion hgVersion = repo.getHgVersion();
        DummyTestCommand cmd = new DummyTestCommand(repo);

        try {
            cmd.execute();
            assertFailedExecution(cmd);
View Full Code Here

public class ResolveCommandTest extends AbstractTestCase {

    @Test
    public void test() throws IOException {
        Repository repo = getTestRepository();
        writeFile("a", "a");
        writeFile("b", "b");
        writeFile("c", "c");
        Changeset csBase = commit();
        writeFile("a", "A");
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.