Package com.aragost.javahg

Examples of com.aragost.javahg.BaseRepository


public class JavaHgTestMercurialExtensionTest extends AbstractTestCase {

    @Test
    public void testAbort() throws IOException {
        BaseRepository repo = getTestRepository();
        GenericCommand cmd = new GenericCommand(repo, "javahg-abort");
        try {
            cmd.execute();
            assertFailedExecution(cmd);
        } catch (ExecutionException e) {
View Full Code Here


        // See comment in Server#checkStderr()
        // Without that available call in checkStderr typically not
        // everything from stderr will be read and this testcase fails
        // Assume.assumeTrue(System.getProperty("java.runtime.version").compareTo("1.7")
        // < 0);
        BaseRepository repo = getTestRepository();
        RepositoryConfiguration configuration = repo.getConfiguration();
        int bufSize = configuration.getStderrBufferSize();
        String longMessage = Strings.repeat("x", bufSize + 100) + "A";
        GenericCommand cmd = new GenericCommand(repo, "javahg-stderr");
        try {
            cmd.execute(longMessage);
View Full Code Here

    private volatile boolean inPush = false;

    @Test
    public void testLock() throws InterruptedException {
        final BaseRepository repo = getTestRepository2();
        GenericCommand lockCmd = new GenericCommand(repo, "javahg-lock");
        GenericCommand unlockCmd = new GenericCommand(repo, "javahg-unlock");
        lockCmd.execute();

        Thread thread = new Thread("otherrepo") {
            public void run() {
                try {
                    JavaHgMercurialExtensionTest.this.inPush = true;
                    BaseRepository other = getTestRepository();
                    createChangeset();
                    PushCommand.on(other).execute(repo.getDirectory().getAbsolutePath());
                    JavaHgMercurialExtensionTest.this.inPush = false;
                } catch (IOException e) {
                    throw new RuntimeIOException(e);
View Full Code Here

public class RollbackCommandTest extends AbstractTestCase {

    @Test
    public void test() throws IOException {
        BaseRepository repo = getTestRepository();
        Changeset cs1 = createChangeset();
        createChangeset();
        Changeset newTip = RollbackCommand.on(repo).execute();
        Assert.assertSame(cs1, newTip);
        Assert.assertEquals(1, repo.workingCopy().status().getModified().size());
        // The following commit might fail, see mercurial issue 3261
        // TODO How to handle cases like this?
        //createChangeset();
    }
View Full Code Here

import org.junit.Test;

public class PhaseCommandTest extends AbstractTestCase {

    private boolean isPhasesSupported() {
        BaseRepository repo = getTestRepository();
        try {
            PhaseCommand.on(repo).rev(Changeset.NULL_ID).execute();
            return true;
        } catch (UnknownCommandException e) {
            return false;
View Full Code Here

    }

    @Test
    public void test() throws IOException {
        Assume.assumeTrue(isPhasesSupported());
        BaseRepository repo = getTestRepository();
        Changeset cs1 = createChangeset();
        Changeset cs2 = createChangeset();
        Assert.assertEquals(DRAFT, cs1.phase());
        Assert.assertEquals(DRAFT, cs2.phase());
        PhaseCommand cmd = PhaseCommand.on(repo).pub().rev(cs2.getNode());
View Full Code Here

    }

    @Test
    public void testPhaseMakesNoChanges() throws IOException {
        Assume.assumeTrue(isPhasesSupported());
        BaseRepository repo = getTestRepository();
        Changeset cs = createChangeset();
        PhaseCommand cmd = PhaseCommand.on(repo).draft().rev(cs.getNode());
        Assert.assertFalse(cmd.execute());
    }
View Full Code Here

public class JavaHgTestMercurialExtensionTest extends AbstractTestCase {

    @Test
    public void testAbort() throws IOException {
        BaseRepository repo = getTestRepository();
        GenericCommand cmd = new GenericCommand(repo, "javahg-abort");
        try {
            cmd.execute();
            assertFailedExecution(cmd);
        } catch (ExecutionException e) {
View Full Code Here

        // See comment in Server#checkStderr()
        // Without that available call in checkStderr typically not
        // everything from stderr will be read and this testcase fails
        // Assume.assumeTrue(System.getProperty("java.runtime.version").compareTo("1.7")
        // < 0);
        BaseRepository repo = getTestRepository();
        RepositoryConfiguration configuration = repo.getConfiguration();
        int bufSize = configuration.getStderrBufferSize();
        String longMessage = Strings.repeat("x", bufSize + 100) + "A";
        GenericCommand cmd = new GenericCommand(repo, "javahg-stderr");
        try {
            cmd.execute(longMessage);
View Full Code Here

        command.executeToStream();
    }

    @Test
    public void testServerRefCount() throws IOException {
        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());
        Server server = pool.getServers().get(0);
        bundle.close();
        Assert.assertNull(server.getProcess());
        Assert.assertTrue(pool.getServers().isEmpty());
View Full Code Here

TOP

Related Classes of com.aragost.javahg.BaseRepository

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.