Merge "Delete SQL index support"

This commit is contained in:
Shawn Pearce
2013-11-29 20:48:25 +00:00
committed by Gerrit Code Review
34 changed files with 238 additions and 1217 deletions

View File

@@ -1,26 +0,0 @@
// Copyright (C) 2013 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.acceptance;
import org.eclipse.jgit.lib.Config;
public class AbstractDaemonTestWithSecondaryIndex extends AbstractDaemonTest {
@Override
protected GerritServer startServer(Config cfg, boolean memory)
throws Exception {
return GerritServer.start(cfg, memory, true);
}
}

View File

@@ -18,7 +18,6 @@ import com.google.common.collect.ImmutableList;
import com.google.gerrit.lucene.LuceneIndexModule;
import com.google.gerrit.pgm.Daemon;
import com.google.gerrit.pgm.Init;
import com.google.gerrit.pgm.Reindex;
import com.google.gerrit.server.config.FactoryModule;
import com.google.gerrit.server.config.GerritServerConfig;
import com.google.gerrit.server.index.ChangeSchemas;
@@ -51,12 +50,6 @@ public class GerritServer {
/** Returns fully started Gerrit server */
static GerritServer start(Config base, boolean memory) throws Exception {
return start(base, memory, false);
}
/** Returns fully started Gerrit server */
static GerritServer start(Config base, boolean memory, boolean index)
throws Exception {
final CyclicBarrier serverStarted = new CyclicBarrier(2);
final Daemon daemon = new Daemon(new Runnable() {
public void run() {
@@ -78,25 +71,16 @@ public class GerritServer {
mergeTestConfig(cfg);
cfg.setBoolean("httpd", null, "requestLog", false);
cfg.setBoolean("sshd", null, "requestLog", false);
if (index) {
cfg.setString("index", null, "type", "lucene");
cfg.setBoolean("index", "lucene", "testInmemory", true);
daemon.setLuceneModule(new LuceneIndexModule(
ChangeSchemas.getLatest().getVersion(),
Runtime.getRuntime().availableProcessors(), null));
}
cfg.setBoolean("index", "lucene", "testInmemory", true);
daemon.setLuceneModule(new LuceneIndexModule(
ChangeSchemas.getLatest().getVersion(),
Runtime.getRuntime().availableProcessors(), null));
daemon.setDatabaseForTesting(ImmutableList.<Module>of(
new InMemoryTestingDatabaseModule(cfg)));
daemon.start();
} else {
Config cfg = base != null ? base : new Config();
if (index) {
cfg.setString("index", null, "type", "lucene");
}
site = initSite(cfg);
if (index) {
reindex(site);
}
daemonService = Executors.newSingleThreadExecutor();
daemonService.submit(new Callable<Void>() {
public Void call() throws Exception {
@@ -137,15 +121,6 @@ public class GerritServer {
return tmp;
}
/** Runs the reindex command. Works only if the site is not currently running. */
private static void reindex(File site) throws Exception {
Reindex reindex = new Reindex();
int rc = reindex.main(new String[] {"-d", site.getPath()});
if (rc != 0) {
throw new RuntimeException("Reindex failed");
}
}
private static void mergeTestConfig(Config cfg)
throws IOException {
InetSocketAddress http = newPort();

View File

@@ -23,7 +23,7 @@ import static org.junit.Assert.assertTrue;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.gerrit.acceptance.AbstractDaemonTestWithSecondaryIndex;
import com.google.gerrit.acceptance.AbstractDaemonTest;
import com.google.gerrit.acceptance.AccountCreator;
import com.google.gerrit.acceptance.RestResponse;
import com.google.gerrit.acceptance.RestSession;
@@ -49,7 +49,7 @@ import org.junit.Test;
import java.io.IOException;
import java.util.Set;
public class ConflictsOperatorIT extends AbstractDaemonTestWithSecondaryIndex {
public class ConflictsOperatorIT extends AbstractDaemonTest {
@Inject
private AccountCreator accounts;