Package org.sonar.core.component

Examples of org.sonar.core.component.ComponentDto


    checkTables("should_insert_new_issues", new String[]{"id", "created_at", "updated_at", "issue_change_creation_date"}, "issues", "issue_changes");
  }

  @Test
  public void server_insert_new_issues_with_session() throws Exception {
    ComponentDto project = new ComponentDto().setId(10L);
    ComponentDto component = new ComponentDto().setId(100L);
    FakeServerSaver saver = new FakeServerSaver(getMyBatis(), new FakeRuleFinder(), component, project);

    DefaultIssueComment comment = DefaultIssueComment.create("ABCDE", "emmerik", "the comment");
    // override generated key
    comment.setKey("FGHIJ");
View Full Code Here


  @Test
  public void server_update_issues() throws Exception {
    setupData("should_update_issues");

    ComponentDto project = new ComponentDto().setId(10L);
    ComponentDto component = new ComponentDto().setId(100L);
    FakeServerSaver saver = new FakeServerSaver(getMyBatis(), new FakeRuleFinder(), component, project);

    DefaultIssueComment comment = DefaultIssueComment.create("ABCDE", "emmerik", "the comment");
    // override generated key
    comment.setKey("FGHIJ");
View Full Code Here

  @Test
  public void insert_and_find_by_key() throws Exception {
    RuleDto rule = RuleTesting.newXooX1();
    tester.get(RuleDao.class).insert(dbSession, rule);

    ComponentDto project = ComponentTesting.newProjectDto();
    tester.get(ComponentDao.class).insert(dbSession, project);

    // project can be seen by anyone
    tester.get(PermissionFacade.class).insertGroupPermission(project.getId(), DefaultGroups.ANYONE, UserRole.USER, dbSession);
    dbClient.issueAuthorizationDao().synchronizeAfter(dbSession, new Date(0));

    ComponentDto file = ComponentTesting.newFileDto(project);
    tester.get(ComponentDao.class).insert(dbSession, file);

    IssueDto issue = IssueTesting.newDto(rule, file, project).setIssueAttributes(KeyValueFormat.format(ImmutableMap.of("key", "value")));
    dbClient.issueDao().insert(dbSession, issue);
View Full Code Here

  @Test
  public void insert_and_find_after_date() throws Exception {
    RuleDto rule = RuleTesting.newXooX1();
    tester.get(RuleDao.class).insert(dbSession, rule);

    ComponentDto project = ComponentTesting.newProjectDto();
    tester.get(ComponentDao.class).insert(dbSession, project);

    ComponentDto file = ComponentTesting.newFileDto(project);
    tester.get(ComponentDao.class).insert(dbSession, file);

    IssueDto issue = IssueTesting.newDto(rule, file, project).setId(1L);
    dbClient.issueDao().insert(dbSession, issue);
View Full Code Here

  @Test
  public void insert() throws Exception {
    when(system2.now()).thenReturn(DateUtils.parseDate("2013-05-22").getTime());

    IssueDto dto = new IssueDto();
    dto.setComponent(new ComponentDto().setKey("struts:Action").setId(123L));
    dto.setProject(new ComponentDto().setKey("struts").setId(100L));
    dto.setRule(RuleTesting.newDto(RuleKey.of("squid", "S001")).setId(200));
    dto.setKee("ABCDE");
    dto.setLine(500);
    dto.setEffortToFix(3.14);
    dto.setDebt(10L);
View Full Code Here

    when(system2.now()).thenReturn(DateUtils.parseDate("2013-05-22").getTime());

    setupData("update");

    IssueDto dto = new IssueDto();
    dto.setComponent(new ComponentDto().setKey("struts:Action").setId(123L));
    dto.setProject(new ComponentDto().setKey("struts").setId(101L));
    dto.setRule(RuleTesting.newDto(RuleKey.of("squid", "S001")).setId(200));
    dto.setKee("ABCDE");
    dto.setLine(500);
    dto.setEffortToFix(3.14);
    dto.setDebt(10L);
View Full Code Here

  @Test
  public void app() throws Exception {
    MockUserSession.set().setLogin("john").addComponentPermission(UserRole.USER, SUB_PROJECT_KEY, COMPONENT_KEY);

    ComponentDto file = ComponentTesting.newFileDto(project)
      .setId(10L)
      .setKey(COMPONENT_KEY)
      .setName("Plugin.java")
      .setLongName("src/main/java/org/sonar/api/Plugin.java")
      .setPath("src/main/java/org/sonar/api/Plugin.java")
      .setSubProjectId(5L);
    when(componentDao.getNullableByKey(session, COMPONENT_KEY)).thenReturn(file);
    when(componentDao.getById(5L, session)).thenReturn(new ComponentDto().setId(5L).setLongName("SonarQube :: Plugin API").setKey(SUB_PROJECT_KEY));
    when(componentDao.getByUuid(session, project.uuid())).thenReturn(project);
    when(propertiesDao.selectByQuery(any(PropertyQuery.class), eq(session))).thenReturn(newArrayList(new PropertyDto()));

    WsTester.TestRequest request = tester.newGetRequest("api/components", "app").setParam("key", COMPONENT_KEY);
    request.execute().assertJson(getClass(), "app.json");
View Full Code Here

  @Test
  public void app_with_sub_project_equals_to_project() throws Exception {
    MockUserSession.set().setLogin("john").addComponentPermission(UserRole.USER, SUB_PROJECT_KEY, COMPONENT_KEY);

    ComponentDto file = ComponentTesting.newFileDto(project)
      .setId(10L)
      .setKey(COMPONENT_KEY)
      .setName("Plugin.java")
      .setLongName(null)
      .setPath("src/main/java/org/sonar/api/Plugin.java")
View Full Code Here

  @Test
  public void app_with_tests_measure() throws Exception {
    String componentKey = "org.codehaus.sonar:sonar-server:src/test/java/org/sonar/server/issue/PlanActionTest.java";
    MockUserSession.set().addComponentPermission(UserRole.USER, SUB_PROJECT_KEY, componentKey);

    ComponentDto file = ComponentTesting.newFileDto(project)
      .setId(10L)
      .setQualifier("UTS")
      .setLongName(null)
      .setKey(componentKey).setName("PlanActionTest.java")
      .setPath("src/test/java/org/sonar/server/issue/PlanActionTest.java")
      .setSubProjectId(5L);
    when(componentDao.getNullableByKey(session, componentKey)).thenReturn(file);
    when(componentDao.getById(5L, session)).thenReturn(new ComponentDto().setId(5L).setLongName("SonarQube :: Plugin API").setKey(SUB_PROJECT_KEY));
    when(componentDao.getByUuid(session, project.uuid())).thenReturn(project);

    addMeasure(CoreMetrics.TESTS_KEY, 10);

    WsTester.TestRequest request = tester.newGetRequest("api/components", "app").setParam("key", componentKey);
View Full Code Here

  @Test
  public void app_with_periods() throws Exception {
    MockUserSession.set().addComponentPermission(UserRole.USER, SUB_PROJECT_KEY, COMPONENT_KEY);

    ComponentDto file = addComponent();

    when(resourceDao.getLastSnapshotByResourceUuid(file.projectUuid(), session)).thenReturn(
      new SnapshotDto().setPeriodMode(1, "previous_analysis").setPeriodDate(1, DateUtils.parseDate("2014-05-08"))
      );
    when(periods.label(anyString(), anyString(), any(Date.class))).thenReturn("since previous analysis (May 08 2014)");

    WsTester.TestRequest request = tester.newGetRequest("api/components", "app").setParam("key", COMPONENT_KEY);
View Full Code Here

TOP

Related Classes of org.sonar.core.component.ComponentDto

Copyright © 2018 www.massapicom. 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.