diff --git a/legend-pure-dsl/legend-pure-dsl-graph/legend-pure-m2-dsl-graph-grammar/pom.xml b/legend-pure-dsl/legend-pure-dsl-graph/legend-pure-m2-dsl-graph-grammar/pom.xml index dc6fb2e8df..10d4526d91 100644 --- a/legend-pure-dsl/legend-pure-dsl-graph/legend-pure-m2-dsl-graph-grammar/pom.xml +++ b/legend-pure-dsl/legend-pure-dsl-graph/legend-pure-m2-dsl-graph-grammar/pom.xml @@ -76,6 +76,44 @@ + + org.finos.legend.pure + legend-pure-maven-generation-par + + ${project.basedir}/src/test/resources + ${project.version} + + ${project.basedir}/src/test/resources/platform_dsl_graph_test.definition.json + + + + + + test-compile + + build-pure-jar + + + + + + org.finos.legend.pure + legend-pure-m3-core + ${project.version} + + + + org.finos.legend.pure + legend-pure-m2-dsl-graph-pure + ${project.version} + + + org.finos.legend.pure + legend-pure-m2-dsl-graph-grammar + ${project.version} + + + diff --git a/legend-pure-dsl/legend-pure-dsl-graph/legend-pure-m2-dsl-graph-grammar/src/test/java/org/finos/legend/pure/m2/inlinedsl/graph/GraphCodeTestRepositoryProvider.java b/legend-pure-dsl/legend-pure-dsl-graph/legend-pure-m2-dsl-graph-grammar/src/test/java/org/finos/legend/pure/m2/inlinedsl/graph/GraphCodeTestRepositoryProvider.java new file mode 100644 index 0000000000..2a28c994db --- /dev/null +++ b/legend-pure-dsl/legend-pure-dsl-graph/legend-pure-m2-dsl-graph-grammar/src/test/java/org/finos/legend/pure/m2/inlinedsl/graph/GraphCodeTestRepositoryProvider.java @@ -0,0 +1,28 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License + +package org.finos.legend.pure.m2.inlinedsl.graph; + +import org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepository; +import org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider; +import org.finos.legend.pure.m3.serialization.filesystem.repository.GenericCodeRepository; + +public class GraphCodeTestRepositoryProvider implements CodeRepositoryProvider +{ + @Override + public CodeRepository repository() + { + return GenericCodeRepository.build("platform_dsl_graph_test.definition.json"); + } +} diff --git a/legend-pure-dsl/legend-pure-dsl-graph/legend-pure-m2-dsl-graph-grammar/src/test/java/org/finos/legend/pure/m2/inlinedsl/graph/TestGraphDSLTestCodeIntegrity.java b/legend-pure-dsl/legend-pure-dsl-graph/legend-pure-m2-dsl-graph-grammar/src/test/java/org/finos/legend/pure/m2/inlinedsl/graph/TestGraphDSLTestCodeIntegrity.java new file mode 100644 index 0000000000..b996bec7b9 --- /dev/null +++ b/legend-pure-dsl/legend-pure-dsl-graph/legend-pure-m2-dsl-graph-grammar/src/test/java/org/finos/legend/pure/m2/inlinedsl/graph/TestGraphDSLTestCodeIntegrity.java @@ -0,0 +1,37 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License + +package org.finos.legend.pure.m2.inlinedsl.graph; + +import org.finos.legend.pure.m3.tests.AbstractCompiledStateIntegrityTest; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +public class TestGraphDSLTestCodeIntegrity extends AbstractCompiledStateIntegrityTest +{ + @BeforeClass + public static void initialize() + { + initialize("platform_dsl_graph_test"); + } + + @Test + @Ignore + @Override + public void testReferenceUsages() + { + super.testReferenceUsages(); + } +} diff --git a/legend-pure-dsl/legend-pure-dsl-graph/legend-pure-m2-dsl-graph-grammar/src/test/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider b/legend-pure-dsl/legend-pure-dsl-graph/legend-pure-m2-dsl-graph-grammar/src/test/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider new file mode 100644 index 0000000000..c9b12ff81f --- /dev/null +++ b/legend-pure-dsl/legend-pure-dsl-graph/legend-pure-m2-dsl-graph-grammar/src/test/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider @@ -0,0 +1 @@ +org.finos.legend.pure.m2.inlinedsl.graph.GraphCodeTestRepositoryProvider \ No newline at end of file diff --git a/legend-pure-dsl/legend-pure-dsl-graph/legend-pure-m2-dsl-graph-grammar/src/test/resources/platform_dsl_graph_test.definition.json b/legend-pure-dsl/legend-pure-dsl-graph/legend-pure-m2-dsl-graph-grammar/src/test/resources/platform_dsl_graph_test.definition.json new file mode 100644 index 0000000000..41560f553c --- /dev/null +++ b/legend-pure-dsl/legend-pure-dsl-graph/legend-pure-m2-dsl-graph-grammar/src/test/resources/platform_dsl_graph_test.definition.json @@ -0,0 +1,8 @@ +{ + "name": "platform_dsl_graph_test", + "pattern": "(meta::pure::graphFetch|meta::pure::functions::meta)(::.*)?", + "dependencies": [ + "platform", + "platform_dsl_graph" + ] +} diff --git a/legend-pure-dsl/legend-pure-dsl-graph/legend-pure-m2-dsl-graph-grammar/src/test/resources/platform_dsl_graph_test/graph_test.pure b/legend-pure-dsl/legend-pure-dsl-graph/legend-pure-m2-dsl-graph-grammar/src/test/resources/platform_dsl_graph_test/graph_test.pure new file mode 100644 index 0000000000..0abd57cc62 --- /dev/null +++ b/legend-pure-dsl/legend-pure-dsl-graph/legend-pure-m2-dsl-graph-grammar/src/test/resources/platform_dsl_graph_test/graph_test.pure @@ -0,0 +1,62 @@ +import meta::pure::graphFetch::test::*; + +Class meta::pure::graphFetch::test::A +{ + a : String[1]; +} + +function meta::pure::graphFetch::test::simpleFetchTree():Any[*] +{ + print(#{meta::pure::graphFetch::test::A{a}}#, 2); +} + +Class meta::pure::graphFetch::test::Person +{ + firstName: String[1]; + lastName: String[1]; + address: Address[1]; + + nameWithTitle(title:String[1]) + { + $title + ' ' + $this.firstName + ' ' + $this.lastName + ' '; + } : String[1]; + + nameWithPrefixAndSuffix(prefix:String[0..1], suffixes:String[*]) + { + if($prefix->isEmpty(), + | if($suffixes->isEmpty(), + | $this.firstName + ' ' + $this.lastName, + | $this.firstName + ' ' + $this.lastName + ', ' + $suffixes->joinStrings(', ')), + | if($suffixes->isEmpty(), + | $prefix->toOne() + ' ' + $this.firstName + ' ' + $this.lastName, + | $prefix->toOne() + ' ' + $this.firstName + ' ' + $this.lastName + ', ' + $suffixes->joinStrings(', '))) + }:String[1]; +} + +Class meta::pure::graphFetch::test::Address +{ +} + +Class meta::pure::graphFetch::test::PersonAddress extends Address +{ +} + +Class meta::pure::graphFetch::test::FirmAddress extends Address +{ +} + +Class meta::pure::graphFetch::test::Firm +{ + a: Address[1]; + employees: Person[*]; +} + +function meta::pure::graphFetch::test::subTypeInTree():Any[*] +{ + print(#{Firm{employees{address->subType(@PersonAddress)}}}#, 2); +} + +function meta::pure::graphFetch::test::graphPropertyParameter():Any[*] +{ + print(#{Person { nameWithTitle('Ms')}}#, 2); +} \ No newline at end of file diff --git a/legend-pure-dsl/legend-pure-dsl-graph/legend-pure-m2-dsl-graph-pure/src/main/resources/platform_dsl_graph/graph_test.pure b/legend-pure-dsl/legend-pure-dsl-graph/legend-pure-m2-dsl-graph-pure/src/main/resources/platform_dsl_graph/graph_test.pure new file mode 100644 index 0000000000..e69de29bb2