mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-24 15:17:30 -04:00
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:
parent
ca01b5fe49
commit
763d6d510f
730 changed files with 28591 additions and 25000 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue