All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.testvagrant.optimus.recommender.ExceptionCollator Maven / Gradle / Ivy

There is a newer version: 3.1.6
Show newest version
package com.testvagrant.optimus.recommender;


import com.testvagrant.commons.entities.reportParser.ExecutedScenario;
import com.testvagrant.commons.entities.reportParser.Step;
import com.testvagrant.optimus.entity.ExceptionEntity;
import com.testvagrant.optimus.ml.ExceptionClassifier;
import com.testvagrant.optimus.utils.DataFinder;
import com.testvagrant.optimus.utils.DataStore;

import java.io.IOException;
import java.util.List;
import java.util.Map;

public class ExceptionCollator {

    private List executedScenarios;

    public ExceptionCollator(List executedScenarios) {
        this.executedScenarios = executedScenarios;
    }

    public Map> collate() {
        DataFinder dataFinder = new DataFinder();
        List failedScenarios = dataFinder.findFailedScenarios(executedScenarios);
        DataStore dataStore = new DataStore();
        failedScenarios.forEach(failedScenario -> {
            Step failedStep = dataFinder.findFailedStep(failedScenario);
            ExceptionClassifier classifier = new ExceptionClassifier(failedStep.getError_message());
            try {
                ExceptionEntity exceptionEntity = classifier.classifyException();
                dataStore.store(exceptionEntity,failedScenario);
            } catch (IOException e) {
                e.printStackTrace();
            }
        });

        return dataStore.getFailedScenarioMap();
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy