Use Java 15 text blocks for JSON and multiline strings (#80751)

The ES code base is quite JSON heavy. It uses a lot of multi-line JSON requests in tests which need to be escaped and concatenated which in turn makes them hard to read. Let's try to leverage Java 15 text blocks for representing them.
This commit is contained in:
Artem Prigoda 2021-12-15 18:01:28 +01:00 committed by GitHub
parent ca01b5fe49
commit 763d6d510f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
730 changed files with 28591 additions and 25000 deletions

View file

@ -39,12 +39,8 @@ public class StoredExpressionIT extends ESIntegTestCase {
}
public void testAllOpsDisabledIndexedScripts() throws IOException {
client().admin()
.cluster()
.preparePutStoredScript()
.setId("script1")
.setContent(new BytesArray("{\"script\": {\"lang\": \"expression\", \"source\": \"2\"} }"), XContentType.JSON)
.get();
client().admin().cluster().preparePutStoredScript().setId("script1").setContent(new BytesArray("""
{"script": {"lang": "expression", "source": "2"} }"""), XContentType.JSON).get();
client().prepareIndex("test").setId("1").setSource("{\"theField\":\"foo\"}", XContentType.JSON).get();
try {
client().prepareUpdate("test", "1").setScript(new Script(ScriptType.STORED, null, "script1", Collections.emptyMap())).get();