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.
* no changes needed for relationalGraphFetch
* always route to otherwiseMapping for graphFetchFlow * fix otherwise embedded mapping for graphfetch * behave as if embedded mapping were empty
- Loading branch information
1 parent
85fef69
commit 5bc1ee3
Showing
10 changed files
with
551 additions
and
19 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
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
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
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
96 changes: 96 additions & 0 deletions
96
...n/resources/core_relational/relational/graphFetch/tests/testGraphFetchEmbeddedInline.pure
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,96 @@ | ||
// 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. | ||
|
||
import meta::pure::executionPlan::profiles::*; | ||
import meta::pure::graphFetch::execution::*; | ||
import meta::relational::tests::mapping::embedded::advanced::model::*; | ||
|
||
|
||
function <<test.BeforePackage>> meta::relational::graphFetch::tests::embedded::inline::setup(): Boolean[1] | ||
{ | ||
meta::relational::tests::mapping::embedded::advanced::setUp(); | ||
} | ||
|
||
|
||
function <<test.Test, test.AlloyOnly>> {serverVersion.start='v1_19_0'} meta::relational::graphFetch::tests::embedded::inline::testInlineEmbeddedMapping(): Boolean[1] | ||
{ | ||
let tree = #{ | ||
Product { | ||
name, | ||
bondDetails { | ||
description | ||
} | ||
} | ||
}#; | ||
let query = {|Product.all()->graphFetch($tree)->serialize($tree)}; | ||
let mapping = meta::relational::tests::mapping::embedded::advanced::mapping::testMappingEmbedded; | ||
let runtime = meta::external::store::relational::tests::testRuntime(); | ||
|
||
let result = execute($query, $mapping, $runtime, meta::relational::extension::relationalExtensions()).values; | ||
|
||
assertJsonStringsEqual( | ||
'[{"name":"Product 1","bondDetails":{"description":"Bond 1"}},' + | ||
'{"name":"Product 2","bondDetails":{"description":"Bond 2"}},' + | ||
'{"name":"Product 3","bondDetails":{"description":"SuperBond 3 super"}}]', | ||
$result | ||
); | ||
} | ||
|
||
function <<test.Test, test.AlloyOnly>> {serverVersion.start='v1_19_0'} meta::relational::graphFetch::tests::embedded::inline::testQualifierWithArgs(): Boolean[1] | ||
{ | ||
let tree = #{ | ||
Product { | ||
name, | ||
bondDetails { | ||
'duration': durationStartsWith('5') | ||
} | ||
} | ||
}#; | ||
let query = {|Product.all()->graphFetch($tree)->serialize($tree)}; | ||
let mapping = meta::relational::tests::mapping::embedded::advanced::mapping::testMappingEmbedded; | ||
let runtime = meta::external::store::relational::tests::testRuntime(); | ||
|
||
let result = execute($query, $mapping, $runtime, meta::relational::extension::relationalExtensions()).values; | ||
|
||
assertJsonStringsEqual( | ||
'[{"name":"Product 1","bondDetails":{"duration":true}},' + | ||
'{"name":"Product 2","bondDetails":{"duration":true}},' + | ||
'{"name":"Product 3","bondDetails":{"duration":false}}]', | ||
$result | ||
); | ||
} | ||
|
||
function <<test.Test, test.AlloyOnly>> {serverVersion.start='v1_19_0'} meta::relational::graphFetch::tests::embedded::inline::testWithAssociationFromRootMappingWithFilter(): Boolean[1] | ||
{ | ||
let tree = #{ | ||
Product { | ||
name, | ||
bondDetails { | ||
bondClassification { | ||
type | ||
} | ||
} | ||
} | ||
}#; | ||
let query = {|Product.all()->filter(p|$p.name == 'Product 1')->graphFetch($tree)->serialize($tree)}; | ||
let mapping = meta::relational::tests::mapping::embedded::advanced::mapping::testMappingEmbeddedParent; | ||
let runtime = meta::external::store::relational::tests::testRuntime(); | ||
|
||
let result = execute($query, $mapping, $runtime, meta::relational::extension::relationalExtensions()).values; | ||
|
||
assertJsonStringsEqual( | ||
'{"name":"Product 1","bondDetails":{"bondClassification":[{"type":"Corporate"}]}}', | ||
$result | ||
); | ||
} |
Oops, something went wrong.