use of com.google.gerrit.server.index.change.ChangeIndex in project gerrit by GerritCodeReview.
the class ChangeIT method deleteChangeUpdatesIndex.
@Test
public void deleteChangeUpdatesIndex() throws Exception {
PushOneCommit.Result changeResult = createChange();
String changeId = changeResult.getChangeId();
Change.Id id = changeResult.getChange().getId();
ChangeIndex idx = changeIndexCollection.getSearchIndex();
Optional<ChangeData> result = idx.get(id, IndexedChangeQuery.createOptions(indexConfig, 0, 1, ImmutableSet.of()));
assertThat(result).isPresent();
gApi.changes().id(changeId).delete();
result = idx.get(id, IndexedChangeQuery.createOptions(indexConfig, 0, 1, ImmutableSet.of()));
assertThat(result).isEmpty();
}
use of com.google.gerrit.server.index.change.ChangeIndex in project gerrit by GerritCodeReview.
the class AbstractDaemonTest method disableChangeIndex.
protected AutoCloseable disableChangeIndex() {
disableChangeIndexWrites();
ChangeIndex maybeDisabledSearchIndex = changeIndexes.getSearchIndex();
if (!(maybeDisabledSearchIndex instanceof DisabledChangeIndex)) {
changeIndexes.setSearchIndex(new DisabledChangeIndex(maybeDisabledSearchIndex), false);
}
return () -> {
enableChangeIndexWrites();
ChangeIndex maybeEnabledSearchIndex = changeIndexes.getSearchIndex();
if (maybeEnabledSearchIndex instanceof DisabledChangeIndex) {
changeIndexes.setSearchIndex(((DisabledChangeIndex) maybeEnabledSearchIndex).unwrap(), false);
}
};
}
Aggregations