Package org.sonar.core.component

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


  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


      if (component == null) {
        throw new NotFoundException(String.format("Component '%s' does not exist", fileKey));
      }
      userSession.checkComponentPermission(UserRole.USER, fileKey);

      List<Period> periodList = periods(component.projectUuid(), session);
      Integer periodIndex = request.paramAsInt(PARAM_PERIOD);
      Date periodDate = periodDate(periodIndex, periodList);

      RulesAggregation rulesAggregation = issueService.findRulesByComponent(component.key(), periodDate, session);
      Multiset<String> severitiesAggregation = issueService.findSeveritiesByComponent(component.key(), periodDate, session);
View Full Code Here

    assertThat(result).isNotNull();
    assertThat(result.uuid()).isEqualTo("KLMN");
    assertThat(result.moduleUuid()).isEqualTo("EFGH");
    assertThat(result.moduleUuidPath()).isEqualTo("ABCD.EFGH.");
    assertThat(result.subProjectId()).isEqualTo(2);
    assertThat(result.projectUuid()).isEqualTo("ABCD");
    assertThat(result.key()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java");
    assertThat(result.path()).isEqualTo("src/org/struts/RequestContext.java");
    assertThat(result.name()).isEqualTo("RequestContext.java");
    assertThat(result.longName()).isEqualTo("org.struts.RequestContext");
    assertThat(result.qualifier()).isEqualTo("FIL");
View Full Code Here

        // the current resource must be displayed first
        return -1;
      } else if (file2.equals(component)) {
        // the current resource must be displayed first
        return 1;
      } else if (StringUtils.equals(file1.projectUuid(), component.projectUuid()) && !StringUtils.equals(file2.projectUuid(), component.projectUuid())) {
        // if resource is in the same project, this it must be displayed first
        return -1;
      } else if (StringUtils.equals(file2.projectUuid(), component.projectUuid()) && !StringUtils.equals(file1.projectUuid(), component.projectUuid())) {
        // if resource is in the same project, this it must be displayed first
        return 1;
View Full Code Here

        // the current resource must be displayed first
        return 1;
      } else if (StringUtils.equals(file1.projectUuid(), component.projectUuid()) && !StringUtils.equals(file2.projectUuid(), component.projectUuid())) {
        // if resource is in the same project, this it must be displayed first
        return -1;
      } else if (StringUtils.equals(file2.projectUuid(), component.projectUuid()) && !StringUtils.equals(file1.projectUuid(), component.projectUuid())) {
        // if resource is in the same project, this it must be displayed first
        return 1;
      } else {
        return d1.from().compareTo(d2.from());
      }
View Full Code Here

    assertThat(result).isNotNull();
    assertThat(result.uuid()).isEqualTo("KLMN");
    assertThat(result.moduleUuid()).isEqualTo("EFGH");
    assertThat(result.moduleUuidPath()).isEqualTo("ABCD.EFGH.");
    assertThat(result.subProjectId()).isEqualTo(2);
    assertThat(result.projectUuid()).isEqualTo("ABCD");
    assertThat(result.key()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java");
    assertThat(result.path()).isEqualTo("src/org/struts/RequestContext.java");
    assertThat(result.name()).isEqualTo("RequestContext.java");
    assertThat(result.longName()).isEqualTo("org.struts.RequestContext");
    assertThat(result.qualifier()).isEqualTo("FIL");
View Full Code Here

    enableSnapshot(1001);
    SqlSession session = getMyBatis().openSession(false);
    try {
      ComponentDto newProject = session.getMapper(ComponentMapper.class).selectByKey("foo");
      assertThat(newProject.uuid()).isNotNull();
      assertThat(newProject.projectUuid()).isEqualTo(newProject.uuid());
      assertThat(newProject.moduleUuid()).isNull();
      assertThat(newProject.moduleUuidPath()).isNull();
      // SONAR-3636 : created_at must be fed when inserting a new entry in the 'projects' table
      assertThat(newProject.getCreatedAt()).isNotNull();
    } finally {
View Full Code Here

    enableSnapshot(1001);
    SqlSession session = getMyBatis().openSession(false);
    try {
      ComponentDto newProject = session.getMapper(ComponentMapper.class).selectByKey("foo");
      assertThat(newProject.uuid()).isNotNull();
      assertThat(newProject.projectUuid()).isEqualTo(newProject.uuid());
      assertThat(newProject.moduleUuid()).isNull();
      assertThat(newProject.moduleUuidPath()).isNull();
    } finally {
      MyBatis.closeQuietly(session);
    }
View Full Code Here

    enableSnapshot(1006);
    SqlSession session = getMyBatis().openSession(false);
    try {
      ComponentDto root = session.getMapper(ComponentMapper.class).selectByKey("root");
      assertThat(root.uuid()).isNotNull();
      assertThat(root.projectUuid()).isEqualTo(root.uuid());
      assertThat(root.moduleUuid()).isNull();
      assertThat(root.moduleUuidPath()).isNull();
      ComponentDto a = session.getMapper(ComponentMapper.class).selectByKey("a");
      assertThat(a.uuid()).isNotNull();
      assertThat(a.projectUuid()).isEqualTo(root.uuid());
View Full Code Here

      assertThat(root.projectUuid()).isEqualTo(root.uuid());
      assertThat(root.moduleUuid()).isNull();
      assertThat(root.moduleUuidPath()).isNull();
      ComponentDto a = session.getMapper(ComponentMapper.class).selectByKey("a");
      assertThat(a.uuid()).isNotNull();
      assertThat(a.projectUuid()).isEqualTo(root.uuid());
      assertThat(a.moduleUuid()).isEqualTo(root.uuid());
      assertThat(a.moduleUuidPath()).isEqualTo(root.uuid());
      ComponentDto b = session.getMapper(ComponentMapper.class).selectByKey("b");
      assertThat(b.uuid()).isNotNull();
      assertThat(b.projectUuid()).isEqualTo(root.uuid());
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.