Search in sources :

Example 1 with JavaCode

use of org.finos.legend.engine.plan.execution.service.test.JavaCode in project legend-engine by finos.

the class ServiceModeling method executeTests.

private static TestRun executeTests(Service service, Root_meta_legend_service_metamodel_Service pureService, Pair<PureModelContextData, PureModel> pureModelPairs, String pureVersion, String metricsContext) throws IOException, JavaCompileException {
    MutableList<PlanGeneratorExtension> extensions = Lists.mutable.withAll(ServiceLoader.load(PlanGeneratorExtension.class));
    RichIterable<? extends Root_meta_pure_router_extension_RouterExtension> routerExtensions = extensions.flatCollect(e -> e.getExtraRouterExtensions(pureModelPairs.getTwo()));
    MutableList<PlanTransformer> planTransformers = extensions.flatCollect(PlanGeneratorExtension::getExtraPlanTransformers);
    ServiceTestRunner runner = new ServiceTestRunner(service, pureService, pureModelPairs.getOne(), pureModelPairs.getTwo(), objectMapper, planExecutor, routerExtensions, planTransformers, pureVersion, metricsContext);
    RichServiceTestResult richServiceTestResult = runner.executeTests().get(0);
    Map<String, Boolean> results = Maps.mutable.empty();
    for (Map.Entry<String, org.finos.legend.engine.test.runner.shared.TestResult> entry : richServiceTestResult.getResults().entrySet()) {
        Boolean testResult = entry.getValue().equals(org.finos.legend.engine.test.runner.shared.TestResult.SUCCESS);
        results.put(entry.getKey(), testResult);
    }
    return new SingleTestRun(richServiceTestResult.getExecutionPlan(), new JavaCode(richServiceTestResult.getJavaCodeString()), results);
}
Also used : PlanTransformer(org.finos.legend.engine.plan.generation.transformers.PlanTransformer) ServiceTestRunner(org.finos.legend.engine.test.runner.service.ServiceTestRunner) JavaCode(org.finos.legend.engine.plan.execution.service.test.JavaCode) RichServiceTestResult(org.finos.legend.engine.test.runner.service.RichServiceTestResult) TestResult(org.finos.legend.engine.plan.execution.service.test.TestResult) RichServiceTestResult(org.finos.legend.engine.test.runner.service.RichServiceTestResult) PlanGeneratorExtension(org.finos.legend.engine.plan.generation.extension.PlanGeneratorExtension) Map(java.util.Map) SingleTestRun(org.finos.legend.engine.plan.execution.service.test.SingleTestRun)

Aggregations

Map (java.util.Map)1 JavaCode (org.finos.legend.engine.plan.execution.service.test.JavaCode)1 SingleTestRun (org.finos.legend.engine.plan.execution.service.test.SingleTestRun)1 TestResult (org.finos.legend.engine.plan.execution.service.test.TestResult)1 PlanGeneratorExtension (org.finos.legend.engine.plan.generation.extension.PlanGeneratorExtension)1 PlanTransformer (org.finos.legend.engine.plan.generation.transformers.PlanTransformer)1 RichServiceTestResult (org.finos.legend.engine.test.runner.service.RichServiceTestResult)1 ServiceTestRunner (org.finos.legend.engine.test.runner.service.ServiceTestRunner)1