|
@@ -76,16 +76,6 @@ public class ScriptParameterParserTests extends ESTestCase {
|
|
assertThat(paramParser.token(parser.currentName(), parser.currentToken(), parser, ParseFieldMatcher.STRICT), equalTo(true));
|
|
assertThat(paramParser.token(parser.currentName(), parser.currentToken(), parser, ParseFieldMatcher.STRICT), equalTo(true));
|
|
assertDefaultParameterValue(paramParser, "scriptValue", ScriptType.FILE);
|
|
assertDefaultParameterValue(paramParser, "scriptValue", ScriptType.FILE);
|
|
assertThat(paramParser.lang(), nullValue());
|
|
assertThat(paramParser.lang(), nullValue());
|
|
-
|
|
|
|
- parser = XContentHelper.createParser(new BytesArray("{ \"scriptFile\" : \"scriptValue\" }"));
|
|
|
|
- token = parser.nextToken();
|
|
|
|
- while (token != Token.VALUE_STRING) {
|
|
|
|
- token = parser.nextToken();
|
|
|
|
- }
|
|
|
|
- paramParser = new ScriptParameterParser();
|
|
|
|
- assertThat(paramParser.token(parser.currentName(), parser.currentToken(), parser, ParseFieldMatcher.STRICT), equalTo(true));
|
|
|
|
- assertDefaultParameterValue(paramParser, "scriptValue", ScriptType.FILE);
|
|
|
|
- assertThat(paramParser.lang(), nullValue());
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public void testTokenDefaultIndexed() throws IOException {
|
|
public void testTokenDefaultIndexed() throws IOException {
|
|
@@ -98,16 +88,6 @@ public class ScriptParameterParserTests extends ESTestCase {
|
|
assertThat(paramParser.token(parser.currentName(), parser.currentToken(), parser, ParseFieldMatcher.STRICT), equalTo(true));
|
|
assertThat(paramParser.token(parser.currentName(), parser.currentToken(), parser, ParseFieldMatcher.STRICT), equalTo(true));
|
|
assertDefaultParameterValue(paramParser, "scriptValue", ScriptType.STORED);
|
|
assertDefaultParameterValue(paramParser, "scriptValue", ScriptType.STORED);
|
|
assertThat(paramParser.lang(), nullValue());
|
|
assertThat(paramParser.lang(), nullValue());
|
|
-
|
|
|
|
- parser = XContentHelper.createParser(new BytesArray("{ \"scriptId\" : \"scriptValue\" }"));
|
|
|
|
- token = parser.nextToken();
|
|
|
|
- while (token != Token.VALUE_STRING) {
|
|
|
|
- token = parser.nextToken();
|
|
|
|
- }
|
|
|
|
- paramParser = new ScriptParameterParser();
|
|
|
|
- assertThat(paramParser.token(parser.currentName(), parser.currentToken(), parser, ParseFieldMatcher.STRICT), equalTo(true));
|
|
|
|
- assertDefaultParameterValue(paramParser, "scriptValue", ScriptType.STORED);
|
|
|
|
- assertThat(paramParser.lang(), nullValue());
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public void testTokenDefaultNotFound() throws IOException {
|
|
public void testTokenDefaultNotFound() throws IOException {
|
|
@@ -562,14 +542,6 @@ public class ScriptParameterParserTests extends ESTestCase {
|
|
assertDefaultParameterValue(paramParser, "scriptValue", ScriptType.FILE);
|
|
assertDefaultParameterValue(paramParser, "scriptValue", ScriptType.FILE);
|
|
assertThat(paramParser.lang(), nullValue());
|
|
assertThat(paramParser.lang(), nullValue());
|
|
assertThat(config.isEmpty(), equalTo(true));
|
|
assertThat(config.isEmpty(), equalTo(true));
|
|
-
|
|
|
|
- config = new HashMap<>();
|
|
|
|
- config.put("scriptFile", "scriptValue");
|
|
|
|
- paramParser = new ScriptParameterParser();
|
|
|
|
- paramParser.parseConfig(config, true, ParseFieldMatcher.STRICT);
|
|
|
|
- assertDefaultParameterValue(paramParser, "scriptValue", ScriptType.FILE);
|
|
|
|
- assertThat(paramParser.lang(), nullValue());
|
|
|
|
- assertThat(config.isEmpty(), equalTo(true));
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public void testConfigDefaultIndexed() throws IOException {
|
|
public void testConfigDefaultIndexed() throws IOException {
|
|
@@ -580,14 +552,6 @@ public class ScriptParameterParserTests extends ESTestCase {
|
|
assertDefaultParameterValue(paramParser, "scriptValue", ScriptType.STORED);
|
|
assertDefaultParameterValue(paramParser, "scriptValue", ScriptType.STORED);
|
|
assertThat(paramParser.lang(), nullValue());
|
|
assertThat(paramParser.lang(), nullValue());
|
|
assertThat(config.isEmpty(), equalTo(true));
|
|
assertThat(config.isEmpty(), equalTo(true));
|
|
-
|
|
|
|
- config = new HashMap<>();
|
|
|
|
- config.put("scriptId", "scriptValue");
|
|
|
|
- paramParser = new ScriptParameterParser();
|
|
|
|
- paramParser.parseConfig(config, true, ParseFieldMatcher.STRICT);
|
|
|
|
- assertDefaultParameterValue(paramParser, "scriptValue", ScriptType.STORED);
|
|
|
|
- assertThat(paramParser.lang(), nullValue());
|
|
|
|
- assertThat(config.isEmpty(), equalTo(true));
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public void testConfigDefaultIndexedNoRemove() throws IOException {
|
|
public void testConfigDefaultIndexedNoRemove() throws IOException {
|
|
@@ -599,15 +563,6 @@ public class ScriptParameterParserTests extends ESTestCase {
|
|
assertThat(paramParser.lang(), nullValue());
|
|
assertThat(paramParser.lang(), nullValue());
|
|
assertThat(config.size(), equalTo(1));
|
|
assertThat(config.size(), equalTo(1));
|
|
assertThat((String) config.get("script_id"), equalTo("scriptValue"));
|
|
assertThat((String) config.get("script_id"), equalTo("scriptValue"));
|
|
-
|
|
|
|
- config = new HashMap<>();
|
|
|
|
- config.put("scriptId", "scriptValue");
|
|
|
|
- paramParser = new ScriptParameterParser();
|
|
|
|
- paramParser.parseConfig(config, false, ParseFieldMatcher.STRICT);
|
|
|
|
- assertDefaultParameterValue(paramParser, "scriptValue", ScriptType.STORED);
|
|
|
|
- assertThat(paramParser.lang(), nullValue());
|
|
|
|
- assertThat(config.size(), equalTo(1));
|
|
|
|
- assertThat((String) config.get("scriptId"), equalTo("scriptValue"));
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public void testConfigDefaultNotFound() throws IOException {
|
|
public void testConfigDefaultNotFound() throws IOException {
|