Implement REST endpoint to reindex a project

We recently added a project index to Gerrit. This complements the
existing set of indices (change, account, group). For this new index we
want to offer a REST endpoint as well to reindex a project with the
option to recusively reindex the children as well.

Unfortunately, we previously bound /index to the endpoint that reindexes
all changes in the project. This commit changes that binding to
/index.changes.
We make an effort to keep the REST API stable, but this is just an
administrative endpoint and it seems to be a better fit to just
repurpose the endpoint name.

This commit adds tests and methods for the Java extension API.

Change-Id: I2b3bb9f38c94938b98059da193e80289996a4a41
This commit is contained in:
Patrick Hiesel
2018-07-04 09:48:21 +02:00
parent bdbee9cf8e
commit 20d981e1d9
14 changed files with 257 additions and 43 deletions

View File

@@ -19,7 +19,7 @@ import static com.google.gerrit.common.data.GlobalCapability.MAINTAIN_SERVER;
import com.google.gerrit.extensions.annotations.RequiresAnyCapability;
import com.google.gerrit.server.project.ProjectResource;
import com.google.gerrit.server.project.ProjectState;
import com.google.gerrit.server.restapi.project.Index;
import com.google.gerrit.server.restapi.project.IndexChanges;
import com.google.gerrit.sshd.CommandMetaData;
import com.google.gerrit.sshd.SshCommand;
import com.google.inject.Inject;
@@ -28,10 +28,10 @@ import java.util.List;
import org.kohsuke.args4j.Argument;
@RequiresAnyCapability({MAINTAIN_SERVER})
@CommandMetaData(name = "project", description = "Index changes of a project")
final class IndexProjectCommand extends SshCommand {
@CommandMetaData(name = "changes-in-project", description = "Index changes of a project")
final class IndexChangesInProjectCommand extends SshCommand {
@Inject private Index index;
@Inject private IndexChanges index;
@Argument(
index = 0,

View File

@@ -40,6 +40,6 @@ public class IndexCommandsModule extends CommandModule {
command(index, IndexStartCommand.class);
}
command(index, IndexChangesCommand.class);
command(index, IndexProjectCommand.class);
command(index, IndexChangesInProjectCommand.class);
}
}