use of com.google.gerrit.acceptance.RestResponse 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();
}
use of com.google.gerrit.acceptance.RestResponse in project gerrit by GerritCodeReview.
the class ListTasksIT method listTasksWithoutViewQueueCapability.
@Test
public void listTasksWithoutViewQueueCapability() throws Exception {
RestResponse r = userRestSession.get("/config/server/tasks/");
r.assertOK();
List<TaskInfo> result = newGson().fromJson(r.getReader(), new TypeToken<List<TaskInfo>>() {
}.getType());
assertThat(result).isEmpty();
}
use of com.google.gerrit.acceptance.RestResponse in project gerrit by GerritCodeReview.
the class GroupsIT method invalidQueryOptions.
@Test
public void invalidQueryOptions() throws Exception {
RestResponse r = adminRestSession.put("/groups/?query=foo&query2=bar");
r.assertBadRequest();
assertThat(r.getEntityContent()).isEqualTo("\"query\" and \"query2\" options are mutually exclusive");
}
use of com.google.gerrit.acceptance.RestResponse in project gerrit by GerritCodeReview.
the class TopicIT method topic.
@Test
public void topic() throws Exception {
Result result = createChange();
String endpoint = "/changes/" + result.getChangeId() + "/topic";
RestResponse response = adminRestSession.put(endpoint, "topic");
response.assertOK();
response = adminRestSession.delete(endpoint);
response.assertNoContent();
response = adminRestSession.put(endpoint, "topic");
response.assertOK();
response = adminRestSession.put(endpoint, "");
response.assertNoContent();
}
use of com.google.gerrit.acceptance.RestResponse in project gerrit by GerritCodeReview.
the class CacheOperationsIT method flush.
@Test
public void flush() throws Exception {
RestResponse r = adminRestSession.getOK("/config/server/caches/project_list");
CacheInfo cacheInfo = newGson().fromJson(r.getReader(), CacheInfo.class);
assertThat(cacheInfo.entries.mem).isGreaterThan((long) 0);
r = adminRestSession.getOK("/config/server/caches/projects");
cacheInfo = newGson().fromJson(r.getReader(), CacheInfo.class);
assertThat(cacheInfo.entries.mem).isGreaterThan((long) 1);
r = adminRestSession.postOK("/config/server/caches/", new PostCaches.Input(FLUSH, Arrays.asList("accounts", "project_list")));
r.consume();
r = adminRestSession.getOK("/config/server/caches/project_list");
cacheInfo = newGson().fromJson(r.getReader(), CacheInfo.class);
assertThat(cacheInfo.entries.mem).isNull();
r = adminRestSession.getOK("/config/server/caches/projects");
cacheInfo = newGson().fromJson(r.getReader(), CacheInfo.class);
assertThat(cacheInfo.entries.mem).isGreaterThan((long) 1);
}
Aggregations