ElasticTestUtils: also reuse index name constants

Rather than the no longer reused _PREFIX ones, now that the index name
constants are all properly refactored, which enabled such reuse.

Change-Id: Ifc1244f5633fc31f6c71bca1277dbe2fab5a8a82
This commit is contained in:
Marco Miller
2018-03-29 16:22:24 -04:00
parent 399299e7c8
commit 8cd3ecb1e0
4 changed files with 6 additions and 9 deletions

View File

@@ -69,7 +69,6 @@ public class ElasticAccountIndex extends AbstractElasticIndex<Account.Id, Accoun
}
static final String ACCOUNTS = "accounts";
static final String ACCOUNTS_PREFIX = ACCOUNTS + "_";
private static final Logger log = LoggerFactory.getLogger(ElasticAccountIndex.class);

View File

@@ -92,7 +92,6 @@ class ElasticChangeIndex extends AbstractElasticIndex<Change.Id, ChangeData>
}
static final String CHANGES = "changes";
static final String CHANGES_PREFIX = CHANGES + "_";
static final String OPEN_CHANGES = "open_" + CHANGES;
static final String CLOSED_CHANGES = "closed_" + CHANGES;

View File

@@ -66,7 +66,6 @@ public class ElasticGroupIndex extends AbstractElasticIndex<AccountGroup.UUID, A
}
static final String GROUPS = "groups";
static final String GROUPS_PREFIX = GROUPS + "_";
private static final Logger log = LoggerFactory.getLogger(ElasticGroupIndex.class);

View File

@@ -15,11 +15,11 @@
package com.google.gerrit.elasticsearch;
import static com.google.common.truth.Truth.assertThat;
import static com.google.gerrit.elasticsearch.ElasticAccountIndex.ACCOUNTS_PREFIX;
import static com.google.gerrit.elasticsearch.ElasticChangeIndex.CHANGES_PREFIX;
import static com.google.gerrit.elasticsearch.ElasticAccountIndex.ACCOUNTS;
import static com.google.gerrit.elasticsearch.ElasticChangeIndex.CHANGES;
import static com.google.gerrit.elasticsearch.ElasticChangeIndex.CLOSED_CHANGES;
import static com.google.gerrit.elasticsearch.ElasticChangeIndex.OPEN_CHANGES;
import static com.google.gerrit.elasticsearch.ElasticGroupIndex.GROUPS_PREFIX;
import static com.google.gerrit.elasticsearch.ElasticGroupIndex.GROUPS;
import com.google.common.base.Strings;
import com.google.common.io.Files;
@@ -128,7 +128,7 @@ final class ElasticTestUtils {
.client()
.admin()
.indices()
.prepareCreate(String.format("%s%04d", CHANGES_PREFIX, changeSchema.getVersion()))
.prepareCreate(String.format("%s_%04d", CHANGES, changeSchema.getVersion()))
.addMapping(OPEN_CHANGES, gson.toJson(openChangesMapping))
.addMapping(CLOSED_CHANGES, gson.toJson(closedChangesMapping))
.execute()
@@ -141,7 +141,7 @@ final class ElasticTestUtils {
.client()
.admin()
.indices()
.prepareCreate(String.format("%s%04d", ACCOUNTS_PREFIX, accountSchema.getVersion()))
.prepareCreate(String.format("%s_%04d", ACCOUNTS, accountSchema.getVersion()))
.addMapping(ElasticAccountIndex.ACCOUNTS, gson.toJson(accountMapping))
.execute()
.actionGet();
@@ -153,7 +153,7 @@ final class ElasticTestUtils {
.client()
.admin()
.indices()
.prepareCreate(String.format("%s%04d", GROUPS_PREFIX, groupSchema.getVersion()))
.prepareCreate(String.format("%s_%04d", GROUPS, groupSchema.getVersion()))
.addMapping(ElasticGroupIndex.GROUPS, gson.toJson(groupMapping))
.execute()
.actionGet();