Package org.sonar.core.component

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


    List<ComponentDto> results = dao.getByUuids(session, newArrayList("KLMN"));
    assertThat(results).hasSize(1);

    ComponentDto result = results.get(0);
    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");
View Full Code Here


    db.issueDao().insert(session,
      IssueTesting.newDto(rule, file, project));
    session.commit();

    assertThat(index.search(IssueQuery.builder().componentRootUuids(newArrayList(file.uuid())).build(), new QueryContext()).getHits()).isEmpty();
    assertThat(index.search(IssueQuery.builder().componentRootUuids(newArrayList(module.uuid())).build(), new QueryContext()).getHits()).hasSize(1);
    assertThat(index.search(IssueQuery.builder().componentRootUuids(newArrayList(subModule.uuid())).build(), new QueryContext()).getHits()).hasSize(1);
    assertThat(index.search(IssueQuery.builder().componentRootUuids(newArrayList(project.uuid())).build(), new QueryContext()).getHits()).hasSize(1);
    assertThat(index.search(IssueQuery.builder().componentRootUuids(newArrayList("unknown")).build(), new QueryContext()).getHits()).isEmpty();
  }
View Full Code Here

    db.issueDao().insert(session,
      IssueTesting.newDto(rule, file1, project),
      IssueTesting.newDto(rule, file2, project));
    session.commit();

    assertThat(index.search(IssueQuery.builder().componentUuids(newArrayList(file1.uuid(), file2.uuid())).build(), new QueryContext()).getHits()).hasSize(2);
    assertThat(index.search(IssueQuery.builder().componentUuids(newArrayList(file1.uuid())).build(), new QueryContext()).getHits()).hasSize(1);
    assertThat(index.search(IssueQuery.builder().componentUuids(newArrayList("unknown")).build(), new QueryContext()).getHits()).isEmpty();
    assertThat(index.search(IssueQuery.builder().componentUuids(newArrayList(project.uuid())).build(), new QueryContext()).getHits()).isEmpty();
  }
View Full Code Here

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

    assertThat(index.getLastSynchronization(ImmutableMap.of("project", project1.uuid()))).isNull();
    assertThat(index.getLastSynchronization(ImmutableMap.of("project", project2.uuid()))).isNull();

    db.issueDao().insert(session, IssueTesting.newDto(rule, file, project1));
    session.commit();
    session.clearCache();
View Full Code Here

    db.issueDao().insert(session, IssueTesting.newDto(rule, file, project1));
    session.commit();
    session.clearCache();

    assertThat(index.getLastSynchronization(ImmutableMap.of("project", project1.uuid()))).isNotNull();
    assertThat(index.getLastSynchronization(ImmutableMap.of("project", project2.uuid()))).isNull();
  }

  @Test
  public void get_last_synchronization() throws Exception {
    ComponentDto project = ComponentTesting.newProjectDto().setKey("project1");
View Full Code Here

    // Need to enable snapshot to make resource visible using ComponentMapper
    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();
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

    // Need to enable snapshot to make resource visible using ComponentMapper
    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(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(1005);
    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();
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.