Package org.locationtech.geogig.api.porcelain

Examples of org.locationtech.geogig.api.porcelain.ConfigOp


        assertEquals(remoteName, remote.getName());
        assertEquals(remoteURL, remote.getFetchURL());
        assertEquals(remoteURL, remote.getPushURL());
        assertEquals("+refs/heads/*:refs/remotes/" + remoteName + "/*", remote.getFetch());

        final ConfigOp config = geogig.command(ConfigOp.class);
        config.setAction(ConfigAction.CONFIG_UNSET).setName("remote." + remoteName + ".url").call();

        final RemoteListOp remoteList = geogig.command(RemoteListOp.class);

        ImmutableList<Remote> allRemotes = remoteList.call();

View Full Code Here


        assertEquals(remoteName, remote.getName());
        assertEquals(remoteURL, remote.getFetchURL());
        assertEquals(remoteURL, remote.getPushURL());
        assertEquals("+refs/heads/*:refs/remotes/" + remoteName + "/*", remote.getFetch());

        final ConfigOp config = geogig.command(ConfigOp.class);
        config.setAction(ConfigAction.CONFIG_UNSET).setName("remote." + remoteName + ".fetch")
                .call();

        final RemoteListOp remoteList = geogig.command(RemoteListOp.class);

        ImmutableList<Remote> allRemotes = remoteList.call();
View Full Code Here

        assertEquals(remoteName, remote.getName());
        assertEquals(remoteURL, remote.getFetchURL());
        assertEquals(remoteURL, remote.getPushURL());
        assertEquals("+refs/heads/*:refs/remotes/" + remoteName + "/*", remote.getFetch());

        final ConfigOp config = geogig.command(ConfigOp.class);
        config.setAction(ConfigAction.CONFIG_UNSET).setName("remote." + remoteName + ".url").call();

        final RemoteRemoveOp remoteRemove = geogig.command(RemoteRemoveOp.class);

        Remote deletedRemote = remoteRemove.setName(remoteName).call();

View Full Code Here

        assertEquals(remoteName, remote.getName());
        assertEquals(remoteURL, remote.getFetchURL());
        assertEquals(remoteURL, remote.getPushURL());
        assertEquals("+refs/heads/*:refs/remotes/" + remoteName + "/*", remote.getFetch());

        final ConfigOp config = geogig.command(ConfigOp.class);
        config.setAction(ConfigAction.CONFIG_UNSET).setName("remote." + remoteName + ".fetch")
                .call();

        final RemoteRemoveOp remoteRemove = geogig.command(RemoteRemoveOp.class);

        Remote deletedRemote = remoteRemove.setName(remoteName).call();
View Full Code Here

    @After
    public final void tearDownInternal() {
    }

    private void test(ConfigOp.ConfigScope scope) {
        final ConfigOp config = geogig.command(ConfigOp.class);
        config.setScope(scope);

        config.setAction(ConfigAction.CONFIG_SET).setName("section.string").setValue("1").call();

        Map<String, String> result = config.setAction(ConfigAction.CONFIG_GET)
                .setName("section.string").setValue(null).call().or(new HashMap<String, String>());
        assertEquals("1", result.get("section.string"));

        // Test overwriting a value that already exists
        config.setAction(ConfigAction.CONFIG_SET).setName("section.string").setValue("2").call();

        result = config.setAction(ConfigAction.CONFIG_GET).setName("section.string").setValue(null)
                .call().or(new HashMap<String, String>());
        assertEquals("2", result.get("section.string"));

        // Test unsetting a value that exists
        config.setAction(ConfigAction.CONFIG_UNSET).setName("section.string").setValue(null).call();
        result = config.setAction(ConfigAction.CONFIG_GET).setName("section.string").setValue(null)
                .call().or(new HashMap<String, String>());
        assertNull(result.get("section.string"));

        // Test unsetting a value that doesn't exist
        config.setAction(ConfigAction.CONFIG_UNSET).setName("section.string").setValue(null).call();
        result = config.setAction(ConfigAction.CONFIG_GET).setName("section.string").setValue(null)
                .call().or(new HashMap<String, String>());
        assertNull(result.get("section.string"));

        // Test removing a section that exists
        config.setAction(ConfigAction.CONFIG_SET).setName("section.string").setValue("1").call();
        config.setAction(ConfigAction.CONFIG_SET).setName("section.string2").setValue("2").call();
        config.setAction(ConfigAction.CONFIG_REMOVE_SECTION).setName("section").setValue(null)
                .call();

        result = config.setAction(ConfigAction.CONFIG_GET).setName("section.string").setValue(null)
                .call().or(new HashMap<String, String>());
        assertNull(result.get("section.string"));
        result = config.setAction(ConfigAction.CONFIG_GET).setName("section.string2")
                .setValue(null).call().or(new HashMap<String, String>());
        assertNull(result.get("section.string2"));

        // Try listing the config file
        config.setAction(ConfigAction.CONFIG_SET).setName("section.string").setValue("1").call();
        config.setAction(ConfigAction.CONFIG_SET).setName("section.string2").setValue("2").call();

        result = config.setAction(ConfigAction.CONFIG_LIST).call()
                .or(new HashMap<String, String>());
        assertEquals("1", result.get("section.string"));
        assertEquals("2", result.get("section.string2"));
    }
View Full Code Here

    @Test
    public void testListDefaultWithNoLocalRepository() {
        ConfigDatabase database = mock(ConfigDatabase.class);
        when(database.getAll()).thenThrow(new ConfigException(StatusCode.INVALID_LOCATION));
        ConfigOp config = new ConfigOp(database);

        config.setScope(ConfigScope.DEFAULT).setAction(ConfigAction.CONFIG_LIST).setName(null)
                .setValue(null).call();
    }
View Full Code Here

    @Test
    public void testGetDefaultWithNoLocalRepository() {
        ConfigDatabase database = mock(ConfigDatabase.class);
        when(database.get(anyString())).thenThrow(new ConfigException(StatusCode.INVALID_LOCATION));
        when(database.getGlobal(anyString())).thenReturn(Optional.of("value"));
        ConfigOp config = new ConfigOp(database);

        config.setScope(ConfigScope.DEFAULT).setAction(ConfigAction.CONFIG_GET)
                .setName("section.key").setValue(null).call();
    }
View Full Code Here

    @Test
    public void testListLocalWithNoLocalRepository() {
        ConfigDatabase database = mock(ConfigDatabase.class);
        when(database.getAll()).thenThrow(new ConfigException(StatusCode.INVALID_LOCATION));
        ConfigOp config = new ConfigOp(database);

        exception.expect(ConfigException.class);

        config.setScope(ConfigScope.LOCAL).setAction(ConfigAction.CONFIG_LIST).setName(null)
                .setValue(null).call();
    }
View Full Code Here

    @Test
    public void testGetLocalWithNoLocalRepository() {
        ConfigDatabase database = mock(ConfigDatabase.class);
        when(database.get(anyString())).thenThrow(new ConfigException(StatusCode.INVALID_LOCATION));
        ConfigOp config = new ConfigOp(database);

        exception.expect(ConfigException.class);
        config.setScope(ConfigScope.LOCAL).setAction(ConfigAction.CONFIG_GET)
                .setName("section.key").setValue(null).call();
    }
View Full Code Here

                .setName("section.key").setValue(null).call();
    }

    @Test
    public void testNullNameValuePairForGet() {
        final ConfigOp config = geogig.command(ConfigOp.class);

        exception.expect(ConfigException.class);
        config.setScope(ConfigScope.GLOBAL).setAction(ConfigAction.CONFIG_GET).setName(null)
                .setValue(null).call();
    }
View Full Code Here

TOP

Related Classes of org.locationtech.geogig.api.porcelain.ConfigOp

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.