use of org.sonarqube.ws.Settings.FieldValues.Value in project sonarqube by SonarSource.
the class DefaultSettingsLoaderTest method should_load_global_propertyset_settings.
@Test
public void should_load_global_propertyset_settings() {
Builder valuesBuilder = Value.newBuilder();
valuesBuilder.getMutableValue().put("filepattern", "**/*.xml");
valuesBuilder.getMutableValue().put("rulepattern", "*:S12345");
Value value1 = valuesBuilder.build();
valuesBuilder.clear();
valuesBuilder.getMutableValue().put("filepattern", "**/*.java");
valuesBuilder.getMutableValue().put("rulepattern", "*:S456");
Value value2 = valuesBuilder.build();
assertThat(DefaultSettingsLoader.toMap(asList(Setting.newBuilder().setKey("sonar.issue.exclusions.multicriteria").setFieldValues(FieldValues.newBuilder().addFieldValues(value1).addFieldValues(value2)).build()))).containsOnly(entry("sonar.issue.exclusions.multicriteria", "1,2"), entry("sonar.issue.exclusions.multicriteria.1.filepattern", "**/*.xml"), entry("sonar.issue.exclusions.multicriteria.1.rulepattern", "*:S12345"), entry("sonar.issue.exclusions.multicriteria.2.filepattern", "**/*.java"), entry("sonar.issue.exclusions.multicriteria.2.rulepattern", "*:S456"));
}
use of org.sonarqube.ws.Settings.FieldValues.Value in project sonarqube by SonarSource.
the class DefaultSettingsLoader method convertPropertySetToProps.
private static void convertPropertySetToProps(Map<String, String> result, Setting s) {
List<String> ids = new ArrayList<>();
int id = 1;
for (Value v : s.getFieldValues().getFieldValuesList()) {
for (Map.Entry<String, String> entry : v.getValue().entrySet()) {
result.put(s.getKey() + "." + id + "." + entry.getKey(), entry.getValue());
}
ids.add(String.valueOf(id));
id++;
}
result.put(s.getKey(), Joiner.on(',').join(ids));
}