Package org.sonar.core.component

Examples of org.sonar.core.component.ComponentDto.uuid()


    queue.add(DEFAULT_PROJECT_KEY, 123L);
    List<AnalysisReportDto> reports = queue.findByProjectKey(DEFAULT_PROJECT_KEY);

    sut.execute(session, reports.get(0), project);

    IssueAuthorizationDoc issueAuthorizationIndex = tester.get(IssueAuthorizationIndex.class).getNullableByKey(project.uuid());
    assertThat(issueAuthorizationIndex).isNotNull();
    assertThat(issueAuthorizationIndex.groups()).containsExactly(DefaultGroups.ANYONE);
  }

  @Test
View Full Code Here


  @Test
  public void not_add_project_issue_permission_if_already_existing() throws Exception {
    ComponentDto project = insertProjectWithPermissions(DEFAULT_PROJECT_KEY);
    // Synchronisation on project is already done
    db.issueAuthorizationDao().synchronizeAfter(session, null, ImmutableMap.of("project", project.uuid()));

    // To check that permission will not be synchronized again, add a new permission on the project in db, this permission should not be in
    // the index
    tester.get(PermissionFacade.class).insertGroupPermission(project.getId(), DefaultGroups.USERS, UserRole.USER, session);
View Full Code Here

    queue.add(DEFAULT_PROJECT_KEY, 123L);
    List<AnalysisReportDto> reports = queue.findByProjectKey(DEFAULT_PROJECT_KEY);

    sut.execute(session, reports.get(0), project);

    IssueAuthorizationDoc issueAuthorizationIndex = tester.get(IssueAuthorizationIndex.class).getNullableByKey(project.uuid());
    assertThat(issueAuthorizationIndex).isNotNull();
    assertThat(issueAuthorizationIndex.groups()).containsExactly(DefaultGroups.ANYONE);
  }

  private ComponentDto insertProjectWithPermissions(String projectKey) {
View Full Code Here

    // Check file key has been updated
    assertThat(service.getNullableByKey(file.key())).isNull();
    assertThat(service.getNullableByKey("sample2:root:src/File.xoo")).isNotNull();

    // Check issues are still here
    assertThat(tester.get(IssueIndex.class).getNullableByKey(issue.getKey()).componentUuid()).isEqualTo(file.uuid());
    assertThat(tester.get(IssueIndex.class).getNullableByKey(issue.getKey()).projectUuid()).isEqualTo(project.uuid());

    // Check that no new issue has been added
    assertThat(tester.get(SearchClient.class).prepareCount(IndexDefinition.ISSUES.getIndexName()).setTypes(IndexDefinition.ISSUES.getIndexType()).get().getCount()).isEqualTo(1);
View Full Code Here

    // Check file key has been updated
    assertThat(service.getNullableByKey(file.key())).isNull();
    assertThat(service.getNullableByKey("sample:root2:module:src/File.xoo")).isNotNull();

    // Check issues are still here
    assertThat(tester.get(IssueIndex.class).getNullableByKey(issue.getKey()).componentUuid()).isEqualTo(file.uuid());
    assertThat(tester.get(IssueIndex.class).getNullableByKey(issue.getKey()).projectUuid()).isEqualTo(project.uuid());

    // Check Issue Authorization index
    assertThat(tester.get(IssueAuthorizationIndex.class).getNullableByKey(project.uuid())).isNotNull();
View Full Code Here

    // Check file key has been updated
    assertThat(service.getNullableByKey(file.key())).isNull();
    assertThat(service.getNullableByKey("sample2:root:module:src/File.xoo")).isNotNull();

    // Check issues are still here
    assertThat(tester.get(IssueIndex.class).getNullableByKey(issue.getKey()).componentUuid()).isEqualTo(file.uuid());
    assertThat(tester.get(IssueIndex.class).getNullableByKey(issue.getKey()).projectUuid()).isEqualTo(project.uuid());

    // Check that no new issue has been added
    assertThat(tester.get(SearchClient.class).prepareCount(IndexDefinition.ISSUES.getIndexName()).setTypes(IndexDefinition.ISSUES.getIndexType()).get().getCount()).isEqualTo(1);
View Full Code Here

    MockUserSession.set().setLogin("admin").addProjectPermissions(UserRole.ADMIN, "org.sample.Sample");

    service.addPermission(params);

    verify(permissionFacade).insertUserPermission(eq(10L), eq(2L), eq("user"), eq(session));
    verify(issueAuthorizationDao).synchronizeAfter(eq(session), any(Date.class), eq(ImmutableMap.of("project", project.uuid())));
  }

  @Test
  public void remove_global_user_permission() throws Exception {
    params = buildPermissionChangeParams("user", null, GlobalPermissions.QUALITY_PROFILE_ADMIN);
View Full Code Here

    MockUserSession.set().setLogin("admin").addProjectPermissions(UserRole.ADMIN, "org.sample.Sample");

    service.removePermission(params);

    verify(permissionFacade).deleteUserPermission(eq(10L), eq(2L), eq("codeviewer"), eq(session));
    verify(issueAuthorizationDao).synchronizeAfter(eq(session), any(Date.class), eq(ImmutableMap.of("project", project.uuid())));
  }

  @Test
  public void add_global_group_permission() throws Exception {
    params = buildPermissionChangeParams(null, "group", GlobalPermissions.DASHBOARD_SHARING);
View Full Code Here

    MockUserSession.set().setLogin("admin").addProjectPermissions(UserRole.ADMIN, "org.sample.Sample");

    service.addPermission(params);

    verify(permissionFacade).insertGroupPermission(eq(10L), eq(2L), eq("user"), eq(session));
    verify(issueAuthorizationDao).synchronizeAfter(eq(session), any(Date.class), eq(ImmutableMap.of("project", project.uuid())));
  }

  @Test
  public void add_global_permission_to_anyone_group() throws Exception {
    params = buildPermissionChangeParams(null, DefaultGroups.ANYONE, GlobalPermissions.QUALITY_PROFILE_ADMIN);
View Full Code Here

    MockUserSession.set().setLogin("admin").addProjectPermissions(UserRole.ADMIN, "org.sample.Sample");

    service.addPermission(params);

    verify(permissionFacade).insertGroupPermission(eq(10L), eq((Long) null), eq("user"), eq(session));
    verify(issueAuthorizationDao).synchronizeAfter(eq(session), any(Date.class), eq(ImmutableMap.of("project", project.uuid())));
  }

  @Test
  public void remove_global_group_permission() throws Exception {
    params = buildPermissionChangeParams(null, "group", GlobalPermissions.QUALITY_PROFILE_ADMIN);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.