use of fr.inria.spirals.repairnator.process.step.checkoutrepository.CheckoutBuggyBuild in project repairnator by Spirals-Team.
the class TestNPERepair method testNPERepair.
@Test
public void testNPERepair() throws IOException {
// surli/failingProject build
int buildId = 252712792;
Build build = BuildHelper.getBuildFromId(buildId, null);
assertThat(build, notNullValue());
assertThat(buildId, is(build.getId()));
Path tmpDirPath = Files.createTempDirectory("test_nperepair");
File tmpDir = tmpDirPath.toFile();
tmpDir.deleteOnExit();
System.out.println("Dirpath : " + tmpDirPath);
BuildToBeInspected toBeInspected = new BuildToBeInspected(build, null, ScannedBuildStatus.ONLY_FAIL, "");
ProjectInspector inspector = new ProjectInspector(toBeInspected, tmpDir.getAbsolutePath(), null, null);
CloneRepository cloneStep = new CloneRepository(inspector);
NPERepair npeRepair = new NPERepair(inspector);
cloneStep.setNextStep(new CheckoutBuggyBuild(inspector)).setNextStep(new TestProject(inspector)).setNextStep(new GatherTestInformation(inspector, new BuildShouldFail(), false)).setNextStep(npeRepair);
cloneStep.execute();
assertThat(npeRepair.shouldStop, is(false));
assertThat(npeRepair.getPipelineState(), is(PipelineState.NPEFIX_PATCHED));
assertThat(inspector.getJobStatus().getNpeFixPatches().size(), is(6));
}
use of fr.inria.spirals.repairnator.process.step.checkoutrepository.CheckoutBuggyBuild in project repairnator by Spirals-Team.
the class TestTestProject method testTestProjectWhenNotFailing.
@Test
public void testTestProjectWhenNotFailing() throws IOException {
// surli/failingProject build
int buildId = 201176013;
Build build = BuildHelper.getBuildFromId(buildId, null);
assertThat(build, notNullValue());
assertThat(buildId, is(build.getId()));
Path tmpDirPath = Files.createTempDirectory("test_clone");
File tmpDir = tmpDirPath.toFile();
tmpDir.deleteOnExit();
BuildToBeInspected toBeInspected = new BuildToBeInspected(build, null, ScannedBuildStatus.ONLY_FAIL, "");
ProjectInspector inspector = mock(ProjectInspector.class);
when(inspector.getWorkspace()).thenReturn(tmpDir.getAbsolutePath());
when(inspector.getRepoLocalPath()).thenReturn(tmpDir.getAbsolutePath() + "/repo");
when(inspector.getBuildToBeInspected()).thenReturn(toBeInspected);
when(inspector.getBuggyBuild()).thenReturn(build);
when(inspector.getM2LocalPath()).thenReturn(tmpDir.getAbsolutePath() + "/.m2");
when(inspector.getGitHelper()).thenReturn(new GitHelper());
JobStatus jobStatus = new JobStatus(tmpDir.getAbsolutePath() + "/repo");
when(inspector.getJobStatus()).thenReturn(jobStatus);
CloneRepository cloneStep = new CloneRepository(inspector);
TestProject testProject = new TestProject(inspector);
cloneStep.setNextStep(new CheckoutBuggyBuild(inspector)).setNextStep(testProject);
cloneStep.execute();
assertThat(testProject.shouldStop, is(false));
assertThat(testProject.getPipelineState(), is(PipelineState.NOTFAILING));
assertThat(jobStatus.getPipelineState(), is(PipelineState.NOTFAILING));
}
use of fr.inria.spirals.repairnator.process.step.checkoutrepository.CheckoutBuggyBuild in project repairnator by Spirals-Team.
the class TestTestProject method testTestProjectWhenErroring.
@Test
public void testTestProjectWhenErroring() throws IOException {
// surli/failingProject build
int buildId = 208240908;
Build build = BuildHelper.getBuildFromId(buildId, null);
assertThat(build, notNullValue());
assertThat(buildId, is(build.getId()));
Path tmpDirPath = Files.createTempDirectory("test_clone");
File tmpDir = tmpDirPath.toFile();
tmpDir.deleteOnExit();
BuildToBeInspected toBeInspected = new BuildToBeInspected(build, null, ScannedBuildStatus.ONLY_FAIL, "");
ProjectInspector inspector = mock(ProjectInspector.class);
when(inspector.getWorkspace()).thenReturn(tmpDir.getAbsolutePath());
when(inspector.getRepoLocalPath()).thenReturn(tmpDir.getAbsolutePath() + "/repo");
when(inspector.getBuildToBeInspected()).thenReturn(toBeInspected);
when(inspector.getBuggyBuild()).thenReturn(build);
when(inspector.getM2LocalPath()).thenReturn(tmpDir.getAbsolutePath() + "/.m2");
when(inspector.getGitHelper()).thenReturn(new GitHelper());
JobStatus jobStatus = new JobStatus(tmpDir.getAbsolutePath() + "/repo");
when(inspector.getJobStatus()).thenReturn(jobStatus);
CloneRepository cloneStep = new CloneRepository(inspector);
TestProject testProject = new TestProject(inspector);
cloneStep.setNextStep(new CheckoutBuggyBuild(inspector)).setNextStep(testProject);
cloneStep.execute();
assertThat(testProject.shouldStop, is(false));
assertThat(testProject.getPipelineState(), is(PipelineState.TESTABLE));
assertThat(jobStatus.getPipelineState(), is(PipelineState.TESTABLE));
}
use of fr.inria.spirals.repairnator.process.step.checkoutrepository.CheckoutBuggyBuild in project repairnator by Spirals-Team.
the class TestBuildProject method testBuildProjectWithPomNotInRoot.
@Test
public void testBuildProjectWithPomNotInRoot() throws IOException {
int buildId = 218036343;
Build build = BuildHelper.getBuildFromId(buildId, null);
assertThat(build, notNullValue());
assertThat(buildId, is(build.getId()));
Path tmpDirPath = Files.createTempDirectory("test_build");
File tmpDir = tmpDirPath.toFile();
tmpDir.deleteOnExit();
BuildToBeInspected toBeInspected = new BuildToBeInspected(build, null, ScannedBuildStatus.ONLY_FAIL, "");
ProjectInspector inspector = new ProjectInspector(toBeInspected, tmpDir.getAbsolutePath(), Collections.EMPTY_LIST, Collections.EMPTY_LIST);
JobStatus jobStatus = inspector.getJobStatus();
CloneRepository cloneStep = new CloneRepository(inspector);
BuildProject buildStep = new BuildProject(inspector);
cloneStep.setNextStep(new CheckoutBuggyBuild(inspector)).setNextStep(buildStep);
cloneStep.execute();
assertThat(buildStep.shouldStop, is(false));
assertThat(buildStep.getPipelineState(), is(PipelineState.BUILDABLE));
assertThat(jobStatus.getPipelineState(), is(PipelineState.BUILDABLE));
}
use of fr.inria.spirals.repairnator.process.step.checkoutrepository.CheckoutBuggyBuild in project repairnator by Spirals-Team.
the class TestCommitPatch method testPushHumanPatchSimpleCase.
@Test
public void testPushHumanPatchSimpleCase() throws IOException, GitAPIException, RepairnatorConfigException {
// surli/failingProject build
int buildId = 207924136;
RepairnatorConfig repairnatorConfig = RepairnatorConfig.getInstance();
repairnatorConfig.setClean(false);
repairnatorConfig.setPush(true);
Build build = BuildHelper.getBuildFromId(buildId, null);
assertThat(build, notNullValue());
assertThat(buildId, is(build.getId()));
Path tmpDirPath = Files.createTempDirectory("test_pushPatch");
File tmpDir = tmpDirPath.toFile();
tmpDir.deleteOnExit();
BuildToBeInspected toBeInspected = new BuildToBeInspected(build, null, ScannedBuildStatus.ONLY_FAIL, "");
ProjectInspector inspector = mock(ProjectInspector.class);
when(inspector.getWorkspace()).thenReturn(tmpDir.getAbsolutePath());
when(inspector.getRepoLocalPath()).thenReturn(tmpDir.getAbsolutePath() + "/repo");
when(inspector.getRepoToPushLocalPath()).thenReturn(tmpDir.getAbsolutePath() + "/repotopush");
when(inspector.getBuildToBeInspected()).thenReturn(toBeInspected);
when(inspector.getBuggyBuild()).thenReturn(build);
when(inspector.getGitHelper()).thenReturn(new GitHelper());
JobStatus jobStatus = new JobStatus(tmpDir.getAbsolutePath() + "/repo");
when(inspector.getJobStatus()).thenReturn(jobStatus);
CloneRepository cloneStep = new CloneRepository(inspector);
cloneStep.setNextStep(new CheckoutBuggyBuild(inspector)).setNextStep(new InitRepoToPush(inspector)).setNextStep(new CommitPatch(inspector, true));
cloneStep.execute();
assertThat(jobStatus.getPushState(), is(PushState.PATCH_COMMITTED));
Git gitDir = Git.open(new File(tmpDir, "repotopush"));
Iterable<RevCommit> logs = gitDir.log().call();
Iterator<RevCommit> iterator = logs.iterator();
assertThat(iterator.hasNext(), is(true));
RevCommit commit = iterator.next();
assertThat(commit.getShortMessage(), containsString("End of the repairnator process"));
commit = iterator.next();
assertThat(commit.getShortMessage(), containsString("Human patch"));
commit = iterator.next();
assertThat(commit.getShortMessage(), containsString("Bug commit"));
assertThat(iterator.hasNext(), is(false));
}
Aggregations