Search in sources :

Example 6 with BooleanCondition

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

the class PermissionBackendConditionIT method changePermissions_differentResourceSameUserDoesNotEqual.

@Test
public void changePermissions_differentResourceSameUserDoesNotEqual() throws Exception {
    ChangeData change1 = createChange().getChange();
    ChangeData change2 = createChange().getChange();
    BooleanCondition cond1 = pb.user(user()).change(change1).testCond(ChangePermission.READ);
    BooleanCondition cond2 = pb.user(user()).change(change2).testCond(ChangePermission.READ);
    assertNotEquals(cond1, cond2);
    assertNotEquals(cond1.hashCode(), cond2.hashCode());
}
Also used : BooleanCondition(com.google.gerrit.extensions.conditions.BooleanCondition) ChangeData(com.google.gerrit.server.query.change.ChangeData) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 7 with BooleanCondition

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

the class PermissionBackendConditionIT method changePermissions_sameResourceDifferentUserDoesNotEqual.

@Test
public void changePermissions_sameResourceDifferentUserDoesNotEqual() throws Exception {
    ChangeData change = createChange().getChange();
    BooleanCondition cond1 = pb.user(user()).change(change).testCond(ChangePermission.READ);
    BooleanCondition cond2 = pb.user(admin()).change(change).testCond(ChangePermission.READ);
    assertNotEquals(cond1, cond2);
    assertNotEquals(cond1.hashCode(), cond2.hashCode());
}
Also used : BooleanCondition(com.google.gerrit.extensions.conditions.BooleanCondition) ChangeData(com.google.gerrit.server.query.change.ChangeData) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 8 with BooleanCondition

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

the class PermissionBackendConditionIT method projectPermissions_differentResourceSameUserDoesNotEqual.

@Test
public void projectPermissions_differentResourceSameUserDoesNotEqual() throws Exception {
    Project.NameKey project2 = projectOperations.newProject().create();
    BooleanCondition cond1 = pb.user(user()).project(project).testCond(ProjectPermission.READ);
    BooleanCondition cond2 = pb.user(user()).project(project2).testCond(ProjectPermission.READ);
    assertNotEquals(cond1, cond2);
    assertNotEquals(cond1.hashCode(), cond2.hashCode());
}
Also used : Project(com.google.gerrit.entities.Project) BooleanCondition(com.google.gerrit.extensions.conditions.BooleanCondition) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 9 with BooleanCondition

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

the class PermissionBackendConditionIT method changePermissions_sameResourceAndUserEquals.

@Test
public void changePermissions_sameResourceAndUserEquals() throws Exception {
    ChangeData change = createChange().getChange();
    BooleanCondition cond1 = pb.user(user()).change(change).testCond(ChangePermission.READ);
    BooleanCondition cond2 = pb.user(user()).change(change).testCond(ChangePermission.READ);
    assertEquals(cond1, cond2);
    assertEquals(cond1.hashCode(), cond2.hashCode());
}
Also used : BooleanCondition(com.google.gerrit.extensions.conditions.BooleanCondition) ChangeData(com.google.gerrit.server.query.change.ChangeData) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 10 with BooleanCondition

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

the class PermissionBackendConditionIT method refPermissions_differentResourceAndSameUserDoesNotEqual2.

@Test
public void refPermissions_differentResourceAndSameUserDoesNotEqual2() throws Exception {
    BranchNameKey branch1 = BranchNameKey.create(project, "branch");
    BranchNameKey branch2 = BranchNameKey.create(projectOperations.newProject().create(), "branch");
    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)

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