SchemaUtil.getNameParts(...): Use US Locale and split on '/' and '_'
Always use US Locale when converting name parts to lower case. This makes the behaviour independent of the default Locale. In addition also split names on '/' and '_'. Splitting on these characters makes sense for group names, especially since in future groups are stored as refs/groups/<group-name> refs in NoteDb and hierarchical group names will be encouraged. Both these changes to SchemaUtil.getNameParts(...) require new schema versions for all indexes since values for fields that use SchemaUtil.getNameParts(...) may change. This is why we do both modification in the same change, so that we must increase the index schema versions only once. Change-Id: I26f6940216058acd27e2f0dd38441a93fe5d7107 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
committed by
David Pursehouse
parent
8b038714f5
commit
d6d67bb740
@@ -15,6 +15,7 @@
|
||||
package com.google.gerrit.server.index;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static com.google.gerrit.server.index.SchemaUtil.getNameParts;
|
||||
import static com.google.gerrit.server.index.SchemaUtil.getPersonParts;
|
||||
import static com.google.gerrit.server.index.SchemaUtil.schema;
|
||||
|
||||
@@ -68,4 +69,11 @@ public class SchemaUtilTest extends GerritBaseTests {
|
||||
"ba-z@example.com", "ba-z", "ba", "z",
|
||||
"example.com", "example", "com");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getNamePartsExtractsParts() {
|
||||
assertThat(getNameParts("")).isEmpty();
|
||||
assertThat(getNameParts("foO-bAr_Baz a.b@c/d"))
|
||||
.containsExactly("foo", "bar", "baz", "a", "b", "c", "d");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user