use of fr.inria.spirals.repairnator.serializer.engines.SerializedData in project repairnator by Spirals-Team.
the class HardwareInfoSerializer method serialize.
@Override
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());
}
}
use of fr.inria.spirals.repairnator.serializer.engines.SerializedData in project repairnator by Spirals-Team.
the class CSVSerializerEngine method serialize.
@Override
public void serialize(List<SerializedData> data, SerializerType serializer) {
String filename = serializer.getFilename() + FILE_EXTENSION;
BufferedWriter writer = this.openFile(filename);
if (writer != null) {
for (SerializedData row : data) {
String rowStr = StringUtils.join(row.getAsList(), SEPARATOR);
this.writeNewLine(writer, rowStr);
}
try {
writer.close();
} catch (IOException e) {
logger.error("Error while clonse file", e);
}
}
}
use of fr.inria.spirals.repairnator.serializer.engines.SerializedData in project repairnator by Spirals-Team.
the class NopolSerializer method main.
public static void main(String[] args) throws IOException, GeneralSecurityException {
GoogleSpreadSheetFactory.initWithFileSecret("client_secret.json");
GoogleSpreadSheetFactory.setSpreadsheetId(args[1]);
Sheets sheets = GoogleSpreadSheetFactory.getSheets();
List<List<Object>> results = sheets.spreadsheets().values().get(GoogleSpreadSheetFactory.getSpreadsheetID(), "Nopol Stats!A:T").execute().getValues();
MongoConnection mongoConnection = new MongoConnection(args[0], "repairnator");
if (!mongoConnection.isConnected()) {
throw new RuntimeException("Error when connection to mongodb");
}
MongoDBSerializerEngine serializerEngine = new MongoDBSerializerEngine(mongoConnection);
List<SerializedData> data = new ArrayList<>();
for (int i = 1; i < results.size(); i++) {
List<Object> value = results.get(i);
JsonObject result = new JsonObject();
result.addProperty("buildId", Utils.getValue(value, 3));
result.addProperty("repositoryName", Utils.getValue(value, 4));
result.addProperty("hostname", Utils.getValue(value, 0));
result.addProperty("nopolDateEnd", Utils.getValue(value, 1));
result.addProperty("nopolDayEnd", Utils.getValue(value, 2));
result.addProperty("testClassLocation", Utils.getValue(value, 5));
result.addProperty("failures", Utils.getValue(value, 6));
result.addProperty("allocatedTime", Utils.getValue(value, 7));
result.addProperty("passingTime", Utils.getValue(value, 8));
result.addProperty("status", Utils.getValue(value, 9));
result.addProperty("exceptionDetail", Utils.getValue(value, 10));
result.addProperty("patchNumber", Utils.getValue(value, 11));
result.addProperty("patchType", Utils.getValue(value, 12));
result.addProperty("patch", Utils.getValue(value, 13));
result.addProperty("patchLocation", Utils.getValue(value, 14));
result.addProperty("nopolContext", Utils.getValue(value, 15));
result.addProperty("nbAngelicValues", Utils.getValue(value, 16));
result.addProperty("nbStatements", Utils.getValue(value, 17));
result.addProperty("ignoreStatus", Utils.getValue(value, 18));
result.addProperty("runId", Utils.getValue(value, 19));
data.add(new SerializedData(Collections.EMPTY_LIST, result));
}
serializerEngine.serialize(data, SerializerType.NOPOL);
}
use of fr.inria.spirals.repairnator.serializer.engines.SerializedData in project repairnator by Spirals-Team.
the class BlacklistedSerializer method serialize.
public void serialize(Repository repo, Reason reason, String comment) {
SerializedData data = new SerializedData(this.serializeAsList(repo, reason, comment), this.serializeAsJson(repo, reason, comment));
List<SerializedData> allData = new ArrayList<>();
allData.add(data);
for (SerializerEngine engine : this.getEngines()) {
engine.serialize(allData, this.getType());
}
}
use of fr.inria.spirals.repairnator.serializer.engines.SerializedData in project repairnator by Spirals-Team.
the class AstorSerializer method serializeData.
@Override
public void serializeData(ProjectInspector inspector) {
JsonElement result = inspector.getJobStatus().getAstorResults();
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());
}
}
}
Aggregations