Package org.sonar.core.component

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


  private ComponentDto insertPermissionsForProject(String projectKey) {
    ComponentDto project = new ComponentDto().setKey(projectKey);
    db.componentDao().insert(session, project);

    tester.get(PermissionFacade.class).insertGroupPermission(project.getId(), DefaultGroups.ANYONE, UserRole.USER, session);
    userSession.addProjectPermissions(UserRole.USER, project.key());

    session.commit();

    return project;
  }
View Full Code Here


    ComponentDto project = new ComponentDto()
      .setKey("MyProject");
    db.componentDao().insert(session, project);
    session.commit();

    MockUserSession.set().setLogin("gandalf").addProjectPermissions(UserRole.USER, project.key());

    sut.add(project.getKey(), 123L);
  }

}
View Full Code Here

      new PropertyDto().setKey("sonar.jira.project.key").setValue("SONAR-SERVER"),
      // This property should not be found on the other module
      new PropertyDto().setKey("sonar.coverage.exclusions").setValue("**/*.java")
      ));

    when(propertiesDao.selectProjectProperties(module2.key(), session)).thenReturn(newArrayList(
      new PropertyDto().setKey("sonar.jira.project.key").setValue("SONAR-APPLICATION")
      ));

    WsTester.TestRequest request = tester.newGetRequest("batch", "project").setParam("key", project.key());
    request.execute().assertJson(getClass(), "return_project_with_two_modules.json");
View Full Code Here

  private ComponentDto insertPermissionsForProject(String projectKey) {
    ComponentDto project = ComponentTesting.newProjectDto().setKey(projectKey);
    db.componentDao().insert(session, project);

    tester.get(PermissionFacade.class).insertGroupPermission(project.getId(), DefaultGroups.ANYONE, UserRole.USER, session);
    userSession.addProjectPermissions(UserRole.USER, project.key());

    session.commit();

    return project;
  }
View Full Code Here

  private ComponentDto insertPermissionsForProject(String projectKey) {
    ComponentDto project = new ComponentDto().setKey(projectKey).setId(1L);
    dbClient.componentDao().insert(session, project);

    tester.get(PermissionFacade.class).insertGroupPermission(project.getId(), DefaultGroups.ANYONE, UserRole.USER, session);
    userSession.addProjectPermissions(UserRole.ADMIN, project.key());
    userSession.addProjectPermissions(UserRole.USER, project.key());

    session.commit();

    return project;
View Full Code Here

    ComponentDto project = new ComponentDto().setKey(projectKey).setId(1L);
    dbClient.componentDao().insert(session, project);

    tester.get(PermissionFacade.class).insertGroupPermission(project.getId(), DefaultGroups.ANYONE, UserRole.USER, session);
    userSession.addProjectPermissions(UserRole.ADMIN, project.key());
    userSession.addProjectPermissions(UserRole.USER, project.key());

    session.commit();

    return project;
  }
View Full Code Here

    // Check project key has been updated
    assertThat(service.getNullableByKey(project.key())).isNull();
    assertThat(service.getNullableByKey("sample2:root")).isNotNull();

    // 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());
View Full Code Here

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

    // 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());
View Full Code Here

    ComponentDto provisionedProject = ComponentTesting.newProjectDto().setKey("provisionedProject");
    tester.get(ComponentDao.class).insert(session, provisionedProject);

    session.commit();

    MockUserSession.set().setLogin("john").addComponentPermission(UserRole.ADMIN, provisionedProject.key(), provisionedProject.key());
    service.updateKey(provisionedProject.key(), "provisionedProject2");
    session.commit();

    // Check project key has been updated
    assertThat(service.getNullableByKey(provisionedProject.key())).isNull();
View Full Code Here

    ComponentDto provisionedProject = ComponentTesting.newProjectDto().setKey("provisionedProject");
    tester.get(ComponentDao.class).insert(session, provisionedProject);

    session.commit();

    MockUserSession.set().setLogin("john").addComponentPermission(UserRole.ADMIN, provisionedProject.key(), provisionedProject.key());
    service.updateKey(provisionedProject.key(), "provisionedProject2");
    session.commit();

    // Check project key has been updated
    assertThat(service.getNullableByKey(provisionedProject.key())).isNull();
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.