AbstractDaemonTest: Add user SSH session
Rename the adminSession and userSession members to adminRestSession and userRestSession. Rename sshSession to adminSshSession. Add userSshSession. Change-Id: Id705a04317d146cea48b6215e78d8f8ea7fa95a1
This commit is contained in:
@@ -201,9 +201,10 @@ public abstract class AbstractDaemonTest {
|
||||
protected GerritServer server;
|
||||
protected TestAccount admin;
|
||||
protected TestAccount user;
|
||||
protected RestSession adminSession;
|
||||
protected RestSession userSession;
|
||||
protected SshSession sshSession;
|
||||
protected RestSession adminRestSession;
|
||||
protected RestSession userRestSession;
|
||||
protected SshSession adminSshSession;
|
||||
protected SshSession userSshSession;
|
||||
protected ReviewDb db;
|
||||
protected Project.NameKey project;
|
||||
|
||||
@@ -300,14 +301,18 @@ public abstract class AbstractDaemonTest {
|
||||
accountCache.evict(admin.getId());
|
||||
accountCache.evict(user.getId());
|
||||
|
||||
adminSession = new RestSession(server, admin);
|
||||
userSession = new RestSession(server, user);
|
||||
adminRestSession = new RestSession(server, admin);
|
||||
userRestSession = new RestSession(server, user);
|
||||
initSsh(admin);
|
||||
db = reviewDbProvider.open();
|
||||
Context ctx = newRequestContext(admin);
|
||||
Context ctx = newRequestContext(user);
|
||||
atrScope.set(ctx);
|
||||
sshSession = ctx.getSession();
|
||||
sshSession.open();
|
||||
userSshSession = ctx.getSession();
|
||||
userSshSession.open();
|
||||
ctx = newRequestContext(admin);
|
||||
atrScope.set(ctx);
|
||||
adminSshSession = ctx.getSession();
|
||||
adminSshSession.open();
|
||||
resourcePrefix = UNSAFE_PROJECT_NAME.matcher(
|
||||
description.getClassName() + "_"
|
||||
+ description.getMethodName() + "_").replaceAll("");
|
||||
@@ -423,7 +428,8 @@ public abstract class AbstractDaemonTest {
|
||||
repo.close();
|
||||
}
|
||||
db.close();
|
||||
sshSession.close();
|
||||
adminSshSession.close();
|
||||
userSshSession.close();
|
||||
if (server != commonServer) {
|
||||
server.stop();
|
||||
}
|
||||
|
@@ -171,7 +171,7 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
modifier.modifyFile(editUtil.byChange(change).get(), FILE_NAME,
|
||||
RawInputUtil.create(CONTENT_NEW))).isEqualTo(RefUpdate.Result.FORCED);
|
||||
Optional<ChangeEdit> edit = editUtil.byChange(change);
|
||||
adminSession.post(urlPublish()).assertNoContent();
|
||||
adminRestSession.post(urlPublish()).assertNoContent();
|
||||
edit = editUtil.byChange(change);
|
||||
assertThat(edit.isPresent()).isFalse();
|
||||
PatchSet newCurrentPatchSet = getCurrentPatchSet(changeId);
|
||||
@@ -189,7 +189,7 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
modifier.modifyFile(editUtil.byChange(change).get(), FILE_NAME,
|
||||
RawInputUtil.create(CONTENT_NEW))).isEqualTo(RefUpdate.Result.FORCED);
|
||||
Optional<ChangeEdit> edit = editUtil.byChange(change);
|
||||
adminSession.delete(urlEdit()).assertNoContent();
|
||||
adminRestSession.delete(urlEdit()).assertNoContent();
|
||||
edit = editUtil.byChange(change);
|
||||
assertThat(edit.isPresent()).isFalse();
|
||||
}
|
||||
@@ -203,9 +203,9 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
assertThat(
|
||||
modifier.modifyFile(editUtil.byChange(change).get(), FILE_NAME,
|
||||
RawInputUtil.create(CONTENT_NEW))).isEqualTo(RefUpdate.Result.FORCED);
|
||||
adminSession.post(urlPublish()).assertForbidden();
|
||||
adminRestSession.post(urlPublish()).assertForbidden();
|
||||
setUseContributorAgreements(InheritableBoolean.FALSE);
|
||||
adminSession.post(urlPublish()).assertNoContent();
|
||||
adminRestSession.post(urlPublish()).assertNoContent();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -242,7 +242,7 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
assertThat(edit.getBasePatchSet().getPatchSetId()).isEqualTo(
|
||||
current.getPatchSetId() - 1);
|
||||
Date beforeRebase = edit.getEditCommit().getCommitterIdent().getWhen();
|
||||
adminSession.post(urlRebase()).assertNoContent();
|
||||
adminRestSession.post(urlRebase()).assertNoContent();
|
||||
edit = editUtil.byChange(change).get();
|
||||
assertByteArray(fileUtil.getContent(projectCache.get(edit.getChange().getProject()),
|
||||
ObjectId.fromString(edit.getRevision().get()), FILE_NAME), CONTENT_NEW);
|
||||
@@ -268,7 +268,7 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
pushFactory.create(db, admin.getIdent(), testRepo, PushOneCommit.SUBJECT, FILE_NAME,
|
||||
new String(CONTENT_NEW2), changeId2);
|
||||
push.to("refs/for/master").assertOkStatus();
|
||||
adminSession.post(urlRebase()).assertConflict();
|
||||
adminRestSession.post(urlRebase()).assertConflict();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -362,13 +362,13 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void updateMessageRest() throws Exception {
|
||||
adminSession.get(urlEditMessage()).assertNotFound();
|
||||
adminRestSession.get(urlEditMessage()).assertNotFound();
|
||||
EditMessage.Input in = new EditMessage.Input();
|
||||
in.message = String.format("New commit message\n\n" +
|
||||
CONTENT_NEW2_STR + "\n\nChange-Id: %s\n",
|
||||
change.getKey());
|
||||
adminSession.put(urlEditMessage(), in).assertNoContent();
|
||||
RestResponse r = adminSession.getJsonAccept(urlEditMessage());
|
||||
adminRestSession.put(urlEditMessage(), in).assertNoContent();
|
||||
RestResponse r = adminRestSession.getJsonAccept(urlEditMessage());
|
||||
r.assertOK();
|
||||
assertThat(readContentFromJson(r)).isEqualTo(in.message);
|
||||
Optional<ChangeEdit> edit = editUtil.byChange(change);
|
||||
@@ -376,7 +376,7 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
.isEqualTo(in.message);
|
||||
in.message = String.format("New commit message2\n\nChange-Id: %s\n",
|
||||
change.getKey());
|
||||
adminSession.put(urlEditMessage(), in).assertNoContent();
|
||||
adminRestSession.put(urlEditMessage(), in).assertNoContent();
|
||||
edit = editUtil.byChange(change);
|
||||
assertThat(edit.get().getEditCommit().getFullMessage())
|
||||
.isEqualTo(in.message);
|
||||
@@ -389,7 +389,7 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void retrieveEdit() throws Exception {
|
||||
adminSession.get(urlEdit()).assertNoContent();
|
||||
adminRestSession.get(urlEdit()).assertNoContent();
|
||||
assertThat(modifier.createEdit(change, ps)).isEqualTo(RefUpdate.Result.NEW);
|
||||
Optional<ChangeEdit> edit = editUtil.byChange(change);
|
||||
assertThat(modifier.modifyFile(edit.get(), FILE_NAME, RawInputUtil.create(CONTENT_NEW)))
|
||||
@@ -402,7 +402,7 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
edit = editUtil.byChange(change);
|
||||
editUtil.delete(edit.get());
|
||||
|
||||
adminSession.get(urlEdit()).assertNoContent();
|
||||
adminRestSession.get(urlEdit()).assertNoContent();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -447,7 +447,7 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void createEditByDeletingExistingFileRest() throws Exception {
|
||||
adminSession.delete(urlEditFile()).assertNoContent();
|
||||
adminRestSession.delete(urlEditFile()).assertNoContent();
|
||||
Optional<ChangeEdit> edit = editUtil.byChange(change);
|
||||
exception.expect(ResourceNotFoundException.class);
|
||||
fileUtil.getContent(projectCache.get(edit.get().getChange().getProject()),
|
||||
@@ -456,13 +456,13 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void deletingNonExistingEditRest() throws Exception {
|
||||
adminSession.delete(urlEdit()).assertNotFound();
|
||||
adminRestSession.delete(urlEdit()).assertNotFound();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deleteExistingFileRest() throws Exception {
|
||||
assertThat(modifier.createEdit(change, ps)).isEqualTo(RefUpdate.Result.NEW);
|
||||
adminSession.delete(urlEditFile()).assertNoContent();
|
||||
adminRestSession.delete(urlEditFile()).assertNoContent();
|
||||
Optional<ChangeEdit> edit = editUtil.byChange(change);
|
||||
exception.expect(ResourceNotFoundException.class);
|
||||
fileUtil.getContent(projectCache.get(edit.get().getChange().getProject()),
|
||||
@@ -511,7 +511,7 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
Post.Input in = new Post.Input();
|
||||
in.oldPath = FILE_NAME;
|
||||
in.newPath = FILE_NAME3;
|
||||
adminSession.post(urlEdit(), in).assertNoContent();
|
||||
adminRestSession.post(urlEdit(), in).assertNoContent();
|
||||
Optional<ChangeEdit> edit = editUtil.byChange(change);
|
||||
assertByteArray(fileUtil.getContent(projectCache.get(edit.get().getChange().getProject()),
|
||||
ObjectId.fromString(edit.get().getRevision().get()), FILE_NAME3), CONTENT_OLD);
|
||||
@@ -524,7 +524,7 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
public void restoreDeletedFileInPatchSetRest() throws Exception {
|
||||
Post.Input in = new Post.Input();
|
||||
in.restorePath = FILE_NAME;
|
||||
adminSession.post(urlEdit2(), in).assertNoContent();
|
||||
adminRestSession.post(urlEdit2(), in).assertNoContent();
|
||||
Optional<ChangeEdit> edit = editUtil.byChange(change2);
|
||||
assertByteArray(fileUtil.getContent(projectCache.get(edit.get().getChange().getProject()),
|
||||
ObjectId.fromString(edit.get().getRevision().get()), FILE_NAME), CONTENT_OLD);
|
||||
@@ -550,12 +550,12 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
public void createAndChangeEditInOneRequestRest() throws Exception {
|
||||
Put.Input in = new Put.Input();
|
||||
in.content = RawInputUtil.create(CONTENT_NEW);
|
||||
adminSession.putRaw(urlEditFile(), in.content).assertNoContent();
|
||||
adminRestSession.putRaw(urlEditFile(), in.content).assertNoContent();
|
||||
Optional<ChangeEdit> edit = editUtil.byChange(change);
|
||||
assertByteArray(fileUtil.getContent(projectCache.get(edit.get().getChange().getProject()),
|
||||
ObjectId.fromString(edit.get().getRevision().get()), FILE_NAME), CONTENT_NEW);
|
||||
in.content = RawInputUtil.create(CONTENT_NEW2);
|
||||
adminSession.putRaw(urlEditFile(), in.content).assertNoContent();
|
||||
adminRestSession.putRaw(urlEditFile(), in.content).assertNoContent();
|
||||
edit = editUtil.byChange(change);
|
||||
assertByteArray(fileUtil.getContent(projectCache.get(edit.get().getChange().getProject()),
|
||||
ObjectId.fromString(edit.get().getRevision().get()), FILE_NAME), CONTENT_NEW2);
|
||||
@@ -566,7 +566,7 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
assertThat(modifier.createEdit(change, ps)).isEqualTo(RefUpdate.Result.NEW);
|
||||
Put.Input in = new Put.Input();
|
||||
in.content = RawInputUtil.create(CONTENT_NEW);
|
||||
adminSession.putRaw(urlEditFile(), in.content).assertNoContent();
|
||||
adminRestSession.putRaw(urlEditFile(), in.content).assertNoContent();
|
||||
Optional<ChangeEdit> edit = editUtil.byChange(change);
|
||||
assertByteArray(fileUtil.getContent(projectCache.get(edit.get().getChange().getProject()),
|
||||
ObjectId.fromString(edit.get().getRevision().get()), FILE_NAME), CONTENT_NEW);
|
||||
@@ -575,7 +575,7 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void emptyPutRequest() throws Exception {
|
||||
assertThat(modifier.createEdit(change, ps)).isEqualTo(RefUpdate.Result.NEW);
|
||||
adminSession.put(urlEditFile()).assertNoContent();
|
||||
adminRestSession.put(urlEditFile()).assertNoContent();
|
||||
Optional<ChangeEdit> edit = editUtil.byChange(change);
|
||||
assertByteArray(fileUtil.getContent(projectCache.get(edit.get().getChange().getProject()),
|
||||
ObjectId.fromString(edit.get().getRevision().get()), FILE_NAME), "".getBytes());
|
||||
@@ -583,7 +583,7 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void createEmptyEditRest() throws Exception {
|
||||
adminSession.post(urlEdit()).assertNoContent();
|
||||
adminRestSession.post(urlEdit()).assertNoContent();
|
||||
Optional<ChangeEdit> edit = editUtil.byChange(change);
|
||||
assertByteArray(fileUtil.getContent(projectCache.get(edit.get().getChange().getProject()),
|
||||
ObjectId.fromString(edit.get().getRevision().get()), FILE_NAME), CONTENT_OLD);
|
||||
@@ -593,12 +593,12 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
public void getFileContentRest() throws Exception {
|
||||
Put.Input in = new Put.Input();
|
||||
in.content = RawInputUtil.create(CONTENT_NEW);
|
||||
adminSession.putRaw(urlEditFile(), in.content).assertNoContent();
|
||||
adminRestSession.putRaw(urlEditFile(), in.content).assertNoContent();
|
||||
Optional<ChangeEdit> edit = editUtil.byChange(change);
|
||||
assertThat(modifier.modifyFile(edit.get(), FILE_NAME, RawInputUtil.create(CONTENT_NEW2)))
|
||||
.isEqualTo(RefUpdate.Result.FORCED);
|
||||
edit = editUtil.byChange(change);
|
||||
RestResponse r = adminSession.getJsonAccept(urlEditFile());
|
||||
RestResponse r = adminRestSession.getJsonAccept(urlEditFile());
|
||||
r.assertOK();
|
||||
assertThat(readContentFromJson(r)).isEqualTo(
|
||||
StringUtils.newStringUtf8(CONTENT_NEW2));
|
||||
@@ -607,9 +607,9 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void getFileNotFoundRest() throws Exception {
|
||||
assertThat(modifier.createEdit(change, ps)).isEqualTo(RefUpdate.Result.NEW);
|
||||
adminSession.delete(urlEditFile()).assertNoContent();
|
||||
adminRestSession.delete(urlEditFile()).assertNoContent();
|
||||
Optional<ChangeEdit> edit = editUtil.byChange(change);
|
||||
adminSession.get(urlEditFile()).assertNoContent();
|
||||
adminRestSession.get(urlEditFile()).assertNoContent();
|
||||
exception.expect(ResourceNotFoundException.class);
|
||||
fileUtil.getContent(projectCache.get(edit.get().getChange().getProject()),
|
||||
ObjectId.fromString(edit.get().getRevision().get()), FILE_NAME);
|
||||
@@ -724,12 +724,12 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
.isEqualTo(RefUpdate.Result.FORCED);
|
||||
edit = editUtil.byChange(change).get();
|
||||
|
||||
RestResponse r = adminSession.getJsonAccept(urlRevisionFiles(edit));
|
||||
RestResponse r = adminRestSession.getJsonAccept(urlRevisionFiles(edit));
|
||||
Map<String, FileInfo> files = readContentFromJson(
|
||||
r, new TypeToken<Map<String, FileInfo>>() {});
|
||||
assertThat(files).containsKey(FILE_NAME);
|
||||
|
||||
r = adminSession.getJsonAccept(urlRevisionFiles());
|
||||
r = adminRestSession.getJsonAccept(urlRevisionFiles());
|
||||
files = readContentFromJson(r, new TypeToken<Map<String, FileInfo>>() {});
|
||||
assertThat(files).containsKey(FILE_NAME);
|
||||
}
|
||||
@@ -742,11 +742,11 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
.isEqualTo(RefUpdate.Result.FORCED);
|
||||
edit = editUtil.byChange(change).get();
|
||||
|
||||
RestResponse r = adminSession.getJsonAccept(urlDiff(edit));
|
||||
RestResponse r = adminRestSession.getJsonAccept(urlDiff(edit));
|
||||
DiffInfo diff = readContentFromJson(r, DiffInfo.class);
|
||||
assertThat(diff.diffHeader.get(0)).contains(FILE_NAME);
|
||||
|
||||
r = adminSession.getJsonAccept(urlDiff());
|
||||
r = adminRestSession.getJsonAccept(urlDiff());
|
||||
diff = readContentFromJson(r, DiffInfo.class);
|
||||
assertThat(diff.diffHeader.get(0)).contains(FILE_NAME);
|
||||
}
|
||||
@@ -866,7 +866,7 @@ public class ChangeEditIT extends AbstractDaemonTest {
|
||||
}
|
||||
|
||||
private EditInfo toEditInfo(boolean files) throws Exception {
|
||||
RestResponse r = adminSession.get(files ? urlGetFiles() : urlEdit());
|
||||
RestResponse r = adminRestSession.get(files ? urlGetFiles() : urlEdit());
|
||||
return readContentFromJson(r, EditInfo.class);
|
||||
}
|
||||
|
||||
|
@@ -75,7 +75,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
sshUrl = sshSession.getUrl();
|
||||
sshUrl = adminSshSession.getUrl();
|
||||
ProjectConfig cfg = projectCache.checkedGet(project).getConfig();
|
||||
patchSetLock = Util.patchSetLock();
|
||||
cfg.getLabelSections().put(patchSetLock.getName(), patchSetLock);
|
||||
|
@@ -51,7 +51,7 @@ public class CapabilitiesIT extends AbstractDaemonTest {
|
||||
allowGlobalCapabilities(REGISTERED_USERS, all);
|
||||
try {
|
||||
RestResponse r =
|
||||
userSession.get("/accounts/self/capabilities");
|
||||
userRestSession.get("/accounts/self/capabilities");
|
||||
r.assertOK();
|
||||
CapabilityInfo info = (new Gson()).fromJson(r.getReader(),
|
||||
new TypeToken<CapabilityInfo>() {}.getType());
|
||||
@@ -79,7 +79,7 @@ public class CapabilitiesIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void testCapabilitiesAdmin() throws Exception {
|
||||
RestResponse r =
|
||||
adminSession.get("/accounts/self/capabilities");
|
||||
adminRestSession.get("/accounts/self/capabilities");
|
||||
r.assertOK();
|
||||
CapabilityInfo info = (new Gson()).fromJson(r.getReader(),
|
||||
new TypeToken<CapabilityInfo>() {}.getType());
|
||||
|
@@ -27,7 +27,7 @@ import org.junit.Test;
|
||||
public class GetAccountDetailIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void getDetail() throws Exception {
|
||||
RestResponse r = adminSession.get("/accounts/" + admin.username + "/detail/");
|
||||
RestResponse r = adminRestSession.get("/accounts/" + admin.username + "/detail/");
|
||||
AccountDetailInfo info = newGson().fromJson(r.getReader(), AccountDetailInfo.class);
|
||||
assertAccountInfo(admin, info);
|
||||
Account account = accountCache.get(admin.getId()).getAccount();
|
||||
|
@@ -38,7 +38,7 @@ public class PutUsernameIT extends AbstractDaemonTest {
|
||||
PutUsername.Input in = new PutUsername.Input();
|
||||
in.username = "myUsername";
|
||||
RestResponse r =
|
||||
adminSession.put("/accounts/" + createUser().get() + "/username", in);
|
||||
adminRestSession.put("/accounts/" + createUser().get() + "/username", in);
|
||||
r.assertOK();
|
||||
assertThat(newGson().fromJson(r.getReader(), String.class)).isEqualTo(
|
||||
in.username);
|
||||
@@ -48,7 +48,7 @@ public class PutUsernameIT extends AbstractDaemonTest {
|
||||
public void setExisting_Conflict() throws Exception {
|
||||
PutUsername.Input in = new PutUsername.Input();
|
||||
in.username = admin.username;
|
||||
adminSession
|
||||
adminRestSession
|
||||
.put("/accounts/" + createUser().get() + "/username", in)
|
||||
.assertConflict();
|
||||
}
|
||||
@@ -57,14 +57,14 @@ public class PutUsernameIT extends AbstractDaemonTest {
|
||||
public void setNew_MethodNotAllowed() throws Exception {
|
||||
PutUsername.Input in = new PutUsername.Input();
|
||||
in.username = "newUsername";
|
||||
adminSession
|
||||
adminRestSession
|
||||
.put("/accounts/" + admin.username + "/username", in)
|
||||
.assertMethodNotAllowed();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void delete_MethodNotAllowed() throws Exception {
|
||||
adminSession
|
||||
adminRestSession
|
||||
.put("/accounts/" + admin.username + "/username")
|
||||
.assertMethodNotAllowed();
|
||||
}
|
||||
|
@@ -178,14 +178,14 @@ public class CreateChangeIT extends AbstractDaemonTest {
|
||||
|
||||
// TODO(davido): Expose setting of account preferences in the API
|
||||
private void setSignedOffByFooter() throws Exception {
|
||||
RestResponse r = adminSession.get("/accounts/" + admin.email
|
||||
RestResponse r = adminRestSession.get("/accounts/" + admin.email
|
||||
+ "/preferences");
|
||||
r.assertOK();
|
||||
GeneralPreferencesInfo i =
|
||||
newGson().fromJson(r.getReader(), GeneralPreferencesInfo.class);
|
||||
i.signedOffBy = true;
|
||||
|
||||
r = adminSession.put("/accounts/" + admin.email + "/preferences", i);
|
||||
r = adminRestSession.put("/accounts/" + admin.email + "/preferences", i);
|
||||
r.assertOK();
|
||||
GeneralPreferencesInfo o = newGson().fromJson(r.getReader(),
|
||||
GeneralPreferencesInfo.class);
|
||||
|
@@ -51,7 +51,7 @@ public class DeleteDraftPatchSetIT extends AbstractDaemonTest {
|
||||
ChangeInfo c = get(triplet);
|
||||
assertThat(c.id).isEqualTo(triplet);
|
||||
assertThat(c.status).isEqualTo(ChangeStatus.NEW);
|
||||
RestResponse r = deletePatchSet(changeId, ps, adminSession);
|
||||
RestResponse r = deletePatchSet(changeId, ps, adminRestSession);
|
||||
assertThat(r.getEntityContent()).isEqualTo("Patch set is not a draft");
|
||||
r.assertConflict();
|
||||
}
|
||||
@@ -64,7 +64,7 @@ public class DeleteDraftPatchSetIT extends AbstractDaemonTest {
|
||||
ChangeInfo c = get(triplet);
|
||||
assertThat(c.id).isEqualTo(triplet);
|
||||
assertThat(c.status).isEqualTo(ChangeStatus.DRAFT);
|
||||
RestResponse r = deletePatchSet(changeId, ps, userSession);
|
||||
RestResponse r = deletePatchSet(changeId, ps, userRestSession);
|
||||
assertThat(r.getEntityContent()).isEqualTo("Not found: " + changeId);
|
||||
r.assertNotFound();
|
||||
}
|
||||
@@ -87,14 +87,14 @@ public class DeleteDraftPatchSetIT extends AbstractDaemonTest {
|
||||
assertThat(cd.patchSets()).hasSize(2);
|
||||
assertThat(cd.change().currentPatchSetId().get()).isEqualTo(2);
|
||||
assertThat(cd.change().getStatus()).isEqualTo(Change.Status.DRAFT);
|
||||
deletePatchSet(changeId, ps, adminSession).assertNoContent();
|
||||
deletePatchSet(changeId, ps, adminRestSession).assertNoContent();
|
||||
|
||||
cd = getChange(changeId);
|
||||
assertThat(cd.patchSets()).hasSize(1);
|
||||
assertThat(cd.change().currentPatchSetId().get()).isEqualTo(1);
|
||||
|
||||
ps = getCurrentPatchSet(changeId);
|
||||
deletePatchSet(changeId, ps, adminSession).assertNoContent();
|
||||
deletePatchSet(changeId, ps, adminRestSession).assertNoContent();
|
||||
assertThat(queryProvider.get().byKeyPrefix(changeId)).isEmpty();
|
||||
|
||||
if (notesMigration.writeChanges()) {
|
||||
|
@@ -53,7 +53,7 @@ public class DraftChangeIT extends AbstractDaemonTest {
|
||||
ChangeInfo c = get(triplet);
|
||||
assertThat(c.id).isEqualTo(triplet);
|
||||
assertThat(c.status).isEqualTo(ChangeStatus.NEW);
|
||||
RestResponse response = deleteChange(changeId, adminSession);
|
||||
RestResponse response = deleteChange(changeId, adminRestSession);
|
||||
assertThat(response.getEntityContent())
|
||||
.isEqualTo("Change is not a draft: " + c._number);
|
||||
response.assertConflict();
|
||||
@@ -69,7 +69,7 @@ public class DraftChangeIT extends AbstractDaemonTest {
|
||||
ChangeInfo c = get(triplet);
|
||||
assertThat(c.id).isEqualTo(triplet);
|
||||
assertThat(c.status).isEqualTo(ChangeStatus.DRAFT);
|
||||
deleteChange(changeId, adminSession).assertNoContent();
|
||||
deleteChange(changeId, adminRestSession).assertNoContent();
|
||||
|
||||
exception.expect(ResourceNotFoundException.class);
|
||||
get(triplet);
|
||||
@@ -151,13 +151,13 @@ public class DraftChangeIT extends AbstractDaemonTest {
|
||||
}
|
||||
|
||||
private RestResponse publishChange(String changeId) throws Exception {
|
||||
return adminSession.post("/changes/" + changeId + "/publish");
|
||||
return adminRestSession.post("/changes/" + changeId + "/publish");
|
||||
}
|
||||
|
||||
private RestResponse publishPatchSet(String changeId) throws Exception {
|
||||
PatchSet patchSet = Iterables.getOnlyElement(
|
||||
queryProvider.get().byKeyPrefix(changeId)).currentPatchSet();
|
||||
return adminSession.post("/changes/"
|
||||
return adminRestSession.post("/changes/"
|
||||
+ changeId
|
||||
+ "/revisions/"
|
||||
+ patchSet.getRevision().get()
|
||||
|
@@ -22,7 +22,7 @@ public class IndexChangeIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void indexChange() throws Exception {
|
||||
String changeId = createChange().getChangeId();
|
||||
adminSession
|
||||
adminRestSession
|
||||
.post("/changes/" + changeId + "/index/")
|
||||
.assertNoContent();
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public class IndexChangeIT extends AbstractDaemonTest {
|
||||
public void indexChangeOnNonVisibleBranch() throws Exception {
|
||||
String changeId = createChange().getChangeId();
|
||||
blockRead("refs/heads/master");
|
||||
userSession
|
||||
userRestSession
|
||||
.post("/changes/" + changeId + "/index/")
|
||||
.assertNotFound();
|
||||
}
|
||||
|
@@ -33,28 +33,28 @@ public class CacheOperationsIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void flushAll() throws Exception {
|
||||
RestResponse r = adminSession.get("/config/server/caches/project_list");
|
||||
RestResponse r = adminRestSession.get("/config/server/caches/project_list");
|
||||
CacheInfo cacheInfo = newGson().fromJson(r.getReader(), CacheInfo.class);
|
||||
assertThat(cacheInfo.entries.mem).isGreaterThan((long) 0);
|
||||
|
||||
r = adminSession.post("/config/server/caches/", new PostCaches.Input(FLUSH_ALL));
|
||||
r = adminRestSession.post("/config/server/caches/", new PostCaches.Input(FLUSH_ALL));
|
||||
r.assertOK();
|
||||
r.consume();
|
||||
|
||||
r = adminSession.get("/config/server/caches/project_list");
|
||||
r = adminRestSession.get("/config/server/caches/project_list");
|
||||
cacheInfo = newGson().fromJson(r.getReader(), CacheInfo.class);
|
||||
assertThat(cacheInfo.entries.mem).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void flushAll_Forbidden() throws Exception {
|
||||
userSession.post("/config/server/caches/",
|
||||
userRestSession.post("/config/server/caches/",
|
||||
new PostCaches.Input(FLUSH_ALL)).assertForbidden();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void flushAll_BadRequest() throws Exception {
|
||||
adminSession
|
||||
adminRestSession
|
||||
.post("/config/server/caches/",
|
||||
new PostCaches.Input(FLUSH_ALL, Arrays.asList("projects")))
|
||||
.assertBadRequest();
|
||||
@@ -62,31 +62,31 @@ public class CacheOperationsIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void flush() throws Exception {
|
||||
RestResponse r = adminSession.get("/config/server/caches/project_list");
|
||||
RestResponse r = adminRestSession.get("/config/server/caches/project_list");
|
||||
CacheInfo cacheInfo = newGson().fromJson(r.getReader(), CacheInfo.class);
|
||||
assertThat(cacheInfo.entries.mem).isGreaterThan((long)0);
|
||||
|
||||
r = adminSession.get("/config/server/caches/projects");
|
||||
r = adminRestSession.get("/config/server/caches/projects");
|
||||
cacheInfo = newGson().fromJson(r.getReader(), CacheInfo.class);
|
||||
assertThat(cacheInfo.entries.mem).isGreaterThan((long)1);
|
||||
|
||||
r = adminSession.post("/config/server/caches/",
|
||||
r = adminRestSession.post("/config/server/caches/",
|
||||
new PostCaches.Input(FLUSH, Arrays.asList("accounts", "project_list")));
|
||||
r.assertOK();
|
||||
r.consume();
|
||||
|
||||
r = adminSession.get("/config/server/caches/project_list");
|
||||
r = adminRestSession.get("/config/server/caches/project_list");
|
||||
cacheInfo = newGson().fromJson(r.getReader(), CacheInfo.class);
|
||||
assertThat(cacheInfo.entries.mem).isNull();
|
||||
|
||||
r = adminSession.get("/config/server/caches/projects");
|
||||
r = adminRestSession.get("/config/server/caches/projects");
|
||||
cacheInfo = newGson().fromJson(r.getReader(), CacheInfo.class);
|
||||
assertThat(cacheInfo.entries.mem).isGreaterThan((long)1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void flush_Forbidden() throws Exception {
|
||||
userSession
|
||||
userRestSession
|
||||
.post("/config/server/caches/",
|
||||
new PostCaches.Input(FLUSH, Arrays.asList("projects")))
|
||||
.assertForbidden();
|
||||
@@ -94,7 +94,7 @@ public class CacheOperationsIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void flush_BadRequest() throws Exception {
|
||||
adminSession
|
||||
adminRestSession
|
||||
.post("/config/server/caches/",
|
||||
new PostCaches.Input(FLUSH))
|
||||
.assertBadRequest();
|
||||
@@ -102,16 +102,16 @@ public class CacheOperationsIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void flush_UnprocessableEntity() throws Exception {
|
||||
RestResponse r = adminSession.get("/config/server/caches/projects");
|
||||
RestResponse r = adminRestSession.get("/config/server/caches/projects");
|
||||
CacheInfo cacheInfo = newGson().fromJson(r.getReader(), CacheInfo.class);
|
||||
assertThat(cacheInfo.entries.mem).isGreaterThan((long)0);
|
||||
|
||||
r = adminSession.post("/config/server/caches/",
|
||||
r = adminRestSession.post("/config/server/caches/",
|
||||
new PostCaches.Input(FLUSH, Arrays.asList("projects", "unprocessable")));
|
||||
r.assertUnprocessableEntity();
|
||||
r.consume();
|
||||
|
||||
r = adminSession.get("/config/server/caches/projects");
|
||||
r = adminRestSession.get("/config/server/caches/projects");
|
||||
cacheInfo = newGson().fromJson(r.getReader(), CacheInfo.class);
|
||||
assertThat(cacheInfo.entries.mem).isGreaterThan((long)0);
|
||||
}
|
||||
@@ -121,12 +121,12 @@ public class CacheOperationsIT extends AbstractDaemonTest {
|
||||
allowGlobalCapabilities(REGISTERED_USERS,
|
||||
GlobalCapability.FLUSH_CACHES, GlobalCapability.VIEW_CACHES);
|
||||
try {
|
||||
RestResponse r = userSession.post("/config/server/caches/",
|
||||
RestResponse r = userRestSession.post("/config/server/caches/",
|
||||
new PostCaches.Input(FLUSH, Arrays.asList("projects")));
|
||||
r.assertOK();
|
||||
r.consume();
|
||||
|
||||
userSession
|
||||
userRestSession
|
||||
.post("/config/server/caches/",
|
||||
new PostCaches.Input(FLUSH, Arrays.asList("web_sessions")))
|
||||
.assertForbidden();
|
||||
|
@@ -40,7 +40,7 @@ public class ConfirmEmailIT extends AbstractDaemonTest {
|
||||
public void confirm() throws Exception {
|
||||
ConfirmEmail.Input in = new ConfirmEmail.Input();
|
||||
in.token = emailTokenVerifier.encode(admin.getId(), "new.mail@example.com");
|
||||
adminSession
|
||||
adminRestSession
|
||||
.put("/config/server/email.confirm", in)
|
||||
.assertNoContent();
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public class ConfirmEmailIT extends AbstractDaemonTest {
|
||||
public void confirmForOtherUser_UnprocessableEntity() throws Exception {
|
||||
ConfirmEmail.Input in = new ConfirmEmail.Input();
|
||||
in.token = emailTokenVerifier.encode(user.getId(), "new.mail@example.com");
|
||||
adminSession
|
||||
adminRestSession
|
||||
.put("/config/server/email.confirm", in)
|
||||
.assertUnprocessableEntity();
|
||||
}
|
||||
@@ -58,7 +58,7 @@ public class ConfirmEmailIT extends AbstractDaemonTest {
|
||||
public void confirmInvalidToken_UnprocessableEntity() throws Exception {
|
||||
ConfirmEmail.Input in = new ConfirmEmail.Input();
|
||||
in.token = "invalidToken";
|
||||
adminSession
|
||||
adminRestSession
|
||||
.put("/config/server/email.confirm", in)
|
||||
.assertUnprocessableEntity();
|
||||
}
|
||||
|
@@ -28,43 +28,43 @@ public class FlushCacheIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void flushCache() throws Exception {
|
||||
RestResponse r = adminSession.get("/config/server/caches/groups");
|
||||
RestResponse r = adminRestSession.get("/config/server/caches/groups");
|
||||
CacheInfo result = newGson().fromJson(r.getReader(), CacheInfo.class);
|
||||
assertThat(result.entries.mem).isGreaterThan((long)0);
|
||||
|
||||
r = adminSession.post("/config/server/caches/groups/flush");
|
||||
r = adminRestSession.post("/config/server/caches/groups/flush");
|
||||
r.assertOK();
|
||||
r.consume();
|
||||
|
||||
r = adminSession.get("/config/server/caches/groups");
|
||||
r = adminRestSession.get("/config/server/caches/groups");
|
||||
result = newGson().fromJson(r.getReader(), CacheInfo.class);
|
||||
assertThat(result.entries.mem).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void flushCache_Forbidden() throws Exception {
|
||||
userSession
|
||||
userRestSession
|
||||
.post("/config/server/caches/accounts/flush")
|
||||
.assertForbidden();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void flushCache_NotFound() throws Exception {
|
||||
adminSession
|
||||
adminRestSession
|
||||
.post("/config/server/caches/nonExisting/flush")
|
||||
.assertNotFound();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void flushCacheWithGerritPrefix() throws Exception {
|
||||
adminSession
|
||||
adminRestSession
|
||||
.post("/config/server/caches/gerrit-accounts/flush")
|
||||
.assertOK();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void flushWebSessionsCache() throws Exception {
|
||||
adminSession
|
||||
adminRestSession
|
||||
.post("/config/server/caches/web_sessions/flush")
|
||||
.assertOK();
|
||||
}
|
||||
@@ -74,11 +74,11 @@ public class FlushCacheIT extends AbstractDaemonTest {
|
||||
allowGlobalCapabilities(REGISTERED_USERS,
|
||||
GlobalCapability.VIEW_CACHES, GlobalCapability.FLUSH_CACHES);
|
||||
try {
|
||||
RestResponse r = userSession.post("/config/server/caches/accounts/flush");
|
||||
RestResponse r = userRestSession.post("/config/server/caches/accounts/flush");
|
||||
r.assertOK();
|
||||
r.consume();
|
||||
|
||||
userSession
|
||||
userRestSession
|
||||
.post("/config/server/caches/web_sessions/flush")
|
||||
.assertForbidden();
|
||||
} finally {
|
||||
|
@@ -27,7 +27,7 @@ public class GetCacheIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void getCache() throws Exception {
|
||||
RestResponse r = adminSession.get("/config/server/caches/accounts");
|
||||
RestResponse r = adminRestSession.get("/config/server/caches/accounts");
|
||||
r.assertOK();
|
||||
CacheInfo result = newGson().fromJson(r.getReader(), CacheInfo.class);
|
||||
|
||||
@@ -42,8 +42,8 @@ public class GetCacheIT extends AbstractDaemonTest {
|
||||
assertThat(result.hitRatio.mem).isAtMost(100);
|
||||
assertThat(result.hitRatio.disk).isNull();
|
||||
|
||||
userSession.get("/config/server/version").consume();
|
||||
r = adminSession.get("/config/server/caches/accounts");
|
||||
userRestSession.get("/config/server/version").consume();
|
||||
r = adminRestSession.get("/config/server/caches/accounts");
|
||||
r.assertOK();
|
||||
result = newGson().fromJson(r.getReader(), CacheInfo.class);
|
||||
assertThat(result.entries.mem).isEqualTo(2);
|
||||
@@ -51,21 +51,21 @@ public class GetCacheIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void getCache_Forbidden() throws Exception {
|
||||
userSession
|
||||
userRestSession
|
||||
.get("/config/server/caches/accounts")
|
||||
.assertForbidden();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getCache_NotFound() throws Exception {
|
||||
adminSession
|
||||
adminRestSession
|
||||
.get("/config/server/caches/nonExisting")
|
||||
.assertNotFound();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getCacheWithGerritPrefix() throws Exception {
|
||||
adminSession
|
||||
adminRestSession
|
||||
.get("/config/server/caches/gerrit-accounts")
|
||||
.assertOK();
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ public class GetTaskIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void getTask() throws Exception {
|
||||
RestResponse r =
|
||||
adminSession.get("/config/server/tasks/" + getLogFileCompressorTaskId());
|
||||
adminRestSession.get("/config/server/tasks/" + getLogFileCompressorTaskId());
|
||||
r.assertOK();
|
||||
TaskInfo info =
|
||||
newGson().fromJson(r.getReader(),
|
||||
@@ -43,13 +43,13 @@ public class GetTaskIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void getTask_NotFound() throws Exception {
|
||||
userSession
|
||||
userRestSession
|
||||
.get("/config/server/tasks/" + getLogFileCompressorTaskId())
|
||||
.assertNotFound();
|
||||
}
|
||||
|
||||
private String getLogFileCompressorTaskId() throws Exception {
|
||||
RestResponse r = adminSession.get("/config/server/tasks/");
|
||||
RestResponse r = adminRestSession.get("/config/server/tasks/");
|
||||
List<TaskInfo> result =
|
||||
newGson().fromJson(r.getReader(),
|
||||
new TypeToken<List<TaskInfo>>() {}.getType());
|
||||
|
@@ -28,18 +28,18 @@ import java.util.List;
|
||||
public class KillTaskIT extends AbstractDaemonTest {
|
||||
|
||||
private void killTask() throws Exception {
|
||||
RestResponse r = adminSession.get("/config/server/tasks/");
|
||||
RestResponse r = adminRestSession.get("/config/server/tasks/");
|
||||
List<TaskInfo> result = newGson().fromJson(r.getReader(),
|
||||
new TypeToken<List<TaskInfo>>() {}.getType());
|
||||
r.consume();
|
||||
int taskCount = result.size();
|
||||
assertThat(taskCount).isGreaterThan(0);
|
||||
|
||||
r = adminSession.delete("/config/server/tasks/" + result.get(0).id);
|
||||
r = adminRestSession.delete("/config/server/tasks/" + result.get(0).id);
|
||||
r.assertNoContent();
|
||||
r.consume();
|
||||
|
||||
r = adminSession.get("/config/server/tasks/");
|
||||
r = adminRestSession.get("/config/server/tasks/");
|
||||
result = newGson().fromJson(r.getReader(),
|
||||
new TypeToken<List<TaskInfo>>() {}.getType());
|
||||
r.consume();
|
||||
@@ -47,13 +47,13 @@ public class KillTaskIT extends AbstractDaemonTest {
|
||||
}
|
||||
|
||||
private void killTask_NotFound() throws Exception {
|
||||
RestResponse r = adminSession.get("/config/server/tasks/");
|
||||
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);
|
||||
|
||||
userSession
|
||||
userRestSession
|
||||
.delete("/config/server/tasks/" + result.get(0).id)
|
||||
.assertNotFound();
|
||||
}
|
||||
|
@@ -35,7 +35,7 @@ public class ListCachesIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void listCaches() throws Exception {
|
||||
RestResponse r = adminSession.get("/config/server/caches/");
|
||||
RestResponse r = adminRestSession.get("/config/server/caches/");
|
||||
r.assertOK();
|
||||
Map<String, CacheInfo> result =
|
||||
newGson().fromJson(r.getReader(),
|
||||
@@ -53,8 +53,8 @@ public class ListCachesIT extends AbstractDaemonTest {
|
||||
assertThat(accountsCacheInfo.hitRatio.mem).isAtMost(100);
|
||||
assertThat(accountsCacheInfo.hitRatio.disk).isNull();
|
||||
|
||||
userSession.get("/config/server/version").consume();
|
||||
r = adminSession.get("/config/server/caches/");
|
||||
userRestSession.get("/config/server/version").consume();
|
||||
r = adminRestSession.get("/config/server/caches/");
|
||||
r.assertOK();
|
||||
result = newGson().fromJson(r.getReader(),
|
||||
new TypeToken<Map<String, CacheInfo>>() {}.getType());
|
||||
@@ -63,14 +63,14 @@ public class ListCachesIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void listCaches_Forbidden() throws Exception {
|
||||
userSession
|
||||
userRestSession
|
||||
.get("/config/server/caches/")
|
||||
.assertForbidden();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void listCacheNames() throws Exception {
|
||||
RestResponse r = adminSession.get("/config/server/caches/?format=LIST");
|
||||
RestResponse r = adminRestSession.get("/config/server/caches/?format=LIST");
|
||||
r.assertOK();
|
||||
List<String> result =
|
||||
newGson().fromJson(r.getReader(),
|
||||
@@ -82,7 +82,7 @@ public class ListCachesIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void listCacheNamesTextList() throws Exception {
|
||||
RestResponse r = adminSession.get("/config/server/caches/?format=TEXT_LIST");
|
||||
RestResponse r = adminRestSession.get("/config/server/caches/?format=TEXT_LIST");
|
||||
r.assertOK();
|
||||
String result = new String(Base64.decode(r.getEntityContent()), UTF_8.name());
|
||||
List<String> list = Arrays.asList(result.split("\n"));
|
||||
@@ -93,7 +93,7 @@ public class ListCachesIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void listCaches_BadRequest() throws Exception {
|
||||
adminSession
|
||||
adminRestSession
|
||||
.get("/config/server/caches/?format=NONSENSE")
|
||||
.assertBadRequest();
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ public class ListTasksIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void listTasks() throws Exception {
|
||||
RestResponse r = adminSession.get("/config/server/tasks/");
|
||||
RestResponse r = adminRestSession.get("/config/server/tasks/");
|
||||
r.assertOK();
|
||||
List<TaskInfo> result =
|
||||
newGson().fromJson(r.getReader(),
|
||||
@@ -50,7 +50,7 @@ public class ListTasksIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void listTasksWithoutViewQueueCapability() throws Exception {
|
||||
RestResponse r = userSession.get("/config/server/tasks/");
|
||||
RestResponse r = userRestSession.get("/config/server/tasks/");
|
||||
r.assertOK();
|
||||
List<TaskInfo> result =
|
||||
newGson().fromJson(r.getReader(),
|
||||
|
@@ -73,7 +73,7 @@ public class ServerInfoIT extends AbstractDaemonTest {
|
||||
@GerritConfig(name = "user.anonymousCoward", value = "Unnamed User"),
|
||||
})
|
||||
public void serverConfig() throws Exception {
|
||||
RestResponse r = adminSession.get("/config/server/info/");
|
||||
RestResponse r = adminRestSession.get("/config/server/info/");
|
||||
ServerInfo i = newGson().fromJson(r.getReader(), ServerInfo.class);
|
||||
|
||||
// auth
|
||||
@@ -129,9 +129,9 @@ public class ServerInfoIT extends AbstractDaemonTest {
|
||||
Path plugins = tempSiteDir.newFolder("plugins").toPath();
|
||||
Path jsplugin = plugins.resolve("js-plugin-1.js");
|
||||
Files.write(jsplugin, "Gerrit.install(function(self){});\n".getBytes(UTF_8));
|
||||
sshSession.exec("gerrit plugin reload");
|
||||
adminSshSession.exec("gerrit plugin reload");
|
||||
|
||||
RestResponse r = adminSession.get("/config/server/info/");
|
||||
RestResponse r = adminRestSession.get("/config/server/info/");
|
||||
ServerInfo i = newGson().fromJson(r.getReader(), ServerInfo.class);
|
||||
|
||||
// plugin
|
||||
@@ -140,7 +140,7 @@ public class ServerInfoIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void serverConfigWithDefaults() throws Exception {
|
||||
RestResponse r = adminSession.get("/config/server/info/");
|
||||
RestResponse r = adminRestSession.get("/config/server/info/");
|
||||
ServerInfo i = newGson().fromJson(r.getReader(), ServerInfo.class);
|
||||
|
||||
// auth
|
||||
|
@@ -21,7 +21,7 @@ import org.junit.Test;
|
||||
public class AddMemberIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void addNonExistingMember_NotFound() throws Exception {
|
||||
adminSession
|
||||
adminRestSession
|
||||
.put("/groups/Administrators/members/non-existing")
|
||||
.assertNotFound();
|
||||
}
|
||||
|
@@ -37,7 +37,7 @@ public class BanCommitIT extends AbstractDaemonTest {
|
||||
.create();
|
||||
|
||||
RestResponse r =
|
||||
adminSession.put("/projects/" + project.get() + "/ban/",
|
||||
adminRestSession.put("/projects/" + project.get() + "/ban/",
|
||||
BanCommit.Input.fromCommits(c.name()));
|
||||
r.assertOK();
|
||||
BanResultInfo info = newGson().fromJson(r.getReader(), BanResultInfo.class);
|
||||
@@ -55,11 +55,11 @@ public class BanCommitIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void banAlreadyBannedCommit() throws Exception {
|
||||
RestResponse r =
|
||||
adminSession.put("/projects/" + project.get() + "/ban/",
|
||||
adminRestSession.put("/projects/" + project.get() + "/ban/",
|
||||
BanCommit.Input.fromCommits("a8a477efffbbf3b44169bb9a1d3a334cbbd9aa96"));
|
||||
r.consume();
|
||||
|
||||
r = adminSession.put("/projects/" + project.get() + "/ban/",
|
||||
r = adminRestSession.put("/projects/" + project.get() + "/ban/",
|
||||
BanCommit.Input.fromCommits("a8a477efffbbf3b44169bb9a1d3a334cbbd9aa96"));
|
||||
r.assertOK();
|
||||
BanResultInfo info = newGson().fromJson(r.getReader(), BanResultInfo.class);
|
||||
@@ -71,7 +71,7 @@ public class BanCommitIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void banCommit_Forbidden() throws Exception {
|
||||
userSession
|
||||
userRestSession
|
||||
.put("/projects/" + project.get() + "/ban/", BanCommit.Input.fromCommits(
|
||||
"a8a477efffbbf3b44169bb9a1d3a334cbbd9aa96"))
|
||||
.assertForbidden();
|
||||
|
@@ -54,7 +54,7 @@ public class CreateProjectIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void testCreateProjectHttp() throws Exception {
|
||||
String newProjectName = name("newProject");
|
||||
RestResponse r = adminSession.put("/projects/" + newProjectName);
|
||||
RestResponse r = adminRestSession.put("/projects/" + newProjectName);
|
||||
r.assertCreated();
|
||||
ProjectInfo p = newGson().fromJson(r.getReader(), ProjectInfo.class);
|
||||
assertThat(p.name).isEqualTo(newProjectName);
|
||||
@@ -67,7 +67,7 @@ public class CreateProjectIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void testCreateProjectHttpWhenProjectAlreadyExists_Conflict()
|
||||
throws Exception {
|
||||
adminSession
|
||||
adminRestSession
|
||||
.put("/projects/" + allProjects.get())
|
||||
.assertConflict();
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public class CreateProjectIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void testCreateProjectHttpWhenProjectAlreadyExists_PreconditionFailed()
|
||||
throws Exception {
|
||||
adminSession
|
||||
adminRestSession
|
||||
.putWithHeader("/projects/" + allProjects.get(),
|
||||
new BasicHeader(HttpHeaders.IF_NONE_MATCH, "*"))
|
||||
.assertPreconditionFailed();
|
||||
@@ -85,7 +85,7 @@ public class CreateProjectIT extends AbstractDaemonTest {
|
||||
@UseLocalDisk
|
||||
public void testCreateProjectHttpWithUnreasonableName_BadRequest()
|
||||
throws Exception {
|
||||
adminSession
|
||||
adminRestSession
|
||||
.put("/projects/" + Url.encode(name("invalid/../name")))
|
||||
.assertBadRequest();
|
||||
}
|
||||
@@ -94,7 +94,7 @@ public class CreateProjectIT extends AbstractDaemonTest {
|
||||
public void testCreateProjectHttpWithNameMismatch_BadRequest() throws Exception {
|
||||
ProjectInput in = new ProjectInput();
|
||||
in.name = name("otherName");
|
||||
adminSession
|
||||
adminRestSession
|
||||
.put("/projects/" + name("someName"), in)
|
||||
.assertBadRequest();
|
||||
}
|
||||
@@ -104,7 +104,7 @@ public class CreateProjectIT extends AbstractDaemonTest {
|
||||
throws Exception {
|
||||
ProjectInput in = new ProjectInput();
|
||||
in.branches = Collections.singletonList(name("invalid ref name"));
|
||||
adminSession
|
||||
adminRestSession
|
||||
.put("/projects/" + name("newProject"), in)
|
||||
.assertBadRequest();
|
||||
}
|
||||
|
@@ -43,7 +43,7 @@ public class GarbageCollectionIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void testGcNotAllowed_Forbidden() throws Exception {
|
||||
userSession
|
||||
userRestSession
|
||||
.post("/projects/" + allProjects.get() + "/gc")
|
||||
.assertForbidden();
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public class GarbageCollectionIT extends AbstractDaemonTest {
|
||||
}
|
||||
|
||||
private RestResponse POST(String endPoint) throws Exception {
|
||||
RestResponse r = adminSession.post(endPoint);
|
||||
RestResponse r = adminRestSession.post(endPoint);
|
||||
r.consume();
|
||||
return r;
|
||||
}
|
||||
|
@@ -129,13 +129,13 @@ public class GetCommitIT extends AbstractDaemonTest {
|
||||
}
|
||||
|
||||
private void assertNotFound(ObjectId id) throws Exception {
|
||||
userSession
|
||||
userRestSession
|
||||
.get("/projects/" + project.get() + "/commits/" + id.name())
|
||||
.assertNotFound();
|
||||
}
|
||||
|
||||
private CommitInfo getCommit(ObjectId id) throws Exception {
|
||||
RestResponse r = userSession.get(
|
||||
RestResponse r = userRestSession.get(
|
||||
"/projects/" + project.get() + "/commits/" + id.name());
|
||||
r.assertOK();
|
||||
CommitInfo result = newGson().fromJson(r.getReader(), CommitInfo.class);
|
||||
|
@@ -29,7 +29,7 @@ public class SetParentIT extends AbstractDaemonTest {
|
||||
public void setParent_Forbidden() throws Exception {
|
||||
String parent = createProject("parent", null, true).get();
|
||||
RestResponse r =
|
||||
userSession.put("/projects/" + project.get() + "/parent",
|
||||
userRestSession.put("/projects/" + project.get() + "/parent",
|
||||
newParentInput(parent));
|
||||
r.assertForbidden();
|
||||
r.consume();
|
||||
@@ -39,12 +39,12 @@ public class SetParentIT extends AbstractDaemonTest {
|
||||
public void setParent() throws Exception {
|
||||
String parent = createProject("parent", null, true).get();
|
||||
RestResponse r =
|
||||
adminSession.put("/projects/" + project.get() + "/parent",
|
||||
adminRestSession.put("/projects/" + project.get() + "/parent",
|
||||
newParentInput(parent));
|
||||
r.assertOK();
|
||||
r.consume();
|
||||
|
||||
r = adminSession.get("/projects/" + project.get() + "/parent");
|
||||
r = adminRestSession.get("/projects/" + project.get() + "/parent");
|
||||
r.assertOK();
|
||||
String newParent =
|
||||
newGson().fromJson(r.getReader(), String.class);
|
||||
@@ -53,12 +53,12 @@ public class SetParentIT extends AbstractDaemonTest {
|
||||
|
||||
// When the parent name is not explicitly set, it should be
|
||||
// set to "All-Projects".
|
||||
r = adminSession.put("/projects/" + project.get() + "/parent",
|
||||
r = adminRestSession.put("/projects/" + project.get() + "/parent",
|
||||
newParentInput(null));
|
||||
r.assertOK();
|
||||
r.consume();
|
||||
|
||||
r = adminSession.get("/projects/" + project.get() + "/parent");
|
||||
r = adminRestSession.get("/projects/" + project.get() + "/parent");
|
||||
r.assertOK();
|
||||
newParent = newGson().fromJson(r.getReader(), String.class);
|
||||
assertThat(newParent).isEqualTo(AllProjectsNameProvider.DEFAULT);
|
||||
@@ -68,7 +68,7 @@ public class SetParentIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void setParentForAllProjects_Conflict() throws Exception {
|
||||
RestResponse r =
|
||||
adminSession.put("/projects/" + allProjects.get() + "/parent",
|
||||
adminRestSession.put("/projects/" + allProjects.get() + "/parent",
|
||||
newParentInput(project.get()));
|
||||
r.assertConflict();
|
||||
r.consume();
|
||||
@@ -77,19 +77,19 @@ public class SetParentIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void setInvalidParent_Conflict() throws Exception {
|
||||
RestResponse r =
|
||||
adminSession.put("/projects/" + project.get() + "/parent",
|
||||
adminRestSession.put("/projects/" + project.get() + "/parent",
|
||||
newParentInput(project.get()));
|
||||
r.assertConflict();
|
||||
r.consume();
|
||||
|
||||
Project.NameKey child = createProject("child", project, true);
|
||||
r = adminSession.put("/projects/" + project.get() + "/parent",
|
||||
r = adminRestSession.put("/projects/" + project.get() + "/parent",
|
||||
newParentInput(child.get()));
|
||||
r.assertConflict();
|
||||
r.consume();
|
||||
|
||||
String grandchild = createProject("grandchild", child, true).get();
|
||||
r = adminSession.put("/projects/" + project.get() + "/parent",
|
||||
r = adminRestSession.put("/projects/" + project.get() + "/parent",
|
||||
newParentInput(grandchild));
|
||||
r.assertConflict();
|
||||
r.consume();
|
||||
@@ -98,7 +98,7 @@ public class SetParentIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void setNonExistingParent_UnprocessibleEntity() throws Exception {
|
||||
RestResponse r =
|
||||
adminSession.put("/projects/" + project.get() + "/parent",
|
||||
adminRestSession.put("/projects/" + project.get() + "/parent",
|
||||
newParentInput("non-existing"));
|
||||
r.assertUnprocessableEntity();
|
||||
r.consume();
|
||||
|
@@ -41,7 +41,7 @@ public class TagsIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void listTagsOfNonExistingProject() throws Exception {
|
||||
adminSession
|
||||
adminRestSession
|
||||
.get("/projects/non-existing/tags")
|
||||
.assertNotFound();
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class TagsIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void listTagsOfNonVisibleProject() throws Exception {
|
||||
blockRead("refs/*");
|
||||
userSession
|
||||
userRestSession
|
||||
.get("/projects/" + project.get() + "/tags")
|
||||
.assertNotFound();
|
||||
}
|
||||
|
@@ -654,7 +654,7 @@ public class GetRelatedIT extends AbstractDaemonTest {
|
||||
throws Exception {
|
||||
String url = String.format("/changes/%d/revisions/%d/related",
|
||||
changeId.get(), ps);
|
||||
return newGson().fromJson(adminSession.get(url).getReader(),
|
||||
return newGson().fromJson(adminRestSession.get(url).getReader(),
|
||||
RelatedInfo.class).changes;
|
||||
}
|
||||
|
||||
|
@@ -66,10 +66,10 @@ public class AbandonRestoreIT extends AbstractDaemonTest {
|
||||
if (message != null) {
|
||||
command.append(" --message ").append(message);
|
||||
}
|
||||
String response = sshSession.exec(command.toString());
|
||||
String response = adminSshSession.exec(command.toString());
|
||||
assert_()
|
||||
.withFailureMessage(sshSession.getError())
|
||||
.that(sshSession.hasError())
|
||||
.withFailureMessage(adminSshSession.getError())
|
||||
.that(adminSshSession.hasError())
|
||||
.isFalse();
|
||||
assertThat(response.toLowerCase(Locale.US)).doesNotContain("error");
|
||||
}
|
||||
|
@@ -38,9 +38,9 @@ public class BanCommitIT extends AbstractDaemonTest {
|
||||
.create();
|
||||
|
||||
String response =
|
||||
sshSession.exec("gerrit ban-commit " + project.get() + " " + c.name());
|
||||
assert_().withFailureMessage(sshSession.getError())
|
||||
.that(sshSession.hasError()).isFalse();
|
||||
adminSshSession.exec("gerrit ban-commit " + project.get() + " " + c.name());
|
||||
assert_().withFailureMessage(adminSshSession.getError())
|
||||
.that(adminSshSession.hasError()).isFalse();
|
||||
assertThat(response.toLowerCase(Locale.US)).doesNotContain("error");
|
||||
|
||||
RemoteRefUpdate u = pushHead(testRepo, "refs/heads/master", false)
|
||||
|
@@ -28,10 +28,10 @@ public class CreateGroupIT extends AbstractDaemonTest {
|
||||
public void withDuplicateInternalGroupCaseSensitiveName_Conflict()
|
||||
throws Exception {
|
||||
String newGroupName = "dupGroupA";
|
||||
adminSession.put("/groups/" + newGroupName);
|
||||
sshSession.exec("gerrit create-group " + newGroupName);
|
||||
assert_().withFailureMessage(sshSession.getError())
|
||||
.that(sshSession.hasError()).isTrue();
|
||||
adminRestSession.put("/groups/" + newGroupName);
|
||||
adminSshSession.exec("gerrit create-group " + newGroupName);
|
||||
assert_().withFailureMessage(adminSshSession.getError())
|
||||
.that(adminSshSession.hasError()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -40,10 +40,10 @@ public class CreateGroupIT extends AbstractDaemonTest {
|
||||
String newGroupName = "dupGroupB";
|
||||
String newGroupNameLowerCase = newGroupName.toLowerCase();
|
||||
|
||||
adminSession.put("/groups/" + newGroupName);
|
||||
sshSession.exec("gerrit create-group " + newGroupNameLowerCase);
|
||||
assert_().withFailureMessage(sshSession.getError())
|
||||
.that(sshSession.hasError()).isFalse();
|
||||
adminRestSession.put("/groups/" + newGroupName);
|
||||
adminSshSession.exec("gerrit create-group " + newGroupNameLowerCase);
|
||||
assert_().withFailureMessage(adminSshSession.getError())
|
||||
.that(adminSshSession.hasError()).isFalse();
|
||||
assertThat(groupCache.get(new AccountGroup.NameKey(newGroupName)))
|
||||
.isNotNull();
|
||||
assertThat(groupCache.get(new AccountGroup.NameKey(newGroupNameLowerCase)))
|
||||
@@ -54,26 +54,26 @@ public class CreateGroupIT extends AbstractDaemonTest {
|
||||
public void withDuplicateSystemGroupCaseSensitiveName_Conflict()
|
||||
throws Exception {
|
||||
String newGroupName = "Registered Users";
|
||||
sshSession.exec("gerrit create-group " + newGroupName);
|
||||
assert_().withFailureMessage(sshSession.getError())
|
||||
.that(sshSession.hasError()).isTrue();
|
||||
adminSshSession.exec("gerrit create-group " + newGroupName);
|
||||
assert_().withFailureMessage(adminSshSession.getError())
|
||||
.that(adminSshSession.hasError()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withDuplicateSystemGroupCaseInsensitiveName_Conflict()
|
||||
throws Exception {
|
||||
String newGroupName = "Registered Users";
|
||||
sshSession.exec("gerrit create-group " + newGroupName);
|
||||
assert_().withFailureMessage(sshSession.getError())
|
||||
.that(sshSession.hasError()).isTrue();
|
||||
adminSshSession.exec("gerrit create-group " + newGroupName);
|
||||
assert_().withFailureMessage(adminSshSession.getError())
|
||||
.that(adminSshSession.hasError()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withNonDuplicateGroupName() throws Exception {
|
||||
String newGroupName = "newGroupB";
|
||||
sshSession.exec("gerrit create-group " + newGroupName);
|
||||
assert_().withFailureMessage(sshSession.getError())
|
||||
.that(sshSession.hasError()).isFalse();
|
||||
adminSshSession.exec("gerrit create-group " + newGroupName);
|
||||
assert_().withFailureMessage(adminSshSession.getError())
|
||||
.that(adminSshSession.hasError()).isFalse();
|
||||
AccountGroup accountGroup =
|
||||
groupCache.get(new AccountGroup.NameKey(newGroupName));
|
||||
assertThat(accountGroup).isNotNull();
|
||||
|
@@ -28,12 +28,12 @@ public class CreateProjectIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void withValidGroupName() throws Exception {
|
||||
String newGroupName = "newGroup";
|
||||
adminSession.put("/groups/" + newGroupName);
|
||||
adminRestSession.put("/groups/" + newGroupName);
|
||||
String newProjectName = "newProject";
|
||||
sshSession.exec("gerrit create-project --branch master --owner "
|
||||
adminSshSession.exec("gerrit create-project --branch master --owner "
|
||||
+ newGroupName + " " + newProjectName);
|
||||
assert_().withFailureMessage(sshSession.getError())
|
||||
.that(sshSession.hasError()).isFalse();
|
||||
assert_().withFailureMessage(adminSshSession.getError())
|
||||
.that(adminSshSession.hasError()).isFalse();
|
||||
ProjectState projectState =
|
||||
projectCache.get(new Project.NameKey(newProjectName));
|
||||
assertThat(projectState).isNotNull();
|
||||
@@ -42,13 +42,13 @@ public class CreateProjectIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void withInvalidGroupName() throws Exception {
|
||||
String newGroupName = "newGroup";
|
||||
adminSession.put("/groups/" + newGroupName);
|
||||
adminRestSession.put("/groups/" + newGroupName);
|
||||
String wrongGroupName = "newG";
|
||||
String newProjectName = "newProject";
|
||||
sshSession.exec("gerrit create-project --branch master --owner "
|
||||
adminSshSession.exec("gerrit create-project --branch master --owner "
|
||||
+ wrongGroupName + " " + newProjectName);
|
||||
assert_().withFailureMessage(sshSession.getError())
|
||||
.that(sshSession.hasError()).isTrue();
|
||||
assert_().withFailureMessage(adminSshSession.getError())
|
||||
.that(adminSshSession.hasError()).isTrue();
|
||||
ProjectState projectState =
|
||||
projectCache.get(new Project.NameKey(newProjectName));
|
||||
assertThat(projectState).isNull();
|
||||
|
@@ -20,7 +20,6 @@ import static com.google.common.truth.Truth.assert_;
|
||||
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
||||
import com.google.gerrit.acceptance.GcAssert;
|
||||
import com.google.gerrit.acceptance.NoHttpd;
|
||||
import com.google.gerrit.acceptance.SshSession;
|
||||
import com.google.gerrit.acceptance.UseLocalDisk;
|
||||
import com.google.gerrit.common.data.GarbageCollectionResult;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
@@ -59,10 +58,10 @@ public class GarbageCollectionIT extends AbstractDaemonTest {
|
||||
@UseLocalDisk
|
||||
public void testGc() throws Exception {
|
||||
String response =
|
||||
sshSession.exec("gerrit gc \"" + project.get() + "\" \""
|
||||
adminSshSession.exec("gerrit gc \"" + project.get() + "\" \""
|
||||
+ project2.get() + "\"");
|
||||
assert_().withFailureMessage(sshSession.getError())
|
||||
.that(sshSession.hasError()).isFalse();
|
||||
assert_().withFailureMessage(adminSshSession.getError())
|
||||
.that(adminSshSession.hasError()).isFalse();
|
||||
assertNoError(response);
|
||||
gcAssert.assertHasPackFile(project, project2);
|
||||
gcAssert.assertHasNoPackFile(allProjects, project3);
|
||||
@@ -71,23 +70,21 @@ public class GarbageCollectionIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
@UseLocalDisk
|
||||
public void testGcAll() throws Exception {
|
||||
String response = sshSession.exec("gerrit gc --all");
|
||||
assert_().withFailureMessage(sshSession.getError())
|
||||
.that(sshSession.hasError()).isFalse();
|
||||
String response = adminSshSession.exec("gerrit gc --all");
|
||||
assert_().withFailureMessage(adminSshSession.getError())
|
||||
.that(adminSshSession.hasError()).isFalse();
|
||||
assertNoError(response);
|
||||
gcAssert.assertHasPackFile(allProjects, project, project2, project3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGcWithoutCapability_Error() throws Exception {
|
||||
SshSession s = new SshSession(server, user);
|
||||
s.exec("gerrit gc --all");
|
||||
assertThat(s.hasError()).isTrue();
|
||||
String error = s.getError();
|
||||
userSshSession.exec("gerrit gc --all");
|
||||
assertThat(userSshSession.hasError()).isTrue();
|
||||
String error = userSshSession.getError();
|
||||
assertThat(error).isNotNull();
|
||||
assertError("One of the following capabilities is required to access this"
|
||||
+ " resource: [runGC, maintainServer]", error);
|
||||
s.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -150,9 +150,9 @@ public class QueryIT extends AbstractDaemonTest {
|
||||
public void shouldFailWithFilesWithoutPatchSetsOrCurrentPatchSetsOption()
|
||||
throws Exception {
|
||||
String changeId = createChange().getChangeId();
|
||||
sshSession.exec("gerrit query --files " + changeId);
|
||||
assertThat(sshSession.hasError()).isTrue();
|
||||
assertThat(sshSession.getError()).contains(
|
||||
adminSshSession.exec("gerrit query --files " + changeId);
|
||||
assertThat(adminSshSession.hasError()).isTrue();
|
||||
assertThat(adminSshSession.getError()).contains(
|
||||
"needs --patch-sets or --current-patch-set");
|
||||
}
|
||||
|
||||
@@ -303,9 +303,9 @@ public class QueryIT extends AbstractDaemonTest {
|
||||
private List<ChangeAttribute> executeSuccessfulQuery(String params)
|
||||
throws Exception {
|
||||
String rawResponse =
|
||||
sshSession.exec("gerrit query --format=JSON " + params);
|
||||
assert_().withFailureMessage(sshSession.getError())
|
||||
.that(sshSession.hasError()).isFalse();
|
||||
adminSshSession.exec("gerrit query --format=JSON " + params);
|
||||
assert_().withFailureMessage(adminSshSession.getError())
|
||||
.that(adminSshSession.hasError()).isFalse();
|
||||
return getChanges(rawResponse);
|
||||
}
|
||||
|
||||
|
@@ -58,7 +58,7 @@ public class UploadArchiveIT extends AbstractDaemonTest {
|
||||
String c = command(r, abbreviated);
|
||||
|
||||
InputStream out =
|
||||
sshSession.exec2("git-upload-archive " + project.get(),
|
||||
adminSshSession.exec2("git-upload-archive " + project.get(),
|
||||
argumentsToInputStream(c));
|
||||
|
||||
// Wrap with PacketLineIn to read ACK bytes from output stream
|
||||
@@ -101,7 +101,7 @@ public class UploadArchiveIT extends AbstractDaemonTest {
|
||||
String c = command(r, abbreviated);
|
||||
|
||||
InputStream out =
|
||||
sshSession.exec2("git-upload-archive " + project.get(),
|
||||
adminSshSession.exec2("git-upload-archive " + project.get(),
|
||||
argumentsToInputStream(c));
|
||||
|
||||
// Wrap with PacketLineIn to read ACK bytes from output stream
|
||||
|
Submodule plugins/cookbook-plugin updated: 97c7ccfd62...3e801bd7d4
Reference in New Issue
Block a user