Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial FCT test flow #3264

Closed
wants to merge 15 commits into from

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,18 @@ function meta::pure::lineage::analytics::inlineQualifiedProperties(vs: ValueSpec
ve : VariableExpression[1] | let resolved = $ve->resolve($vars, $openVars); if($resolved->isEmpty(), | $ve, | $resolved->toOne());,
v : ValueSpecification[1] | $v
]);
}
}


function meta::pure::lineage::analytics::reportLineageToString(report:meta::pure::lineage::result::ReportLineage[1]):String[1]
{
$report.properties->map(c | $c.propertyName + $c.resultDetail)->sort()->joinStrings('[', ', ', ']');
}

function meta::pure::lineage::test::assertLineage(storeLineage:String[*], classLineage:String[*], reportLineage:String[1], result:meta::pure::lineage::result::LineageResult[1]):Boolean[1]
{

assertSameElements($storeLineage, $result.storeLineage.nodes.data.id) && assertSameElements($classLineage, $result.classLineage.nodes.data.id) && assertEquals($reportLineage, meta::pure::lineage::analytics::reportLineageToString($result.reportLineage));
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// 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.


Class meta::pure::lineage::report::Source
{
<<equality.Key>> context: String[1];
}

Class meta::pure::lineage::report::PropertySource extends meta::pure::lineage::report::Source
{
<<equality.Key>> classPath: String[1];
<<equality.Key>> propertyName: String[1];
}


Class meta::pure::lineage::graph::Node
{
data : meta::pure::lineage::graph::NodeData[1];
}

Class meta::pure::lineage::graph::NodeData
{
id : String[1];
text : String[1];
type : String[1];
displayType : String[0..1];
parent : meta::pure::lineage::graph::Node[0..1];
}

Class meta::pure::lineage::graph::Edge
{
data : meta::pure::lineage::graph::EdgeData[1];
}

Class meta::pure::lineage::graph::EdgeData
{
id : String[1];
text : String[1];
type : String[1];
source : meta::pure::lineage::graph::Node[1];
target : meta::pure::lineage::graph::Node[1];
}

Class meta::pure::lineage::graph::Graph
{
nodes : meta::pure::lineage::graph::Node[*];
edges : meta::pure::lineage::graph::Edge[*];
}

Class meta::pure::lineage::result::PropertyLineage
{
propertyName : String[1];
resultDetail : String[1];
}

Class meta::pure::lineage::result::ReportLineage
{
properties : meta::pure::lineage::result::PropertyLineage[*];
}


Class meta::pure::lineage::result::LineageResult
{
storeLineage: meta::pure::lineage::graph::Graph[1];
classLineage: meta::pure::lineage::graph::Graph[1];
reportLineage : meta::pure::lineage::result::ReportLineage[1];
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// 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.

import meta::core::runtime::*;
import meta::pure::mapping::*;
import meta::pure::test::fct::*;


Class meta::pure::test::fct::TestResult
{

}

Class meta::pure::test::fct::ExecuteResult<T> extends meta::pure::test::fct::TestResult
{
result:meta::pure::mapping::Result<T|*>[1];

}






Class meta::pure::test::fct::TestParameters
{
mapping:meta::pure::mapping::Mapping[1];
runtime:meta::core::runtime::Runtime[1];
extensions:meta::pure::extension::Extension[*];
context:meta::pure::runtime::ExecutionContext[1];
}


function meta::pure::test::fct::testParameters(mapping:meta::pure::mapping::Mapping[1],runtime:meta::core::runtime::Runtime[1],extensions:meta::pure::extension::Extension[*]):meta::pure::test::fct::TestParameters[1]
{
^meta::pure::test::fct::TestParameters( mapping = $mapping,
runtime = $runtime,
extensions = $extensions,
context = ^meta::pure::runtime::ExecutionContext());
}

function meta::pure::test::fct::testParameters(mapping:meta::pure::mapping::Mapping[1],runtime:meta::core::runtime::Runtime[1],context:meta::pure::runtime::ExecutionContext[1], extensions:meta::pure::extension::Extension[*]):meta::pure::test::fct::TestParameters[1]
{
^meta::pure::test::fct::TestParameters( mapping = $mapping,
runtime = $runtime,
extensions = $extensions,
context = $context);
}

function

meta::pure::test::fct::executeWrapper<T|y>(f:FunctionDefinition<{->T[y]}>[1],holder:meta::pure::test::fct::TestParameters[1]):meta::pure::test::fct::ExecuteResult<T>[1]
{
^ExecuteResult<T>(result=meta::pure::router::execute($f,$holder.mapping,$holder.runtime,$holder.context,$holder.extensions));
}


function meta::pure::test::fct::assertTDSExecuteResult<T>(result:meta::pure::test::fct::TestResult[1],assertion:Function<{meta::pure::mapping::Result<T|*>[1]->Boolean[1]}>[1]):Boolean[1]
{

if($result->instanceOf(ExecuteResult),
|let tds = $result->cast(@ExecuteResult<TabularDataSet>).result;
$assertion->eval($tds);,
| true);
}


Class meta::pure::test::fct::LineageResult extends meta::pure::test::fct::TestResult
{
result:meta::pure::lineage::result::LineageResult[1];
}


function meta::pure::test::fct::assertLineageResult( storeLineage:String[*], classLineage:String[*], reportLineage:String[1],result:meta::pure::test::fct::TestResult[1]):Boolean[1]
{

if($result->instanceOf(meta::pure::test::fct::LineageResult),
| let lineage = $result->cast(@meta::pure::test::fct::LineageResult).result;
meta::pure::lineage::test::assertLineage($storeLineage,$classLineage,$reportLineage,$lineage);,
| true);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?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.67.3-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>
<dependency>
<groupId>io.opentracing</groupId>
<artifactId>opentracing-noop</artifactId>
</dependency>
<dependency>
<groupId>io.opentracing</groupId>
<artifactId>opentracing-util</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.collections</groupId>
<artifactId>eclipse-collections</artifactId>
</dependency>
</dependencies>

</project>
Loading
Loading