Search in sources :

Example 1 with ProjectStats

use of com.searchcode.app.dto.ProjectStats in project searchcode-server by boyter.

the class ApiRouteService method getFileCount.

public String getFileCount(Request request, Response response) {
    if (request.queryParams().contains("reponame")) {
        CodeSearcher codeSearcher = new CodeSearcher();
        ProjectStats projectStats = codeSearcher.getProjectStats(request.queryParams("reponame"));
        return Values.EMPTYSTRING + projectStats.getTotalFiles();
    }
    return Values.EMPTYSTRING;
}
Also used : ProjectStats(com.searchcode.app.dto.ProjectStats)

Example 2 with ProjectStats

use of com.searchcode.app.dto.ProjectStats in project searchcode-server by boyter.

the class CodeSearcherTest method testGetProjectStats.

public void testGetProjectStats() throws IOException {
    CodeIndexDocument codeIndexDocument = new CodeIndexDocument("/", "testGetRepoDocuments", "/", "/", "/", "md5hash", "Java", 10, "", "/", "/");
    Singleton.getCodeIndexer().indexDocument(codeIndexDocument);
    CodeSearcher cs = new CodeSearcher();
    ProjectStats projectStats = cs.getProjectStats("testGetRepoDocuments");
    assertThat(projectStats.getTotalFiles()).isEqualTo(1);
    assertThat(projectStats.getTotalCodeLines()).isEqualTo(10);
    assertThat(projectStats.getCodeFacetLanguages().get(0).getLanguageName()).isEqualTo("Java");
    assertThat(projectStats.getCodeFacetLanguages().get(0).getCount()).isEqualTo(1);
    assertThat(projectStats.getRepoFacetOwner().get(0).getOwner()).isEqualTo("/");
    assertThat(projectStats.getRepoFacetOwner().get(0).getCount()).isEqualTo(1);
    assertThat(projectStats.getCodeByLines().size()).isEqualTo(1);
}
Also used : ProjectStats(com.searchcode.app.dto.ProjectStats) CodeIndexDocument(com.searchcode.app.dto.CodeIndexDocument)

Aggregations

ProjectStats (com.searchcode.app.dto.ProjectStats)2 CodeIndexDocument (com.searchcode.app.dto.CodeIndexDocument)1