use of fr.inria.spirals.repairnator.serializer.engines.SerializedData in project repairnator by Spirals-Team.
the class MetricsSerializer method serializeData.
@Override
public void serializeData(ProjectInspector inspector) {
Gson gson = new GsonBuilder().registerTypeAdapter(Metrics.class, new MetricsSerializerAdapter()).create();
JsonObject element = (JsonObject) gson.toJsonTree(inspector.getJobStatus().getMetrics());
element.addProperty("runId", RepairnatorConfig.getInstance().getRunId());
this.addDate(element, "reproductionDate", new Date());
element.addProperty("buggyBuildId", inspector.getBuggyBuild().getId());
element.addProperty("buildStatus", inspector.getBuildToBeInspected().getStatus().name());
if (inspector.getPatchedBuild() != null) {
element.addProperty("patchedBuildId", inspector.getPatchedBuild().getId());
}
element.addProperty("status", this.getPrettyPrintState(inspector));
List<SerializedData> dataList = new ArrayList<>();
dataList.add(new SerializedData(new ArrayList<>(), element));
for (SerializerEngine engine : this.getEngines()) {
engine.serialize(dataList, this.getType());
}
}
use of fr.inria.spirals.repairnator.serializer.engines.SerializedData in project repairnator by Spirals-Team.
the class NPEFixSerializer method serializeData.
@Override
public void serializeData(ProjectInspector inspector) {
JsonElement result = inspector.getJobStatus().getNpeFixResults();
if (result != null) {
List<Object> dataAsList = new ArrayList<>();
dataAsList.add(Utils.getHostname());
dataAsList.add(inspector.getBuildToBeInspected().getRunId());
dataAsList.add(Utils.formatCompleteDate(new Date()));
dataAsList.add(Utils.formatOnlyDay(new Date()));
dataAsList.add(inspector.getRepoSlug());
dataAsList.add(inspector.getBuggyBuild().getId());
dataAsList.add(result.toString());
JsonObject dataAsJson = new JsonObject();
dataAsJson.addProperty("hostname", Utils.getHostname());
dataAsJson.addProperty("runId", inspector.getBuildToBeInspected().getRunId());
dataAsJson.addProperty("buildId", inspector.getBuggyBuild().getId());
dataAsJson.addProperty("repositoryName", inspector.getRepoSlug());
this.addDate(dataAsJson, "computedDate", new Date());
dataAsJson.addProperty("computedDateStr", Utils.formatCompleteDate(new Date()));
dataAsJson.addProperty("computedDay", Utils.formatOnlyDay(new Date()));
dataAsJson.add("result", result);
List<SerializedData> serializedData = new ArrayList<>();
serializedData.add(new SerializedData(dataAsList, dataAsJson));
for (SerializerEngine engine : this.getEngines()) {
engine.serialize(serializedData, this.getType());
}
}
}
use of fr.inria.spirals.repairnator.serializer.engines.SerializedData in project repairnator by Spirals-Team.
the class NopolSerializer method serializeData.
@Override
public void serializeData(ProjectInspector inspector) {
if (inspector.getJobStatus().getNopolInformations() != null) {
BuildToBeInspected buildToBeInspected = inspector.getBuildToBeInspected();
List<SerializedData> allDatas = new ArrayList<>();
for (NopolInformation nopolInformation : inspector.getJobStatus().getNopolInformations()) {
if (nopolInformation.getPatches().isEmpty()) {
SerializedData data = new SerializedData(this.serializeNopolInfoAsList(buildToBeInspected, nopolInformation, null, 0), this.serializeNopolInfoAsJson(buildToBeInspected, nopolInformation, null, 0));
allDatas.add(data);
} else {
int patchNumber = 1;
for (PatchAndDiff patchAndDiff : nopolInformation.getPatches()) {
SerializedData data = new SerializedData(this.serializeNopolInfoAsList(buildToBeInspected, nopolInformation, patchAndDiff, patchNumber), this.serializeNopolInfoAsJson(buildToBeInspected, nopolInformation, patchAndDiff, patchNumber));
allDatas.add(data);
patchNumber++;
}
}
for (SerializerEngine engine : this.getEngines()) {
engine.serialize(allDatas, this.getType());
}
}
}
}
use of fr.inria.spirals.repairnator.serializer.engines.SerializedData in project repairnator by Spirals-Team.
the class PipelineErrorSerializer method serializeData.
@Override
public void serializeData(ProjectInspector inspector) {
List<Object> dataAsList = new ArrayList<>();
dataAsList.add(Utils.getHostname());
dataAsList.add(inspector.getBuildToBeInspected().getRunId());
dataAsList.add(Utils.formatCompleteDate(new Date()));
dataAsList.add(Utils.formatOnlyDay(new Date()));
dataAsList.add(inspector.getRepoSlug());
dataAsList.add(inspector.getBuggyBuild().getId());
for (List<String> strings : inspector.getJobStatus().getStepErrors().values()) {
dataAsList.add(StringUtils.join(strings, " "));
}
JsonObject dataAsJson = new JsonObject();
dataAsJson.addProperty("hostname", Utils.getHostname());
dataAsJson.addProperty("runId", inspector.getBuildToBeInspected().getRunId());
dataAsJson.addProperty("buildId", inspector.getBuggyBuild().getId());
dataAsJson.addProperty("repositoryName", inspector.getRepoSlug());
this.addDate(dataAsJson, "computedDate", new Date());
dataAsJson.addProperty("computedDateStr", Utils.formatCompleteDate(new Date()));
dataAsJson.addProperty("computedDay", Utils.formatOnlyDay(new Date()));
for (Map.Entry<String, List<String>> stringListEntry : inspector.getJobStatus().getStepErrors().entrySet()) {
JsonArray jsonElements = new JsonArray();
for (String message : stringListEntry.getValue()) {
jsonElements.add(message);
}
dataAsJson.add(stringListEntry.getKey(), jsonElements);
}
List<SerializedData> serializedData = new ArrayList<>();
serializedData.add(new SerializedData(dataAsList, dataAsJson));
for (SerializerEngine serializerEngine : this.getEngines()) {
serializerEngine.serialize(serializedData, this.getType());
}
}
use of fr.inria.spirals.repairnator.serializer.engines.SerializedData in project repairnator by Spirals-Team.
the class TreatedBuildTracking method serialize.
public void serialize() {
SerializedData data = new SerializedData(this.serializeAsList(), this.serializeAsJson());
List<SerializedData> allData = new ArrayList<>();
allData.add(data);
for (SerializerEngine engine : this.getEngines()) {
engine.serialize(allData, this.getType());
}
}
Aggregations