use of fr.inria.spirals.repairnator.serializer.engines.SerializedData in project repairnator by Spirals-Team.
the class InspectorSerializer 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(), "All data!A:L").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, 0));
result.addProperty("repositoryName", Utils.getValue(value, 1));
result.addProperty("status", Utils.getValue(value, 2));
result.addProperty("prNumber", Utils.getValue(value, 3));
result.addProperty("buildFinishedDate", Utils.getValue(value, 4));
result.addProperty("buildFinishedDay", Utils.getValue(value, 5));
result.addProperty("realStatus", Utils.getValue(value, 6));
result.addProperty("hostname", Utils.getValue(value, 7));
result.addProperty("buildReproductionDate", Utils.getValue(value, 8));
result.addProperty("travisURL", Utils.getValue(value, 9));
result.addProperty("typeOfFailures", Utils.getValue(value, 10));
result.addProperty("runId", Utils.getValue(value, 11));
data.add(new SerializedData(Collections.EMPTY_LIST, result));
}
serializerEngine.serialize(data, SerializerType.INSPECTOR);
}
use of fr.inria.spirals.repairnator.serializer.engines.SerializedData in project repairnator by Spirals-Team.
the class InspectorSerializer method serializeData.
@Override
public void serializeData(ProjectInspector inspector) {
SerializedData data = new SerializedData(this.serializeAsList(inspector), this.serializeAsJson(inspector));
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 InspectorSerializer4Bears 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(), "All data!A:Q").execute().getValues();
MongoConnection mongoConnection = new MongoConnection(args[0], "bears");
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, 0));
result.addProperty("previousBuildId", Utils.getValue(value, 1));
result.addProperty("scannedBuildStatus", Utils.getValue(value, 2));
result.addProperty("status", Utils.getValue(value, 3));
result.addProperty("realStatus", Utils.getValue(value, 4));
result.addProperty("checkoutType", Utils.getValue(value, 5));
result.addProperty("typeOfFailures", Utils.getValue(value, 6));
result.addProperty("repositoryName", Utils.getValue(value, 7));
result.addProperty("prNumber", Utils.getValue(value, 8));
result.addProperty("buildFinishedDate", Utils.getValue(value, 9));
result.addProperty("buildFinishedDay", Utils.getValue(value, 10));
result.addProperty("hostname", Utils.getValue(value, 11));
result.addProperty("buildReproductionDate", Utils.getValue(value, 12));
result.addProperty("buildTravisUrl", Utils.getValue(value, 13));
result.addProperty("previousBuildTravisUrl", Utils.getValue(value, 14));
result.addProperty("committerEmail", Utils.getValue(value, 15));
result.addProperty("runId", Utils.getValue(value, 16));
data.add(new SerializedData(Collections.EMPTY_LIST, result));
}
serializerEngine.serialize(data, SerializerType.INSPECTOR4BEARS);
}
use of fr.inria.spirals.repairnator.serializer.engines.SerializedData in project repairnator by Spirals-Team.
the class InspectorSerializer4Bears method serializeData.
@Override
public void serializeData(ProjectInspector inspector) {
SerializedData data = new SerializedData(this.serializeAsList(inspector), this.serializeAsJson(inspector));
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 InspectorTimeSerializer4Bears method serializeData.
@Override
public void serializeData(ProjectInspector inspector) {
SerializedData data = new SerializedData(this.serializeAsList(inspector), this.serializeAsJson(inspector));
List<SerializedData> allData = new ArrayList<>();
allData.add(data);
for (SerializerEngine engine : this.getEngines()) {
engine.serialize(allData, this.getType());
}
}
Aggregations