Skip to content

Commit

Permalink
Update milestonedSourceToNonMilestonedTargetProperty.pure
Browse files Browse the repository at this point in the history
  • Loading branch information
PrateekGarg-gs authored Sep 21, 2023
1 parent 7076d4a commit 8348160
Showing 1 changed file with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,38 @@ function <<test.Test, test.AlloyOnly>> meta::pure::graphFetch::tests::m2m2r::mil
']}', $result);
}

function <<test.Test, test.AlloyOnly>> meta::pure::graphFetch::tests::m2m2r::milestoning::milestonedSourceToNonMilestonedTargetProperty::testFlatten_ViaNoArgMapping_ViaAssociation():Boolean[1]
{
let mapping = meta::pure::graphFetch::tests::m2m2r::milestoning::milestonedSourceToNonMilestonedTargetProperty::getNoArgFlattenMapping_ViaAssociation();
let runtime = getModelChainRuntime($mapping);

let query={bdate:DateTime[1]|meta::relational::tests::milestoning::TargetProductFlattened.all($bdate)->graphFetch(
#{
meta::relational::tests::milestoning::TargetProductFlattened{
id,
name,
synonymNames
}
}#
)->serialize(
#{
meta::relational::tests::milestoning::TargetProductFlattened{
id,
name,
synonymNames
}
}#
)
->meta::pure::mapping::from($mapping,$runtime)
};
let result = meta::legend::executeLegendQuery($query, [pair('bdate', '2023-10-15T00:00:00')], ^meta::pure::runtime::ExecutionContext(), meta::relational::extension::relationalExtensions());
assertJsonStringsEqual('{"builder":{"_type":"json"},"values":['+
'{"id":2,"name":"ProductName2","synonymNames":["GS-Mod-S1","GS-Mod-S3"]},'+
'{"id":3,"name":"ProductName3","synonymNames":["GS-Mod-S3"]}'+
']}', $result);
}


function <<test.Test, test.AlloyOnly>> meta::pure::graphFetch::tests::m2m2r::milestoning::milestonedSourceToNonMilestonedTargetProperty::testFlatten_ViaAllVersionsMapping():Boolean[1]
{
let mapping = meta::relational::tests::m2m2r::milestoning::milestonedSourceToNonMilestonedTargetProperty::TargetToModeMappingWithComplexPropertyFlattened_AllVersions;
Expand Down Expand Up @@ -247,6 +279,28 @@ function meta::pure::graphFetch::tests::m2m2r::milestoning::milestonedSourceToNo
);
}

function meta::pure::graphFetch::tests::m2m2r::milestoning::milestonedSourceToNonMilestonedTargetProperty::getNoArgFlattenMapping_ViaAssociation():meta::pure::mapping::Mapping[1]
{
let mappingStr = '###Mapping\n' +
'Mapping meta::relational::tests::m2m2r::milestoning::milestonedSourceToNonMilestonedTargetProperty::TargetToModelMappingWithComplexPropertyFlattened_WithNoArg\n'+
'(\n'+
' *meta::relational::tests::milestoning::TargetProductFlattened: Pure\n'+
' {\n'+
' ~src meta::relational::tests::milestoning::ProductMilestoned\n'+
' id: $src.id,\n'+
' name: $src.name,\n'+
' synonymNames:$src.synonymsMilestonedViaAssociation.synonym\n'+
' }\n' +
')';

let mapping = meta::legend::compileLegendGrammar($mappingStr)->at(0)->cast(@Mapping);

let newMapping = ^$mapping(includes = ^MappingInclude(included = meta::relational::tests::milestoning::milestoningMapSmall, // fix legend compile to allow mapping reference in include
owner = $mapping)
);
}


###Mapping

Mapping meta::relational::tests::m2m2r::milestoning::milestonedSourceToNonMilestonedTargetProperty::TargetToModeMapping_AllVersions
Expand Down

0 comments on commit 8348160

Please sign in to comment.