private void setConfig(final String sectionAndKey, String value) { command(ConfigOp.class).setAction(ConfigAction.CONFIG_SET).setScope(ConfigScope.LOCAL) .setName(sectionAndKey).setValue(value).call(); } }
private void setConfig(Repository clone, String name, String value) { clone.command(ConfigOp.class)// .setAction(ConfigAction.CONFIG_SET)// .setScope(ConfigScope.LOCAL)// .setName(name)// .setValue(value).call(); }
@Override protected void setUpInternal() throws Exception { System.err.println(testName.getMethodName()); // These values should be used during a commit to set author/committer // TODO: author/committer roles need to be defined better, but for // now they are the same thing. repo.command(ConfigOp.class).setAction(ConfigAction.CONFIG_SET).setName("user.name") .setValue(COMMITTER_NAME).call(); repo.command(ConfigOp.class).setAction(ConfigAction.CONFIG_SET).setName("user.email") .setValue(COMMITTER_EMAIL).call(); }
public TestData config(String key, String value) { repo.command(ConfigOp.class).setAction(ConfigAction.CONFIG_SET).setName(key).setValue(value) .call(); return this; }
@Override protected void setUpInternal() throws Exception { // These values should be used during a commit to set author/committer // TODO: author/committer roles need to be defined better, but for // now they are the same thing. repo.command(ConfigOp.class).setAction(ConfigAction.CONFIG_SET).setName("user.name") .setValue("groldan").call(); repo.command(ConfigOp.class).setAction(ConfigAction.CONFIG_SET).setName("user.email") .setValue("groldan@boundlessgeo.com").call(); }
@Override protected void setUpInternal() throws Exception { repo.command(ConfigOp.class).setAction(ConfigAction.CONFIG_SET).setName("user.name") .setValue("groldan").call(); repo.command(ConfigOp.class).setAction(ConfigAction.CONFIG_SET).setName("user.email") .setValue("groldan@boundlessgeo.com").call(); }
@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(); }
@Override protected void setUpInternal() throws Exception { // These values should be used during a commit to set author/committer // TODO: author/committer roles need to be defined better, but for // now they are the same thing. repo.command(ConfigOp.class).setAction(ConfigAction.CONFIG_SET).setName("user.name") .setValue("groldan").call(); repo.command(ConfigOp.class).setAction(ConfigAction.CONFIG_SET).setName("user.email") .setValue("groldan@boundlessgeo.com").call(); database = geogig.getRepository().graphDatabase(); }
@Test public void testInvalidSectionKey() { final ConfigOp config = geogig.command(ConfigOp.class); Optional<Map<String, String>> result = config.setScope(ConfigScope.GLOBAL) .setAction(ConfigAction.CONFIG_GET).setName("doesnt.exist").setValue(null).call(); assertFalse(result.isPresent()); }
@Test public void testInvalidSectionKey() { final ConfigOp config = geogig.command(ConfigOp.class); Optional<Map<String, String>> result = config.setScope(ConfigScope.GLOBAL) .setAction(ConfigAction.CONFIG_GET).setName("doesnt.exist").setValue(null).call(); assertFalse(result.isPresent()); }
@Test public void testEmptyNameForRemoveSection() { final ConfigOp config = geogig.command(ConfigOp.class); exception.expect(ConfigException.class); config.setScope(ConfigScope.GLOBAL).setAction(ConfigAction.CONFIG_REMOVE_SECTION) .setName("").call(); }
@Test public void testEmptyNameAndValueForSet() { final ConfigOp config = geogig.command(ConfigOp.class); exception.expect(ConfigException.class); config.setScope(ConfigScope.GLOBAL).setAction(ConfigAction.CONFIG_SET).setName("") .setValue("").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(); }
@Test public void testNoNameForUnset() { final ConfigOp config = geogig.command(ConfigOp.class); exception.expect(ConfigException.class); config.setScope(ConfigScope.GLOBAL).setAction(ConfigAction.CONFIG_UNSET).setName(null) .setValue(null).call(); }
@Test public void testRemovingMissingSection() { final ConfigOp config = geogig.command(ConfigOp.class); exception.expect(ConfigException.class); config.setScope(ConfigScope.GLOBAL).setAction(ConfigAction.CONFIG_REMOVE_SECTION) .setName("unusedsectionname").setValue(null).call(); }
@Test public void testEmptyNameAndValueForGet() { final ConfigOp config = geogig.command(ConfigOp.class); exception.expect(ConfigException.class); config.setScope(ConfigScope.GLOBAL).setAction(ConfigAction.CONFIG_GET).setName("") .setValue("").call(); }
@Test public void testEmptyNameForUnset() { final ConfigOp config = geogig.command(ConfigOp.class); exception.expect(ConfigException.class); config.setScope(ConfigScope.GLOBAL).setAction(ConfigAction.CONFIG_UNSET).setName("") .setValue(null).call(); }
@Test public void testEmptyNameAndValueForGet() { final ConfigOp config = geogig.command(ConfigOp.class); exception.expect(ConfigException.class); config.setScope(ConfigScope.GLOBAL).setAction(ConfigAction.CONFIG_GET).setName("") .setValue("").call(); }
@Test public void testNoUserNameForResolveCommiter() throws Exception { insertAndAdd(points1); RevCommit c1 = geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); repo.command(ConfigOp.class).setAction(ConfigAction.CONFIG_SET).setName("user.name") .setValue(null).call(); exception.expect(IllegalStateException.class); geogig.command(RevertOp.class).addCommit(c1.getId()).call(); }
@Test public void testNoUserEmailForResolveCommiterEmail() throws Exception { insertAndAdd(points1); RevCommit c1 = geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); repo.command(ConfigOp.class).setAction(ConfigAction.CONFIG_SET).setName("user.email") .setValue(null).call(); exception.expect(IllegalStateException.class); geogig.command(RevertOp.class).addCommit(c1.getId()).call(); }