diff options
Diffstat (limited to 'modules/ingest-common')
36 files changed, 182 insertions, 185 deletions
diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/AppendProcessorFactoryTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/AppendProcessorFactoryTests.java index e70bc3434e..072aa6faf8 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/AppendProcessorFactoryTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/AppendProcessorFactoryTests.java @@ -51,7 +51,7 @@ public class AppendProcessorFactoryTests extends ESTestCase { value = Arrays.asList("value1", "value2", "value3"); } config.put("value", value); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); AppendProcessor appendProcessor = factory.create(null, processorTag, config); assertThat(appendProcessor.getTag(), equalTo(processorTag)); assertThat(appendProcessor.getField().execute(Collections.emptyMap()), equalTo("field1")); @@ -97,7 +97,7 @@ public class AppendProcessorFactoryTests extends ESTestCase { Map<String, Object> config = new HashMap<>(); config.put("field", "field1"); config.put("value", "value1"); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); ElasticsearchException exception = expectThrows(ElasticsearchException.class, () -> factory.create(null, processorTag, config)); assertThat(exception.getMessage(), equalTo("java.lang.RuntimeException: could not compile script")); assertThat(exception.getHeader("processor_tag").get(0), equalTo(processorTag)); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/AppendProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/AppendProcessorTests.java index 16df08721d..fbbfb8a844 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/AppendProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/AppendProcessorTests.java @@ -130,13 +130,13 @@ public class AppendProcessorTests extends ESTestCase { List<String> values = new ArrayList<>(); Processor appendProcessor; if (randomBoolean()) { - String value = randomAsciiOfLengthBetween(1, 10); + String value = randomAlphaOfLengthBetween(1, 10); values.add(value); appendProcessor = createAppendProcessor(randomMetaData.getFieldName(), value); } else { int valuesSize = randomIntBetween(0, 10); for (int i = 0; i < valuesSize; i++) { - values.add(randomAsciiOfLengthBetween(1, 10)); + values.add(randomAlphaOfLengthBetween(1, 10)); } appendProcessor = createAppendProcessor(randomMetaData.getFieldName(), values); } @@ -158,7 +158,7 @@ public class AppendProcessorTests extends ESTestCase { private static Processor createAppendProcessor(String fieldName, Object fieldValue) { TemplateService templateService = TestTemplateService.instance(); - return new AppendProcessor(randomAsciiOfLength(10), templateService.compile(fieldName), ValueSource.wrap(fieldValue, + return new AppendProcessor(randomAlphaOfLength(10), templateService.compile(fieldName), ValueSource.wrap(fieldValue, templateService)); } @@ -186,7 +186,7 @@ public class AppendProcessorTests extends ESTestCase { }, STRING { @Override Object randomValue() { - return randomAsciiOfLengthBetween(1, 10); + return randomAlphaOfLengthBetween(1, 10); } }, MAP { @Override @@ -194,7 +194,7 @@ public class AppendProcessorTests extends ESTestCase { int numItems = randomIntBetween(1, 10); Map<String, Object> map = new HashMap<>(numItems); for (int i = 0; i < numItems; i++) { - map.put(randomAsciiOfLengthBetween(1, 10), randomFrom(Scalar.values()).randomValue()); + map.put(randomAlphaOfLengthBetween(1, 10), randomFrom(Scalar.values()).randomValue()); } return map; } diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ConvertProcessorFactoryTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ConvertProcessorFactoryTests.java index afdb7f7841..9e4acd7b17 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ConvertProcessorFactoryTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ConvertProcessorFactoryTests.java @@ -38,7 +38,7 @@ public class ConvertProcessorFactoryTests extends ESTestCase { ConvertProcessor.Type type = randomFrom(ConvertProcessor.Type.values()); config.put("field", "field1"); config.put("type", type.toString()); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); ConvertProcessor convertProcessor = factory.create(null, processorTag, config); assertThat(convertProcessor.getTag(), equalTo(processorTag)); assertThat(convertProcessor.getField(), equalTo("field1")); @@ -50,7 +50,7 @@ public class ConvertProcessorFactoryTests extends ESTestCase { public void testCreateUnsupportedType() throws Exception { ConvertProcessor.Factory factory = new ConvertProcessor.Factory(); Map<String, Object> config = new HashMap<>(); - String type = "type-" + randomAsciiOfLengthBetween(1, 10); + String type = "type-" + randomAlphaOfLengthBetween(1, 10); config.put("field", "field1"); config.put("type", type); try { @@ -67,7 +67,7 @@ public class ConvertProcessorFactoryTests extends ESTestCase { public void testCreateNoFieldPresent() throws Exception { ConvertProcessor.Factory factory = new ConvertProcessor.Factory(); Map<String, Object> config = new HashMap<>(); - String type = "type-" + randomAsciiOfLengthBetween(1, 10); + String type = "type-" + randomAlphaOfLengthBetween(1, 10); config.put("type", type); try { factory.create(null, null, config); @@ -96,7 +96,7 @@ public class ConvertProcessorFactoryTests extends ESTestCase { config.put("field", "field1"); config.put("target_field", "field2"); config.put("type", type.toString()); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); ConvertProcessor convertProcessor = factory.create(null, processorTag, config); assertThat(convertProcessor.getTag(), equalTo(processorTag)); assertThat(convertProcessor.getField(), equalTo("field1")); @@ -112,7 +112,7 @@ public class ConvertProcessorFactoryTests extends ESTestCase { config.put("field", "field1"); config.put("type", type.toString()); config.put("ignore_missing", true); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); ConvertProcessor convertProcessor = factory.create(null, processorTag, config); assertThat(convertProcessor.getTag(), equalTo(processorTag)); assertThat(convertProcessor.getField(), equalTo("field1")); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ConvertProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ConvertProcessorTests.java index f8a8a24286..7cab5fff45 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ConvertProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ConvertProcessorTests.java @@ -43,7 +43,7 @@ public class ConvertProcessorTests extends ESTestCase { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random()); int randomInt = randomInt(); String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, randomInt); - Processor processor = new ConvertProcessor(randomAsciiOfLength(10), fieldName, fieldName, Type.INTEGER, false); + Processor processor = new ConvertProcessor(randomAlphaOfLength(10), fieldName, fieldName, Type.INTEGER, false); processor.execute(ingestDocument); assertThat(ingestDocument.getFieldValue(fieldName, Integer.class), equalTo(randomInt)); } @@ -59,7 +59,7 @@ public class ConvertProcessorTests extends ESTestCase { expectedList.add(randomInt); } String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, fieldValue); - Processor processor = new ConvertProcessor(randomAsciiOfLength(10), fieldName, fieldName, Type.INTEGER, false); + Processor processor = new ConvertProcessor(randomAlphaOfLength(10), fieldName, fieldName, Type.INTEGER, false); processor.execute(ingestDocument); assertThat(ingestDocument.getFieldValue(fieldName, List.class), equalTo(expectedList)); } @@ -67,10 +67,10 @@ public class ConvertProcessorTests extends ESTestCase { public void testConvertIntError() throws Exception { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); String fieldName = RandomDocumentPicks.randomFieldName(random()); - String value = "string-" + randomAsciiOfLengthBetween(1, 10); + String value = "string-" + randomAlphaOfLengthBetween(1, 10); ingestDocument.setFieldValue(fieldName, value); - Processor processor = new ConvertProcessor(randomAsciiOfLength(10), fieldName, fieldName, Type.INTEGER, false); + Processor processor = new ConvertProcessor(randomAlphaOfLength(10), fieldName, fieldName, Type.INTEGER, false); try { processor.execute(ingestDocument); fail("processor execute should have failed"); @@ -86,7 +86,7 @@ public class ConvertProcessorTests extends ESTestCase { String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, randomFloat); expectedResult.put(fieldName, randomFloat); - Processor processor = new ConvertProcessor(randomAsciiOfLength(10), fieldName, fieldName, Type.FLOAT, false); + Processor processor = new ConvertProcessor(randomAlphaOfLength(10), fieldName, fieldName, Type.FLOAT, false); processor.execute(ingestDocument); assertThat(ingestDocument.getFieldValue(fieldName, Float.class), equalTo(randomFloat)); } @@ -102,7 +102,7 @@ public class ConvertProcessorTests extends ESTestCase { expectedList.add(randomFloat); } String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, fieldValue); - Processor processor = new ConvertProcessor(randomAsciiOfLength(10), fieldName, fieldName, Type.FLOAT, false); + Processor processor = new ConvertProcessor(randomAlphaOfLength(10), fieldName, fieldName, Type.FLOAT, false); processor.execute(ingestDocument); assertThat(ingestDocument.getFieldValue(fieldName, List.class), equalTo(expectedList)); } @@ -110,10 +110,10 @@ public class ConvertProcessorTests extends ESTestCase { public void testConvertFloatError() throws Exception { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); String fieldName = RandomDocumentPicks.randomFieldName(random()); - String value = "string-" + randomAsciiOfLengthBetween(1, 10); + String value = "string-" + randomAlphaOfLengthBetween(1, 10); ingestDocument.setFieldValue(fieldName, value); - Processor processor = new ConvertProcessor(randomAsciiOfLength(10), fieldName, fieldName, Type.FLOAT, false); + Processor processor = new ConvertProcessor(randomAlphaOfLength(10), fieldName, fieldName, Type.FLOAT, false); try { processor.execute(ingestDocument); fail("processor execute should have failed"); @@ -131,7 +131,7 @@ public class ConvertProcessorTests extends ESTestCase { } String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, booleanString); - Processor processor = new ConvertProcessor(randomAsciiOfLength(10), fieldName, fieldName, Type.BOOLEAN, false); + Processor processor = new ConvertProcessor(randomAlphaOfLength(10), fieldName, fieldName, Type.BOOLEAN, false); processor.execute(ingestDocument); assertThat(ingestDocument.getFieldValue(fieldName, Boolean.class), equalTo(randomBoolean)); } @@ -151,7 +151,7 @@ public class ConvertProcessorTests extends ESTestCase { expectedList.add(randomBoolean); } String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, fieldValue); - Processor processor = new ConvertProcessor(randomAsciiOfLength(10), fieldName, fieldName, Type.BOOLEAN, false); + Processor processor = new ConvertProcessor(randomAlphaOfLength(10), fieldName, fieldName, Type.BOOLEAN, false); processor.execute(ingestDocument); assertThat(ingestDocument.getFieldValue(fieldName, List.class), equalTo(expectedList)); } @@ -161,14 +161,14 @@ public class ConvertProcessorTests extends ESTestCase { String fieldName = RandomDocumentPicks.randomFieldName(random()); String fieldValue; if (randomBoolean()) { - fieldValue = "string-" + randomAsciiOfLengthBetween(1, 10); + fieldValue = "string-" + randomAlphaOfLengthBetween(1, 10); } else { //verify that only proper boolean values are supported and we are strict about it fieldValue = randomFrom("on", "off", "yes", "no", "0", "1"); } ingestDocument.setFieldValue(fieldName, fieldValue); - Processor processor = new ConvertProcessor(randomAsciiOfLength(10), fieldName, fieldName, Type.BOOLEAN, false); + Processor processor = new ConvertProcessor(randomAlphaOfLength(10), fieldName, fieldName, Type.BOOLEAN, false); try { processor.execute(ingestDocument); fail("processor execute should have failed"); @@ -202,7 +202,7 @@ public class ConvertProcessorTests extends ESTestCase { } String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, fieldValue); - Processor processor = new ConvertProcessor(randomAsciiOfLength(10), fieldName, fieldName, Type.STRING, false); + Processor processor = new ConvertProcessor(randomAlphaOfLength(10), fieldName, fieldName, Type.STRING, false); processor.execute(ingestDocument); assertThat(ingestDocument.getFieldValue(fieldName, String.class), equalTo(expectedFieldValue)); } @@ -238,7 +238,7 @@ public class ConvertProcessorTests extends ESTestCase { expectedList.add(randomValueString); } String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, fieldValue); - Processor processor = new ConvertProcessor(randomAsciiOfLength(10), fieldName, fieldName, Type.STRING, false); + Processor processor = new ConvertProcessor(randomAlphaOfLength(10), fieldName, fieldName, Type.STRING, false); processor.execute(ingestDocument); assertThat(ingestDocument.getFieldValue(fieldName, List.class), equalTo(expectedList)); } @@ -247,7 +247,7 @@ public class ConvertProcessorTests extends ESTestCase { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); String fieldName = RandomDocumentPicks.randomFieldName(random()); Type type = randomFrom(Type.values()); - Processor processor = new ConvertProcessor(randomAsciiOfLength(10), fieldName, fieldName, type, false); + Processor processor = new ConvertProcessor(randomAlphaOfLength(10), fieldName, fieldName, type, false); try { processor.execute(ingestDocument); fail("processor execute should have failed"); @@ -259,7 +259,7 @@ public class ConvertProcessorTests extends ESTestCase { public void testConvertNullField() throws Exception { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), Collections.singletonMap("field", null)); Type type = randomFrom(Type.values()); - Processor processor = new ConvertProcessor(randomAsciiOfLength(10), "field", "field", type, false); + Processor processor = new ConvertProcessor(randomAlphaOfLength(10), "field", "field", type, false); try { processor.execute(ingestDocument); fail("processor execute should have failed"); @@ -273,7 +273,7 @@ public class ConvertProcessorTests extends ESTestCase { IngestDocument ingestDocument = new IngestDocument(originalIngestDocument); String fieldName = RandomDocumentPicks.randomFieldName(random()); Type type = randomFrom(Type.values()); - Processor processor = new ConvertProcessor(randomAsciiOfLength(10), fieldName, fieldName, type, true); + Processor processor = new ConvertProcessor(randomAlphaOfLength(10), fieldName, fieldName, type, true); processor.execute(ingestDocument); assertIngestDocument(originalIngestDocument, ingestDocument); } @@ -282,7 +282,7 @@ public class ConvertProcessorTests extends ESTestCase { IngestDocument originalIngestDocument = RandomDocumentPicks.randomIngestDocument(random(), Collections.singletonMap("field", null)); IngestDocument ingestDocument = new IngestDocument(originalIngestDocument); Type type = randomFrom(Type.values()); - Processor processor = new ConvertProcessor(randomAsciiOfLength(10), "field", "field", type, true); + Processor processor = new ConvertProcessor(randomAlphaOfLength(10), "field", "field", type, true); processor.execute(ingestDocument); assertIngestDocument(originalIngestDocument, ingestDocument); } @@ -306,7 +306,7 @@ public class ConvertProcessorTests extends ESTestCase { throw new UnsupportedOperationException(); } IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), Collections.singletonMap("field", randomValue)); - Processor processor = new ConvertProcessor(randomAsciiOfLength(10), "field", "field", Type.AUTO, false); + Processor processor = new ConvertProcessor(randomAlphaOfLength(10), "field", "field", Type.AUTO, false); processor.execute(ingestDocument); Object convertedValue = ingestDocument.getFieldValue("field", Object.class); assertThat(convertedValue, sameInstance(randomValue)); @@ -315,7 +315,7 @@ public class ConvertProcessorTests extends ESTestCase { public void testAutoConvertStringNotMatched() throws Exception { String value = "notAnIntFloatOrBool"; IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), Collections.singletonMap("field", value)); - Processor processor = new ConvertProcessor(randomAsciiOfLength(10), "field", "field", Type.AUTO, false); + Processor processor = new ConvertProcessor(randomAlphaOfLength(10), "field", "field", Type.AUTO, false); processor.execute(ingestDocument); Object convertedValue = ingestDocument.getFieldValue("field", Object.class); assertThat(convertedValue, sameInstance(value)); @@ -326,7 +326,7 @@ public class ConvertProcessorTests extends ESTestCase { String booleanString = Boolean.toString(randomBoolean); IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), Collections.singletonMap("field", booleanString)); - Processor processor = new ConvertProcessor(randomAsciiOfLength(10), "field", "field", Type.AUTO, false); + Processor processor = new ConvertProcessor(randomAlphaOfLength(10), "field", "field", Type.AUTO, false); processor.execute(ingestDocument); Object convertedValue = ingestDocument.getFieldValue("field", Object.class); assertThat(convertedValue, equalTo(randomBoolean)); @@ -336,7 +336,7 @@ public class ConvertProcessorTests extends ESTestCase { int randomInt = randomInt(); String randomString = Integer.toString(randomInt); IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), Collections.singletonMap("field", randomString)); - Processor processor = new ConvertProcessor(randomAsciiOfLength(10), "field", "field", Type.AUTO, false); + Processor processor = new ConvertProcessor(randomAlphaOfLength(10), "field", "field", Type.AUTO, false); processor.execute(ingestDocument); Object convertedValue = ingestDocument.getFieldValue("field", Object.class); assertThat(convertedValue, equalTo(randomInt)); @@ -346,7 +346,7 @@ public class ConvertProcessorTests extends ESTestCase { float randomFloat = randomFloat(); String randomString = Float.toString(randomFloat); IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), Collections.singletonMap("field", randomString)); - Processor processor = new ConvertProcessor(randomAsciiOfLength(10), "field", "field", Type.AUTO, false); + Processor processor = new ConvertProcessor(randomAlphaOfLength(10), "field", "field", Type.AUTO, false); processor.execute(ingestDocument); Object convertedValue = ingestDocument.getFieldValue("field", Object.class); assertThat(convertedValue, equalTo(randomFloat)); @@ -356,8 +356,8 @@ public class ConvertProcessorTests extends ESTestCase { IngestDocument ingestDocument = new IngestDocument(new HashMap<>(), new HashMap<>()); int randomInt = randomInt(); String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, String.valueOf(randomInt)); - String targetField = fieldName + randomAsciiOfLength(5); - Processor processor = new ConvertProcessor(randomAsciiOfLength(10), fieldName, targetField, Type.INTEGER, false); + String targetField = fieldName + randomAlphaOfLength(5); + Processor processor = new ConvertProcessor(randomAlphaOfLength(10), fieldName, targetField, Type.INTEGER, false); processor.execute(ingestDocument); assertThat(ingestDocument.getFieldValue(fieldName, String.class), equalTo(String.valueOf(randomInt))); assertThat(ingestDocument.getFieldValue(targetField, Integer.class), equalTo(randomInt)); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/DateFormatTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/DateFormatTests.java index 0885371f86..886630dbbd 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/DateFormatTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/DateFormatTests.java @@ -81,6 +81,6 @@ public class DateFormatTests extends ESTestCase { assertThat(DateFormat.fromString("iso8601"), equalTo(DateFormat.Joda)); assertThat(DateFormat.fromString("TAI64N"), equalTo(DateFormat.Tai64n)); assertThat(DateFormat.fromString("tai64n"), equalTo(DateFormat.Joda)); - assertThat(DateFormat.fromString("prefix-" + randomAsciiOfLengthBetween(1, 10)), equalTo(DateFormat.Joda)); + assertThat(DateFormat.fromString("prefix-" + randomAlphaOfLengthBetween(1, 10)), equalTo(DateFormat.Joda)); } } diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/DateProcessorFactoryTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/DateProcessorFactoryTests.java index 95ad68bb11..2dc16ad7bd 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/DateProcessorFactoryTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/DateProcessorFactoryTests.java @@ -37,10 +37,10 @@ public class DateProcessorFactoryTests extends ESTestCase { public void testBuildDefaults() throws Exception { DateProcessor.Factory factory = new DateProcessor.Factory(); Map<String, Object> config = new HashMap<>(); - String sourceField = randomAsciiOfLengthBetween(1, 10); + String sourceField = randomAlphaOfLengthBetween(1, 10); config.put("field", sourceField); config.put("formats", Collections.singletonList("dd/MM/yyyyy")); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); DateProcessor processor = factory.create(null, processorTag, config); assertThat(processor.getTag(), equalTo(processorTag)); assertThat(processor.getField(), equalTo(sourceField)); @@ -53,7 +53,7 @@ public class DateProcessorFactoryTests extends ESTestCase { public void testMatchFieldIsMandatory() throws Exception { DateProcessor.Factory factory = new DateProcessor.Factory(); Map<String, Object> config = new HashMap<>(); - String targetField = randomAsciiOfLengthBetween(1, 10); + String targetField = randomAlphaOfLengthBetween(1, 10); config.put("target_field", targetField); config.put("formats", Collections.singletonList("dd/MM/yyyyy")); @@ -68,8 +68,8 @@ public class DateProcessorFactoryTests extends ESTestCase { public void testMatchFormatsIsMandatory() throws Exception { DateProcessor.Factory factory = new DateProcessor.Factory(); Map<String, Object> config = new HashMap<>(); - String sourceField = randomAsciiOfLengthBetween(1, 10); - String targetField = randomAsciiOfLengthBetween(1, 10); + String sourceField = randomAlphaOfLengthBetween(1, 10); + String targetField = randomAlphaOfLengthBetween(1, 10); config.put("field", sourceField); config.put("target_field", targetField); @@ -84,7 +84,7 @@ public class DateProcessorFactoryTests extends ESTestCase { public void testParseLocale() throws Exception { DateProcessor.Factory factory = new DateProcessor.Factory(); Map<String, Object> config = new HashMap<>(); - String sourceField = randomAsciiOfLengthBetween(1, 10); + String sourceField = randomAlphaOfLengthBetween(1, 10); config.put("field", sourceField); config.put("formats", Collections.singletonList("dd/MM/yyyyy")); Locale locale = randomLocale(random()); @@ -97,7 +97,7 @@ public class DateProcessorFactoryTests extends ESTestCase { public void testParseInvalidLocale() throws Exception { DateProcessor.Factory factory = new DateProcessor.Factory(); Map<String, Object> config = new HashMap<>(); - String sourceField = randomAsciiOfLengthBetween(1, 10); + String sourceField = randomAlphaOfLengthBetween(1, 10); config.put("field", sourceField); config.put("formats", Collections.singletonList("dd/MM/yyyyy")); config.put("locale", "invalid_locale"); @@ -112,7 +112,7 @@ public class DateProcessorFactoryTests extends ESTestCase { public void testParseTimezone() throws Exception { DateProcessor.Factory factory = new DateProcessor.Factory(); Map<String, Object> config = new HashMap<>(); - String sourceField = randomAsciiOfLengthBetween(1, 10); + String sourceField = randomAlphaOfLengthBetween(1, 10); config.put("field", sourceField); config.put("formats", Collections.singletonList("dd/MM/yyyyy")); @@ -125,7 +125,7 @@ public class DateProcessorFactoryTests extends ESTestCase { public void testParseInvalidTimezone() throws Exception { DateProcessor.Factory factory = new DateProcessor.Factory(); Map<String, Object> config = new HashMap<>(); - String sourceField = randomAsciiOfLengthBetween(1, 10); + String sourceField = randomAlphaOfLengthBetween(1, 10); config.put("field", sourceField); config.put("match_formats", Collections.singletonList("dd/MM/yyyyy")); config.put("timezone", "invalid_timezone"); @@ -140,7 +140,7 @@ public class DateProcessorFactoryTests extends ESTestCase { public void testParseMatchFormats() throws Exception { DateProcessor.Factory factory = new DateProcessor.Factory(); Map<String, Object> config = new HashMap<>(); - String sourceField = randomAsciiOfLengthBetween(1, 10); + String sourceField = randomAlphaOfLengthBetween(1, 10); config.put("field", sourceField); config.put("formats", Arrays.asList("dd/MM/yyyy", "dd-MM-yyyy")); @@ -151,7 +151,7 @@ public class DateProcessorFactoryTests extends ESTestCase { public void testParseMatchFormatsFailure() throws Exception { DateProcessor.Factory factory = new DateProcessor.Factory(); Map<String, Object> config = new HashMap<>(); - String sourceField = randomAsciiOfLengthBetween(1, 10); + String sourceField = randomAlphaOfLengthBetween(1, 10); config.put("field", sourceField); config.put("formats", "dd/MM/yyyy"); @@ -166,8 +166,8 @@ public class DateProcessorFactoryTests extends ESTestCase { public void testParseTargetField() throws Exception { DateProcessor.Factory factory = new DateProcessor.Factory(); Map<String, Object> config = new HashMap<>(); - String sourceField = randomAsciiOfLengthBetween(1, 10); - String targetField = randomAsciiOfLengthBetween(1, 10); + String sourceField = randomAlphaOfLengthBetween(1, 10); + String targetField = randomAlphaOfLengthBetween(1, 10); config.put("field", sourceField); config.put("target_field", targetField); config.put("formats", Arrays.asList("dd/MM/yyyy", "dd-MM-yyyy")); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/DateProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/DateProcessorTests.java index 8ac5a56abb..d92f2e84be 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/DateProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/DateProcessorTests.java @@ -38,7 +38,7 @@ import static org.hamcrest.CoreMatchers.equalTo; public class DateProcessorTests extends ESTestCase { public void testJodaPattern() { - DateProcessor dateProcessor = new DateProcessor(randomAsciiOfLength(10), DateTimeZone.forID("Europe/Amsterdam"), Locale.ENGLISH, + DateProcessor dateProcessor = new DateProcessor(randomAlphaOfLength(10), DateTimeZone.forID("Europe/Amsterdam"), Locale.ENGLISH, "date_as_string", Collections.singletonList("yyyy dd MM hh:mm:ss"), "date_as_date"); Map<String, Object> document = new HashMap<>(); document.put("date_as_string", "2010 12 06 11:05:15"); @@ -52,7 +52,7 @@ public class DateProcessorTests extends ESTestCase { matchFormats.add("yyyy dd MM"); matchFormats.add("dd/MM/yyyy"); matchFormats.add("dd-MM-yyyy"); - DateProcessor dateProcessor = new DateProcessor(randomAsciiOfLength(10), DateTimeZone.forID("Europe/Amsterdam"), Locale.ENGLISH, + DateProcessor dateProcessor = new DateProcessor(randomAlphaOfLength(10), DateTimeZone.forID("Europe/Amsterdam"), Locale.ENGLISH, "date_as_string", matchFormats, "date_as_date"); Map<String, Object> document = new HashMap<>(); @@ -86,7 +86,7 @@ public class DateProcessorTests extends ESTestCase { public void testInvalidJodaPattern() { try { - new DateProcessor(randomAsciiOfLength(10), DateTimeZone.UTC, randomLocale(random()), + new DateProcessor(randomAlphaOfLength(10), DateTimeZone.UTC, randomLocale(random()), "date_as_string", Collections.singletonList("invalid pattern"), "date_as_date"); fail("date processor initialization should have failed"); } catch(IllegalArgumentException e) { @@ -95,7 +95,7 @@ public class DateProcessorTests extends ESTestCase { } public void testJodaPatternLocale() { - DateProcessor dateProcessor = new DateProcessor(randomAsciiOfLength(10), DateTimeZone.forID("Europe/Amsterdam"), Locale.ITALIAN, + DateProcessor dateProcessor = new DateProcessor(randomAlphaOfLength(10), DateTimeZone.forID("Europe/Amsterdam"), Locale.ITALIAN, "date_as_string", Collections.singletonList("yyyy dd MMM"), "date_as_date"); Map<String, Object> document = new HashMap<>(); document.put("date_as_string", "2010 12 giugno"); @@ -105,7 +105,7 @@ public class DateProcessorTests extends ESTestCase { } public void testJodaPatternDefaultYear() { - DateProcessor dateProcessor = new DateProcessor(randomAsciiOfLength(10), DateTimeZone.forID("Europe/Amsterdam"), Locale.ENGLISH, + DateProcessor dateProcessor = new DateProcessor(randomAlphaOfLength(10), DateTimeZone.forID("Europe/Amsterdam"), Locale.ENGLISH, "date_as_string", Collections.singletonList("dd/MM"), "date_as_date"); Map<String, Object> document = new HashMap<>(); document.put("date_as_string", "12/06"); @@ -116,7 +116,7 @@ public class DateProcessorTests extends ESTestCase { } public void testTAI64N() { - DateProcessor dateProcessor = new DateProcessor(randomAsciiOfLength(10), DateTimeZone.forOffsetHours(2), randomLocale(random()), + DateProcessor dateProcessor = new DateProcessor(randomAlphaOfLength(10), DateTimeZone.forOffsetHours(2), randomLocale(random()), "date_as_string", Collections.singletonList("TAI64N"), "date_as_date"); Map<String, Object> document = new HashMap<>(); String dateAsString = (randomBoolean() ? "@" : "") + "4000000050d506482dbdf024"; @@ -127,7 +127,7 @@ public class DateProcessorTests extends ESTestCase { } public void testUnixMs() { - DateProcessor dateProcessor = new DateProcessor(randomAsciiOfLength(10), DateTimeZone.UTC, randomLocale(random()), + DateProcessor dateProcessor = new DateProcessor(randomAlphaOfLength(10), DateTimeZone.UTC, randomLocale(random()), "date_as_string", Collections.singletonList("UNIX_MS"), "date_as_date"); Map<String, Object> document = new HashMap<>(); document.put("date_as_string", "1000500"); @@ -137,7 +137,7 @@ public class DateProcessorTests extends ESTestCase { } public void testUnix() { - DateProcessor dateProcessor = new DateProcessor(randomAsciiOfLength(10), DateTimeZone.UTC, randomLocale(random()), + DateProcessor dateProcessor = new DateProcessor(randomAlphaOfLength(10), DateTimeZone.UTC, randomLocale(random()), "date_as_string", Collections.singletonList("UNIX"), "date_as_date"); Map<String, Object> document = new HashMap<>(); document.put("date_as_string", "1000.5"); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/FailProcessorFactoryTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/FailProcessorFactoryTests.java index 217a15cf5b..ab0acad4ae 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/FailProcessorFactoryTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/FailProcessorFactoryTests.java @@ -43,7 +43,7 @@ public class FailProcessorFactoryTests extends ESTestCase { public void testCreate() throws Exception { Map<String, Object> config = new HashMap<>(); config.put("message", "error"); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); FailProcessor failProcessor = factory.create(null, processorTag, config); assertThat(failProcessor.getTag(), equalTo(processorTag)); assertThat(failProcessor.getMessage().execute(Collections.emptyMap()), equalTo("error")); @@ -63,7 +63,7 @@ public class FailProcessorFactoryTests extends ESTestCase { FailProcessor.Factory factory = new FailProcessor.Factory(TestTemplateService.instance(true)); Map<String, Object> config = new HashMap<>(); config.put("message", "error"); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); ElasticsearchException exception = expectThrows(ElasticsearchException.class, () -> factory.create(null, processorTag, config)); assertThat(exception.getMessage(), equalTo("java.lang.RuntimeException: could not compile script")); assertThat(exception.getHeader("processor_tag").get(0), equalTo(processorTag)); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/FailProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/FailProcessorTests.java index 76685854d2..c05323c12e 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/FailProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/FailProcessorTests.java @@ -31,8 +31,8 @@ public class FailProcessorTests extends ESTestCase { public void test() throws Exception { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random()); - String message = randomAsciiOfLength(10); - Processor processor = new FailProcessor(randomAsciiOfLength(10), new TestTemplateService.MockTemplate(message)); + String message = randomAlphaOfLength(10); + Processor processor = new FailProcessor(randomAlphaOfLength(10), new TestTemplateService.MockTemplate(message)); try { processor.execute(ingestDocument); fail("fail processor should throw an exception"); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/GrokProcessorFactoryTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/GrokProcessorFactoryTests.java index 37aa8adca9..4cac94cd5b 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/GrokProcessorFactoryTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/GrokProcessorFactoryTests.java @@ -38,7 +38,7 @@ public class GrokProcessorFactoryTests extends ESTestCase { Map<String, Object> config = new HashMap<>(); config.put("field", "_field"); config.put("patterns", Collections.singletonList("(?<foo>\\w+)")); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); GrokProcessor processor = factory.create(null, processorTag, config); assertThat(processor.getTag(), equalTo(processorTag)); assertThat(processor.getMatchField(), equalTo("_field")); @@ -53,7 +53,7 @@ public class GrokProcessorFactoryTests extends ESTestCase { config.put("field", "_field"); config.put("patterns", Collections.singletonList("(?<foo>\\w+)")); config.put("ignore_missing", true); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); GrokProcessor processor = factory.create(null, processorTag, config); assertThat(processor.getTag(), equalTo(processorTag)); assertThat(processor.getMatchField(), equalTo("_field")); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/GrokProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/GrokProcessorTests.java index 24d775db68..86bc780b75 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/GrokProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/GrokProcessorTests.java @@ -38,7 +38,7 @@ public class GrokProcessorTests extends ESTestCase { String fieldName = RandomDocumentPicks.randomFieldName(random()); IngestDocument doc = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); doc.setFieldValue(fieldName, "1"); - GrokProcessor processor = new GrokProcessor(randomAsciiOfLength(10), Collections.singletonMap("ONE", "1"), + GrokProcessor processor = new GrokProcessor(randomAlphaOfLength(10), Collections.singletonMap("ONE", "1"), Collections.singletonList("%{ONE:one}"), fieldName, false, false); processor.execute(doc); assertThat(doc.getFieldValue("one", String.class), equalTo("1")); @@ -48,7 +48,7 @@ public class GrokProcessorTests extends ESTestCase { String fieldName = RandomDocumentPicks.randomFieldName(random()); IngestDocument doc = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); doc.setFieldValue(fieldName, "23"); - GrokProcessor processor = new GrokProcessor(randomAsciiOfLength(10), Collections.singletonMap("ONE", "1"), + GrokProcessor processor = new GrokProcessor(randomAlphaOfLength(10), Collections.singletonMap("ONE", "1"), Collections.singletonList("%{ONE:one}"), fieldName, false, false); Exception e = expectThrows(Exception.class, () -> processor.execute(doc)); assertThat(e.getMessage(), equalTo("Provided Grok expressions do not match field value: [23]")); @@ -59,7 +59,7 @@ public class GrokProcessorTests extends ESTestCase { IngestDocument originalDoc = new IngestDocument(new HashMap<>(), new HashMap<>()); originalDoc.setFieldValue(fieldName, fieldName); IngestDocument doc = new IngestDocument(originalDoc); - GrokProcessor processor = new GrokProcessor(randomAsciiOfLength(10), Collections.emptyMap(), + GrokProcessor processor = new GrokProcessor(randomAlphaOfLength(10), Collections.emptyMap(), Collections.singletonList(fieldName), fieldName, false, false); processor.execute(doc); assertThat(doc, equalTo(originalDoc)); @@ -69,7 +69,7 @@ public class GrokProcessorTests extends ESTestCase { String fieldName = RandomDocumentPicks.randomFieldName(random()); IngestDocument doc = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); doc.setFieldValue(fieldName, null); - GrokProcessor processor = new GrokProcessor(randomAsciiOfLength(10), Collections.singletonMap("ONE", "1"), + GrokProcessor processor = new GrokProcessor(randomAlphaOfLength(10), Collections.singletonMap("ONE", "1"), Collections.singletonList("%{ONE:one}"), fieldName, false, false); Exception e = expectThrows(Exception.class, () -> processor.execute(doc)); assertThat(e.getMessage(), equalTo("field [" + fieldName + "] is null, cannot process it.")); @@ -80,7 +80,7 @@ public class GrokProcessorTests extends ESTestCase { IngestDocument originalIngestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); originalIngestDocument.setFieldValue(fieldName, null); IngestDocument ingestDocument = new IngestDocument(originalIngestDocument); - GrokProcessor processor = new GrokProcessor(randomAsciiOfLength(10), Collections.singletonMap("ONE", "1"), + GrokProcessor processor = new GrokProcessor(randomAlphaOfLength(10), Collections.singletonMap("ONE", "1"), Collections.singletonList("%{ONE:one}"), fieldName, false, true); processor.execute(ingestDocument); assertIngestDocument(originalIngestDocument, ingestDocument); @@ -90,7 +90,7 @@ public class GrokProcessorTests extends ESTestCase { String fieldName = RandomDocumentPicks.randomFieldName(random()); IngestDocument doc = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); doc.setFieldValue(fieldName, 1); - GrokProcessor processor = new GrokProcessor(randomAsciiOfLength(10), Collections.singletonMap("ONE", "1"), + GrokProcessor processor = new GrokProcessor(randomAlphaOfLength(10), Collections.singletonMap("ONE", "1"), Collections.singletonList("%{ONE:one}"), fieldName, false, false); Exception e = expectThrows(Exception.class, () -> processor.execute(doc)); assertThat(e.getMessage(), equalTo("field [" + fieldName + "] of type [java.lang.Integer] cannot be cast to [java.lang.String]")); @@ -100,7 +100,7 @@ public class GrokProcessorTests extends ESTestCase { String fieldName = RandomDocumentPicks.randomFieldName(random()); IngestDocument doc = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); doc.setFieldValue(fieldName, 1); - GrokProcessor processor = new GrokProcessor(randomAsciiOfLength(10), Collections.singletonMap("ONE", "1"), + GrokProcessor processor = new GrokProcessor(randomAlphaOfLength(10), Collections.singletonMap("ONE", "1"), Collections.singletonList("%{ONE:one}"), fieldName, false, true); Exception e = expectThrows(Exception.class, () -> processor.execute(doc)); assertThat(e.getMessage(), equalTo("field [" + fieldName + "] of type [java.lang.Integer] cannot be cast to [java.lang.String]")); @@ -109,7 +109,7 @@ public class GrokProcessorTests extends ESTestCase { public void testMissingField() { String fieldName = "foo.bar"; IngestDocument doc = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); - GrokProcessor processor = new GrokProcessor(randomAsciiOfLength(10), Collections.singletonMap("ONE", "1"), + GrokProcessor processor = new GrokProcessor(randomAlphaOfLength(10), Collections.singletonMap("ONE", "1"), Collections.singletonList("%{ONE:one}"), fieldName, false, false); Exception e = expectThrows(Exception.class, () -> processor.execute(doc)); assertThat(e.getMessage(), equalTo("field [foo] not present as part of path [foo.bar]")); @@ -119,7 +119,7 @@ public class GrokProcessorTests extends ESTestCase { String fieldName = "foo.bar"; IngestDocument originalIngestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); - GrokProcessor processor = new GrokProcessor(randomAsciiOfLength(10), Collections.singletonMap("ONE", "1"), + GrokProcessor processor = new GrokProcessor(randomAlphaOfLength(10), Collections.singletonMap("ONE", "1"), Collections.singletonList("%{ONE:one}"), fieldName, false, true); processor.execute(ingestDocument); assertIngestDocument(originalIngestDocument, ingestDocument); @@ -133,7 +133,7 @@ public class GrokProcessorTests extends ESTestCase { patternBank.put("ONE", "1"); patternBank.put("TWO", "2"); patternBank.put("THREE", "3"); - GrokProcessor processor = new GrokProcessor(randomAsciiOfLength(10), patternBank, + GrokProcessor processor = new GrokProcessor(randomAlphaOfLength(10), patternBank, Arrays.asList("%{ONE:one}", "%{TWO:two}", "%{THREE:three}"), fieldName, false, false); processor.execute(doc); assertThat(doc.hasField("one"), equalTo(false)); @@ -149,7 +149,7 @@ public class GrokProcessorTests extends ESTestCase { patternBank.put("ONE", "1"); patternBank.put("TWO", "2"); patternBank.put("THREE", "3"); - GrokProcessor processor = new GrokProcessor(randomAsciiOfLength(10), patternBank, + GrokProcessor processor = new GrokProcessor(randomAlphaOfLength(10), patternBank, Arrays.asList("%{ONE:one}", "%{TWO:two}", "%{THREE:three}"), fieldName, true, false); processor.execute(doc); assertThat(doc.hasField("one"), equalTo(false)); @@ -164,7 +164,7 @@ public class GrokProcessorTests extends ESTestCase { doc.setFieldValue(fieldName, "first1"); Map<String, String> patternBank = new HashMap<>(); patternBank.put("ONE", "1"); - GrokProcessor processor = new GrokProcessor(randomAsciiOfLength(10), patternBank, + GrokProcessor processor = new GrokProcessor(randomAlphaOfLength(10), patternBank, Arrays.asList("%{ONE:one}"), fieldName, true, false); processor.execute(doc); assertThat(doc.hasField("one"), equalTo(true)); @@ -195,7 +195,7 @@ public class GrokProcessorTests extends ESTestCase { patternBank.put("ONE", "1"); patternBank.put("TWO", "2"); patternBank.put("THREE", "3"); - GrokProcessor processor = new GrokProcessor(randomAsciiOfLength(10), patternBank, + GrokProcessor processor = new GrokProcessor(randomAlphaOfLength(10), patternBank, Arrays.asList("%{ONE:first}-%{TWO:second}", "%{ONE:first}-%{THREE:second}"), fieldName, randomBoolean(), randomBoolean()); processor.execute(doc); assertThat(doc.getFieldValue("first", String.class), equalTo("1")); @@ -208,7 +208,7 @@ public class GrokProcessorTests extends ESTestCase { doc.setFieldValue(fieldName, "12"); Map<String, String> patternBank = new HashMap<>(); patternBank.put("ONETWO", "1|2"); - GrokProcessor processor = new GrokProcessor(randomAsciiOfLength(10), patternBank, + GrokProcessor processor = new GrokProcessor(randomAlphaOfLength(10), patternBank, Collections.singletonList("%{ONETWO:first}%{ONETWO:first}"), fieldName, randomBoolean(), randomBoolean()); processor.execute(doc); assertThat(doc.getFieldValue("first", String.class), equalTo("1")); @@ -221,7 +221,7 @@ public class GrokProcessorTests extends ESTestCase { Map<String, String> patternBank = new HashMap<>(); patternBank.put("ONETWO", "1|2"); patternBank.put("THREE", "3"); - GrokProcessor processor = new GrokProcessor(randomAsciiOfLength(10), patternBank, + GrokProcessor processor = new GrokProcessor(randomAlphaOfLength(10), patternBank, Collections.singletonList("%{ONETWO:first}|%{THREE:second}"), fieldName, randomBoolean(), randomBoolean()); processor.execute(doc); assertFalse(doc.hasField("first")); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/GsubProcessorFactoryTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/GsubProcessorFactoryTests.java index 51e246c67e..f7947c2162 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/GsubProcessorFactoryTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/GsubProcessorFactoryTests.java @@ -36,7 +36,7 @@ public class GsubProcessorFactoryTests extends ESTestCase { config.put("field", "field1"); config.put("pattern", "\\."); config.put("replacement", "-"); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); GsubProcessor gsubProcessor = factory.create(null, processorTag, config); assertThat(gsubProcessor.getTag(), equalTo(processorTag)); assertThat(gsubProcessor.getField(), equalTo("field1")); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/GsubProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/GsubProcessorTests.java index 20dc5b8c8d..d791d34722 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/GsubProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/GsubProcessorTests.java @@ -36,7 +36,7 @@ public class GsubProcessorTests extends ESTestCase { public void testGsub() throws Exception { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random()); String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, "127.0.0.1"); - Processor processor = new GsubProcessor(randomAsciiOfLength(10), fieldName, Pattern.compile("\\."), "-"); + Processor processor = new GsubProcessor(randomAlphaOfLength(10), fieldName, Pattern.compile("\\."), "-"); processor.execute(ingestDocument); assertThat(ingestDocument.getFieldValue(fieldName, String.class), equalTo("127-0-0-1")); } @@ -45,7 +45,7 @@ public class GsubProcessorTests extends ESTestCase { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); String fieldName = RandomDocumentPicks.randomFieldName(random()); ingestDocument.setFieldValue(fieldName, 123); - Processor processor = new GsubProcessor(randomAsciiOfLength(10), fieldName, Pattern.compile("\\."), "-"); + Processor processor = new GsubProcessor(randomAlphaOfLength(10), fieldName, Pattern.compile("\\."), "-"); try { processor.execute(ingestDocument); fail("processor execution should have failed"); @@ -58,7 +58,7 @@ public class GsubProcessorTests extends ESTestCase { public void testGsubFieldNotFound() throws Exception { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); String fieldName = RandomDocumentPicks.randomFieldName(random()); - Processor processor = new GsubProcessor(randomAsciiOfLength(10), fieldName, Pattern.compile("\\."), "-"); + Processor processor = new GsubProcessor(randomAlphaOfLength(10), fieldName, Pattern.compile("\\."), "-"); try { processor.execute(ingestDocument); fail("processor execution should have failed"); @@ -69,7 +69,7 @@ public class GsubProcessorTests extends ESTestCase { public void testGsubNullValue() throws Exception { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), Collections.singletonMap("field", null)); - Processor processor = new GsubProcessor(randomAsciiOfLength(10), "field", Pattern.compile("\\."), "-"); + Processor processor = new GsubProcessor(randomAlphaOfLength(10), "field", Pattern.compile("\\."), "-"); try { processor.execute(ingestDocument); fail("processor execution should have failed"); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/JoinProcessorFactoryTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/JoinProcessorFactoryTests.java index 68b2daecb4..0eda639afc 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/JoinProcessorFactoryTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/JoinProcessorFactoryTests.java @@ -34,7 +34,7 @@ public class JoinProcessorFactoryTests extends ESTestCase { Map<String, Object> config = new HashMap<>(); config.put("field", "field1"); config.put("separator", "-"); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); JoinProcessor joinProcessor = factory.create(null, processorTag, config); assertThat(joinProcessor.getTag(), equalTo(processorTag)); assertThat(joinProcessor.getField(), equalTo("field1")); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/JoinProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/JoinProcessorTests.java index 078d636570..b7ef9d675c 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/JoinProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/JoinProcessorTests.java @@ -43,7 +43,7 @@ public class JoinProcessorTests extends ESTestCase { List<String> fieldValue = new ArrayList<>(numItems); String expectedResult = ""; for (int j = 0; j < numItems; j++) { - String value = randomAsciiOfLengthBetween(1, 10); + String value = randomAlphaOfLengthBetween(1, 10); fieldValue.add(value); expectedResult += value; if (j < numItems - 1) { @@ -51,7 +51,7 @@ public class JoinProcessorTests extends ESTestCase { } } String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, fieldValue); - Processor processor = new JoinProcessor(randomAsciiOfLength(10), fieldName, separator); + Processor processor = new JoinProcessor(randomAlphaOfLength(10), fieldName, separator); processor.execute(ingestDocument); assertThat(ingestDocument.getFieldValue(fieldName, String.class), equalTo(expectedResult)); } @@ -71,7 +71,7 @@ public class JoinProcessorTests extends ESTestCase { } } String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, fieldValue); - Processor processor = new JoinProcessor(randomAsciiOfLength(10), fieldName, separator); + Processor processor = new JoinProcessor(randomAlphaOfLength(10), fieldName, separator); processor.execute(ingestDocument); assertThat(ingestDocument.getFieldValue(fieldName, String.class), equalTo(expectedResult)); } @@ -79,8 +79,8 @@ public class JoinProcessorTests extends ESTestCase { public void testJoinNonListField() throws Exception { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); String fieldName = RandomDocumentPicks.randomFieldName(random()); - ingestDocument.setFieldValue(fieldName, randomAsciiOfLengthBetween(1, 10)); - Processor processor = new JoinProcessor(randomAsciiOfLength(10), fieldName, "-"); + ingestDocument.setFieldValue(fieldName, randomAlphaOfLengthBetween(1, 10)); + Processor processor = new JoinProcessor(randomAlphaOfLength(10), fieldName, "-"); try { processor.execute(ingestDocument); } catch(IllegalArgumentException e) { @@ -91,7 +91,7 @@ public class JoinProcessorTests extends ESTestCase { public void testJoinNonExistingField() throws Exception { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); String fieldName = RandomDocumentPicks.randomFieldName(random()); - Processor processor = new JoinProcessor(randomAsciiOfLength(10), fieldName, "-"); + Processor processor = new JoinProcessor(randomAlphaOfLength(10), fieldName, "-"); try { processor.execute(ingestDocument); } catch(IllegalArgumentException e) { @@ -101,7 +101,7 @@ public class JoinProcessorTests extends ESTestCase { public void testJoinNullValue() throws Exception { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), Collections.singletonMap("field", null)); - Processor processor = new JoinProcessor(randomAsciiOfLength(10), "field", "-"); + Processor processor = new JoinProcessor(randomAlphaOfLength(10), "field", "-"); try { processor.execute(ingestDocument); } catch(IllegalArgumentException e) { diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/JsonProcessorFactoryTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/JsonProcessorFactoryTests.java index 456b31f872..66f163a31e 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/JsonProcessorFactoryTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/JsonProcessorFactoryTests.java @@ -21,11 +21,8 @@ package org.elasticsearch.ingest.common; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ElasticsearchParseException; -import org.elasticsearch.ingest.TestTemplateService; import org.elasticsearch.test.ESTestCase; -import org.junit.Before; -import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -36,9 +33,9 @@ public class JsonProcessorFactoryTests extends ESTestCase { private static final JsonProcessor.Factory FACTORY = new JsonProcessor.Factory(); public void testCreate() throws Exception { - String processorTag = randomAsciiOfLength(10); - String randomField = randomAsciiOfLength(10); - String randomTargetField = randomAsciiOfLength(5); + String processorTag = randomAlphaOfLength(10); + String randomField = randomAlphaOfLength(10); + String randomTargetField = randomAlphaOfLength(5); Map<String, Object> config = new HashMap<>(); config.put("field", randomField); config.put("target_field", randomTargetField); @@ -49,8 +46,8 @@ public class JsonProcessorFactoryTests extends ESTestCase { } public void testCreateWithAddToRoot() throws Exception { - String processorTag = randomAsciiOfLength(10); - String randomField = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); + String randomField = randomAlphaOfLength(10); Map<String, Object> config = new HashMap<>(); config.put("field", randomField); config.put("add_to_root", true); @@ -62,8 +59,8 @@ public class JsonProcessorFactoryTests extends ESTestCase { } public void testCreateWithDefaultTarget() throws Exception { - String processorTag = randomAsciiOfLength(10); - String randomField = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); + String randomField = randomAlphaOfLength(10); Map<String, Object> config = new HashMap<>(); config.put("field", randomField); JsonProcessor jsonProcessor = FACTORY.create(null, processorTag, config); @@ -74,21 +71,21 @@ public class JsonProcessorFactoryTests extends ESTestCase { public void testCreateWithMissingField() throws Exception { Map<String, Object> config = new HashMap<>(); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); ElasticsearchException exception = expectThrows(ElasticsearchParseException.class, () -> FACTORY.create(null, processorTag, config)); assertThat(exception.getMessage(), equalTo("[field] required property is missing")); } public void testCreateWithBothTargetFieldAndAddToRoot() throws Exception { - String randomField = randomAsciiOfLength(10); - String randomTargetField = randomAsciiOfLength(5); + String randomField = randomAlphaOfLength(10); + String randomTargetField = randomAlphaOfLength(5); Map<String, Object> config = new HashMap<>(); config.put("field", randomField); config.put("target_field", randomTargetField); config.put("add_to_root", true); ElasticsearchException exception = expectThrows(ElasticsearchParseException.class, - () -> FACTORY.create(null, randomAsciiOfLength(10), config)); + () -> FACTORY.create(null, randomAlphaOfLength(10), config)); assertThat(exception.getMessage(), equalTo("[target_field] Cannot set a target field while also setting `add_to_root` to true")); } } diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/JsonProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/JsonProcessorTests.java index 5d087ebbc1..66ffb87e8d 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/JsonProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/JsonProcessorTests.java @@ -36,9 +36,9 @@ public class JsonProcessorTests extends ESTestCase { @SuppressWarnings("unchecked") public void testExecute() throws Exception { - String processorTag = randomAsciiOfLength(3); - String randomField = randomAsciiOfLength(3); - String randomTargetField = randomAsciiOfLength(2); + String processorTag = randomAlphaOfLength(3); + String randomField = randomAlphaOfLength(3); + String randomTargetField = randomAlphaOfLength(2); JsonProcessor jsonProcessor = new JsonProcessor(processorTag, randomField, randomTargetField, false); Map<String, Object> document = new HashMap<>(); @@ -76,8 +76,8 @@ public class JsonProcessorTests extends ESTestCase { @SuppressWarnings("unchecked") public void testAddToRoot() throws Exception { - String processorTag = randomAsciiOfLength(3); - String randomTargetField = randomAsciiOfLength(2); + String processorTag = randomAlphaOfLength(3); + String randomTargetField = randomAlphaOfLength(2); JsonProcessor jsonProcessor = new JsonProcessor(processorTag, "a", randomTargetField, true); Map<String, Object> document = new HashMap<>(); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/KeyValueProcessorFactoryTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/KeyValueProcessorFactoryTests.java index 4dc4e08265..8c1e8a7149 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/KeyValueProcessorFactoryTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/KeyValueProcessorFactoryTests.java @@ -39,7 +39,7 @@ public class KeyValueProcessorFactoryTests extends ESTestCase { config.put("field", "field1"); config.put("field_split", "&"); config.put("value_split", "="); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); KeyValueProcessor processor = factory.create(null, processorTag, config); assertThat(processor.getTag(), equalTo(processorTag)); assertThat(processor.getField(), equalTo("field1")); @@ -59,7 +59,7 @@ public class KeyValueProcessorFactoryTests extends ESTestCase { config.put("target_field", "target"); config.put("include_keys", Arrays.asList("a", "b")); config.put("ignore_missing", true); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); KeyValueProcessor processor = factory.create(null, processorTag, config); assertThat(processor.getTag(), equalTo(processorTag)); assertThat(processor.getField(), equalTo("field1")); @@ -73,7 +73,7 @@ public class KeyValueProcessorFactoryTests extends ESTestCase { public void testCreateWithMissingField() { KeyValueProcessor.Factory factory = new KeyValueProcessor.Factory(); Map<String, Object> config = new HashMap<>(); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); ElasticsearchException exception = expectThrows(ElasticsearchParseException.class, () -> factory.create(null, processorTag, config)); assertThat(exception.getMessage(), equalTo("[field] required property is missing")); @@ -83,7 +83,7 @@ public class KeyValueProcessorFactoryTests extends ESTestCase { KeyValueProcessor.Factory factory = new KeyValueProcessor.Factory(); Map<String, Object> config = new HashMap<>(); config.put("field", "field1"); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); ElasticsearchException exception = expectThrows(ElasticsearchParseException.class, () -> factory.create(null, processorTag, config)); assertThat(exception.getMessage(), equalTo("[field_split] required property is missing")); @@ -94,7 +94,7 @@ public class KeyValueProcessorFactoryTests extends ESTestCase { Map<String, Object> config = new HashMap<>(); config.put("field", "field1"); config.put("field_split", "&"); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); ElasticsearchException exception = expectThrows(ElasticsearchParseException.class, () -> factory.create(null, processorTag, config)); assertThat(exception.getMessage(), equalTo("[value_split] required property is missing")); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/KeyValueProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/KeyValueProcessorTests.java index f5db4be143..1c7103d35b 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/KeyValueProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/KeyValueProcessorTests.java @@ -36,7 +36,7 @@ public class KeyValueProcessorTests extends ESTestCase { public void test() throws Exception { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random()); String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, "first=hello&second=world&second=universe"); - Processor processor = new KeyValueProcessor(randomAsciiOfLength(10), fieldName, "&", "=", null, "target", false); + Processor processor = new KeyValueProcessor(randomAlphaOfLength(10), fieldName, "&", "=", null, "target", false); processor.execute(ingestDocument); assertThat(ingestDocument.getFieldValue("target.first", String.class), equalTo("hello")); assertThat(ingestDocument.getFieldValue("target.second", List.class), equalTo(Arrays.asList("world", "universe"))); @@ -45,7 +45,7 @@ public class KeyValueProcessorTests extends ESTestCase { public void testRootTarget() throws Exception { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), Collections.emptyMap()); ingestDocument.setFieldValue("myField", "first=hello&second=world&second=universe"); - Processor processor = new KeyValueProcessor(randomAsciiOfLength(10), "myField", "&", "=", null, null, false); + Processor processor = new KeyValueProcessor(randomAlphaOfLength(10), "myField", "&", "=", null, null, false); processor.execute(ingestDocument); assertThat(ingestDocument.getFieldValue("first", String.class), equalTo("hello")); assertThat(ingestDocument.getFieldValue("second", List.class), equalTo(Arrays.asList("world", "universe"))); @@ -54,7 +54,7 @@ public class KeyValueProcessorTests extends ESTestCase { public void testKeySameAsSourceField() throws Exception { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), Collections.emptyMap()); ingestDocument.setFieldValue("first", "first=hello"); - Processor processor = new KeyValueProcessor(randomAsciiOfLength(10), "first", "&", "=", null, null, false); + Processor processor = new KeyValueProcessor(randomAlphaOfLength(10), "first", "&", "=", null, null, false); processor.execute(ingestDocument); assertThat(ingestDocument.getFieldValue("first", List.class), equalTo(Arrays.asList("first=hello", "hello"))); } @@ -62,7 +62,7 @@ public class KeyValueProcessorTests extends ESTestCase { public void testIncludeKeys() throws Exception { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random()); String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, "first=hello&second=world&second=universe"); - Processor processor = new KeyValueProcessor(randomAsciiOfLength(10), fieldName, "&", "=", + Processor processor = new KeyValueProcessor(randomAlphaOfLength(10), fieldName, "&", "=", Collections.singletonList("first"), "target", false); processor.execute(ingestDocument); assertThat(ingestDocument.getFieldValue("target.first", String.class), equalTo("hello")); @@ -71,7 +71,7 @@ public class KeyValueProcessorTests extends ESTestCase { public void testMissingField() { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), Collections.emptyMap()); - Processor processor = new KeyValueProcessor(randomAsciiOfLength(10), "unknown", "&", "=", null, "target", false); + Processor processor = new KeyValueProcessor(randomAlphaOfLength(10), "unknown", "&", "=", null, "target", false); IllegalArgumentException exception = expectThrows(IllegalArgumentException.class, () -> processor.execute(ingestDocument)); assertThat(exception.getMessage(), equalTo("field [unknown] not present as part of path [unknown]")); } @@ -81,7 +81,7 @@ public class KeyValueProcessorTests extends ESTestCase { IngestDocument originalIngestDocument = RandomDocumentPicks.randomIngestDocument(random(), Collections.singletonMap(fieldName, null)); IngestDocument ingestDocument = new IngestDocument(originalIngestDocument); - Processor processor = new KeyValueProcessor(randomAsciiOfLength(10), fieldName, "", "", null, "target", true); + Processor processor = new KeyValueProcessor(randomAlphaOfLength(10), fieldName, "", "", null, "target", true); processor.execute(ingestDocument); assertIngestDocument(originalIngestDocument, ingestDocument); } @@ -89,7 +89,7 @@ public class KeyValueProcessorTests extends ESTestCase { public void testNonExistentWithIgnoreMissing() throws Exception { IngestDocument originalIngestDocument = RandomDocumentPicks.randomIngestDocument(random(), Collections.emptyMap()); IngestDocument ingestDocument = new IngestDocument(originalIngestDocument); - Processor processor = new KeyValueProcessor(randomAsciiOfLength(10), "unknown", "", "", null, "target", true); + Processor processor = new KeyValueProcessor(randomAlphaOfLength(10), "unknown", "", "", null, "target", true); processor.execute(ingestDocument); assertIngestDocument(originalIngestDocument, ingestDocument); } @@ -97,7 +97,7 @@ public class KeyValueProcessorTests extends ESTestCase { public void testFailFieldSplitMatch() throws Exception { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random()); String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, "first=hello|second=world|second=universe"); - Processor processor = new KeyValueProcessor(randomAsciiOfLength(10), fieldName, "&", "=", null, "target", false); + Processor processor = new KeyValueProcessor(randomAlphaOfLength(10), fieldName, "&", "=", null, "target", false); processor.execute(ingestDocument); assertThat(ingestDocument.getFieldValue("target.first", String.class), equalTo("hello|second=world|second=universe")); assertFalse(ingestDocument.hasField("target.second")); @@ -105,7 +105,7 @@ public class KeyValueProcessorTests extends ESTestCase { public void testFailValueSplitMatch() throws Exception { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), Collections.singletonMap("foo", "bar")); - Processor processor = new KeyValueProcessor(randomAsciiOfLength(10), "foo", "&", "=", null, "target", false); + Processor processor = new KeyValueProcessor(randomAlphaOfLength(10), "foo", "&", "=", null, "target", false); Exception exception = expectThrows(IllegalArgumentException.class, () -> processor.execute(ingestDocument)); assertThat(exception.getMessage(), equalTo("field [foo] does not contain value_split [=]")); } diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/LowercaseProcessorFactoryTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/LowercaseProcessorFactoryTests.java index 2c80071b80..dc12556df4 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/LowercaseProcessorFactoryTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/LowercaseProcessorFactoryTests.java @@ -34,7 +34,7 @@ public class LowercaseProcessorFactoryTests extends ESTestCase { LowercaseProcessor.Factory factory = new LowercaseProcessor.Factory(); Map<String, Object> config = new HashMap<>(); config.put("field", "field1"); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); LowercaseProcessor uppercaseProcessor = (LowercaseProcessor)factory.create(null, processorTag, config); assertThat(uppercaseProcessor.getTag(), equalTo(processorTag)); assertThat(uppercaseProcessor.getField(), equalTo("field1")); @@ -46,7 +46,7 @@ public class LowercaseProcessorFactoryTests extends ESTestCase { Map<String, Object> config = new HashMap<>(); config.put("field", "field1"); config.put("ignore_missing", true); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); LowercaseProcessor uppercaseProcessor = (LowercaseProcessor)factory.create(null, processorTag, config); assertThat(uppercaseProcessor.getTag(), equalTo(processorTag)); assertThat(uppercaseProcessor.getField(), equalTo("field1")); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/LowercaseProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/LowercaseProcessorTests.java index 560a949f15..77e26d3eb9 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/LowercaseProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/LowercaseProcessorTests.java @@ -24,7 +24,7 @@ import java.util.Locale; public class LowercaseProcessorTests extends AbstractStringProcessorTestCase { @Override protected AbstractStringProcessor newProcessor(String field, boolean ignoreMissing) { - return new LowercaseProcessor(randomAsciiOfLength(10), field, ignoreMissing); + return new LowercaseProcessor(randomAlphaOfLength(10), field, ignoreMissing); } @Override diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/RemoveProcessorFactoryTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/RemoveProcessorFactoryTests.java index 71e878744d..d53e5ff1cd 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/RemoveProcessorFactoryTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/RemoveProcessorFactoryTests.java @@ -43,7 +43,7 @@ public class RemoveProcessorFactoryTests extends ESTestCase { public void testCreate() throws Exception { Map<String, Object> config = new HashMap<>(); config.put("field", "field1"); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); RemoveProcessor removeProcessor = factory.create(null, processorTag, config); assertThat(removeProcessor.getTag(), equalTo(processorTag)); assertThat(removeProcessor.getField().execute(Collections.emptyMap()), equalTo("field1")); @@ -63,7 +63,7 @@ public class RemoveProcessorFactoryTests extends ESTestCase { RemoveProcessor.Factory factory = new RemoveProcessor.Factory(TestTemplateService.instance(true)); Map<String, Object> config = new HashMap<>(); config.put("field", "field1"); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); ElasticsearchException exception = expectThrows(ElasticsearchException.class, () -> factory.create(null, processorTag, config)); assertThat(exception.getMessage(), equalTo("java.lang.RuntimeException: could not compile script")); assertThat(exception.getHeader("processor_tag").get(0), equalTo(processorTag)); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/RemoveProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/RemoveProcessorTests.java index fd569567d1..60748a5203 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/RemoveProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/RemoveProcessorTests.java @@ -35,7 +35,7 @@ public class RemoveProcessorTests extends ESTestCase { public void testRemoveFields() throws Exception { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random()); String field = RandomDocumentPicks.randomExistingFieldName(random(), ingestDocument); - Processor processor = new RemoveProcessor(randomAsciiOfLength(10), new TestTemplateService.MockTemplate(field)); + Processor processor = new RemoveProcessor(randomAlphaOfLength(10), new TestTemplateService.MockTemplate(field)); processor.execute(ingestDocument); assertThat(ingestDocument.hasField(field), equalTo(false)); } @@ -43,7 +43,7 @@ public class RemoveProcessorTests extends ESTestCase { public void testRemoveNonExistingField() throws Exception { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); String fieldName = RandomDocumentPicks.randomFieldName(random()); - Processor processor = new RemoveProcessor(randomAsciiOfLength(10), new TestTemplateService.MockTemplate(fieldName)); + Processor processor = new RemoveProcessor(randomAlphaOfLength(10), new TestTemplateService.MockTemplate(fieldName)); try { processor.execute(ingestDocument); fail("remove field should have failed"); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/RenameProcessorFactoryTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/RenameProcessorFactoryTests.java index b631b78bf0..1eaac36a64 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/RenameProcessorFactoryTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/RenameProcessorFactoryTests.java @@ -34,7 +34,7 @@ public class RenameProcessorFactoryTests extends ESTestCase { Map<String, Object> config = new HashMap<>(); config.put("field", "old_field"); config.put("target_field", "new_field"); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); RenameProcessor renameProcessor = factory.create(null, processorTag, config); assertThat(renameProcessor.getTag(), equalTo(processorTag)); assertThat(renameProcessor.getField(), equalTo("old_field")); @@ -48,7 +48,7 @@ public class RenameProcessorFactoryTests extends ESTestCase { config.put("field", "old_field"); config.put("target_field", "new_field"); config.put("ignore_missing", true); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); RenameProcessor renameProcessor = factory.create(null, processorTag, config); assertThat(renameProcessor.getTag(), equalTo(processorTag)); assertThat(renameProcessor.getField(), equalTo("old_field")); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/RenameProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/RenameProcessorTests.java index 9fae812822..758e5eb997 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/RenameProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/RenameProcessorTests.java @@ -45,7 +45,7 @@ public class RenameProcessorTests extends ESTestCase { do { newFieldName = RandomDocumentPicks.randomFieldName(random()); } while (RandomDocumentPicks.canAddField(newFieldName, ingestDocument) == false || newFieldName.equals(fieldName)); - Processor processor = new RenameProcessor(randomAsciiOfLength(10), fieldName, newFieldName, false); + Processor processor = new RenameProcessor(randomAlphaOfLength(10), fieldName, newFieldName, false); processor.execute(ingestDocument); assertThat(ingestDocument.getFieldValue(newFieldName, Object.class), equalTo(fieldValue)); } @@ -63,7 +63,7 @@ public class RenameProcessorTests extends ESTestCase { document.put("one", one); IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), document); - Processor processor = new RenameProcessor(randomAsciiOfLength(10), "list.0", "item", false); + Processor processor = new RenameProcessor(randomAlphaOfLength(10), "list.0", "item", false); processor.execute(ingestDocument); Object actualObject = ingestDocument.getSourceAndMetadata().get("list"); assertThat(actualObject, instanceOf(List.class)); @@ -76,7 +76,7 @@ public class RenameProcessorTests extends ESTestCase { assertThat(actualObject, instanceOf(String.class)); assertThat(actualObject, equalTo("item1")); - processor = new RenameProcessor(randomAsciiOfLength(10), "list.0", "list.3", false); + processor = new RenameProcessor(randomAlphaOfLength(10), "list.0", "list.3", false); try { processor.execute(ingestDocument); fail("processor execute should have failed"); @@ -91,7 +91,7 @@ public class RenameProcessorTests extends ESTestCase { public void testRenameNonExistingField() throws Exception { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); String fieldName = RandomDocumentPicks.randomFieldName(random()); - Processor processor = new RenameProcessor(randomAsciiOfLength(10), fieldName, + Processor processor = new RenameProcessor(randomAlphaOfLength(10), fieldName, RandomDocumentPicks.randomFieldName(random()), false); try { processor.execute(ingestDocument); @@ -105,7 +105,7 @@ public class RenameProcessorTests extends ESTestCase { IngestDocument originalIngestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); IngestDocument ingestDocument = new IngestDocument(originalIngestDocument); String fieldName = RandomDocumentPicks.randomFieldName(random()); - Processor processor = new RenameProcessor(randomAsciiOfLength(10), fieldName, + Processor processor = new RenameProcessor(randomAlphaOfLength(10), fieldName, RandomDocumentPicks.randomFieldName(random()), true); processor.execute(ingestDocument); assertIngestDocument(originalIngestDocument, ingestDocument); @@ -114,7 +114,7 @@ public class RenameProcessorTests extends ESTestCase { public void testRenameNewFieldAlreadyExists() throws Exception { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random()); String fieldName = RandomDocumentPicks.randomExistingFieldName(random(), ingestDocument); - Processor processor = new RenameProcessor(randomAsciiOfLength(10), RandomDocumentPicks.randomExistingFieldName( + Processor processor = new RenameProcessor(randomAlphaOfLength(10), RandomDocumentPicks.randomExistingFieldName( random(), ingestDocument), fieldName, false); try { processor.execute(ingestDocument); @@ -129,7 +129,7 @@ public class RenameProcessorTests extends ESTestCase { String fieldName = RandomDocumentPicks.randomFieldName(random()); ingestDocument.setFieldValue(fieldName, null); String newFieldName = RandomDocumentPicks.randomFieldName(random()); - Processor processor = new RenameProcessor(randomAsciiOfLength(10), fieldName, newFieldName, false); + Processor processor = new RenameProcessor(randomAlphaOfLength(10), fieldName, newFieldName, false); processor.execute(ingestDocument); assertThat(ingestDocument.hasField(fieldName), equalTo(false)); assertThat(ingestDocument.hasField(newFieldName), equalTo(true)); @@ -149,7 +149,7 @@ public class RenameProcessorTests extends ESTestCase { source.put("list", Collections.singletonList("item")); IngestDocument ingestDocument = new IngestDocument(source, Collections.emptyMap()); - Processor processor = new RenameProcessor(randomAsciiOfLength(10), "list", "new_field", false); + Processor processor = new RenameProcessor(randomAlphaOfLength(10), "list", "new_field", false); try { processor.execute(ingestDocument); fail("processor execute should have failed"); @@ -173,7 +173,7 @@ public class RenameProcessorTests extends ESTestCase { source.put("list", Collections.singletonList("item")); IngestDocument ingestDocument = new IngestDocument(source, Collections.emptyMap()); - Processor processor = new RenameProcessor(randomAsciiOfLength(10), "list", "new_field", false); + Processor processor = new RenameProcessor(randomAlphaOfLength(10), "list", "new_field", false); try { processor.execute(ingestDocument); fail("processor execute should have failed"); @@ -188,12 +188,12 @@ public class RenameProcessorTests extends ESTestCase { Map<String, Object> source = new HashMap<>(); source.put("foo", "bar"); IngestDocument ingestDocument = new IngestDocument(source, Collections.emptyMap()); - Processor processor1 = new RenameProcessor(randomAsciiOfLength(10), "foo", "foo.bar", false); + Processor processor1 = new RenameProcessor(randomAlphaOfLength(10), "foo", "foo.bar", false); processor1.execute(ingestDocument); assertThat(ingestDocument.getFieldValue("foo", Map.class), equalTo(Collections.singletonMap("bar", "bar"))); assertThat(ingestDocument.getFieldValue("foo.bar", String.class), equalTo("bar")); - Processor processor2 = new RenameProcessor(randomAsciiOfLength(10), "foo.bar", "foo.bar.baz", false); + Processor processor2 = new RenameProcessor(randomAlphaOfLength(10), "foo.bar", "foo.bar.baz", false); processor2.execute(ingestDocument); assertThat(ingestDocument.getFieldValue("foo", Map.class), equalTo(Collections.singletonMap("bar", Collections.singletonMap("baz", "bar")))); @@ -201,7 +201,7 @@ public class RenameProcessorTests extends ESTestCase { assertThat(ingestDocument.getFieldValue("foo.bar.baz", String.class), equalTo("bar")); // for fun lets try to restore it (which don't allow today) - Processor processor3 = new RenameProcessor(randomAsciiOfLength(10), "foo.bar.baz", "foo", false); + Processor processor3 = new RenameProcessor(randomAlphaOfLength(10), "foo.bar.baz", "foo", false); Exception e = expectThrows(IllegalArgumentException.class, () -> processor3.execute(ingestDocument)); assertThat(e.getMessage(), equalTo("field [foo] already exists")); } diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ScriptProcessorFactoryTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ScriptProcessorFactoryTests.java index 60b4297946..b3ee7a23a5 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ScriptProcessorFactoryTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ScriptProcessorFactoryTests.java @@ -57,7 +57,7 @@ public class ScriptProcessorFactoryTests extends ESTestCase { Map<String, Object> configMap = new HashMap<>(); String randomType = randomFrom("id", "inline", "file"); configMap.put(randomType, "foo"); - ScriptProcessor processor = factory.create(null, randomAsciiOfLength(10), configMap); + ScriptProcessor processor = factory.create(null, randomAlphaOfLength(10), configMap); assertThat(processor.getScript().getLang(), equalTo(Script.DEFAULT_SCRIPT_LANG)); assertThat(processor.getScript().getType().toString(), equalTo(ingestScriptParamToType.get(randomType))); assertThat(processor.getScript().getParams(), equalTo(Collections.emptyMap())); @@ -66,10 +66,10 @@ public class ScriptProcessorFactoryTests extends ESTestCase { public void testFactoryValidationWithParams() throws Exception { Map<String, Object> configMap = new HashMap<>(); String randomType = randomFrom("id", "inline", "file"); - Map<String, Object> randomParams = Collections.singletonMap(randomAsciiOfLength(10), randomAsciiOfLength(10)); + Map<String, Object> randomParams = Collections.singletonMap(randomAlphaOfLength(10), randomAlphaOfLength(10)); configMap.put(randomType, "foo"); configMap.put("params", randomParams); - ScriptProcessor processor = factory.create(null, randomAsciiOfLength(10), configMap); + ScriptProcessor processor = factory.create(null, randomAlphaOfLength(10), configMap); assertThat(processor.getScript().getLang(), equalTo(Script.DEFAULT_SCRIPT_LANG)); assertThat(processor.getScript().getType().toString(), equalTo(ingestScriptParamToType.get(randomType))); assertThat(processor.getScript().getParams(), equalTo(randomParams)); @@ -88,7 +88,7 @@ public class ScriptProcessorFactoryTests extends ESTestCase { configMap.put("lang", "mockscript"); ElasticsearchException exception = expectThrows(ElasticsearchException.class, - () -> factory.create(null, randomAsciiOfLength(10), configMap)); + () -> factory.create(null, randomAlphaOfLength(10), configMap)); assertThat(exception.getMessage(), is("Only one of [file], [id], or [inline] may be configured")); } @@ -97,7 +97,7 @@ public class ScriptProcessorFactoryTests extends ESTestCase { configMap.put("lang", "mockscript"); ElasticsearchException exception = expectThrows(ElasticsearchException.class, - () -> factory.create(null, randomAsciiOfLength(10), configMap)); + () -> factory.create(null, randomAlphaOfLength(10), configMap)); assertThat(exception.getMessage(), is("Need [file], [id], or [inline] parameter to refer to scripts")); } @@ -115,7 +115,7 @@ public class ScriptProcessorFactoryTests extends ESTestCase { configMap.put(randomType, "my_script"); ElasticsearchException exception = expectThrows(ElasticsearchException.class, - () -> factory.create(null, randomAsciiOfLength(10), configMap)); + () -> factory.create(null, randomAlphaOfLength(10), configMap)); assertThat(exception.getMessage(), is("compile-time exception")); } diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ScriptProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ScriptProcessorTests.java index 8b16fdb7e6..94430622d1 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ScriptProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ScriptProcessorTests.java @@ -58,7 +58,7 @@ public class ScriptProcessorTests extends ESTestCase { return null; }).when(executableScript).run(); - ScriptProcessor processor = new ScriptProcessor(randomAsciiOfLength(10), script, scriptService); + ScriptProcessor processor = new ScriptProcessor(randomAlphaOfLength(10), script, scriptService); processor.execute(ingestDocument); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/SetProcessorFactoryTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/SetProcessorFactoryTests.java index 45f144e330..57d0b7f7b9 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/SetProcessorFactoryTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/SetProcessorFactoryTests.java @@ -44,7 +44,7 @@ public class SetProcessorFactoryTests extends ESTestCase { Map<String, Object> config = new HashMap<>(); config.put("field", "field1"); config.put("value", "value1"); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); SetProcessor setProcessor = factory.create(null, processorTag, config); assertThat(setProcessor.getTag(), equalTo(processorTag)); assertThat(setProcessor.getField().execute(Collections.emptyMap()), equalTo("field1")); @@ -58,7 +58,7 @@ public class SetProcessorFactoryTests extends ESTestCase { config.put("field", "field1"); config.put("value", "value1"); config.put("override", overrideEnabled); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); SetProcessor setProcessor = factory.create(null, processorTag, config); assertThat(setProcessor.getTag(), equalTo(processorTag)); assertThat(setProcessor.getField().execute(Collections.emptyMap()), equalTo("field1")); @@ -105,7 +105,7 @@ public class SetProcessorFactoryTests extends ESTestCase { Map<String, Object> config = new HashMap<>(); config.put("field", "field1"); config.put("value", "value1"); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); ElasticsearchException exception = expectThrows(ElasticsearchException.class, () -> factory.create(null, processorTag, config)); assertThat(exception.getMessage(), equalTo("java.lang.RuntimeException: could not compile script")); assertThat(exception.getHeader("processor_tag").get(0), equalTo(processorTag)); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/SetProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/SetProcessorTests.java index 9ef8fa44ac..d5a693b2bc 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/SetProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/SetProcessorTests.java @@ -110,7 +110,7 @@ public class SetProcessorTests extends ESTestCase { private static Processor createSetProcessor(String fieldName, Object fieldValue, boolean overrideEnabled) { TemplateService templateService = TestTemplateService.instance(); - return new SetProcessor(randomAsciiOfLength(10), templateService.compile(fieldName), + return new SetProcessor(randomAlphaOfLength(10), templateService.compile(fieldName), ValueSource.wrap(fieldValue, templateService), overrideEnabled); } } diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/SortProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/SortProcessorTests.java index 97352109e2..6b878b00a5 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/SortProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/SortProcessorTests.java @@ -42,7 +42,7 @@ public class SortProcessorTests extends ESTestCase { List<String> fieldValue = new ArrayList<>(numItems); List<String> expectedResult = new ArrayList<>(numItems); for (int j = 0; j < numItems; j++) { - String value = randomAsciiOfLengthBetween(1, 10); + String value = randomAlphaOfLengthBetween(1, 10); fieldValue.add(value); expectedResult.add(value); } @@ -54,7 +54,7 @@ public class SortProcessorTests extends ESTestCase { } String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, fieldValue); - Processor processor = new SortProcessor(randomAsciiOfLength(10), fieldName, order); + Processor processor = new SortProcessor(randomAlphaOfLength(10), fieldName, order); processor.execute(ingestDocument); assertEquals(ingestDocument.getFieldValue(fieldName, List.class), expectedResult); } @@ -68,7 +68,7 @@ public class SortProcessorTests extends ESTestCase { Collections.shuffle(fieldValue, random()); String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, fieldValue); - Processor processor = new SortProcessor(randomAsciiOfLength(10), fieldName, SortOrder.ASCENDING); + Processor processor = new SortProcessor(randomAlphaOfLength(10), fieldName, SortOrder.ASCENDING); processor.execute(ingestDocument); assertThat(ingestDocument.getFieldValue(fieldName, List.class).toArray(), equalTo(expectedResult)); } @@ -91,7 +91,7 @@ public class SortProcessorTests extends ESTestCase { } String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, fieldValue); - Processor processor = new SortProcessor(randomAsciiOfLength(10), fieldName, order); + Processor processor = new SortProcessor(randomAlphaOfLength(10), fieldName, order); processor.execute(ingestDocument); assertEquals(ingestDocument.getFieldValue(fieldName, List.class), expectedResult); } @@ -114,7 +114,7 @@ public class SortProcessorTests extends ESTestCase { } String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, fieldValue); - Processor processor = new SortProcessor(randomAsciiOfLength(10), fieldName, order); + Processor processor = new SortProcessor(randomAlphaOfLength(10), fieldName, order); processor.execute(ingestDocument); assertEquals(ingestDocument.getFieldValue(fieldName, List.class), expectedResult); } @@ -137,7 +137,7 @@ public class SortProcessorTests extends ESTestCase { } String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, fieldValue); - Processor processor = new SortProcessor(randomAsciiOfLength(10), fieldName, order); + Processor processor = new SortProcessor(randomAlphaOfLength(10), fieldName, order); processor.execute(ingestDocument); assertEquals(ingestDocument.getFieldValue(fieldName, List.class), expectedResult); } @@ -160,7 +160,7 @@ public class SortProcessorTests extends ESTestCase { } String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, fieldValue); - Processor processor = new SortProcessor(randomAsciiOfLength(10), fieldName, order); + Processor processor = new SortProcessor(randomAlphaOfLength(10), fieldName, order); processor.execute(ingestDocument); assertEquals(ingestDocument.getFieldValue(fieldName, List.class), expectedResult); } @@ -183,7 +183,7 @@ public class SortProcessorTests extends ESTestCase { } String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, fieldValue); - Processor processor = new SortProcessor(randomAsciiOfLength(10), fieldName, order); + Processor processor = new SortProcessor(randomAlphaOfLength(10), fieldName, order); processor.execute(ingestDocument); assertEquals(ingestDocument.getFieldValue(fieldName, List.class), expectedResult); } @@ -206,7 +206,7 @@ public class SortProcessorTests extends ESTestCase { } String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, fieldValue); - Processor processor = new SortProcessor(randomAsciiOfLength(10), fieldName, order); + Processor processor = new SortProcessor(randomAlphaOfLength(10), fieldName, order); processor.execute(ingestDocument); assertEquals(ingestDocument.getFieldValue(fieldName, List.class), expectedResult); } @@ -221,7 +221,7 @@ public class SortProcessorTests extends ESTestCase { if (randomBoolean()) { value = String.valueOf(randomIntBetween(0, 100)); } else { - value = randomAsciiOfLengthBetween(1, 10); + value = randomAlphaOfLengthBetween(1, 10); } fieldValue.add(value); expectedResult.add(value); @@ -234,7 +234,7 @@ public class SortProcessorTests extends ESTestCase { } String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, fieldValue); - Processor processor = new SortProcessor(randomAsciiOfLength(10), fieldName, order); + Processor processor = new SortProcessor(randomAlphaOfLength(10), fieldName, order); processor.execute(ingestDocument); assertEquals(ingestDocument.getFieldValue(fieldName, List.class), expectedResult); } @@ -242,9 +242,9 @@ public class SortProcessorTests extends ESTestCase { public void testSortNonListField() throws Exception { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); String fieldName = RandomDocumentPicks.randomFieldName(random()); - ingestDocument.setFieldValue(fieldName, randomAsciiOfLengthBetween(1, 10)); + ingestDocument.setFieldValue(fieldName, randomAlphaOfLengthBetween(1, 10)); SortOrder order = randomBoolean() ? SortOrder.ASCENDING : SortOrder.DESCENDING; - Processor processor = new SortProcessor(randomAsciiOfLength(10), fieldName, order); + Processor processor = new SortProcessor(randomAlphaOfLength(10), fieldName, order); try { processor.execute(ingestDocument); } catch(IllegalArgumentException e) { @@ -256,7 +256,7 @@ public class SortProcessorTests extends ESTestCase { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); String fieldName = RandomDocumentPicks.randomFieldName(random()); SortOrder order = randomBoolean() ? SortOrder.ASCENDING : SortOrder.DESCENDING; - Processor processor = new SortProcessor(randomAsciiOfLength(10), fieldName, order); + Processor processor = new SortProcessor(randomAlphaOfLength(10), fieldName, order); try { processor.execute(ingestDocument); } catch(IllegalArgumentException e) { @@ -267,7 +267,7 @@ public class SortProcessorTests extends ESTestCase { public void testSortNullValue() throws Exception { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), Collections.singletonMap("field", null)); SortOrder order = randomBoolean() ? SortOrder.ASCENDING : SortOrder.DESCENDING; - Processor processor = new SortProcessor(randomAsciiOfLength(10), "field", order); + Processor processor = new SortProcessor(randomAlphaOfLength(10), "field", order); try { processor.execute(ingestDocument); } catch(IllegalArgumentException e) { diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/SplitProcessorFactoryTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/SplitProcessorFactoryTests.java index 68580eb8f1..b165dae39b 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/SplitProcessorFactoryTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/SplitProcessorFactoryTests.java @@ -34,7 +34,7 @@ public class SplitProcessorFactoryTests extends ESTestCase { Map<String, Object> config = new HashMap<>(); config.put("field", "field1"); config.put("separator", "\\."); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); SplitProcessor splitProcessor = factory.create(null, processorTag, config); assertThat(splitProcessor.getTag(), equalTo(processorTag)); assertThat(splitProcessor.getField(), equalTo("field1")); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/SplitProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/SplitProcessorTests.java index 253ddfd194..257719f7f7 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/SplitProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/SplitProcessorTests.java @@ -39,7 +39,7 @@ public class SplitProcessorTests extends ESTestCase { public void testSplit() throws Exception { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random()); String fieldName = RandomDocumentPicks.addRandomField(random(), ingestDocument, "127.0.0.1"); - Processor processor = new SplitProcessor(randomAsciiOfLength(10), fieldName, "\\.", false); + Processor processor = new SplitProcessor(randomAlphaOfLength(10), fieldName, "\\.", false); processor.execute(ingestDocument); assertThat(ingestDocument.getFieldValue(fieldName, List.class), equalTo(Arrays.asList("127", "0", "0", "1"))); } @@ -47,7 +47,7 @@ public class SplitProcessorTests extends ESTestCase { public void testSplitFieldNotFound() throws Exception { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); String fieldName = RandomDocumentPicks.randomFieldName(random()); - Processor processor = new SplitProcessor(randomAsciiOfLength(10), fieldName, "\\.", false); + Processor processor = new SplitProcessor(randomAlphaOfLength(10), fieldName, "\\.", false); try { processor.execute(ingestDocument); fail("split processor should have failed"); @@ -59,7 +59,7 @@ public class SplitProcessorTests extends ESTestCase { public void testSplitNullValue() throws Exception { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), Collections.singletonMap("field", null)); - Processor processor = new SplitProcessor(randomAsciiOfLength(10), "field", "\\.", false); + Processor processor = new SplitProcessor(randomAlphaOfLength(10), "field", "\\.", false); try { processor.execute(ingestDocument); fail("split processor should have failed"); @@ -73,7 +73,7 @@ public class SplitProcessorTests extends ESTestCase { IngestDocument originalIngestDocument = RandomDocumentPicks.randomIngestDocument(random(), Collections.singletonMap(fieldName, null)); IngestDocument ingestDocument = new IngestDocument(originalIngestDocument); - Processor processor = new SplitProcessor(randomAsciiOfLength(10), fieldName, "\\.", true); + Processor processor = new SplitProcessor(randomAlphaOfLength(10), fieldName, "\\.", true); processor.execute(ingestDocument); assertIngestDocument(originalIngestDocument, ingestDocument); } @@ -81,7 +81,7 @@ public class SplitProcessorTests extends ESTestCase { public void testSplitNonExistentWithIgnoreMissing() throws Exception { IngestDocument originalIngestDocument = RandomDocumentPicks.randomIngestDocument(random(), Collections.emptyMap()); IngestDocument ingestDocument = new IngestDocument(originalIngestDocument); - Processor processor = new SplitProcessor(randomAsciiOfLength(10), "field", "\\.", true); + Processor processor = new SplitProcessor(randomAlphaOfLength(10), "field", "\\.", true); processor.execute(ingestDocument); assertIngestDocument(originalIngestDocument, ingestDocument); } @@ -90,7 +90,7 @@ public class SplitProcessorTests extends ESTestCase { IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>()); String fieldName = RandomDocumentPicks.randomFieldName(random()); ingestDocument.setFieldValue(fieldName, randomInt()); - Processor processor = new SplitProcessor(randomAsciiOfLength(10), fieldName, "\\.", false); + Processor processor = new SplitProcessor(randomAlphaOfLength(10), fieldName, "\\.", false); try { processor.execute(ingestDocument); fail("split processor should have failed"); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/TrimProcessorFactoryTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/TrimProcessorFactoryTests.java index bcc0dde940..ee57724bfc 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/TrimProcessorFactoryTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/TrimProcessorFactoryTests.java @@ -34,7 +34,7 @@ public class TrimProcessorFactoryTests extends ESTestCase { TrimProcessor.Factory factory = new TrimProcessor.Factory(); Map<String, Object> config = new HashMap<>(); config.put("field", "field1"); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); TrimProcessor uppercaseProcessor = (TrimProcessor)factory.create(null, processorTag, config); assertThat(uppercaseProcessor.getTag(), equalTo(processorTag)); assertThat(uppercaseProcessor.getField(), equalTo("field1")); @@ -46,7 +46,7 @@ public class TrimProcessorFactoryTests extends ESTestCase { Map<String, Object> config = new HashMap<>(); config.put("field", "field1"); config.put("ignore_missing", true); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); TrimProcessor uppercaseProcessor = (TrimProcessor)factory.create(null, processorTag, config); assertThat(uppercaseProcessor.getTag(), equalTo(processorTag)); assertThat(uppercaseProcessor.getField(), equalTo("field1")); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/TrimProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/TrimProcessorTests.java index ce21cf3e38..99b543b8fe 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/TrimProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/TrimProcessorTests.java @@ -23,7 +23,7 @@ public class TrimProcessorTests extends AbstractStringProcessorTestCase { @Override protected AbstractStringProcessor newProcessor(String field, boolean ignoreMissing) { - return new TrimProcessor(randomAsciiOfLength(10), field, ignoreMissing); + return new TrimProcessor(randomAlphaOfLength(10), field, ignoreMissing); } @Override diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/UppercaseProcessorFactoryTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/UppercaseProcessorFactoryTests.java index 0f83411951..7dbdf12329 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/UppercaseProcessorFactoryTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/UppercaseProcessorFactoryTests.java @@ -33,7 +33,7 @@ public class UppercaseProcessorFactoryTests extends ESTestCase { UppercaseProcessor.Factory factory = new UppercaseProcessor.Factory(); Map<String, Object> config = new HashMap<>(); config.put("field", "field1"); - String processorTag = randomAsciiOfLength(10); + String processorTag = randomAlphaOfLength(10); UppercaseProcessor uppercaseProcessor = (UppercaseProcessor)factory.create(null, processorTag, config); assertThat(uppercaseProcessor.getTag(), equalTo(processorTag)); assertThat(uppercaseProcessor.getField(), equalTo("field1")); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/UppercaseProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/UppercaseProcessorTests.java index e52c240928..2e4c6bf9ce 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/UppercaseProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/UppercaseProcessorTests.java @@ -25,7 +25,7 @@ public class UppercaseProcessorTests extends AbstractStringProcessorTestCase { @Override protected AbstractStringProcessor newProcessor(String field, boolean ignoreMissing) { - return new UppercaseProcessor(randomAsciiOfLength(10), field, ignoreMissing); + return new UppercaseProcessor(randomAlphaOfLength(10), field, ignoreMissing); } @Override |