diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/test/fct.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/test/fct.pure index 70dc4c633c5..665872a7bfd 100644 --- a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/test/fct.pure +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/test/fct.pure @@ -16,6 +16,10 @@ import meta::core::runtime::*; import meta::pure::mapping::*; import meta::pure::test::fct::*; +Profile meta::pure::test::fct::FCT +{ + stereotypes : [test, adapter]; +} function diff --git a/legend-engine-core/legend-engine-core-testable/legend-engine-test-fct/pom.xml b/legend-engine-core/legend-engine-core-testable/legend-engine-test-fct/pom.xml new file mode 100644 index 00000000000..89cd98c49f1 --- /dev/null +++ b/legend-engine-core/legend-engine-core-testable/legend-engine-test-fct/pom.xml @@ -0,0 +1,58 @@ + + + + + 4.0.0 + + org.finos.legend.engine + legend-engine-core-testable + 4.65.4-SNAPSHOT + + Legend Engine - Testable - FCT + legend-engine-test-fct + + + 11 + 11 + UTF-8 + + + + org.finos.legend.pure + legend-pure-m4 + + + org.finos.legend.pure + legend-pure-m3-core + + + org.finos.legend.pure + legend-pure-runtime-java-engine-compiled + + + org.eclipse.collections + eclipse-collections-api + + + junit + junit + + + + \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-testable/legend-engine-test-fct/src/main/java/org/finos/legend/engine/test/fct/FCTTestSuitBuilder.java b/legend-engine-core/legend-engine-core-testable/legend-engine-test-fct/src/main/java/org/finos/legend/engine/test/fct/FCTTestSuitBuilder.java new file mode 100644 index 00000000000..f40099dd0da --- /dev/null +++ b/legend-engine-core/legend-engine-core-testable/legend-engine-test-fct/src/main/java/org/finos/legend/engine/test/fct/FCTTestSuitBuilder.java @@ -0,0 +1,56 @@ +/* + * // Copyright 2023 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.engine.test.fct; + +import junit.framework.TestSuite; +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.pure.m3.execution.ExecutionSupport; +import org.finos.legend.pure.m3.execution.test.PureTestBuilder; +import org.finos.legend.pure.m3.execution.test.TestCollection; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.profile.Profile; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; + +import static org.finos.legend.pure.m3.execution.test.TestCollection.collectTests; + +public class FCTTestSuitBuilder +{ + public static TestSuite buildFCTTestSuiteWithExecutorFunction(TestCollection collection, MutableMap exclusions, String function, ExecutionSupport executionSupport) + { + PureTestBuilder.F2, Object> testExecutor = (a, b) -> + PureTestBuilderCompiled.executeFn(a, function, exclusions, executionSupport, b); + TestSuite suite = new TestSuite(); + suite.addTest(PureTestBuilder.buildSuite(collection, testExecutor, executionSupport)); + return suite; + } + + public static TestCollection buildFCTTestCollection(String path, ProcessorSupport processorSupport) + { + return collectTests(path, processorSupport, (node) -> + { + return isFCTTest(node, processorSupport); + }); + } + + public static boolean isFCTTest(CoreInstance node, ProcessorSupport processorSupport) + { + return Profile.hasStereotype(node, "meta::pure::test::fct::FCT", "test", processorSupport); + } + +} \ No newline at end of file diff --git a/legend-engine-core/legend-engine-core-testable/pom.xml b/legend-engine-core/legend-engine-core-testable/pom.xml index 317b1c8ac28..5bb9144e14e 100644 --- a/legend-engine-core/legend-engine-core-testable/pom.xml +++ b/legend-engine-core/legend-engine-core-testable/pom.xml @@ -36,5 +36,7 @@ legend-engine-testable-http-api legend-engine-execution-test-data-generation legend-engine-execution-test-data-generation-api + legend-engine-test-fct + \ No newline at end of file diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/pom.xml index 43aff81a394..fc0e8d037c3 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/pom.xml @@ -178,11 +178,11 @@ legend-pure-m2-dsl-path-grammar ${legend.pure.version} - - - - - + + org.finos.legend.pure + legend-pure-m2-dsl-tds-pure + ${legend.pure.version} + org.finos.legend.pure @@ -280,10 +280,10 @@ legend-engine-pure-functions-relation-pure runtime - - - - + + org.finos.legend.pure + legend-pure-m2-dsl-tds-pure + org.finos.legend.engine @@ -436,6 +436,16 @@ legend-engine-pure-runtime-java-extension-shared-functions-planExecution test + + org.finos.legend.engine + legend-engine-test-framework + test + + + org.finos.legend.engine + legend-engine-test-fct + test + @@ -469,7 +479,7 @@ - + diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/test/java/org/finos/legend/pure/code/core/relational/Test_Pure_Relational_FCT.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/test/java/org/finos/legend/pure/code/core/relational/Test_Pure_Relational_FCT.java new file mode 100644 index 00000000000..d5d76f913b5 --- /dev/null +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/test/java/org/finos/legend/pure/code/core/relational/Test_Pure_Relational_FCT.java @@ -0,0 +1,46 @@ +/* + * // Copyright 2023 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.code.core.relational; + +import junit.framework.Test; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.map.MutableMap; +import org.eclipse.collections.impl.factory.Maps; +import org.finos.legend.engine.test.fct.FCTTestSuitBuilder; +import org.finos.legend.pure.m3.execution.test.TestCollection; +import org.finos.legend.pure.runtime.java.compiled.execution.CompiledExecutionSupport; + +import static org.finos.legend.engine.test.fct.FCTTestSuitBuilder.buildFCTTestCollection; +import static org.finos.legend.engine.test.shared.framework.PureTestHelperFramework.*; + +public class Test_Pure_Relational_FCT +{ + public static Test suite() + { + CompiledExecutionSupport support = getClassLoaderExecutionSupport(); + MutableMap exclusions = Maps.mutable.empty(); + + TestCollection collection = buildFCTTestCollection("meta::relational::tests::mapping::association::embedded", support.getProcessorSupport()); + return wrapSuite( + () -> true, + () -> FCTTestSuitBuilder.buildFCTTestSuiteWithExecutorFunction(collection, exclusions,"meta::pure::test::fct::executeWrapper_FunctionDefinition_1__TestParameters_1__ExecuteResult_1_", support), + () -> false, + Lists.mutable.empty() + ); + } + +} diff --git a/pom.xml b/pom.xml index 9d566916622..895a0744ea1 100644 --- a/pom.xml +++ b/pom.xml @@ -107,7 +107,7 @@ - 5.22.2-SNAPSHOT + 5.22.1 0.25.7 12.59.0 @@ -2371,6 +2371,11 @@ legend-engine-testable-http-api ${project.version} + + org.finos.legend.engine + legend-engine-test-fct + ${project.version} + org.finos.legend.engine legend-engine-test-framework