use of com.searchcode.app.jobs.repository.IndexGitRepoJob in project searchcode-server by boyter.
the class IndexBaseAndGitRepoJobTest method testDeleteNoFile.
public void testDeleteNoFile() throws IOException {
IndexGitRepoJob gitRepoJob = new IndexGitRepoJob();
File baseDir = new File(System.getProperty("java.io.tmpdir"));
File tempDir = new File(baseDir, "testIndexSucess");
if (tempDir.exists()) {
FileUtils.deleteDirectory(tempDir);
}
tempDir.mkdir();
String tempDirString = tempDir.toString();
for (int i = 0; i < 100; i++) {
gitRepoJob.deleteIndexSuccess(tempDirString);
gitRepoJob.deleteCloneUpdateSuccess(tempDirString);
}
}
use of com.searchcode.app.jobs.repository.IndexGitRepoJob in project searchcode-server by boyter.
the class IndexBaseAndGitRepoJobTest method testGetRelativeToProjectPath.
public void testGetRelativeToProjectPath() {
IndexGitRepoJob gitRepoJob = new IndexGitRepoJob();
String relativeToProjectPath = gitRepoJob.getRelativeToProjectPath("/Users/boyter/test5", "/Users/boyter/test5/u/something/sources/small/c3p0.csv");
assertThat(relativeToProjectPath).isEqualTo("/u/something/sources/small/c3p0.csv");
relativeToProjectPath = gitRepoJob.getRelativeToProjectPath("/Users/boyter/test5/", "/Users/boyter/test5/u/something/sources/small/c3p0.csv");
assertThat(relativeToProjectPath).isEqualTo("/u/something/sources/small/c3p0.csv");
relativeToProjectPath = gitRepoJob.getRelativeToProjectPath("./repo/test", "./repo/test/chinese.php");
assertThat(relativeToProjectPath).isEqualTo("/chinese.php");
relativeToProjectPath = gitRepoJob.getRelativeToProjectPath("./repo/test/", "./repo/test/chinese.php");
assertThat(relativeToProjectPath).isEqualTo("/chinese.php");
relativeToProjectPath = gitRepoJob.getRelativeToProjectPath("./repo/test", "./repo//test/chinese.php");
assertThat(relativeToProjectPath).isEqualTo("/chinese.php");
}
use of com.searchcode.app.jobs.repository.IndexGitRepoJob in project searchcode-server by boyter.
the class IndexBaseAndGitRepoJobTest method testDetermineBinary.
public void testDetermineBinary() {
IndexGitRepoJob gitRepoJob = new IndexGitRepoJob();
gitRepoJob.LOGINDEXED = true;
List<String[]> reportList = new ArrayList<>();
boolean result = gitRepoJob.determineBinary("", "", new ArrayList<>(), reportList);
assertThat(result).isTrue();
assertThat(reportList.size()).isEqualTo(1);
}
use of com.searchcode.app.jobs.repository.IndexGitRepoJob in project searchcode-server by boyter.
the class IndexBaseAndGitRepoJobTest method testCheckCloneSuccessEmptyReturnsFalse.
public void testCheckCloneSuccessEmptyReturnsFalse() {
IndexGitRepoJob indexGitRepoJob = new IndexGitRepoJob();
boolean actual = indexGitRepoJob.checkCloneSuccess("", "");
assertThat(actual).isFalse();
}
use of com.searchcode.app.jobs.repository.IndexGitRepoJob in project searchcode-server by boyter.
the class IndexBaseRepoJobTest method testExecuteNothingInQueue.
public void testExecuteNothingInQueue() throws JobExecutionException {
IndexGitRepoJob indexGitRepoJob = new IndexGitRepoJob();
IndexGitRepoJob spy = spy(indexGitRepoJob);
spy.haveRepoResult = false;
when(spy.getNextQueuedRepo()).thenReturn(new UniqueRepoQueue());
spy.codeIndexer = mockCodeIndexer;
spy.execute(this.mockContext);
assertThat(spy.haveRepoResult).isFalse();
}
Aggregations