Search in sources :

Example 11 with BooleanCondition

use of com.google.gerrit.extensions.conditions.BooleanCondition in project gerrit by GerritCodeReview.

the class PermissionBackendConditionIT method globalPermissions_differentUserDoesNotEqual.

@Test
public void globalPermissions_differentUserDoesNotEqual() throws Exception {
    BooleanCondition cond1 = pb.user(user()).testCond(GlobalPermission.CREATE_GROUP);
    BooleanCondition cond2 = pb.user(admin()).testCond(GlobalPermission.CREATE_GROUP);
    assertNotEquals(cond1, cond2);
    assertNotEquals(cond1.hashCode(), cond2.hashCode());
}
Also used : BooleanCondition(com.google.gerrit.extensions.conditions.BooleanCondition) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 12 with BooleanCondition

use of com.google.gerrit.extensions.conditions.BooleanCondition in project gerrit by GerritCodeReview.

the class PermissionBackendConditionIT method refPermissions_differentResourceAndSameUserDoesNotEqual.

@Test
public void refPermissions_differentResourceAndSameUserDoesNotEqual() throws Exception {
    BranchNameKey branch1 = BranchNameKey.create(project, "branch");
    BranchNameKey branch2 = BranchNameKey.create(project, "branch2");
    BooleanCondition cond1 = pb.user(user()).ref(branch1).testCond(RefPermission.READ);
    BooleanCondition cond2 = pb.user(user()).ref(branch2).testCond(RefPermission.READ);
    assertNotEquals(cond1, cond2);
    assertNotEquals(cond1.hashCode(), cond2.hashCode());
}
Also used : BranchNameKey(com.google.gerrit.entities.BranchNameKey) BooleanCondition(com.google.gerrit.extensions.conditions.BooleanCondition) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 13 with BooleanCondition

use of com.google.gerrit.extensions.conditions.BooleanCondition in project gerrit by GerritCodeReview.

the class PermissionBackendConditionIT method globalPermissions_sameUserAndPermissionEquals.

@Test
public void globalPermissions_sameUserAndPermissionEquals() throws Exception {
    BooleanCondition cond1 = pb.user(user()).testCond(GlobalPermission.CREATE_GROUP);
    BooleanCondition cond2 = pb.user(user()).testCond(GlobalPermission.CREATE_GROUP);
    assertEquals(cond1, cond2);
    assertEquals(cond1.hashCode(), cond2.hashCode());
}
Also used : BooleanCondition(com.google.gerrit.extensions.conditions.BooleanCondition) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 14 with BooleanCondition

use of com.google.gerrit.extensions.conditions.BooleanCondition in project gerrit by GerritCodeReview.

the class PermissionBackendConditionIT method refPermissions_sameResourceAndDifferentUserDoesNotEqual.

@Test
public void refPermissions_sameResourceAndDifferentUserDoesNotEqual() throws Exception {
    BranchNameKey branch = BranchNameKey.create(project, "branch");
    BooleanCondition cond1 = pb.user(user()).ref(branch).testCond(RefPermission.READ);
    BooleanCondition cond2 = pb.user(admin()).ref(branch).testCond(RefPermission.READ);
    assertNotEquals(cond1, cond2);
    assertNotEquals(cond1.hashCode(), cond2.hashCode());
}
Also used : BranchNameKey(com.google.gerrit.entities.BranchNameKey) BooleanCondition(com.google.gerrit.extensions.conditions.BooleanCondition) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Aggregations

BooleanCondition (com.google.gerrit.extensions.conditions.BooleanCondition)14 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)13 Test (org.junit.Test)13 BranchNameKey (com.google.gerrit.entities.BranchNameKey)4 ChangeData (com.google.gerrit.server.query.change.ChangeData)3 Nullable (com.google.gerrit.common.Nullable)1 Project (com.google.gerrit.entities.Project)1 GlobalOrPluginPermission (com.google.gerrit.extensions.api.access.GlobalOrPluginPermission)1 UiAction (com.google.gerrit.extensions.webui.UiAction)1 Description (com.google.gerrit.extensions.webui.UiAction.Description)1 Timer1 (com.google.gerrit.metrics.Timer1)1 PermissionBackend (com.google.gerrit.server.permissions.PermissionBackend)1 PermissionBackendException (com.google.gerrit.server.permissions.PermissionBackendException)1