Exemplo n.º 1
0
  @Test
  public void insert_add_uuids_on_project_if_missing() {
    setupData("insert");

    ResourceDto project =
        new ResourceDto()
            .setKey("org.struts:struts:struts")
            .setScope(Scopes.PROJECT)
            .setQualifier(Qualifiers.PROJECT);

    ResourceDto file =
        new ResourceDto()
            .setKey("org.struts:struts:/src/main/java/org/struts/Action.java")
            .setScope(Scopes.FILE)
            .setQualifier(Qualifiers.FILE);

    dao.insertOrUpdate(project, file);

    assertThat(project.getUuid()).isNotNull();
    assertThat(project.getProjectUuid()).isEqualTo(project.getUuid());
    assertThat(project.getModuleUuidPath()).isEmpty();

    assertThat(file.getUuid()).isNull();
    assertThat(file.getProjectUuid()).isNull();
    assertThat(file.getModuleUuidPath()).isNull();
  }
Exemplo n.º 2
0
  @Test
  public void get_uuid() {
    setupData("fixture");

    ResourceDto file = dao.getResource(4L);
    assertThat(file.getUuid()).isEqualTo("DEFG");
    assertThat(file.getProjectUuid()).isEqualTo("ABCD");
    assertThat(file.getModuleUuid()).isEqualTo("BCDE");
    assertThat(file.getModuleUuidPath()).isEqualTo(".ABCD.BCDE.");
  }