use of fr.inria.spirals.repairnator.notifier.engines.NotifierEngine in project repairnator by Spirals-Team.
the class TestProjectInspector4Bears method testPassingPassingProject.
@Test
public void testPassingPassingProject() throws IOException, GitAPIException {
int buildIdPassing = 201938881;
int buildIdPreviousPassing = 201938325;
Path tmpDirPath = Files.createTempDirectory("test_bears2");
File tmpDir = tmpDirPath.toFile();
tmpDir.deleteOnExit();
Build passingBuild = BuildHelper.getBuildFromId(buildIdPassing, null);
Build previousPassingBuild = BuildHelper.getBuildFromId(buildIdPreviousPassing, null);
BuildToBeInspected buildToBeInspected = new BuildToBeInspected(previousPassingBuild, passingBuild, ScannedBuildStatus.PASSING_AND_PASSING_WITH_TEST_CHANGES, "test");
List<AbstractDataSerializer> serializers = new ArrayList<>();
List<AbstractNotifier> notifiers = new ArrayList<>();
List<SerializerEngine> serializerEngines = new ArrayList<>();
SerializerEngine serializerEngine = mock(SerializerEngine.class);
serializerEngines.add(serializerEngine);
List<NotifierEngine> notifierEngines = new ArrayList<>();
NotifierEngine notifierEngine = mock(NotifierEngine.class);
notifierEngines.add(notifierEngine);
serializers.add(new InspectorSerializer4Bears(serializerEngines));
notifiers.add(new FixerBuildNotifier(notifierEngines));
RepairnatorConfig config = RepairnatorConfig.getInstance();
config.setLauncherMode(LauncherMode.BEARS);
ProjectInspector4Bears inspector = new ProjectInspector4Bears(buildToBeInspected, tmpDir.getAbsolutePath(), serializers, notifiers);
inspector.run();
JobStatus jobStatus = inspector.getJobStatus();
assertThat(jobStatus.getPipelineState(), is(PipelineState.FIXERBUILDCASE2));
assertThat(jobStatus.getPushState(), is(PushState.PATCH_COMMITTED));
assertThat(inspector.isFixerBuildCase2(), is(true));
assertThat(jobStatus.getFailureLocations().size(), is(1));
assertThat(jobStatus.getMetrics().getFailureNames().size(), is(1));
verify(notifierEngine, times(1)).notify(anyString(), anyString());
verify(serializerEngine, times(1)).serialize(anyListOf(SerializedData.class), eq(SerializerType.INSPECTOR4BEARS));
Git gitDir = Git.open(new File(inspector.getRepoToPushLocalPath()));
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("Automatic repair"));
commit = iterator.next();
assertThat(commit.getShortMessage(), containsString("Bug commit"));
assertThat(iterator.hasNext(), is(false));
}
use of fr.inria.spirals.repairnator.notifier.engines.NotifierEngine in project repairnator by Spirals-Team.
the class RTLauncher method initNotifiers.
private void initNotifiers() {
if (this.config.isNotifyEndProcess()) {
List<NotifierEngine> notifierEngines = LauncherUtils.initNotifierEngines(LOGGER);
this.endProcessNotifier = new EndProcessNotifier(notifierEngines, LauncherType.REALTIME.name().toLowerCase() + " (runid: " + this.config.getRunId() + ")");
}
}
Aggregations