Merge branch 'stable-2.14' into stable-2.15
* stable-2.14: AbstractQueryChangesTest: Extend byDraftBy to include test for "has:draft" AbstractQueryChangesTest: Add explicit tests for is:watched and watchedby: AbstractQueryChangesTest: Add explicit tests for is:abandoned and status:abandoned user-search: Clarify behavior of default search resulting in single change user-search: Fix query used in "My > Watched Changes" Documentation: Clarify ref-updated event content when ref is deleted Fix markup in Documentation section sendemail Allow graceful rolling restarts Change-Id: Ia48cfdd339aec2274e700ad2a69fc2dbf20b06b6
This commit is contained in:
@@ -49,6 +49,7 @@ import com.google.gerrit.extensions.api.changes.StarsInput;
|
||||
import com.google.gerrit.extensions.api.groups.GroupInput;
|
||||
import com.google.gerrit.extensions.api.projects.ConfigInput;
|
||||
import com.google.gerrit.extensions.client.InheritableBoolean;
|
||||
import com.google.gerrit.extensions.client.ProjectWatchInfo;
|
||||
import com.google.gerrit.extensions.client.ReviewerState;
|
||||
import com.google.gerrit.extensions.common.AccountInfo;
|
||||
import com.google.gerrit.extensions.common.ChangeInfo;
|
||||
@@ -376,6 +377,20 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
|
||||
assertQuery("is:closed", expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void byStatusAbandoned() throws Exception {
|
||||
TestRepository<Repo> repo = createProject("repo");
|
||||
ChangeInserter ins1 = newChangeWithStatus(repo, Change.Status.MERGED);
|
||||
insert(repo, ins1);
|
||||
ChangeInserter ins2 = newChangeWithStatus(repo, Change.Status.ABANDONED);
|
||||
Change change1 = insert(repo, ins2);
|
||||
insert(repo, newChangeWithStatus(repo, Change.Status.NEW));
|
||||
|
||||
assertQuery("status:abandoned", change1);
|
||||
assertQuery("status:ABANDONED", change1);
|
||||
assertQuery("is:abandoned", change1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void byStatusPrefix() throws Exception {
|
||||
TestRepository<Repo> repo = createProject("repo");
|
||||
@@ -1494,6 +1509,8 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
|
||||
Change change1 = insert(repo, newChange(repo));
|
||||
Change change2 = insert(repo, newChange(repo));
|
||||
|
||||
assertQuery("has:draft");
|
||||
|
||||
DraftInput in = new DraftInput();
|
||||
in.line = 1;
|
||||
in.message = "nit: trailing whitespace";
|
||||
@@ -1509,6 +1526,7 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
|
||||
int user2 =
|
||||
accountManager.authenticate(AuthRequest.forUser("anotheruser")).getAccountId().get();
|
||||
|
||||
assertQuery("has:draft", change2, change1);
|
||||
assertQuery("draftby:" + userId.get(), change2, change1);
|
||||
assertQuery("draftby:" + user2);
|
||||
}
|
||||
@@ -2147,6 +2165,34 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
|
||||
.containsExactlyElementsIn(expectedPatterns);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void watched() throws Exception {
|
||||
TestRepository<Repo> repo = createProject("repo");
|
||||
ChangeInserter ins1 = newChangeWithStatus(repo, Change.Status.NEW);
|
||||
Change change1 = insert(repo, ins1);
|
||||
|
||||
TestRepository<Repo> repo2 = createProject("repo2");
|
||||
|
||||
ChangeInserter ins2 = newChangeWithStatus(repo2, Change.Status.NEW);
|
||||
insert(repo2, ins2);
|
||||
|
||||
assertQuery("is:watched");
|
||||
assertQuery("watchedby:self");
|
||||
|
||||
List<ProjectWatchInfo> projectsToWatch = new ArrayList<>();
|
||||
ProjectWatchInfo pwi = new ProjectWatchInfo();
|
||||
pwi.project = "repo";
|
||||
pwi.filter = null;
|
||||
pwi.notifyAbandonedChanges = true;
|
||||
pwi.notifyNewChanges = true;
|
||||
pwi.notifyAllComments = true;
|
||||
projectsToWatch.add(pwi);
|
||||
gApi.accounts().self().setWatchedProjects(projectsToWatch);
|
||||
|
||||
assertQuery("is:watched", change1);
|
||||
assertQuery("watchedby:self", change1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void selfAndMe() throws Exception {
|
||||
TestRepository<Repo> repo = createProject("repo");
|
||||
|
||||
Reference in New Issue
Block a user