Search in sources :

Example 1 with AuthorizationScope

use of org.sonar.server.permission.index.AuthorizationScope in project sonarqube by SonarSource.

the class IssueIndexerTest method test_getAuthorizationScope.

@Test
public void test_getAuthorizationScope() {
    AuthorizationScope scope = underTest.getAuthorizationScope();
    assertThat(scope.getIndexType().getIndex()).isEqualTo(IssueIndexDefinition.DESCRIPTOR);
    assertThat(scope.getIndexType().getType()).isEqualTo(TYPE_AUTHORIZATION);
    Predicate<IndexPermissions> projectPredicate = scope.getProjectPredicate();
    IndexPermissions project = new IndexPermissions("P1", Qualifiers.PROJECT);
    IndexPermissions file = new IndexPermissions("F1", Qualifiers.FILE);
    assertThat(projectPredicate.test(project)).isTrue();
    assertThat(projectPredicate.test(file)).isFalse();
}
Also used : IndexPermissions(org.sonar.server.permission.index.IndexPermissions) AuthorizationScope(org.sonar.server.permission.index.AuthorizationScope) Test(org.junit.Test)

Example 2 with AuthorizationScope

use of org.sonar.server.permission.index.AuthorizationScope in project sonarqube by SonarSource.

the class ProjectMeasuresIndexerTest method test_getAuthorizationScope.

@Test
public void test_getAuthorizationScope() {
    AuthorizationScope scope = underTest.getAuthorizationScope();
    assertThat(scope.getIndexType().getIndex()).isEqualTo(ProjectMeasuresIndexDefinition.DESCRIPTOR);
    assertThat(scope.getIndexType().getType()).isEqualTo(TYPE_AUTHORIZATION);
    Predicate<IndexPermissions> projectPredicate = scope.getProjectPredicate();
    IndexPermissions project = new IndexPermissions("P1", Qualifiers.PROJECT);
    IndexPermissions app = new IndexPermissions("P1", Qualifiers.APP);
    IndexPermissions file = new IndexPermissions("F1", Qualifiers.FILE);
    assertThat(projectPredicate.test(project)).isTrue();
    assertThat(projectPredicate.test(app)).isTrue();
    assertThat(projectPredicate.test(file)).isFalse();
}
Also used : IndexPermissions(org.sonar.server.permission.index.IndexPermissions) AuthorizationScope(org.sonar.server.permission.index.AuthorizationScope) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 AuthorizationScope (org.sonar.server.permission.index.AuthorizationScope)2 IndexPermissions (org.sonar.server.permission.index.IndexPermissions)2