Search in sources :

Example 1 with PureMultiExecution

use of org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.PureMultiExecution in project legend-engine by finos.

the class HelperServiceBuilder method processServiceExecution.

public static Root_meta_legend_service_metamodel_Execution processServiceExecution(Execution execution, CompileContext context) {
    if (execution instanceof PureSingleExecution) {
        PureSingleExecution pureSingleExecution = (PureSingleExecution) execution;
        Mapping mapping = context.resolveMapping(pureSingleExecution.mapping, pureSingleExecution.mappingSourceInformation);
        inferEmbeddedRuntimeMapping(pureSingleExecution.runtime, pureSingleExecution.mapping);
        org.finos.legend.pure.m3.coreinstance.meta.pure.runtime.Runtime runtime = HelperRuntimeBuilder.buildPureRuntime(pureSingleExecution.runtime, context);
        HelperRuntimeBuilder.checkRuntimeMappingCoverage(runtime, Lists.fixedSize.of(mapping), context, pureSingleExecution.runtime.sourceInformation);
        return new Root_meta_legend_service_metamodel_PureSingleExecution_Impl("")._func(HelperValueSpecificationBuilder.buildLambda(pureSingleExecution.func, context))._mapping(mapping)._runtime(runtime);
    } else if (execution instanceof PureMultiExecution) {
        PureMultiExecution pureMultiExecution = (PureMultiExecution) execution;
        if (pureMultiExecution.executionParameters.isEmpty()) {
            throw new EngineException("Service multi execution must not be empty", pureMultiExecution.sourceInformation, EngineErrorType.COMPILATION);
        }
        Set<String> executionKeyValues = new HashSet<>();
        return new Root_meta_legend_service_metamodel_PureMultiExecution_Impl("")._executionKey(pureMultiExecution.executionKey)._func(HelperValueSpecificationBuilder.buildLambda(pureMultiExecution.func, context))._executionParameters(ListIterate.collect(pureMultiExecution.executionParameters, executionParameter -> processServiceKeyedExecutionParameter(executionParameter, context, executionKeyValues)));
    }
    return getServiceCompilerExtensions(context).stream().flatMap(extension -> extension.getExtraServiceExecutionProcessors().stream()).map(processor -> processor.value(execution, context)).filter(Objects::nonNull).findFirst().orElseThrow(() -> new UnsupportedOperationException("Unsupported service execution type '" + execution.getClass().getSimpleName() + "'"));
}
Also used : EngineErrorType(org.finos.legend.engine.protocol.pure.v1.model.context.EngineErrorType) KeyedExecutionParameter(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.KeyedExecutionParameter) KeyedSingleExecutionTest(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.KeyedSingleExecutionTest) MultiExecutionTest(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.MultiExecutionTest) StringUtils(org.apache.commons.lang3.StringUtils) org.finos.legend.engine.language.pure.compiler.toPureGraph(org.finos.legend.engine.language.pure.compiler.toPureGraph) Root_meta_legend_service_metamodel_Execution(org.finos.legend.pure.generated.Root_meta_legend_service_metamodel_Execution) HashSet(java.util.HashSet) PackageableElementPointer(org.finos.legend.engine.protocol.pure.v1.model.context.PackageableElementPointer) EngineRuntime(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.runtime.EngineRuntime) Root_meta_legend_service_metamodel_KeyedSingleExecutionTest(org.finos.legend.pure.generated.Root_meta_legend_service_metamodel_KeyedSingleExecutionTest) Root_meta_legend_service_metamodel_KeyedExecutionParameter_Impl(org.finos.legend.pure.generated.Root_meta_legend_service_metamodel_KeyedExecutionParameter_Impl) Root_meta_legend_service_metamodel_MultiExecutionTest_Impl(org.finos.legend.pure.generated.Root_meta_legend_service_metamodel_MultiExecutionTest_Impl) Root_meta_legend_service_metamodel_KeyedExecutionParameter(org.finos.legend.pure.generated.Root_meta_legend_service_metamodel_KeyedExecutionParameter) Root_meta_legend_service_metamodel_SingleExecutionTest_Impl(org.finos.legend.pure.generated.Root_meta_legend_service_metamodel_SingleExecutionTest_Impl) Root_meta_legend_service_metamodel_TestContainer(org.finos.legend.pure.generated.Root_meta_legend_service_metamodel_TestContainer) Root_meta_legend_service_metamodel_KeyedSingleExecutionTest_Impl(org.finos.legend.pure.generated.Root_meta_legend_service_metamodel_KeyedSingleExecutionTest_Impl) Execution(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.Execution) Set(java.util.Set) ListIterate(org.eclipse.collections.impl.utility.ListIterate) Collectors(java.util.stream.Collectors) Root_meta_legend_service_metamodel_TestContainer_Impl(org.finos.legend.pure.generated.Root_meta_legend_service_metamodel_TestContainer_Impl) Root_meta_legend_service_metamodel_MultiExecutionTest(org.finos.legend.pure.generated.Root_meta_legend_service_metamodel_MultiExecutionTest) Root_meta_legend_service_metamodel_PureMultiExecution_Impl(org.finos.legend.pure.generated.Root_meta_legend_service_metamodel_PureMultiExecution_Impl) Objects(java.util.Objects) PackageableElementType(org.finos.legend.engine.protocol.pure.v1.model.context.PackageableElementType) ServiceTest(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.ServiceTest) List(java.util.List) PureMultiExecution(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.PureMultiExecution) Mapping(org.finos.legend.pure.m3.coreinstance.meta.pure.mapping.Mapping) PureSingleExecution(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.PureSingleExecution) Lists(org.eclipse.collections.impl.factory.Lists) SingleExecutionTest(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.SingleExecutionTest) TestContainer(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.TestContainer) EngineException(org.finos.legend.engine.shared.core.operational.errorManagement.EngineException) Root_meta_legend_service_metamodel_Test(org.finos.legend.pure.generated.Root_meta_legend_service_metamodel_Test) Root_meta_legend_service_metamodel_PureSingleExecution_Impl(org.finos.legend.pure.generated.Root_meta_legend_service_metamodel_PureSingleExecution_Impl) Root_meta_legend_service_metamodel_PureSingleExecution_Impl(org.finos.legend.pure.generated.Root_meta_legend_service_metamodel_PureSingleExecution_Impl) HashSet(java.util.HashSet) Set(java.util.Set) PureMultiExecution(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.PureMultiExecution) PureSingleExecution(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.PureSingleExecution) EngineException(org.finos.legend.engine.shared.core.operational.errorManagement.EngineException) Mapping(org.finos.legend.pure.m3.coreinstance.meta.pure.mapping.Mapping) Objects(java.util.Objects) Root_meta_legend_service_metamodel_PureMultiExecution_Impl(org.finos.legend.pure.generated.Root_meta_legend_service_metamodel_PureMultiExecution_Impl)

Example 2 with PureMultiExecution

use of org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.PureMultiExecution in project legend-sdlc by finos.

the class ServiceExecutionClassGenerator method getExecutionParameters.

private MutableList<ExecutionParameter> getExecutionParameters() {
    Execution execution = this.service.execution;
    if (!(execution instanceof PureExecution)) {
        throw new IllegalArgumentException("Only services with Pure executions are supported: " + service.getPath());
    }
    Lambda lambda = ((PureExecution) execution).func;
    MutableList<ExecutionParameter> parameters = Lists.mutable.ofInitialCapacity(lambda.parameters.size() + 1);
    MutableSet<String> javaParameterNames = Sets.mutable.ofInitialCapacity(lambda.parameters.size() + 1);
    if (execution instanceof PureMultiExecution) {
        String executionKey = ((PureMultiExecution) execution).executionKey;
        String javaParameterName = JavaSourceHelper.toValidJavaIdentifier(executionKey);
        javaParameterNames.add(javaParameterName);
        parameters.add(new ExecutionParameter(new Variable(executionKey, "String", new Multiplicity(1, 1)), javaParameterName));
    }
    for (Variable legendParameter : lambda.parameters) {
        String javaParameterName = JavaSourceHelper.toValidJavaIdentifier(legendParameter.name);
        if (!javaParameterNames.add(javaParameterName)) {
            String initialJavaParameterName = javaParameterName;
            int i = 2;
            javaParameterName = initialJavaParameterName + "$" + i;
            while (!javaParameterNames.add(javaParameterName)) {
                i++;
                javaParameterName = initialJavaParameterName + "$" + i;
            }
        }
        parameters.add(new ExecutionParameter(legendParameter, javaParameterName));
    }
    return parameters;
}
Also used : Execution(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.Execution) PureMultiExecution(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.PureMultiExecution) PureExecution(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.PureExecution) Variable(org.finos.legend.engine.protocol.pure.v1.model.valueSpecification.Variable) PureMultiExecution(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.PureMultiExecution) Multiplicity(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.Multiplicity) Lambda(org.finos.legend.engine.protocol.pure.v1.model.valueSpecification.raw.Lambda) PureExecution(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.PureExecution)

Example 3 with PureMultiExecution

use of org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.PureMultiExecution in project legend-engine by finos.

the class ServiceTestRunner method executeTests.

public List<RichServiceTestResult> executeTests() throws IOException, JavaCompileException {
    Execution serviceExecution = this.service.execution;
    if (serviceExecution instanceof PureMultiExecution) {
        List<RichServiceTestResult> results = Lists.mutable.empty();
        try (Scope scope = GlobalTracer.get().buildSpan("Generate Tests And Run For MultiExecution Service").startActive(true)) {
            MutableMap<String, KeyedExecutionParameter> executionsByKey = Iterate.groupByUniqueKey(((PureMultiExecution) serviceExecution).executionParameters, e -> e.key);
            for (KeyedSingleExecutionTest es : ((MultiExecutionTest) service.test).tests) {
                List<TestContainer> asserts = es.asserts;
                KeyedExecutionParameter e = executionsByKey.get(es.key);
                PureMultiExecution pureExecution = (PureMultiExecution) service.execution;
                PureSingleExecution pureSingleExecution = new PureSingleExecution();
                pureSingleExecution.func = pureExecution.func;
                pureSingleExecution.mapping = e.mapping;
                pureSingleExecution.runtime = e.runtime;
                pureSingleExecution.executionOptions = e.executionOptions;
                String noAssertMessage = "No test assert found for key - " + es.key + "!!";
                RichServiceTestResult richServiceTestResult = executeSingleExecutionTest(pureSingleExecution, es.data, asserts, noAssertMessage, pureModelContextData, pureModel, scope);
                richServiceTestResult.setOptionalMultiExecutionKey(es.key);
                results.add(richServiceTestResult);
            }
            return results;
        }
    } else if (serviceExecution instanceof PureSingleExecution) {
        try (Scope scope = GlobalTracer.get().buildSpan("Generate Single Pure Tests And Run").startActive(true)) {
            List<TestContainer> asserts = ((SingleExecutionTest) service.test).asserts;
            String noAssertMessage = "No test assert found !!";
            return Collections.singletonList(executeSingleExecutionTest((PureSingleExecution) service.execution, ((SingleExecutionTest) service.test).data, asserts, noAssertMessage, pureModelContextData, pureModel, scope));
        }
    } else {
        try (Scope scope = GlobalTracer.get().buildSpan("Generate Extra Service Execution Tests and Run").startActive(true)) {
            MutableList<ServiceExecutionExtension> serviceExecutionExtensions = Lists.mutable.withAll(ServiceLoader.load(ServiceExecutionExtension.class));
            Pair<ExecutionPlan, RichIterable<? extends String>> testExecutor = getExtraServiceExecutionPlan(serviceExecutionExtensions, serviceExecution, ((Root_meta_legend_service_metamodel_SingleExecutionTest) this.pureService._test())._data());
            ExecutionPlan executionPlan = testExecutor.getOne();
            Assert.assertTrue(executionPlan instanceof SingleExecutionPlan, () -> "Only Single Execution Plan supported");
            List<TestContainer> containers = getExtraServiceTestContainers(serviceExecutionExtensions, service.test);
            return Collections.singletonList(executeTestAsserts((SingleExecutionPlan) executionPlan, containers, testExecutor.getTwo(), scope));
        }
    }
}
Also used : PureMultiExecution(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.PureMultiExecution) TestContainer(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.TestContainer) PureSingleExecution(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.PureSingleExecution) Root_meta_legend_service_metamodel_SingleExecutionTest(org.finos.legend.pure.generated.Root_meta_legend_service_metamodel_SingleExecutionTest) Execution(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.Execution) PureMultiExecution(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.PureMultiExecution) PureSingleExecution(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.PureSingleExecution) PureExecution(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.PureExecution) SingleExecutionPlan(org.finos.legend.engine.protocol.pure.v1.model.executionPlan.SingleExecutionPlan) ExecutionPlan(org.finos.legend.engine.protocol.pure.v1.model.executionPlan.ExecutionPlan) Scope(io.opentracing.Scope) TestExecutionScope(org.finos.legend.engine.plan.execution.stores.relational.TestExecutionScope) MultiExecutionTest(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.MultiExecutionTest) MutableList(org.eclipse.collections.api.list.MutableList) KeyedExecutionParameter(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.KeyedExecutionParameter) KeyedSingleExecutionTest(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.KeyedSingleExecutionTest) MutableList(org.eclipse.collections.api.list.MutableList) List(java.util.List) PureList(org.finos.legend.engine.protocol.pure.v1.model.valueSpecification.raw.PureList) SingleExecutionPlan(org.finos.legend.engine.protocol.pure.v1.model.executionPlan.SingleExecutionPlan) Pair(org.eclipse.collections.api.tuple.Pair)

Example 4 with PureMultiExecution

use of org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.PureMultiExecution in project legend-engine by finos.

the class ServiceModeling method testService.

@Prometheus(name = "service test model resolve", doc = "Model resolution duration summary within service test execution")
public List<TestResult> testService(MutableList<CommonProfile> profiles, PureModelContext context, String metricsContext) {
    try {
        long start = System.currentTimeMillis();
        PureModelContextData data = ((PureModelContextData) context).shallowCopy();
        Service service = (Service) Iterate.detect(data.getElements(), e -> e instanceof Service);
        PureModelContextData dataWithoutService = PureModelContextData.newBuilder().withOrigin(data.getOrigin()).withSerializer(data.getSerializer()).withElements(LazyIterate.select(data.getElements(), e -> e != service)).build();
        PureModel pureModel = new PureModel(dataWithoutService, profiles, deploymentMode);
        Pair<PureModelContextData, PureModel> pureModelAndData = Tuples.pair(dataWithoutService, pureModel);
        long end = System.currentTimeMillis();
        MetricsHandler.observe("service test model resolve", start, end);
        MetricsHandler.observeServerOperation("model_resolve", metricsContext, start, end);
        if (service.execution instanceof PureMultiExecution) {
            throw new UnsupportedOperationException("MultiExecutions not yet supported");
        }
        Root_meta_legend_service_metamodel_Service pureService = compileService(service, pureModel.getContext(service));
        TestRun testRun = executeTests(service, pureService, pureModelAndData, PureClientVersions.production, metricsContext);
        if (!(testRun instanceof SingleTestRun)) {
            throw new UnsupportedOperationException("Expected a single test run result");
        }
        return ((SingleTestRun) testRun).results.entrySet().stream().map(x -> new TestResult(x.getKey(), x.getValue())).collect(Collectors.toList());
    } catch (IOException | JavaCompileException e) {
        MetricsHandler.incrementErrorCount("model_resolve", 0);
        throw new RuntimeException(e);
    }
}
Also used : Maps(org.eclipse.collections.impl.factory.Maps) RichServiceTestResult(org.finos.legend.engine.test.runner.service.RichServiceTestResult) CommonProfile(org.pac4j.core.profile.CommonProfile) TestRun(org.finos.legend.engine.plan.execution.service.test.TestRun) Lists(org.eclipse.collections.api.factory.Lists) Root_meta_legend_service_metamodel_Service(org.finos.legend.pure.generated.Root_meta_legend_service_metamodel_Service) MutableList(org.eclipse.collections.api.list.MutableList) PackageableElementSecondPassBuilder(org.finos.legend.engine.language.pure.compiler.toPureGraph.PackageableElementSecondPassBuilder) RichIterable(org.eclipse.collections.api.RichIterable) PlanExecutor(org.finos.legend.engine.plan.execution.PlanExecutor) PureModelContextData(org.finos.legend.engine.protocol.pure.v1.model.context.PureModelContextData) Map(java.util.Map) Tuples(org.eclipse.collections.impl.tuple.Tuples) Package(org.finos.legend.pure.m3.coreinstance.Package) Pair(org.eclipse.collections.api.tuple.Pair) MetricsHandler(org.finos.legend.engine.shared.core.operational.prometheus.MetricsHandler) PlanTransformer(org.finos.legend.engine.plan.generation.transformers.PlanTransformer) PureModel(org.finos.legend.engine.language.pure.compiler.toPureGraph.PureModel) PureModelContext(org.finos.legend.engine.protocol.pure.v1.model.context.PureModelContext) Relational(org.finos.legend.engine.plan.execution.stores.relational.plugin.Relational) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Prometheus(org.finos.legend.engine.shared.core.operational.prometheus.Prometheus) PackageableElementFirstPassBuilder(org.finos.legend.engine.language.pure.compiler.toPureGraph.PackageableElementFirstPassBuilder) IOException(java.io.IOException) ServiceLoader(java.util.ServiceLoader) PureClientVersions(org.finos.legend.engine.protocol.pure.PureClientVersions) Iterate(org.eclipse.collections.impl.utility.Iterate) Collectors(java.util.stream.Collectors) JavaCode(org.finos.legend.engine.plan.execution.service.test.JavaCode) Root_meta_pure_router_extension_RouterExtension(org.finos.legend.pure.generated.Root_meta_pure_router_extension_RouterExtension) InMemory(org.finos.legend.engine.plan.execution.stores.inMemory.plugin.InMemory) SingleTestRun(org.finos.legend.engine.plan.execution.service.test.SingleTestRun) ModelManager(org.finos.legend.engine.language.pure.modelManager.ModelManager) List(java.util.List) PureMultiExecution(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.PureMultiExecution) JavaCompileException(org.finos.legend.engine.shared.javaCompiler.JavaCompileException) LazyIterate(org.eclipse.collections.impl.utility.LazyIterate) TestResult(org.finos.legend.engine.plan.execution.service.test.TestResult) ServiceTestRunner(org.finos.legend.engine.test.runner.service.ServiceTestRunner) CompileContext(org.finos.legend.engine.language.pure.compiler.toPureGraph.CompileContext) Service(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.Service) ObjectMapperFactory(org.finos.legend.engine.shared.core.ObjectMapperFactory) DeploymentMode(org.finos.legend.engine.shared.core.deployment.DeploymentMode) PlanGeneratorExtension(org.finos.legend.engine.plan.generation.extension.PlanGeneratorExtension) ServiceStore(org.finos.legend.engine.plan.execution.stores.service.plugin.ServiceStore) PureMultiExecution(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.PureMultiExecution) Root_meta_legend_service_metamodel_Service(org.finos.legend.pure.generated.Root_meta_legend_service_metamodel_Service) Service(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.Service) JavaCompileException(org.finos.legend.engine.shared.javaCompiler.JavaCompileException) RichServiceTestResult(org.finos.legend.engine.test.runner.service.RichServiceTestResult) TestResult(org.finos.legend.engine.plan.execution.service.test.TestResult) Root_meta_legend_service_metamodel_Service(org.finos.legend.pure.generated.Root_meta_legend_service_metamodel_Service) IOException(java.io.IOException) PureModel(org.finos.legend.engine.language.pure.compiler.toPureGraph.PureModel) TestRun(org.finos.legend.engine.plan.execution.service.test.TestRun) SingleTestRun(org.finos.legend.engine.plan.execution.service.test.SingleTestRun) PureModelContextData(org.finos.legend.engine.protocol.pure.v1.model.context.PureModelContextData) SingleTestRun(org.finos.legend.engine.plan.execution.service.test.SingleTestRun) Prometheus(org.finos.legend.engine.shared.core.operational.prometheus.Prometheus)

Example 5 with PureMultiExecution

use of org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.PureMultiExecution in project legend-engine by finos.

the class ServiceParseTreeWalker method visitExecution.

private Execution visitExecution(ServiceParserGrammar.ServiceExecContext ctx) {
    if (ctx.singleExec() != null) {
        ServiceParserGrammar.SingleExecContext pureSingleExecContext = ctx.singleExec();
        PureSingleExecution pureSingleExecution = new PureSingleExecution();
        pureSingleExecution.sourceInformation = walkerSourceInformation.getSourceInformation(pureSingleExecContext);
        // function/query
        ServiceParserGrammar.ServiceFuncContext funcContext = PureGrammarParserUtility.validateAndExtractRequiredField(pureSingleExecContext.serviceFunc(), "query", pureSingleExecution.sourceInformation);
        pureSingleExecution.func = visitLambda(funcContext.combinedExpression());
        // mapping
        ServiceParserGrammar.ServiceMappingContext mappingContext = PureGrammarParserUtility.validateAndExtractRequiredField(pureSingleExecContext.serviceMapping(), "mapping", pureSingleExecution.sourceInformation);
        pureSingleExecution.mapping = PureGrammarParserUtility.fromQualifiedName(mappingContext.qualifiedName().packagePath() == null ? Collections.emptyList() : mappingContext.qualifiedName().packagePath().identifier(), mappingContext.qualifiedName().identifier());
        pureSingleExecution.mappingSourceInformation = walkerSourceInformation.getSourceInformation(mappingContext.qualifiedName());
        // runtime
        ServiceParserGrammar.ServiceRuntimeContext runtimeContext = PureGrammarParserUtility.validateAndExtractRequiredField(pureSingleExecContext.serviceRuntime(), "runtime", pureSingleExecution.sourceInformation);
        pureSingleExecution.runtime = this.visitRuntime(runtimeContext);
        return pureSingleExecution;
    } else if (ctx.multiExec() != null) {
        ServiceParserGrammar.MultiExecContext pureMultiExecContext = ctx.multiExec();
        PureMultiExecution pureMultiExecution = new PureMultiExecution();
        pureMultiExecution.sourceInformation = walkerSourceInformation.getSourceInformation(pureMultiExecContext);
        // function/query
        ServiceParserGrammar.ServiceFuncContext funcContext = PureGrammarParserUtility.validateAndExtractRequiredField(pureMultiExecContext.serviceFunc(), "query", pureMultiExecution.sourceInformation);
        pureMultiExecution.func = visitLambda(funcContext.combinedExpression());
        // execution key
        ServiceParserGrammar.ExecKeyContext execKeyContext = PureGrammarParserUtility.validateAndExtractRequiredField(pureMultiExecContext.execKey(), "key", pureMultiExecution.sourceInformation);
        pureMultiExecution.executionKey = PureGrammarParserUtility.fromGrammarString(execKeyContext.STRING().getText(), true);
        // execution parameters (indexed by execution key)
        pureMultiExecution.executionParameters = ListIterate.collect(pureMultiExecContext.execParameter(), this::visitKeyedExecutionParameter);
        return pureMultiExecution;
    }
    throw new UnsupportedOperationException();
}
Also used : PureMultiExecution(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.PureMultiExecution) PureSingleExecution(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.PureSingleExecution) ServiceParserGrammar(org.finos.legend.engine.language.pure.grammar.from.antlr4.ServiceParserGrammar)

Aggregations

PureMultiExecution (org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.PureMultiExecution)5 List (java.util.List)3 Execution (org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.Execution)3 PureSingleExecution (org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.PureSingleExecution)3 Collectors (java.util.stream.Collectors)2 MutableList (org.eclipse.collections.api.list.MutableList)2 Pair (org.eclipse.collections.api.tuple.Pair)2 PureExecution (org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.PureExecution)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Scope (io.opentracing.Scope)1 IOException (java.io.IOException)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Objects (java.util.Objects)1 ServiceLoader (java.util.ServiceLoader)1 Set (java.util.Set)1 StringUtils (org.apache.commons.lang3.StringUtils)1 RichIterable (org.eclipse.collections.api.RichIterable)1 Lists (org.eclipse.collections.api.factory.Lists)1 Lists (org.eclipse.collections.impl.factory.Lists)1