use of fr.inria.spirals.repairnator.notifier.engines.NotifierEngine in project repairnator by Spirals-Team.
the class Launcher method initNotifiers.
private void initNotifiers() {
List<NotifierEngine> notifierEngines = LauncherUtils.initNotifierEngines(LOGGER);
ErrorNotifier.getInstance(notifierEngines);
this.notifiers = new ArrayList<>();
this.notifiers.add(new PatchNotifier(notifierEngines));
this.notifiers.add(new FixerBuildNotifier(notifierEngines));
}
use of fr.inria.spirals.repairnator.notifier.engines.NotifierEngine in project repairnator by Spirals-Team.
the class EndProcessNotifier method notifyEnd.
public void notifyEnd() {
String subject = "Process " + processName + " on " + Utils.getHostname() + " finished";
String message = "The following process: " + processName + " launched on " + Utils.getHostname() + " the " + this.launchDate.toString() + " has just finished the " + new Date().toString() + ".";
for (NotifierEngine engine : this.engines) {
engine.notify(subject, message);
}
}
use of fr.inria.spirals.repairnator.notifier.engines.NotifierEngine in project repairnator by Spirals-Team.
the class Launcher method initNotifiers.
private void initNotifiers() {
if (this.config.isNotifyEndProcess()) {
List<NotifierEngine> notifierEngines = LauncherUtils.initNotifierEngines(LOGGER);
this.endProcessNotifier = new EndProcessNotifier(notifierEngines, LauncherType.DOCKERPOOL.name().toLowerCase() + " (runid: " + this.config.getRunId() + ")");
}
}
use of fr.inria.spirals.repairnator.notifier.engines.NotifierEngine in project repairnator by Spirals-Team.
the class TestProjectInspector method testPatchFailingProject.
@Test
public void testPatchFailingProject() throws IOException, GitAPIException {
// surli/failingProject only-one-failing
int buildId = 208897371;
Path tmpDirPath = Files.createTempDirectory("test_complete");
File tmpDir = tmpDirPath.toFile();
tmpDir.deleteOnExit();
Build failingBuild = BuildHelper.getBuildFromId(buildId, null);
BuildToBeInspected buildToBeInspected = new BuildToBeInspected(failingBuild, null, ScannedBuildStatus.ONLY_FAIL, "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 InspectorSerializer(serializerEngines));
serializers.add(new NopolSerializer(serializerEngines));
notifiers.add(new PatchNotifier(notifierEngines));
RepairnatorConfig config = RepairnatorConfig.getInstance();
config.setLauncherMode(LauncherMode.REPAIR);
ProjectInspector inspector = new ProjectInspector(buildToBeInspected, tmpDir.getAbsolutePath(), serializers, notifiers);
inspector.run();
JobStatus jobStatus = inspector.getJobStatus();
assertThat(jobStatus.getAstorStatus(), is(AstorOutputStatus.MAX_GENERATION));
assertThat(jobStatus.getPipelineState(), is(PipelineState.NOPOL_PATCHED));
assertThat(jobStatus.getPushState(), is(PushState.REPAIR_INFO_COMMITTED));
assertThat(jobStatus.getFailureLocations().size(), is(1));
assertThat(jobStatus.getMetrics().getFailureNames().size(), is(1));
String remoteBranchName = "surli-failingProject-208897371-20170308-040702";
assertEquals(remoteBranchName, inspector.getRemoteBranchName());
verify(notifierEngine, times(1)).notify(anyString(), anyString());
verify(serializerEngine, times(1)).serialize(anyListOf(SerializedData.class), eq(SerializerType.INSPECTOR));
verify(serializerEngine, times(1)).serialize(anyListOf(SerializedData.class), eq(SerializerType.NOPOL));
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("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 TestProjectInspector4Bears method testFailingPassingProject.
@Test
public void testFailingPassingProject() throws IOException, GitAPIException {
int buildIdPassing = 203800961;
int buildIdFailing = 203797975;
Path tmpDirPath = Files.createTempDirectory("test_bears1");
File tmpDir = tmpDirPath.toFile();
tmpDir.deleteOnExit();
Build passingBuild = BuildHelper.getBuildFromId(buildIdPassing, null);
Build failingBuild = BuildHelper.getBuildFromId(buildIdFailing, null);
BuildToBeInspected buildToBeInspected = new BuildToBeInspected(failingBuild, passingBuild, ScannedBuildStatus.FAILING_AND_PASSING, "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.FIXERBUILDCASE1));
assertThat(jobStatus.getPushState(), is(PushState.PATCH_COMMITTED));
assertThat(inspector.isFixerBuildCase1(), 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));
}
Aggregations