diff --git a/libs/geo/src/main/java/org/opensearch/geometry/utils/Geohash.java b/libs/geo/src/main/java/org/opensearch/geometry/utils/Geohash.java index 8f7cb0e034a..8bccc652c76 100644 --- a/libs/geo/src/main/java/org/opensearch/geometry/utils/Geohash.java +++ b/libs/geo/src/main/java/org/opensearch/geometry/utils/Geohash.java @@ -32,7 +32,7 @@ import java.util.Collection; * * This differs from a morton encoded value which interleaves lat/lon (y/x). * - * NOTE: this will replace {@code org.elasticsearch.common.geo.GeoHashUtils} + * NOTE: this will replace {@code org.opensearch.common.geo.GeoHashUtils} */ public class Geohash { private static final char[] BASE_32 = {'0', '1', '2', '3', '4', '5', '6', diff --git a/libs/grok/src/test/java/org/opensearch/grok/GrokTests.java b/libs/grok/src/test/java/org/opensearch/grok/GrokTests.java index 7967a453312..ae2ca4d372d 100644 --- a/libs/grok/src/test/java/org/opensearch/grok/GrokTests.java +++ b/libs/grok/src/test/java/org/opensearch/grok/GrokTests.java @@ -53,20 +53,20 @@ import static org.hamcrest.Matchers.nullValue; public class GrokTests extends OpenSearchTestCase { public void testMatchWithoutCaptures() { Grok grok = new Grok(Grok.BUILTIN_PATTERNS, "value", logger::warn); - assertThat(grok.captures("value"), equalTo(org.elasticsearch.common.collect.Map.of())); - assertThat(grok.captures("prefix_value"), equalTo(org.elasticsearch.common.collect.Map.of())); + assertThat(grok.captures("value"), equalTo(org.opensearch.common.collect.Map.of())); + assertThat(grok.captures("prefix_value"), equalTo(org.opensearch.common.collect.Map.of())); assertThat(grok.captures("no_match"), nullValue()); } public void testCaputuresBytes() { Grok grok = new Grok(Grok.BUILTIN_PATTERNS, "%{NUMBER:n:int}", logger::warn); byte[] utf8 = "10".getBytes(StandardCharsets.UTF_8); - assertThat(captureBytes(grok, utf8, 0, utf8.length), equalTo(org.elasticsearch.common.collect.Map.of("n", 10))); - assertThat(captureBytes(grok, utf8, 0, 1), equalTo(org.elasticsearch.common.collect.Map.of("n", 1))); + assertThat(captureBytes(grok, utf8, 0, utf8.length), equalTo(org.opensearch.common.collect.Map.of("n", 10))); + assertThat(captureBytes(grok, utf8, 0, 1), equalTo(org.opensearch.common.collect.Map.of("n", 1))); utf8 = "10 11 12".getBytes(StandardCharsets.UTF_8); - assertThat(captureBytes(grok, utf8, 0, 2), equalTo(org.elasticsearch.common.collect.Map.of("n", 10))); - assertThat(captureBytes(grok, utf8, 3, 2), equalTo(org.elasticsearch.common.collect.Map.of("n", 11))); - assertThat(captureBytes(grok, utf8, 6, 2), equalTo(org.elasticsearch.common.collect.Map.of("n", 12))); + assertThat(captureBytes(grok, utf8, 0, 2), equalTo(org.opensearch.common.collect.Map.of("n", 10))); + assertThat(captureBytes(grok, utf8, 3, 2), equalTo(org.opensearch.common.collect.Map.of("n", 11))); + assertThat(captureBytes(grok, utf8, 6, 2), equalTo(org.opensearch.common.collect.Map.of("n", 12))); } private Map captureBytes(Grok grok, byte[] utf8, int offset, int length) { @@ -87,15 +87,15 @@ public class GrokTests extends OpenSearchTestCase { Grok grok = new Grok(Grok.BUILTIN_PATTERNS, "%{SYSLOGLINE}", logger::warn); assertCaptureConfig( grok, - org.elasticsearch.common.collect.Map.ofEntries( - org.elasticsearch.common.collect.Map.entry("facility", STRING), - org.elasticsearch.common.collect.Map.entry("logsource", STRING), - org.elasticsearch.common.collect.Map.entry("message", STRING), - org.elasticsearch.common.collect.Map.entry("pid", STRING), - org.elasticsearch.common.collect.Map.entry("priority", STRING), - org.elasticsearch.common.collect.Map.entry("program", STRING), - org.elasticsearch.common.collect.Map.entry("timestamp", STRING), - org.elasticsearch.common.collect.Map.entry("timestamp8601", STRING) + org.opensearch.common.collect.Map.ofEntries( + org.opensearch.common.collect.Map.entry("facility", STRING), + org.opensearch.common.collect.Map.entry("logsource", STRING), + org.opensearch.common.collect.Map.entry("message", STRING), + org.opensearch.common.collect.Map.entry("pid", STRING), + org.opensearch.common.collect.Map.entry("priority", STRING), + org.opensearch.common.collect.Map.entry("program", STRING), + org.opensearch.common.collect.Map.entry("timestamp", STRING), + org.opensearch.common.collect.Map.entry("timestamp8601", STRING) ) ); Map matches = grok.captures(line); @@ -122,16 +122,16 @@ public class GrokTests extends OpenSearchTestCase { Grok grok = new Grok(Grok.BUILTIN_PATTERNS, "%{SYSLOG5424LINE}", logger::warn); assertCaptureConfig( grok, - org.elasticsearch.common.collect.Map.ofEntries( - org.elasticsearch.common.collect.Map.entry("syslog5424_app", STRING), - org.elasticsearch.common.collect.Map.entry("syslog5424_host", STRING), - org.elasticsearch.common.collect.Map.entry("syslog5424_msg", STRING), - org.elasticsearch.common.collect.Map.entry("syslog5424_msgid", STRING), - org.elasticsearch.common.collect.Map.entry("syslog5424_pri", STRING), - org.elasticsearch.common.collect.Map.entry("syslog5424_proc", STRING), - org.elasticsearch.common.collect.Map.entry("syslog5424_sd", STRING), - org.elasticsearch.common.collect.Map.entry("syslog5424_ts", STRING), - org.elasticsearch.common.collect.Map.entry("syslog5424_ver", STRING) + org.opensearch.common.collect.Map.ofEntries( + org.opensearch.common.collect.Map.entry("syslog5424_app", STRING), + org.opensearch.common.collect.Map.entry("syslog5424_host", STRING), + org.opensearch.common.collect.Map.entry("syslog5424_msg", STRING), + org.opensearch.common.collect.Map.entry("syslog5424_msgid", STRING), + org.opensearch.common.collect.Map.entry("syslog5424_pri", STRING), + org.opensearch.common.collect.Map.entry("syslog5424_proc", STRING), + org.opensearch.common.collect.Map.entry("syslog5424_sd", STRING), + org.opensearch.common.collect.Map.entry("syslog5424_ts", STRING), + org.opensearch.common.collect.Map.entry("syslog5424_ver", STRING) ) ); Map matches = grok.captures(line); @@ -149,14 +149,14 @@ public class GrokTests extends OpenSearchTestCase { public void testDatePattern() { String line = "fancy 12-12-12 12:12:12"; Grok grok = new Grok(Grok.BUILTIN_PATTERNS, "(?%{DATE_EU} %{TIME})", logger::warn); - assertCaptureConfig(grok, org.elasticsearch.common.collect.Map.of("timestamp", STRING)); + assertCaptureConfig(grok, org.opensearch.common.collect.Map.of("timestamp", STRING)); Map matches = grok.captures(line); assertEquals("12-12-12 12:12:12", matches.get("timestamp")); } public void testNilCoercedValues() { Grok grok = new Grok(Grok.BUILTIN_PATTERNS, "test (N/A|%{BASE10NUM:duration:float}ms)", logger::warn); - assertCaptureConfig(grok, org.elasticsearch.common.collect.Map.of("duration", FLOAT)); + assertCaptureConfig(grok, org.opensearch.common.collect.Map.of("duration", FLOAT)); Map matches = grok.captures("test 28.4ms"); assertEquals(28.4f, matches.get("duration")); matches = grok.captures("test N/A"); @@ -165,7 +165,7 @@ public class GrokTests extends OpenSearchTestCase { public void testNilWithNoCoercion() { Grok grok = new Grok(Grok.BUILTIN_PATTERNS, "test (N/A|%{BASE10NUM:duration}ms)", logger::warn); - assertCaptureConfig(grok, org.elasticsearch.common.collect.Map.of("duration", STRING)); + assertCaptureConfig(grok, org.opensearch.common.collect.Map.of("duration", STRING)); Map matches = grok.captures("test 28.4ms"); assertEquals("28.4", matches.get("duration")); matches = grok.captures("test N/A"); @@ -178,13 +178,13 @@ public class GrokTests extends OpenSearchTestCase { "%{GREEDYDATA:syslog_message}", logger::warn); assertCaptureConfig( grok, - org.elasticsearch.common.collect.Map.ofEntries( - org.elasticsearch.common.collect.Map.entry("syslog_hostname", STRING), - org.elasticsearch.common.collect.Map.entry("syslog_message", STRING), - org.elasticsearch.common.collect.Map.entry("syslog_pid", STRING), - org.elasticsearch.common.collect.Map.entry("syslog_pri", STRING), - org.elasticsearch.common.collect.Map.entry("syslog_program", STRING), - org.elasticsearch.common.collect.Map.entry("syslog_timestamp", STRING) + org.opensearch.common.collect.Map.ofEntries( + org.opensearch.common.collect.Map.entry("syslog_hostname", STRING), + org.opensearch.common.collect.Map.entry("syslog_message", STRING), + org.opensearch.common.collect.Map.entry("syslog_pid", STRING), + org.opensearch.common.collect.Map.entry("syslog_pri", STRING), + org.opensearch.common.collect.Map.entry("syslog_program", STRING), + org.opensearch.common.collect.Map.entry("syslog_timestamp", STRING) ) ); Map matches = grok.captures("<22>Jan 4 07:50:46 mailmaster postfix/policy-spf[9454]: : " + @@ -197,21 +197,21 @@ public class GrokTests extends OpenSearchTestCase { public void testNamedFieldsWithWholeTextMatch() { Grok grok = new Grok(Grok.BUILTIN_PATTERNS, "%{DATE_EU:stimestamp}", logger::warn); - assertCaptureConfig(grok, org.elasticsearch.common.collect.Map.of("stimestamp", STRING)); + assertCaptureConfig(grok, org.opensearch.common.collect.Map.of("stimestamp", STRING)); Map matches = grok.captures("11/01/01"); assertThat(matches.get("stimestamp"), equalTo("11/01/01")); } public void testWithOniguramaNamedCaptures() { Grok grok = new Grok(Grok.BUILTIN_PATTERNS, "(?\\w+)", logger::warn); - assertCaptureConfig(grok, org.elasticsearch.common.collect.Map.of("foo", STRING)); + assertCaptureConfig(grok, org.opensearch.common.collect.Map.of("foo", STRING)); Map matches = grok.captures("hello world"); assertThat(matches.get("foo"), equalTo("hello")); } public void testISO8601() { Grok grok = new Grok(Grok.BUILTIN_PATTERNS, "^%{TIMESTAMP_ISO8601}$", logger::warn); - assertCaptureConfig(grok, org.elasticsearch.common.collect.Map.of()); + assertCaptureConfig(grok, org.opensearch.common.collect.Map.of()); List timeMessages = Arrays.asList( "2001-01-01T00:00:00", "1974-03-02T04:09:09", @@ -236,7 +236,7 @@ public class GrokTests extends OpenSearchTestCase { public void testNotISO8601() { Grok grok = new Grok(Grok.BUILTIN_PATTERNS, "^%{TIMESTAMP_ISO8601}$", logger::warn); - assertCaptureConfig(grok, org.elasticsearch.common.collect.Map.of()); + assertCaptureConfig(grok, org.opensearch.common.collect.Map.of()); List timeMessages = Arrays.asList( "2001-13-01T00:00:00", // invalid month "2001-00-01T00:00:00", // invalid month @@ -276,7 +276,7 @@ public class GrokTests extends OpenSearchTestCase { String text = "wowza !!!Tal!!! - Tal"; String pattern = "%{EXCITED_NAME} - %{NAME}"; Grok g = new Grok(bank, pattern, false, logger::warn); - assertCaptureConfig(g, org.elasticsearch.common.collect.Map.of("EXCITED_NAME_0", STRING, "NAME_21", STRING, "NAME_22", STRING)); + assertCaptureConfig(g, org.opensearch.common.collect.Map.of("EXCITED_NAME_0", STRING, "NAME_21", STRING, "NAME_22", STRING)); assertEquals("(?!!!(?Tal)!!!) - (?Tal)", g.toRegex(pattern)); assertEquals(true, g.match(text)); @@ -351,7 +351,7 @@ public class GrokTests extends OpenSearchTestCase { public void testBooleanCaptures() { String pattern = "%{WORD:name}=%{WORD:status:boolean}"; Grok g = new Grok(Grok.BUILTIN_PATTERNS, pattern, logger::warn); - assertCaptureConfig(g, org.elasticsearch.common.collect.Map.of("name", STRING, "status", BOOLEAN)); + assertCaptureConfig(g, org.opensearch.common.collect.Map.of("name", STRING, "status", BOOLEAN)); String text = "active=true"; Map expected = new HashMap<>(); @@ -379,7 +379,7 @@ public class GrokTests extends OpenSearchTestCase { String pattern = "%{NUMBER:bytes:float} %{NUMBER:id:long} %{NUMBER:rating:double}"; Grok g = new Grok(bank, pattern, logger::warn); - assertCaptureConfig(g, org.elasticsearch.common.collect.Map.of("bytes", FLOAT, "id", LONG, "rating", DOUBLE)); + assertCaptureConfig(g, org.opensearch.common.collect.Map.of("bytes", FLOAT, "id", LONG, "rating", DOUBLE)); String text = "12009.34 20000000000 4820.092"; Map expected = new HashMap<>(); @@ -427,7 +427,7 @@ public class GrokTests extends OpenSearchTestCase { String pattern = "%{NUMBER:bytes:float} %{NUMBER:status} %{NUMBER}"; Grok g = new Grok(bank, pattern, logger::warn); - assertCaptureConfig(g, org.elasticsearch.common.collect.Map.of("bytes", FLOAT, "status", STRING)); + assertCaptureConfig(g, org.opensearch.common.collect.Map.of("bytes", FLOAT, "status", STRING)); String text = "12009.34 200 9032"; Map expected = new HashMap<>(); @@ -445,8 +445,8 @@ public class GrokTests extends OpenSearchTestCase { String pattern = "%{NUMBER:f:not_a_valid_type}"; Grok g = new Grok(bank, pattern, logger::warn); - assertCaptureConfig(g, org.elasticsearch.common.collect.Map.of("f", STRING)); - assertThat(g.captures("12009.34"), equalTo(org.elasticsearch.common.collect.Map.of("f", "12009.34"))); + assertCaptureConfig(g, org.opensearch.common.collect.Map.of("f", STRING)); + assertThat(g.captures("12009.34"), equalTo(org.opensearch.common.collect.Map.of("f", "12009.34"))); } public void testApacheLog() { @@ -456,19 +456,19 @@ public class GrokTests extends OpenSearchTestCase { Grok grok = new Grok(Grok.BUILTIN_PATTERNS, "%{COMBINEDAPACHELOG}", logger::warn); assertCaptureConfig( grok, - org.elasticsearch.common.collect.Map.ofEntries( - org.elasticsearch.common.collect.Map.entry("agent", STRING), - org.elasticsearch.common.collect.Map.entry("auth", STRING), - org.elasticsearch.common.collect.Map.entry("bytes", STRING), - org.elasticsearch.common.collect.Map.entry("clientip", STRING), - org.elasticsearch.common.collect.Map.entry("httpversion", STRING), - org.elasticsearch.common.collect.Map.entry("ident", STRING), - org.elasticsearch.common.collect.Map.entry("rawrequest", STRING), - org.elasticsearch.common.collect.Map.entry("referrer", STRING), - org.elasticsearch.common.collect.Map.entry("request", STRING), - org.elasticsearch.common.collect.Map.entry("response", STRING), - org.elasticsearch.common.collect.Map.entry("timestamp", STRING), - org.elasticsearch.common.collect.Map.entry("verb", STRING) + org.opensearch.common.collect.Map.ofEntries( + org.opensearch.common.collect.Map.entry("agent", STRING), + org.opensearch.common.collect.Map.entry("auth", STRING), + org.opensearch.common.collect.Map.entry("bytes", STRING), + org.opensearch.common.collect.Map.entry("clientip", STRING), + org.opensearch.common.collect.Map.entry("httpversion", STRING), + org.opensearch.common.collect.Map.entry("ident", STRING), + org.opensearch.common.collect.Map.entry("rawrequest", STRING), + org.opensearch.common.collect.Map.entry("referrer", STRING), + org.opensearch.common.collect.Map.entry("request", STRING), + org.opensearch.common.collect.Map.entry("response", STRING), + org.opensearch.common.collect.Map.entry("timestamp", STRING), + org.opensearch.common.collect.Map.entry("verb", STRING) ) ); Map matches = grok.captures(logLine); @@ -533,18 +533,18 @@ public class GrokTests extends OpenSearchTestCase { Grok grok = new Grok(bank, pattern, logger::warn); assertCaptureConfig( grok, - org.elasticsearch.common.collect.Map.ofEntries( - org.elasticsearch.common.collect.Map.entry("agent", STRING), - org.elasticsearch.common.collect.Map.entry("auth", STRING), - org.elasticsearch.common.collect.Map.entry("bytes", INTEGER), - org.elasticsearch.common.collect.Map.entry("clientip", STRING), - org.elasticsearch.common.collect.Map.entry("httpversion", STRING), - org.elasticsearch.common.collect.Map.entry("ident", STRING), - org.elasticsearch.common.collect.Map.entry("referrer", STRING), - org.elasticsearch.common.collect.Map.entry("request", STRING), - org.elasticsearch.common.collect.Map.entry("response", INTEGER), - org.elasticsearch.common.collect.Map.entry("timestamp", STRING), - org.elasticsearch.common.collect.Map.entry("verb", STRING) + org.opensearch.common.collect.Map.ofEntries( + org.opensearch.common.collect.Map.entry("agent", STRING), + org.opensearch.common.collect.Map.entry("auth", STRING), + org.opensearch.common.collect.Map.entry("bytes", INTEGER), + org.opensearch.common.collect.Map.entry("clientip", STRING), + org.opensearch.common.collect.Map.entry("httpversion", STRING), + org.opensearch.common.collect.Map.entry("ident", STRING), + org.opensearch.common.collect.Map.entry("referrer", STRING), + org.opensearch.common.collect.Map.entry("request", STRING), + org.opensearch.common.collect.Map.entry("response", INTEGER), + org.opensearch.common.collect.Map.entry("timestamp", STRING), + org.opensearch.common.collect.Map.entry("verb", STRING) ) ); @@ -578,7 +578,7 @@ public class GrokTests extends OpenSearchTestCase { Map bank = new HashMap<>(); bank.put("SINGLEDIGIT", "[0-9]"); Grok grok = new Grok(bank, "%{SINGLEDIGIT:num}%{SINGLEDIGIT:num}", logger::warn); - assertCaptureConfig(grok, org.elasticsearch.common.collect.Map.of("num", STRING)); + assertCaptureConfig(grok, org.opensearch.common.collect.Map.of("num", STRING)); Map expected = new HashMap<>(); expected.put("num", "1");