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:
@@ -69,7 +69,6 @@ public class ElasticAccountIndex extends AbstractElasticIndex<Account.Id, Accoun
|
|||||||
}
|
}
|
||||||
|
|
||||||
static final String ACCOUNTS = "accounts";
|
static final String ACCOUNTS = "accounts";
|
||||||
static final String ACCOUNTS_PREFIX = ACCOUNTS + "_";
|
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(ElasticAccountIndex.class);
|
private static final Logger log = LoggerFactory.getLogger(ElasticAccountIndex.class);
|
||||||
|
|
||||||
|
@@ -92,7 +92,6 @@ class ElasticChangeIndex extends AbstractElasticIndex<Change.Id, ChangeData>
|
|||||||
}
|
}
|
||||||
|
|
||||||
static final String CHANGES = "changes";
|
static final String CHANGES = "changes";
|
||||||
static final String CHANGES_PREFIX = CHANGES + "_";
|
|
||||||
static final String OPEN_CHANGES = "open_" + CHANGES;
|
static final String OPEN_CHANGES = "open_" + CHANGES;
|
||||||
static final String CLOSED_CHANGES = "closed_" + CHANGES;
|
static final String CLOSED_CHANGES = "closed_" + CHANGES;
|
||||||
|
|
||||||
|
@@ -66,7 +66,6 @@ public class ElasticGroupIndex extends AbstractElasticIndex<AccountGroup.UUID, A
|
|||||||
}
|
}
|
||||||
|
|
||||||
static final String GROUPS = "groups";
|
static final String GROUPS = "groups";
|
||||||
static final String GROUPS_PREFIX = GROUPS + "_";
|
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(ElasticGroupIndex.class);
|
private static final Logger log = LoggerFactory.getLogger(ElasticGroupIndex.class);
|
||||||
|
|
||||||
|
@@ -15,11 +15,11 @@
|
|||||||
package com.google.gerrit.elasticsearch;
|
package com.google.gerrit.elasticsearch;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static com.google.gerrit.elasticsearch.ElasticAccountIndex.ACCOUNTS_PREFIX;
|
import static com.google.gerrit.elasticsearch.ElasticAccountIndex.ACCOUNTS;
|
||||||
import static com.google.gerrit.elasticsearch.ElasticChangeIndex.CHANGES_PREFIX;
|
import static com.google.gerrit.elasticsearch.ElasticChangeIndex.CHANGES;
|
||||||
import static com.google.gerrit.elasticsearch.ElasticChangeIndex.CLOSED_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.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.base.Strings;
|
||||||
import com.google.common.io.Files;
|
import com.google.common.io.Files;
|
||||||
@@ -128,7 +128,7 @@ final class ElasticTestUtils {
|
|||||||
.client()
|
.client()
|
||||||
.admin()
|
.admin()
|
||||||
.indices()
|
.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(OPEN_CHANGES, gson.toJson(openChangesMapping))
|
||||||
.addMapping(CLOSED_CHANGES, gson.toJson(closedChangesMapping))
|
.addMapping(CLOSED_CHANGES, gson.toJson(closedChangesMapping))
|
||||||
.execute()
|
.execute()
|
||||||
@@ -141,7 +141,7 @@ final class ElasticTestUtils {
|
|||||||
.client()
|
.client()
|
||||||
.admin()
|
.admin()
|
||||||
.indices()
|
.indices()
|
||||||
.prepareCreate(String.format("%s%04d", ACCOUNTS_PREFIX, accountSchema.getVersion()))
|
.prepareCreate(String.format("%s_%04d", ACCOUNTS, accountSchema.getVersion()))
|
||||||
.addMapping(ElasticAccountIndex.ACCOUNTS, gson.toJson(accountMapping))
|
.addMapping(ElasticAccountIndex.ACCOUNTS, gson.toJson(accountMapping))
|
||||||
.execute()
|
.execute()
|
||||||
.actionGet();
|
.actionGet();
|
||||||
@@ -153,7 +153,7 @@ final class ElasticTestUtils {
|
|||||||
.client()
|
.client()
|
||||||
.admin()
|
.admin()
|
||||||
.indices()
|
.indices()
|
||||||
.prepareCreate(String.format("%s%04d", GROUPS_PREFIX, groupSchema.getVersion()))
|
.prepareCreate(String.format("%s_%04d", GROUPS, groupSchema.getVersion()))
|
||||||
.addMapping(ElasticGroupIndex.GROUPS, gson.toJson(groupMapping))
|
.addMapping(ElasticGroupIndex.GROUPS, gson.toJson(groupMapping))
|
||||||
.execute()
|
.execute()
|
||||||
.actionGet();
|
.actionGet();
|
||||||
|
Reference in New Issue
Block a user