Ejemplo 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();
  }
Ejemplo 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.");
  }
Ejemplo n.º 3
0
  @Test
  public void get_resource_by_uuid() {
    dbTester.prepareDbUnit(getClass(), "fixture.xml");

    ResourceDto resource = underTest.selectResource("ABCD");

    assertThat(resource.getUuid()).isEqualTo("ABCD");
    assertThat(resource.getProjectUuid()).isEqualTo("ABCD");
    assertThat(resource.getPath()).isNull();
    assertThat(resource.getName()).isEqualTo("Struts");
    assertThat(resource.getLongName()).isEqualTo("Apache Struts");
    assertThat(resource.getScope()).isEqualTo("PRJ");
    assertThat(resource.getDescription()).isEqualTo("the description");
    assertThat(resource.getLanguage()).isEqualTo("java");
    assertThat(resource.isEnabled()).isTrue();
    assertThat(resource.getAuthorizationUpdatedAt()).isNotNull();
    assertThat(resource.getCreatedAt()).isNotNull();
  }
Ejemplo n.º 4
0
  @Test
  public void get_resource_by_id() {
    setupData("fixture");

    ResourceDto resource = dao.getResource(1L);

    assertThat(resource.getUuid()).isEqualTo("ABCD");
    assertThat(resource.getProjectUuid()).isEqualTo("ABCD");
    assertThat(resource.getPath()).isNull();
    assertThat(resource.getName()).isEqualTo("Struts");
    assertThat(resource.getLongName()).isEqualTo("Apache Struts");
    assertThat(resource.getScope()).isEqualTo("PRJ");
    assertThat(resource.getDescription()).isEqualTo("the description");
    assertThat(resource.getLanguage()).isEqualTo("java");
    assertThat(resource.isEnabled()).isTrue();
    assertThat(resource.getAuthorizationUpdatedAt()).isNotNull();
    assertThat(resource.getCreatedAt()).isNotNull();
  }