Package org.sonar.core.component

Examples of org.sonar.core.component.ComponentDto


    assertThat(db.componentDao().getNullableByKey(session, project.key())).isNull();
  }

  @Test
  public void remove_issue_permission_index_when_deleting_a_project() throws Exception {
    ComponentDto project = ComponentTesting.newProjectDto();
    db.componentDao().insert(session, project);

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

    session.commit();

    assertThat(tester.get(IssueAuthorizationIndex.class).getNullableByKey(project.uuid())).isNotNull();

    service.delete(project.getKey());

    assertThat(tester.get(IssueAuthorizationIndex.class).getNullableByKey(project.uuid())).isNull();
  }
View Full Code Here


  }

  @Test
  public void remove_issue_when_deleting_a_project() throws Exception {
    //ARRANGE
    ComponentDto project = ComponentTesting.newProjectDto();
    db.componentDao().insert(session, project);

    RuleDto rule = RuleTesting.newXooX1();
    tester.get(RuleDao.class).insert(session, rule);

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

    tester.get(IssueDao.class).insert(session, IssueTesting.newDto(rule, file, project));
    session.commit();
View Full Code Here

    assertThat(tester.get(IssueIndex.class).countAll()).isEqualTo(0);
  }

  @Test(expected = IllegalArgumentException.class)
  public void fail_to_delete_not_project() throws Exception {
    ComponentDto project = ComponentTesting.newProjectDto();
    ComponentDto file = ComponentTesting.newFileDto(project);
    db.componentDao().insert(session, project, file);
    session.commit();

    service.delete(file.getKey());
  }
View Full Code Here

    map.put("createdBefore", "2013-04-17T09:08:24+0200");
    map.put("rules", "squid:AvoidCycle,findbugs:NullReference");
    map.put("sort", "CREATION_DATE");
    map.put("asc", true);
   
    when(componentDao.getByKeys(session, newArrayList("org.apache"))).thenReturn(newArrayList(new ComponentDto().setUuid("ABCD")));
    when(componentDao.getByKeys(session, newArrayList("org.sonar"))).thenReturn(newArrayList(new ComponentDto().setUuid("BCDE")));

    IssueQuery query = issueQueryService.createFromMap(map);
    assertThat(query.issueKeys()).containsOnly("ABCDE1234");
    assertThat(query.severities()).containsOnly("MAJOR", "MINOR");
    assertThat(query.statuses()).containsOnly("CLOSED");
View Full Code Here

  @Test
  public void get_by_uuid() {
    setupData("shared");

    ComponentDto result = dao.getNullableByUuid(session, "KLMN");
    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");
    assertThat(result.scope()).isEqualTo("FIL");
    assertThat(result.language()).isEqualTo("java");
  }
View Full Code Here

    when(dbClient.issueDao()).thenReturn(issueDao);

    rule = Rule.create("repo", "key");
    when(ruleFinder.findByKeys(newHashSet(rule.ruleKey()))).thenReturn(newArrayList(rule));

    project = new ComponentDto()
      .setId(1L)
      .setKey("MyProject")
      .setLongName("My Project")
      .setQualifier(Qualifiers.PROJECT)
      .setScope(Scopes.PROJECT);
    when(componentDao.getByKeys(dbSession, newHashSet(project.key()))).thenReturn(newArrayList(project));

    file = new ComponentDto()
      .setId(2L)
      .setSubProjectId(project.getId())
      .setKey("MyComponent")
      .setLongName("My Component");
    when(componentDao.getByKeys(dbSession, newHashSet(file.key()))).thenReturn(newArrayList(file));
View Full Code Here

  @Test
  public void get_by_uuid_on_disabled_component() {
    setupData("shared");

    ComponentDto result = dao.getNullableByUuid(session, "DCBA");
    assertThat(result).isNotNull();
    assertThat(result.isEnabled()).isFalse();
  }
View Full Code Here

  @Test
  public void get_by_key() {
    setupData("shared");

    ComponentDto result = dao.getNullableByKey(session, "org.struts:struts-core:src/org/struts/RequestContext.java");
    assertThat(result).isNotNull();
    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");
    assertThat(result.scope()).isEqualTo("FIL");
    assertThat(result.language()).isEqualTo("java");
    assertThat(result.subProjectId()).isEqualTo(2);

    assertThat(dao.getNullableByKey(session, "unknown")).isNull();
  }
View Full Code Here

  @Test
  public void get_by_key_on_disabled_component() {
    setupData("shared");

    ComponentDto result = dao.getNullableByKey(session, "org.disabled.project");
    assertThat(result).isNotNull();
    assertThat(result.isEnabled()).isFalse();
  }
View Full Code Here

  @Test
  public void get_by_key_on_a_root_project() {
    setupData("shared");

    ComponentDto result = dao.getNullableByKey(session, "org.struts:struts");
    assertThat(result).isNotNull();
    assertThat(result.key()).isEqualTo("org.struts:struts");
    assertThat(result.deprecatedKey()).isEqualTo("org.struts:struts");
    assertThat(result.path()).isNull();
    assertThat(result.name()).isEqualTo("Struts");
    assertThat(result.longName()).isEqualTo("Apache Struts");
    assertThat(result.qualifier()).isEqualTo("TRK");
    assertThat(result.scope()).isEqualTo("PRJ");
    assertThat(result.language()).isNull();
    assertThat(result.subProjectId()).isNull();
    assertThat(result.getAuthorizationUpdatedAt()).isEqualTo(DateUtils.parseDate("2014-06-18"));
  }
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.