Examples of AnalysisReportDto


Examples of org.sonar.core.computation.db.AnalysisReportDto

  @Test
  public void can_book_report_while_another_one_working_on_the_same_project() {
    db.prepareDbUnit(getClass(), "one_available_analysis_but_another_busy_on_same_project.xml");

    AnalysisReportDto report = newDefaultReport();
    AnalysisReportDto reportBooked = sut.bookAnalysisReport(session, report);

    assertThat(reportBooked).isNotNull();
  }
View Full Code Here

Examples of org.sonar.core.computation.db.AnalysisReportDto

  @Test
  public void book_available_report_analysis_while_having_one_working_on_another_project() {
    db.prepareDbUnit(getClass(), "book_available_report_analysis_while_having_one_working_on_another_project.xml");

    AnalysisReportDto report = newDefaultReport();
    AnalysisReportDto reportBooked = sut.bookAnalysisReport(session, report);

    assertThat(reportBooked.getId()).isEqualTo(1L);
  }
View Full Code Here

Examples of org.sonar.core.computation.db.AnalysisReportDto

    sut.getSynchronizationParams(new Date(), new HashMap<String, String>());
  }

  @Test(expected = UnsupportedOperationException.class)
  public void doUpdate_is_not_implemented_yet() {
    sut.doUpdate(session, new AnalysisReportDto());
  }
View Full Code Here

Examples of org.sonar.core.computation.db.AnalysisReportDto

  public void doUpdate_is_not_implemented_yet() {
    sut.doUpdate(session, new AnalysisReportDto());
  }

  private AnalysisReportDto newDefaultReport() {
    AnalysisReportDto report = AnalysisReportDto.newForTests(1L)
      .setStatus(PENDING)
      .setProjectKey(DEFAULT_PROJECT_KEY)
      .setCreatedAt(DateUtils.parseDate("2014-09-30"))
      .setFinishedAt(DateUtils.parseDate("2014-09-30"))
      .setStartedAt(DateUtils.parseDate("2014-09-30"))
View Full Code Here

Examples of org.sonar.core.computation.db.AnalysisReportDto

  }

  public AnalysisReportDto add(String projectKey, Long snapshotId) {
    UserSession.get().checkGlobalPermission(GlobalPermissions.SCAN_EXECUTION);

    AnalysisReportDto report = newPendingAnalysisReport(projectKey).setSnapshotId(snapshotId);
    DbSession session = dbClient.openSession(false);
    try {
      checkThatProjectExistsInDatabase(projectKey, session);
      return insertInDatabase(report, session);
    } finally {
View Full Code Here

Examples of org.sonar.core.computation.db.AnalysisReportDto

      MyBatis.closeQuietly(session);
    }
  }

  private AnalysisReportDto newPendingAnalysisReport(String projectKey) {
    return new AnalysisReportDto()
      .setProjectKey(projectKey)
      .setStatus(PENDING);
  }
View Full Code Here

Examples of org.sonar.core.computation.db.AnalysisReportDto

  private void checkThatProjectExistsInDatabase(String projectKey, DbSession session) {
    dbClient.componentDao().getByKey(session, projectKey);
  }

  private AnalysisReportDto insertInDatabase(AnalysisReportDto reportTemplate, DbSession session) {
    AnalysisReportDto report = dao.insert(session, reportTemplate);
    session.commit();

    return report;
  }
View Full Code Here

Examples of org.sonar.core.computation.db.AnalysisReportDto

   */
  @CheckForNull
  public synchronized AnalysisReportDto bookNextAvailable() {
    DbSession session = dbClient.openSession(false);
    try {
      AnalysisReportDto nextAvailableReport = dao.getNextAvailableReport(session);
      if (nextAvailableReport == null) {
        return null;
      }

      AnalysisReportDto report = dao.bookAnalysisReport(session, nextAvailableReport);
      session.commit();

      return report;
    } finally {
      MyBatis.closeQuietly(session);
View Full Code Here

Examples of org.sonar.core.computation.db.AnalysisReportDto

    this.service = service;
  }

  @Override
  public void run() {
    AnalysisReportDto report = queue.bookNextAvailable();
    if (report != null) {
      try {
        service.analyzeReport(report);
      } catch (Exception exception) {
        LOG.error(String.format("Analysis of report %s failed", report), exception);
View Full Code Here

Examples of org.sonar.core.computation.db.AnalysisReportDto

    dbSession.close();
  }

  @Test
  public void insert_find_analysis_report_log() {
    AnalysisReportDto report = AnalysisReportDto.newForTests(1L)
      .setProjectKey("projectKey")
      .setStatus(FAILED)
      .setCreatedAt(DateUtils.parseDate("2014-10-15"))
      .setUpdatedAt(DateUtils.parseDate("2014-10-16"))
      .setStartedAt(DateUtils.parseDate("2014-10-17"))
      .setFinishedAt(DateUtils.parseDate("2014-10-18"));
    ComponentDto project = ComponentTesting.newProjectDto();

    service.write(dbSession, ANALYSIS_REPORT, new AnalysisReportLog(report, project));
    dbSession.commit();

    // 0. AssertBase case
    assertThat(index.findAll().getHits()).hasSize(1);

    Activity activity = Iterables.getFirst(index.findAll().getHits(), null);
    assertThat(activity).isNotNull();
    Map<String, String> details = activity.details();
    assertThat(details.get("id")).isEqualTo(String.valueOf(report.getId()));
    assertThat(details.get("projectKey")).isEqualTo(project.key());
    assertThat(details.get("projectName")).isEqualTo(project.name());
    assertThat(details.get("projectUuid")).isEqualTo(project.uuid());
    assertThat(details.get("status")).isEqualTo("FAILED");
    assertThat(details.get("submittedAt")).isEqualTo("2014-10-15T00:00:00+0200");
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.