Search in sources :

Example 1 with CommentAddedListener

use of com.google.gerrit.extensions.events.CommentAddedListener in project gerrit by GerritCodeReview.

the class CommentAddedEventIT method setUp.

@Before
public void setUp() throws Exception {
    ProjectConfig cfg = projectCache.checkedGet(project).getConfig();
    AccountGroup.UUID anonymousUsers = systemGroupBackend.getGroup(ANONYMOUS_USERS).getUUID();
    Util.allow(cfg, Permission.forLabel(label.getName()), -1, 1, anonymousUsers, "refs/heads/*");
    Util.allow(cfg, Permission.forLabel(pLabel.getName()), 0, 1, anonymousUsers, "refs/heads/*");
    saveProjectConfig(project, cfg);
    eventListenerRegistration = source.add(new CommentAddedListener() {

        @Override
        public void onCommentAdded(Event event) {
            lastCommentAddedEvent = event;
        }
    });
}
Also used : ProjectConfig(com.google.gerrit.server.git.ProjectConfig) AccountGroup(com.google.gerrit.reviewdb.client.AccountGroup) CommentAddedListener(com.google.gerrit.extensions.events.CommentAddedListener) Before(org.junit.Before)

Example 2 with CommentAddedListener

use of com.google.gerrit.extensions.events.CommentAddedListener in project gerrit by GerritCodeReview.

the class CustomLabelIT method setUp.

@Before
public void setUp() throws Exception {
    ProjectConfig cfg = projectCache.checkedGet(project).getConfig();
    AccountGroup.UUID anonymousUsers = systemGroupBackend.getGroup(ANONYMOUS_USERS).getUUID();
    Util.allow(cfg, Permission.forLabel(label.getName()), -1, 1, anonymousUsers, "refs/heads/*");
    Util.allow(cfg, Permission.forLabel(P.getName()), 0, 1, anonymousUsers, "refs/heads/*");
    saveProjectConfig(project, cfg);
    eventListenerRegistration = source.add(new CommentAddedListener() {

        @Override
        public void onCommentAdded(Event event) {
            lastCommentAddedEvent = event;
        }
    });
}
Also used : ProjectConfig(com.google.gerrit.server.git.ProjectConfig) AccountGroup(com.google.gerrit.reviewdb.client.AccountGroup) CommentAddedListener(com.google.gerrit.extensions.events.CommentAddedListener) Before(org.junit.Before)

Aggregations

CommentAddedListener (com.google.gerrit.extensions.events.CommentAddedListener)2 AccountGroup (com.google.gerrit.reviewdb.client.AccountGroup)2 ProjectConfig (com.google.gerrit.server.git.ProjectConfig)2 Before (org.junit.Before)2