use of com.google.gerrit.server.config.ListTasks.TaskInfo in project gerrit by GerritCodeReview.
the class KillTaskIT method killTask_NotFound.
private void killTask_NotFound() throws Exception {
RestResponse r = adminRestSession.get("/config/server/tasks/");
List<TaskInfo> result = newGson().fromJson(r.getReader(), new TypeToken<List<TaskInfo>>() {
}.getType());
r.consume();
assertThat(result.size()).isGreaterThan(0);
userRestSession.delete("/config/server/tasks/" + result.get(0).id).assertNotFound();
}
use of com.google.gerrit.server.config.ListTasks.TaskInfo in project gerrit by GerritCodeReview.
the class GetTaskIT method getLogFileCompressorTaskId.
private String getLogFileCompressorTaskId() throws Exception {
RestResponse r = adminRestSession.get("/config/server/tasks/");
List<TaskInfo> result = newGson().fromJson(r.getReader(), new TypeToken<List<TaskInfo>>() {
}.getType());
r.consume();
for (TaskInfo info : result) {
if ("Log File Compressor".equals(info.command)) {
return info.id;
}
}
return null;
}
use of com.google.gerrit.server.config.ListTasks.TaskInfo in project gerrit by GerritCodeReview.
the class GetTaskIT method getTask.
@Test
public void getTask() throws Exception {
RestResponse r = adminRestSession.get("/config/server/tasks/" + getLogFileCompressorTaskId());
r.assertOK();
TaskInfo info = newGson().fromJson(r.getReader(), new TypeToken<TaskInfo>() {
}.getType());
assertThat(info.id).isNotNull();
Long.parseLong(info.id, 16);
assertThat(info.command).isEqualTo("Log File Compressor");
assertThat(info.startTime).isNotNull();
}
use of com.google.gerrit.server.config.ListTasks.TaskInfo in project gerrit by GerritCodeReview.
the class KillTaskIT method killTask.
private void killTask() throws Exception {
RestResponse r = adminRestSession.get("/config/server/tasks/");
List<TaskInfo> result = newGson().fromJson(r.getReader(), new TypeToken<List<TaskInfo>>() {
}.getType());
r.consume();
Optional<String> id = result.stream().filter(t -> "Log File Compressor".equals(t.command)).map(t -> t.id).findFirst();
assertThat(id).isPresent();
r = adminRestSession.delete("/config/server/tasks/" + id.get());
r.assertNoContent();
r.consume();
r = adminRestSession.get("/config/server/tasks/");
result = newGson().fromJson(r.getReader(), new TypeToken<List<TaskInfo>>() {
}.getType());
r.consume();
Set<String> ids = result.stream().map(t -> t.id).collect(toSet());
assertThat(ids).doesNotContain(id.get());
}
use of com.google.gerrit.server.config.ListTasks.TaskInfo in project gerrit by GerritCodeReview.
the class ListTasksIT method listTasks.
@Test
public void listTasks() throws Exception {
RestResponse r = adminRestSession.get("/config/server/tasks/");
r.assertOK();
List<TaskInfo> result = newGson().fromJson(r.getReader(), new TypeToken<List<TaskInfo>>() {
}.getType());
assertThat(result).isNotEmpty();
boolean foundLogFileCompressorTask = false;
for (TaskInfo info : result) {
if ("Log File Compressor".equals(info.command)) {
foundLogFileCompressorTask = true;
}
assertThat(info.id).isNotNull();
Long.parseLong(info.id, 16);
assertThat(info.command).isNotNull();
assertThat(info.startTime).isNotNull();
}
assertThat(foundLogFileCompressorTask).isTrue();
}
Aggregations