generated from finos/software-project-blueprint
-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
192 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
legend-engine-core/legend-engine-core-testable/legend-engine-test-fct/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ // 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. | ||
--> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.finos.legend.engine</groupId> | ||
<artifactId>legend-engine-core-testable</artifactId> | ||
<version>4.65.4-SNAPSHOT</version> | ||
</parent> | ||
<name>Legend Engine - Testable - FCT</name> | ||
<artifactId>legend-engine-test-fct</artifactId> | ||
|
||
<properties> | ||
<maven.compiler.source>11</maven.compiler.source> | ||
<maven.compiler.target>11</maven.compiler.target> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.finos.legend.pure</groupId> | ||
<artifactId>legend-pure-m4</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.finos.legend.pure</groupId> | ||
<artifactId>legend-pure-m3-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.finos.legend.pure</groupId> | ||
<artifactId>legend-pure-runtime-java-engine-compiled</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.collections</groupId> | ||
<artifactId>eclipse-collections-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
56 changes: 56 additions & 0 deletions
56
...nd-engine-test-fct/src/main/java/org/finos/legend/engine/test/fct/FCTTestSuitBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<String, String> exclusions, String function, ExecutionSupport executionSupport) | ||
{ | ||
PureTestBuilder.F2<CoreInstance, MutableList<Object>, 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); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...re/src/test/java/org/finos/legend/pure/code/core/relational/Test_Pure_Relational_FCT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<String,String> 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() | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters