Search in sources :

Example 1 with SerializerEngine

use of fr.inria.spirals.repairnator.serializer.engines.SerializerEngine in project repairnator by Spirals-Team.

the class RTLauncher method initSerializerEngines.

private void initSerializerEngines() {
    this.engines = new ArrayList<>();
    List<SerializerEngine> fileSerializerEngines = LauncherUtils.initFileSerializerEngines(LOGGER);
    this.engines.addAll(fileSerializerEngines);
    SerializerEngine mongoDBSerializerEngine = LauncherUtils.initMongoDBSerializerEngine(LOGGER);
    if (mongoDBSerializerEngine != null) {
        this.engines.add(mongoDBSerializerEngine);
    }
}
Also used : SerializerEngine(fr.inria.spirals.repairnator.serializer.engines.SerializerEngine)

Example 2 with SerializerEngine

use of fr.inria.spirals.repairnator.serializer.engines.SerializerEngine in project repairnator by Spirals-Team.

the class WatchedBuildSerializer method serialize.

public void serialize(Build build) {
    SerializedData data = new SerializedData(this.serializeAsList(build), this.serializeAsJson(build));
    List<SerializedData> allData = new ArrayList<>();
    allData.add(data);
    for (SerializerEngine engine : this.getEngines()) {
        engine.serialize(allData, this.getType());
    }
}
Also used : ArrayList(java.util.ArrayList) SerializedData(fr.inria.spirals.repairnator.serializer.engines.SerializedData) SerializerEngine(fr.inria.spirals.repairnator.serializer.engines.SerializerEngine)

Example 3 with SerializerEngine

use of fr.inria.spirals.repairnator.serializer.engines.SerializerEngine in project repairnator by Spirals-Team.

the class ScannerSerializer4Bears 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());
    }
}
Also used : ArrayList(java.util.ArrayList) SerializedData(fr.inria.spirals.repairnator.serializer.engines.SerializedData) SerializerEngine(fr.inria.spirals.repairnator.serializer.engines.SerializerEngine) MongoDBSerializerEngine(fr.inria.spirals.repairnator.serializer.engines.json.MongoDBSerializerEngine)

Example 4 with SerializerEngine

use of fr.inria.spirals.repairnator.serializer.engines.SerializerEngine in project repairnator by Spirals-Team.

the class LauncherUtils method initFileSerializerEngines.

public static List<SerializerEngine> initFileSerializerEngines(Logger logger) {
    List<SerializerEngine> fileSerializerEngines = new ArrayList<>();
    RepairnatorConfig config = RepairnatorConfig.getInstance();
    if (config.getOutputPath() != null) {
        logger.info("Initialize file serializer engines.");
        String path = config.getOutputPath();
        path += config.getBuildId() > 0 ? "/" + config.getBuildId() : "";
        fileSerializerEngines.add(new CSVSerializerEngine(path));
        fileSerializerEngines.add(new JSONFileSerializerEngine(path));
    } else {
        logger.info("File serializers won't be used.");
    }
    return fileSerializerEngines;
}
Also used : JSONFileSerializerEngine(fr.inria.spirals.repairnator.serializer.engines.json.JSONFileSerializerEngine) RepairnatorConfig(fr.inria.spirals.repairnator.config.RepairnatorConfig) ArrayList(java.util.ArrayList) CSVSerializerEngine(fr.inria.spirals.repairnator.serializer.engines.table.CSVSerializerEngine) CSVSerializerEngine(fr.inria.spirals.repairnator.serializer.engines.table.CSVSerializerEngine) SerializerEngine(fr.inria.spirals.repairnator.serializer.engines.SerializerEngine) MongoDBSerializerEngine(fr.inria.spirals.repairnator.serializer.engines.json.MongoDBSerializerEngine) JSONFileSerializerEngine(fr.inria.spirals.repairnator.serializer.engines.json.JSONFileSerializerEngine) GoogleSpreadsheetSerializerEngine(fr.inria.spirals.repairnator.serializer.engines.table.GoogleSpreadsheetSerializerEngine)

Example 5 with SerializerEngine

use of fr.inria.spirals.repairnator.serializer.engines.SerializerEngine 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());
    }
}
Also used : Metrics(fr.inria.spirals.repairnator.process.inspectors.Metrics) MetricsSerializerAdapter(fr.inria.spirals.repairnator.process.inspectors.MetricsSerializerAdapter) GsonBuilder(com.google.gson.GsonBuilder) ArrayList(java.util.ArrayList) Gson(com.google.gson.Gson) JsonObject(com.google.gson.JsonObject) SerializedData(fr.inria.spirals.repairnator.serializer.engines.SerializedData) SerializerEngine(fr.inria.spirals.repairnator.serializer.engines.SerializerEngine) Date(java.util.Date)

Aggregations

SerializerEngine (fr.inria.spirals.repairnator.serializer.engines.SerializerEngine)28 ArrayList (java.util.ArrayList)24 SerializedData (fr.inria.spirals.repairnator.serializer.engines.SerializedData)23 BuildToBeInspected (fr.inria.spirals.repairnator.BuildToBeInspected)8 RepairnatorConfig (fr.inria.spirals.repairnator.config.RepairnatorConfig)8 Build (fr.inria.jtravis.entities.Build)7 AbstractNotifier (fr.inria.spirals.repairnator.notifier.AbstractNotifier)7 AbstractDataSerializer (fr.inria.spirals.repairnator.serializer.AbstractDataSerializer)7 MongoDBSerializerEngine (fr.inria.spirals.repairnator.serializer.engines.json.MongoDBSerializerEngine)7 File (java.io.File)7 Path (java.nio.file.Path)7 Test (org.junit.Test)7 NotifierEngine (fr.inria.spirals.repairnator.notifier.engines.NotifierEngine)5 InspectorSerializer (fr.inria.spirals.repairnator.serializer.InspectorSerializer)5 NopolSerializer (fr.inria.spirals.repairnator.serializer.NopolSerializer)5 Git (org.eclipse.jgit.api.Git)5 RevCommit (org.eclipse.jgit.revwalk.RevCommit)5 JsonObject (com.google.gson.JsonObject)4 Date (java.util.Date)4 PatchNotifier (fr.inria.spirals.repairnator.notifier.PatchNotifier)3