import org.sonar.process.Props;
public class EsJvmOptions extends JvmOptions<EsJvmOptions> {
- private static final String ELASTICSEARCH_JVM_OPTIONS_HEADER = "# This file has been automatically generated by SonarQube during startup.\n" +
- "# Please use sonar.search.javaOpts and/or sonar.search.javaAdditionalOpts in sonar.properties to specify jvm options for Elasticsearch\n" +
- "\n" +
- "# DO NOT EDIT THIS FILE\n" +
- "\n";
+ private static final String ELASTICSEARCH_JVM_OPTIONS_HEADER = """
+ # This file has been automatically generated by SonarQube during startup.
+ # Please use sonar.search.javaOpts and/or sonar.search.javaAdditionalOpts in sonar.properties to specify jvm options for Elasticsearch
+
+ # DO NOT EDIT THIS FILE
+
+ """;
public EsJvmOptions(Props props, File tmpDir) {
super(mandatoryOptions(tmpDir, props));
import static org.yaml.snakeyaml.DumperOptions.FlowStyle.BLOCK;
public class EsYmlSettings {
- private static final String ELASTICSEARCH_YML_OPTIONS_HEADER = "# This file has been automatically generated by SonarQube during startup.\n" +
- "\n" +
- "# DO NOT EDIT THIS FILE\n" +
- "\n";
+ private static final String ELASTICSEARCH_YML_OPTIONS_HEADER = """
+ # This file has been automatically generated by SonarQube during startup.
+
+ # DO NOT EDIT THIS FILE
+
+ """;
private final Map<String, String> elasticsearchSettings;
new EsYmlSettings(new HashMap<>()).writeToYmlSettingsFile(yamlFile);
assertThat(yamlFile).exists();
- assertThat(yamlFile).hasContent("# This file has been automatically generated by SonarQube during startup.\n" +
- "\n" +
- "# DO NOT EDIT THIS FILE\n" +
- "\n" +
- "{\n" +
- " }");
+ assertThat(yamlFile).hasContent("""
+ # This file has been automatically generated by SonarQube during startup.
+
+ # DO NOT EDIT THIS FILE
+
+ {
+ }""");
}
@Test
public class DefaultAdminCredentialsVerifierNotificationTemplate implements EmailTemplate {
static final String SUBJECT = "Default Administrator credentials are still used";
- static final String BODY_FORMAT = "Hello,\n\n" +
- "Your SonarQube instance is still using default administrator credentials.\n" +
- "Make sure to change the password for the 'admin' account or deactivate this account.";
+ static final String BODY_FORMAT = """
+ Hello,
+
+ Your SonarQube instance is still using default administrator credentials.
+ Make sure to change the password for the 'admin' account or deactivate this account.""";
@Override
@CheckForNull
EmailMessage emailMessage = underTest.format(notification);
assertThat(emailMessage.getSubject()).isEqualTo("Default Administrator credentials are still used");
- assertThat(emailMessage.getMessage()).isEqualTo("Hello,\n\n" +
- "Your SonarQube instance is still using default administrator credentials.\n" +
- "Make sure to change the password for the 'admin' account or deactivate this account.");
+ assertThat(emailMessage.getMessage()).isEqualTo("""
+ Hello,
+
+ Your SonarQube instance is still using default administrator credentials.
+ Make sure to change the password for the 'admin' account or deactivate this account.""");
}
}
public void define(WebService.NewController context) {
context.createAction("metrics")
.setSince("9.3")
- .setDescription("Return monitoring metrics in Prometheus format. \n" +
- "Support content type 'text/plain' (default) and 'application/openmetrics-text'.\n" +
- "this endpoint can be access using a Bearer token, that needs to be defined in sonar.properties with the 'sonar.web.systemPasscode' key.")
+ .setDescription("""
+ Return monitoring metrics in Prometheus format.\s
+ Support content type 'text/plain' (default) and 'application/openmetrics-text'.
+ this endpoint can be access using a Bearer token, that needs to be defined in sonar.properties with the 'sonar.web.systemPasscode' key.""")
.setResponseExample(getClass().getResource("monitoring-metrics.txt"))
.setHandler(this);