use of com.google.gerrit.server.config.PluginConfig in project gerrit by GerritCodeReview.
the class ProjectCacheIT method pluginConfig_cachedValueEqualsConfigValue.
@Test
public void pluginConfig_cachedValueEqualsConfigValue() throws Exception {
GroupReference group = GroupReference.create(AccountGroup.uuid("uuid"), "local-group-name");
try (AbstractDaemonTest.ProjectConfigUpdate u = updateProject(project)) {
u.getConfig().updatePluginConfig("important-plugin", cfg -> {
cfg.setGroupReference("group-config-name", group);
cfg.setString("key", "my-plugin-value");
});
u.save();
}
PluginConfig pluginConfig = projectCache.get(project).get().getPluginConfig("important-plugin");
assertThat(pluginConfig.getString("key")).isEqualTo("my-plugin-value");
assertThat(pluginConfig.getGroupReference("group-config-name")).isPresent();
assertThat(pluginConfig.getGroupReference("group-config-name")).hasValue(group);
}
use of com.google.gerrit.server.config.PluginConfig in project gerrit by GerritCodeReview.
the class ProjectCacheIT method pluginConfig_inheritedCachedValueEqualsConfigValue.
@Test
public void pluginConfig_inheritedCachedValueEqualsConfigValue() throws Exception {
GroupReference group = GroupReference.create(AccountGroup.uuid("uuid"), "local-group-name");
try (AbstractDaemonTest.ProjectConfigUpdate u = updateProject(allProjects)) {
u.getConfig().updatePluginConfig("important-plugin", cfg -> {
cfg.setGroupReference("group-config-name", group);
cfg.setString("key", "my-plugin-value");
});
u.save();
}
PluginConfig pluginConfig = pluginConfigFactory.getFromProjectConfigWithInheritance(project, "important-plugin");
assertThat(pluginConfig.getString("key")).isEqualTo("my-plugin-value");
assertThat(pluginConfig.getGroupReference("group-config-name")).isPresent();
assertThat(pluginConfig.getGroupReference("group-config-name")).hasValue(group);
}
use of com.google.gerrit.server.config.PluginConfig in project gerrit by GerritCodeReview.
the class ProjectConfigTest method readPluginConfigGroupReference.
@Test
public void readPluginConfigGroupReference() throws Exception {
RevCommit rev = tr.commit().add("groups", group(developers)).add("project.config", "[plugin \"somePlugin\"]\nkey1 = " + developers.toConfigValue()).create();
update(rev);
ProjectConfig cfg = read(rev);
PluginConfig pluginCfg = cfg.getPluginConfig("somePlugin");
assertThat(pluginCfg.getNames()).hasSize(1);
assertThat(pluginCfg.getGroupReference("key1").get()).isEqualTo(developers);
}
use of com.google.gerrit.server.config.PluginConfig in project gerrit by GerritCodeReview.
the class ProjectConfigTest method readExistingPluginConfig.
@Test
public void readExistingPluginConfig() throws Exception {
RevCommit rev = tr.commit().add("project.config", "[plugin \"somePlugin\"]\n" + " key1 = value1\n" + " key2 = value2a\n" + " key2 = value2b\n").create();
update(rev);
ProjectConfig cfg = read(rev);
PluginConfig pluginCfg = cfg.getPluginConfig("somePlugin");
assertThat(pluginCfg.getNames()).hasSize(2);
assertThat(pluginCfg.getString("key1")).isEqualTo("value1");
assertThat(pluginCfg.getStringList("key2")).isEqualTo(new String[] { "value2a", "value2b" });
}
Aggregations