Skip to content

Commit

Permalink
Fix Service with milestoning elements in lambda (#2939)
Browse files Browse the repository at this point in the history
  • Loading branch information
jake-kim1 authored Jun 28, 2024
1 parent d4d645d commit 0873375
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,10 @@ else if (cause instanceof RuntimeException)
finally
{
span.finish();
forkJoinPool.shutdown();
if (this.pureModelProcessParameter.getForkJoinPool() == null)
{
forkJoinPool.shutdown();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@ public Iterable<? extends Processor<?>> getExtraProcessors()
Lists.fixedSize.with(PackageableConnection.class, PackageableRuntime.class, DataElement.class, ExecutionEnvironmentInstance.class, DataSpace.class),
(service, context) -> processserviceFirstPass(service, context),
(service, context) ->
{

},
(service, context) ->
{

},
(service, context) ->
{

},
(service, context) ->
{
Root_meta_legend_service_metamodel_Service pureService = (Root_meta_legend_service_metamodel_Service) context.pureModel.getOrCreatePackage(service._package)._children().detect(c -> service.name.equals(c._name()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,41 @@ public void testServiceCompilationWithOnlyLambda()
"}\n");
}

@Test
public void testServiceCompilationWithMilestoningElements()
{
String resource = "" +
"Class <<temporal.businesstemporal>> test::class\n" +
"{\n" +
" prop1 : test::class2[0..1];\n" +
"}\n" +
"Class <<temporal.businesstemporal>> test::class2\n" +
"{\n" +
" prop1 : Integer[0..1];\n" +
"}\n";

test(resource + "###Service\n" +
"Service test::Service\n" +
"{\n" +
" pattern: 'url/myUrl/';\n" +
" owners: ['ownerName', 'ownerName2'];\n" +
" documentation: 'test';\n" +
" autoActivateUpdates: true;\n" +
" execution: Single\n" +
" {\n" +
" query: |test::class.allVersions()->project(x | $x.prop1AllVersions.prop1, 'hello');\n" +
" }\n" +
" test: Single\n" +
" {\n" +
" data: 'moreThanData';\n" +
" asserts:\n" +
" [\n" +
" { [], res: meta::pure::mapping::Result[1]|$res.values->toOne()->size() == 1 }\n" +
" ];\n" +
" }\n" +
"}\n");
}

@Test
public void testServiceWithImport()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.eclipse.collections.impl.utility.LazyIterate;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.CompileContext;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.PackageableElementFifthPassBuilder;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.PackageableElementFirstPassBuilder;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.PackageableElementFourthPassBuilder;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.PackageableElementSecondPassBuilder;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.PackageableElementThirdPassBuilder;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.PureModel;
import org.finos.legend.engine.plan.execution.PlanExecutor;
import org.finos.legend.engine.plan.execution.result.serialization.SerializationFormat;
Expand Down Expand Up @@ -107,6 +110,9 @@ public Root_meta_legend_service_metamodel_Service compileService(Service service

Root_meta_legend_service_metamodel_Service compiledService = (Root_meta_legend_service_metamodel_Service) service.accept(new PackageableElementFirstPassBuilder(compileContext));
service.accept(new PackageableElementSecondPassBuilder(compileContext));
service.accept(new PackageableElementThirdPassBuilder(compileContext));
service.accept(new PackageableElementFourthPassBuilder(compileContext));
service.accept(new PackageableElementFifthPassBuilder(compileContext));
return compiledService;
}

Expand Down

0 comments on commit 0873375

Please sign in to comment.