Search in sources :

Example 6 with ScenarioResultMetadata

use of org.drools.scenariosimulation.backend.runner.model.ScenarioResultMetadata in project drools by kiegroup.

the class SimulationRunMetadataBuilder method build.

public SimulationRunMetadata build() {
    int available = 0;
    Map<String, Integer> outputCounter = new HashMap<>();
    Map<ScenarioWithIndex, Map<String, Integer>> scenarioCounter = new HashMap<>();
    AuditLog auditLog = new AuditLog();
    for (ScenarioResultMetadata scenarioResultMetadatum : scenarioResultMetadata) {
        // this value is the same for all the scenarios
        available = scenarioResultMetadatum.getAvailable().size();
        scenarioResultMetadatum.getExecutedWithCounter().forEach((name, counter) -> outputCounter.compute(name, (key, number) -> number == null ? counter : number + counter));
    }
    for (ScenarioResultMetadata scenarioResultMetadatum : scenarioResultMetadata) {
        scenarioCounter.put(scenarioResultMetadatum.getScenarioWithIndex(), scenarioResultMetadatum.getExecutedWithCounter());
        auditLog.addAuditLogLines(scenarioResultMetadatum.getAuditLogLines());
    }
    return new SimulationRunMetadata(available, outputCounter.keySet().size(), outputCounter, scenarioCounter, auditLog);
}
Also used : List(java.util.List) Map(java.util.Map) AuditLog(org.drools.scenariosimulation.api.model.AuditLog) ScenarioResultMetadata(org.drools.scenariosimulation.backend.runner.model.ScenarioResultMetadata) SimulationRunMetadata(org.drools.scenariosimulation.api.model.SimulationRunMetadata) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ScenarioWithIndex(org.drools.scenariosimulation.api.model.ScenarioWithIndex) HashMap(java.util.HashMap) ScenarioResultMetadata(org.drools.scenariosimulation.backend.runner.model.ScenarioResultMetadata) SimulationRunMetadata(org.drools.scenariosimulation.api.model.SimulationRunMetadata) ScenarioWithIndex(org.drools.scenariosimulation.api.model.ScenarioWithIndex) Map(java.util.Map) HashMap(java.util.HashMap) AuditLog(org.drools.scenariosimulation.api.model.AuditLog)

Aggregations

ScenarioResultMetadata (org.drools.scenariosimulation.backend.runner.model.ScenarioResultMetadata)6 ArrayList (java.util.ArrayList)4 ScenarioWithIndex (org.drools.scenariosimulation.api.model.ScenarioWithIndex)4 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)3 AuditLogLine (org.drools.scenariosimulation.api.model.AuditLogLine)3 TestUtils.commonCheckAuditLogLine (org.drools.scenariosimulation.backend.TestUtils.commonCheckAuditLogLine)3 List (java.util.List)2 AuditLog (org.drools.scenariosimulation.api.model.AuditLog)2 Scenario (org.drools.scenariosimulation.api.model.Scenario)2 SimulationRunMetadata (org.drools.scenariosimulation.api.model.SimulationRunMetadata)2 CoverageAgendaListener (org.drools.scenariosimulation.backend.fluent.CoverageAgendaListener)2 Test (org.junit.Test)2 DMNDecisionResult (org.kie.dmn.api.core.DMNDecisionResult)2 DecisionNode (org.kie.dmn.api.core.ast.DecisionNode)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 Set (java.util.Set)1 TestUtils.getRandomlyGeneratedDMNMessageList (org.drools.scenariosimulation.backend.TestUtils.getRandomlyGeneratedDMNMessageList)1