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

com.testvagrant.monitor.services.IntellisenseServiceImpl Maven / Gradle / Ivy

The newest version!
package com.testvagrant.monitor.services;

import com.google.gson.GsonBuilder;
import com.testvagrant.monitor.clients.IntellisenseClient;
import com.testvagrant.monitor.entities.reportParser.ExecutedScenario;
import com.testvagrant.monitor.requests.Intellisense;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class IntellisenseServiceImpl extends OptimusServiceImpl implements IntellisenseService {

    @Override
    public void writeFailedScenariosByException(Map> failedScenariosMap) {
        Map> failedScenariosObjectMap = new HashMap<>();
        failedScenariosMap.keySet().forEach(key -> {
            List scenarios = failedScenariosMap.get(key);
            List scenarioIds = new ArrayList();
            scenarios.forEach(scenario -> {
                String latestRecordFor = new ScenariosServiceImpl().getLatestRecordFor(scenario);
                scenarioIds.add(latestRecordFor);
            });
            failedScenariosObjectMap.put(key,scenarioIds);
        });
        String exceptions = new GsonBuilder().disableHtmlEscaping().create().toJson(failedScenariosObjectMap);
        Intellisense intellisense = new Intellisense();
        intellisense.setBuildId(getLatestBuild());
        intellisense.setExceptionsense(exceptions);
        new IntellisenseClient().recordExceptionSense(intellisense);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy