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;
}
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);
}
Aggregations