use of org.finos.legend.pure.m3.coreinstance.meta.relational.mapping.RootRelationalInstanceSetImplementation in project legend-pure by finos.
the class TestSimpleGrammar method testMappingScope.
@Test
public void testMappingScope() {
Loader.parseM3("import other::*;\n" + "\n" + "Class other::Person\n" + "{\n" + " name : String[1];\n" + " id : Integer[1];" + " other : String[1];" + "}\n" + "###Relational\n" + "Database mapping::pack::db" + "(" + " Table employeeTable\n" + " (\n" + " id INT PRIMARY KEY,\n" + " name VARCHAR(200),\n" + " other VARCHAR(200),\n" + " firmId INT\n" + " )" + ")\n" + "###Mapping\n" + "import mapping::pack::*;\n" + "Mapping mappingPackage::myMapping\n" + "(\n" + " /* comment */\n" + " other::Person: Relational\n" + " {" + " scope([db])" + " (" + " name : employeeTable.name\n" + " )," + " scope([db]default.employeeTable)" + " (" + " id : id" + " )," + " scope([db]employeeTable)" + " (" + " other : other" + " )" + " }\n" + ")\n", this.repository, new ParserLibrary(Lists.immutable.with(new M3AntlrParser(), new MappingParser(), new RelationalParser())), ValidationType.DEEP, VoidM3M4StateListener.VOID_M3_M4_STATE_LISTENER, this.context);
this.runtime.compile();
CoreInstance mapping = this.runtime.getCoreInstance("mappingPackage::myMapping");
CoreInstance personClassMappingImplementation = Instance.getValueForMetaPropertyToManyResolved(mapping, "classMappings", this.processorSupport).getFirst();
ListIterable<? extends CoreInstance> personClassMappingImplementationPropertyMappings = Instance.getValueForMetaPropertyToManyResolved(personClassMappingImplementation, "propertyMappings", this.processorSupport);
final StringBuilder sb = new StringBuilder("[\n");
personClassMappingImplementationPropertyMappings.forEach(new Procedure<CoreInstance>() {
@Override
public void value(CoreInstance each) {
CoreInstance relationalOperationElement = Instance.getValueForMetaPropertyToOneResolved(each, "relationalOperationElement", TestSimpleGrammar.this.processorSupport);
Printer.print(sb, relationalOperationElement, 3);
sb.append("\n");
}
});
final String mappingGraphDump = sb.append("]").toString();
Assert.assertEquals("[\n" + "Anonymous_StripedId instance TableAliasColumn\n" + " alias(Property):\n" + " Anonymous_StripedId instance TableAlias\n" + " database(Property):\n" + " [~>] db instance Database\n" + " name(Property):\n" + " employeeTable instance String\n" + " relationalElement(Property):\n" + " Anonymous_StripedId instance Table\n" + " columns(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] name instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] other instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] firmId instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " milestoning(Property):\n" + " name(Property):\n" + " employeeTable instance String\n" + " primaryKey(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " schema(Property):\n" + " Anonymous_StripedId instance Schema\n" + " database(Property):\n" + " [X] db instance Database\n" + " name(Property):\n" + " [>3] default instance String\n" + " relations(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " tables(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " views(Property):\n" + " setColumns(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] name instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] other instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] firmId instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " temporaryTable(Property):\n" + " false instance Boolean\n" + " column(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " name instance String\n" + " nullable(Property):\n" + " true instance Boolean\n" + " owner(Property):\n" + " Anonymous_StripedId instance Table\n" + " columns(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " [_] Anonymous_StripedId instance Column\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] other instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] firmId instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " milestoning(Property):\n" + " name(Property):\n" + " employeeTable instance String\n" + " primaryKey(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " schema(Property):\n" + " Anonymous_StripedId instance Schema\n" + " database(Property):\n" + " [X] db instance Database\n" + " name(Property):\n" + " [>3] default instance String\n" + " relations(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " tables(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " views(Property):\n" + " setColumns(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " [_] Anonymous_StripedId instance Column\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] other instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] firmId instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " temporaryTable(Property):\n" + " false instance Boolean\n" + " type(Property):\n" + " Anonymous_StripedId instance Varchar\n" + " size(Property):\n" + " 200 instance Integer\n" + " columnName(Property):\n" + " name instance String\n" + " setMappingOwner(Property):\n" + " Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " class(Property):\n" + " [~>] other::Person instance Class\n" + " distinct(Property):\n" + " false instance Boolean\n" + " id(Property):\n" + " other_Person instance String\n" + " mainTableAlias(Property):\n" + " Anonymous_StripedId instance TableAlias\n" + " database(Property):\n" + " [X] db instance Database\n" + " name(Property):\n" + " instance String\n" + " relationalElement(Property):\n" + " Anonymous_StripedId instance Table\n" + " columns(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " milestoning(Property):\n" + " name(Property):\n" + " [>3] employeeTable instance String\n" + " primaryKey(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " schema(Property):\n" + " [>3] Anonymous_StripedId instance Schema\n" + " setColumns(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " temporaryTable(Property):\n" + " [>3] false instance Boolean\n" + " parent(Property):\n" + " [~>] mappingPackage::myMapping instance Mapping\n" + " primaryKey(Property):\n" + " Anonymous_StripedId instance TableAliasColumn\n" + " alias(Property):\n" + " Anonymous_StripedId instance TableAlias\n" + " database(Property):\n" + " [X] db instance Database\n" + " name(Property):\n" + " [>3] instance String\n" + " relationalElement(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " column(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " propertyMappings(Property):\n" + " Anonymous_StripedId instance RelationalPropertyMapping\n" + " localMappingProperty(Property):\n" + " false instance Boolean\n" + " owner(Property):\n" + " [_] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " property(Property):\n" + " name instance Property\n" + " aggregation(Property):\n" + " [>3] None instance AggregationKind\n" + " classifierGenericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " genericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " multiplicity(Property):\n" + " [X] PureOne instance PackageableMultiplicity\n" + " name(Property):\n" + " [>3] name instance String\n" + " owner(Property):\n" + " [X] Person instance Class\n" + " referenceUsages(Property):\n" + " [>3] Anonymous_StripedId instance ReferenceUsage\n" + " relationalOperationElement(Property):\n" + " [_] Anonymous_StripedId instance TableAliasColumn\n" + " sourceSetImplementationId(Property):\n" + " other_Person instance String\n" + " targetSetImplementationId(Property):\n" + " instance String\n" + " Anonymous_StripedId instance RelationalPropertyMapping\n" + " localMappingProperty(Property):\n" + " false instance Boolean\n" + " owner(Property):\n" + " [_] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " property(Property):\n" + " id instance Property\n" + " aggregation(Property):\n" + " [>3] None instance AggregationKind\n" + " classifierGenericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " genericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " multiplicity(Property):\n" + " [X] PureOne instance PackageableMultiplicity\n" + " name(Property):\n" + " [>3] id instance String\n" + " owner(Property):\n" + " [X] Person instance Class\n" + " referenceUsages(Property):\n" + " [>3] Anonymous_StripedId instance ReferenceUsage\n" + " relationalOperationElement(Property):\n" + " Anonymous_StripedId instance TableAliasColumn\n" + " alias(Property):\n" + " [>3] Anonymous_StripedId instance TableAlias\n" + " column(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " columnName(Property):\n" + " [>3] id instance String\n" + " setMappingOwner(Property):\n" + " [>3] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " sourceSetImplementationId(Property):\n" + " other_Person instance String\n" + " targetSetImplementationId(Property):\n" + " instance String\n" + " Anonymous_StripedId instance RelationalPropertyMapping\n" + " localMappingProperty(Property):\n" + " false instance Boolean\n" + " owner(Property):\n" + " [_] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " property(Property):\n" + " other instance Property\n" + " aggregation(Property):\n" + " [>3] None instance AggregationKind\n" + " classifierGenericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " genericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " multiplicity(Property):\n" + " [X] PureOne instance PackageableMultiplicity\n" + " name(Property):\n" + " [>3] other instance String\n" + " owner(Property):\n" + " [X] Person instance Class\n" + " referenceUsages(Property):\n" + " [>3] Anonymous_StripedId instance ReferenceUsage\n" + " relationalOperationElement(Property):\n" + " Anonymous_StripedId instance TableAliasColumn\n" + " alias(Property):\n" + " [>3] Anonymous_StripedId instance TableAlias\n" + " column(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " columnName(Property):\n" + " [>3] other instance String\n" + " setMappingOwner(Property):\n" + " [>3] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " sourceSetImplementationId(Property):\n" + " other_Person instance String\n" + " targetSetImplementationId(Property):\n" + " instance String\n" + " root(Property):\n" + " true instance Boolean\n" + " stores(Property):\n" + " [X] db instance Database\n" + " userDefinedPrimaryKey(Property):\n" + " false instance Boolean\n" + "Anonymous_StripedId instance TableAliasColumn\n" + " alias(Property):\n" + " Anonymous_StripedId instance TableAlias\n" + " database(Property):\n" + " [~>] db instance Database\n" + " name(Property):\n" + " employeeTable instance String\n" + " relationalElement(Property):\n" + " Anonymous_StripedId instance Table\n" + " columns(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] name instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] other instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] firmId instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " milestoning(Property):\n" + " name(Property):\n" + " employeeTable instance String\n" + " primaryKey(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " schema(Property):\n" + " Anonymous_StripedId instance Schema\n" + " database(Property):\n" + " [X] db instance Database\n" + " name(Property):\n" + " [>3] default instance String\n" + " relations(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " tables(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " views(Property):\n" + " setColumns(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] name instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] other instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] firmId instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " temporaryTable(Property):\n" + " false instance Boolean\n" + " schema(Property):\n" + " default instance String\n" + " column(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " id instance String\n" + " nullable(Property):\n" + " false instance Boolean\n" + " owner(Property):\n" + " Anonymous_StripedId instance Table\n" + " columns(Property):\n" + " [_] Anonymous_StripedId instance Column\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] name instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] other instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] firmId instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " milestoning(Property):\n" + " name(Property):\n" + " employeeTable instance String\n" + " primaryKey(Property):\n" + " [_] Anonymous_StripedId instance Column\n" + " schema(Property):\n" + " Anonymous_StripedId instance Schema\n" + " database(Property):\n" + " [X] db instance Database\n" + " name(Property):\n" + " [>3] default instance String\n" + " relations(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " tables(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " views(Property):\n" + " setColumns(Property):\n" + " [_] Anonymous_StripedId instance Column\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] name instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] other instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] firmId instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " temporaryTable(Property):\n" + " false instance Boolean\n" + " type(Property):\n" + " Anonymous_StripedId instance Integer\n" + " columnName(Property):\n" + " id instance String\n" + " setMappingOwner(Property):\n" + " Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " class(Property):\n" + " [~>] other::Person instance Class\n" + " distinct(Property):\n" + " false instance Boolean\n" + " id(Property):\n" + " other_Person instance String\n" + " mainTableAlias(Property):\n" + " Anonymous_StripedId instance TableAlias\n" + " database(Property):\n" + " [X] db instance Database\n" + " name(Property):\n" + " instance String\n" + " relationalElement(Property):\n" + " Anonymous_StripedId instance Table\n" + " columns(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " milestoning(Property):\n" + " name(Property):\n" + " [>3] employeeTable instance String\n" + " primaryKey(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " schema(Property):\n" + " [>3] Anonymous_StripedId instance Schema\n" + " setColumns(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " temporaryTable(Property):\n" + " [>3] false instance Boolean\n" + " parent(Property):\n" + " [~>] mappingPackage::myMapping instance Mapping\n" + " primaryKey(Property):\n" + " Anonymous_StripedId instance TableAliasColumn\n" + " alias(Property):\n" + " Anonymous_StripedId instance TableAlias\n" + " database(Property):\n" + " [X] db instance Database\n" + " name(Property):\n" + " [>3] instance String\n" + " relationalElement(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " column(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " propertyMappings(Property):\n" + " Anonymous_StripedId instance RelationalPropertyMapping\n" + " localMappingProperty(Property):\n" + " false instance Boolean\n" + " owner(Property):\n" + " [_] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " property(Property):\n" + " name instance Property\n" + " aggregation(Property):\n" + " [>3] None instance AggregationKind\n" + " classifierGenericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " genericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " multiplicity(Property):\n" + " [X] PureOne instance PackageableMultiplicity\n" + " name(Property):\n" + " [>3] name instance String\n" + " owner(Property):\n" + " [X] Person instance Class\n" + " referenceUsages(Property):\n" + " [>3] Anonymous_StripedId instance ReferenceUsage\n" + " relationalOperationElement(Property):\n" + " Anonymous_StripedId instance TableAliasColumn\n" + " alias(Property):\n" + " [>3] Anonymous_StripedId instance TableAlias\n" + " column(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " columnName(Property):\n" + " [>3] name instance String\n" + " setMappingOwner(Property):\n" + " [>3] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " sourceSetImplementationId(Property):\n" + " other_Person instance String\n" + " targetSetImplementationId(Property):\n" + " instance String\n" + " Anonymous_StripedId instance RelationalPropertyMapping\n" + " localMappingProperty(Property):\n" + " false instance Boolean\n" + " owner(Property):\n" + " [_] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " property(Property):\n" + " id instance Property\n" + " aggregation(Property):\n" + " [>3] None instance AggregationKind\n" + " classifierGenericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " genericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " multiplicity(Property):\n" + " [X] PureOne instance PackageableMultiplicity\n" + " name(Property):\n" + " [>3] id instance String\n" + " owner(Property):\n" + " [X] Person instance Class\n" + " referenceUsages(Property):\n" + " [>3] Anonymous_StripedId instance ReferenceUsage\n" + " relationalOperationElement(Property):\n" + " [_] Anonymous_StripedId instance TableAliasColumn\n" + " sourceSetImplementationId(Property):\n" + " other_Person instance String\n" + " targetSetImplementationId(Property):\n" + " instance String\n" + " Anonymous_StripedId instance RelationalPropertyMapping\n" + " localMappingProperty(Property):\n" + " false instance Boolean\n" + " owner(Property):\n" + " [_] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " property(Property):\n" + " other instance Property\n" + " aggregation(Property):\n" + " [>3] None instance AggregationKind\n" + " classifierGenericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " genericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " multiplicity(Property):\n" + " [X] PureOne instance PackageableMultiplicity\n" + " name(Property):\n" + " [>3] other instance String\n" + " owner(Property):\n" + " [X] Person instance Class\n" + " referenceUsages(Property):\n" + " [>3] Anonymous_StripedId instance ReferenceUsage\n" + " relationalOperationElement(Property):\n" + " Anonymous_StripedId instance TableAliasColumn\n" + " alias(Property):\n" + " [>3] Anonymous_StripedId instance TableAlias\n" + " column(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " columnName(Property):\n" + " [>3] other instance String\n" + " setMappingOwner(Property):\n" + " [>3] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " sourceSetImplementationId(Property):\n" + " other_Person instance String\n" + " targetSetImplementationId(Property):\n" + " instance String\n" + " root(Property):\n" + " true instance Boolean\n" + " stores(Property):\n" + " [X] db instance Database\n" + " userDefinedPrimaryKey(Property):\n" + " false instance Boolean\n" + "Anonymous_StripedId instance TableAliasColumn\n" + " alias(Property):\n" + " Anonymous_StripedId instance TableAlias\n" + " database(Property):\n" + " [~>] db instance Database\n" + " name(Property):\n" + " employeeTable instance String\n" + " relationalElement(Property):\n" + " Anonymous_StripedId instance Table\n" + " columns(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] name instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] other instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] firmId instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " milestoning(Property):\n" + " name(Property):\n" + " employeeTable instance String\n" + " primaryKey(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " schema(Property):\n" + " Anonymous_StripedId instance Schema\n" + " database(Property):\n" + " [X] db instance Database\n" + " name(Property):\n" + " [>3] default instance String\n" + " relations(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " tables(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " views(Property):\n" + " setColumns(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] name instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] other instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] firmId instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " temporaryTable(Property):\n" + " false instance Boolean\n" + " column(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " other instance String\n" + " nullable(Property):\n" + " true instance Boolean\n" + " owner(Property):\n" + " Anonymous_StripedId instance Table\n" + " columns(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] name instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " [_] Anonymous_StripedId instance Column\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] firmId instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " milestoning(Property):\n" + " name(Property):\n" + " employeeTable instance String\n" + " primaryKey(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " schema(Property):\n" + " Anonymous_StripedId instance Schema\n" + " database(Property):\n" + " [X] db instance Database\n" + " name(Property):\n" + " [>3] default instance String\n" + " relations(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " tables(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " views(Property):\n" + " setColumns(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] name instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Varchar\n" + " [_] Anonymous_StripedId instance Column\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] firmId instance String\n" + " nullable(Property):\n" + " [>3] true instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " temporaryTable(Property):\n" + " false instance Boolean\n" + " type(Property):\n" + " Anonymous_StripedId instance Varchar\n" + " size(Property):\n" + " 200 instance Integer\n" + " columnName(Property):\n" + " other instance String\n" + " setMappingOwner(Property):\n" + " Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " class(Property):\n" + " [~>] other::Person instance Class\n" + " distinct(Property):\n" + " false instance Boolean\n" + " id(Property):\n" + " other_Person instance String\n" + " mainTableAlias(Property):\n" + " Anonymous_StripedId instance TableAlias\n" + " database(Property):\n" + " [X] db instance Database\n" + " name(Property):\n" + " instance String\n" + " relationalElement(Property):\n" + " Anonymous_StripedId instance Table\n" + " columns(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " milestoning(Property):\n" + " name(Property):\n" + " [>3] employeeTable instance String\n" + " primaryKey(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " schema(Property):\n" + " [>3] Anonymous_StripedId instance Schema\n" + " setColumns(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " [>3] Anonymous_StripedId instance Column\n" + " temporaryTable(Property):\n" + " [>3] false instance Boolean\n" + " parent(Property):\n" + " [~>] mappingPackage::myMapping instance Mapping\n" + " primaryKey(Property):\n" + " Anonymous_StripedId instance TableAliasColumn\n" + " alias(Property):\n" + " Anonymous_StripedId instance TableAlias\n" + " database(Property):\n" + " [X] db instance Database\n" + " name(Property):\n" + " [>3] instance String\n" + " relationalElement(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " column(Property):\n" + " Anonymous_StripedId instance Column\n" + " name(Property):\n" + " [>3] id instance String\n" + " nullable(Property):\n" + " [>3] false instance Boolean\n" + " owner(Property):\n" + " [>3] Anonymous_StripedId instance Table\n" + " type(Property):\n" + " [>3] Anonymous_StripedId instance Integer\n" + " propertyMappings(Property):\n" + " Anonymous_StripedId instance RelationalPropertyMapping\n" + " localMappingProperty(Property):\n" + " false instance Boolean\n" + " owner(Property):\n" + " [_] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " property(Property):\n" + " name instance Property\n" + " aggregation(Property):\n" + " [>3] None instance AggregationKind\n" + " classifierGenericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " genericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " multiplicity(Property):\n" + " [X] PureOne instance PackageableMultiplicity\n" + " name(Property):\n" + " [>3] name instance String\n" + " owner(Property):\n" + " [X] Person instance Class\n" + " referenceUsages(Property):\n" + " [>3] Anonymous_StripedId instance ReferenceUsage\n" + " relationalOperationElement(Property):\n" + " Anonymous_StripedId instance TableAliasColumn\n" + " alias(Property):\n" + " [>3] Anonymous_StripedId instance TableAlias\n" + " column(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " columnName(Property):\n" + " [>3] name instance String\n" + " setMappingOwner(Property):\n" + " [>3] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " sourceSetImplementationId(Property):\n" + " other_Person instance String\n" + " targetSetImplementationId(Property):\n" + " instance String\n" + " Anonymous_StripedId instance RelationalPropertyMapping\n" + " localMappingProperty(Property):\n" + " false instance Boolean\n" + " owner(Property):\n" + " [_] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " property(Property):\n" + " id instance Property\n" + " aggregation(Property):\n" + " [>3] None instance AggregationKind\n" + " classifierGenericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " genericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " multiplicity(Property):\n" + " [X] PureOne instance PackageableMultiplicity\n" + " name(Property):\n" + " [>3] id instance String\n" + " owner(Property):\n" + " [X] Person instance Class\n" + " referenceUsages(Property):\n" + " [>3] Anonymous_StripedId instance ReferenceUsage\n" + " relationalOperationElement(Property):\n" + " Anonymous_StripedId instance TableAliasColumn\n" + " alias(Property):\n" + " [>3] Anonymous_StripedId instance TableAlias\n" + " column(Property):\n" + " [>3] Anonymous_StripedId instance Column\n" + " columnName(Property):\n" + " [>3] id instance String\n" + " setMappingOwner(Property):\n" + " [>3] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " sourceSetImplementationId(Property):\n" + " other_Person instance String\n" + " targetSetImplementationId(Property):\n" + " instance String\n" + " Anonymous_StripedId instance RelationalPropertyMapping\n" + " localMappingProperty(Property):\n" + " false instance Boolean\n" + " owner(Property):\n" + " [_] Anonymous_StripedId instance RootRelationalInstanceSetImplementation\n" + " property(Property):\n" + " other instance Property\n" + " aggregation(Property):\n" + " [>3] None instance AggregationKind\n" + " classifierGenericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " genericType(Property):\n" + " [>3] Anonymous_StripedId instance GenericType\n" + " multiplicity(Property):\n" + " [X] PureOne instance PackageableMultiplicity\n" + " name(Property):\n" + " [>3] other instance String\n" + " owner(Property):\n" + " [X] Person instance Class\n" + " referenceUsages(Property):\n" + " [>3] Anonymous_StripedId instance ReferenceUsage\n" + " relationalOperationElement(Property):\n" + " [_] Anonymous_StripedId instance TableAliasColumn\n" + " sourceSetImplementationId(Property):\n" + " other_Person instance String\n" + " targetSetImplementationId(Property):\n" + " instance String\n" + " root(Property):\n" + " true instance Boolean\n" + " stores(Property):\n" + " [X] db instance Database\n" + " userDefinedPrimaryKey(Property):\n" + " false instance Boolean\n" + "]", mappingGraphDump);
}
use of org.finos.legend.pure.m3.coreinstance.meta.relational.mapping.RootRelationalInstanceSetImplementation in project legend-pure by finos.
the class TestMainTableForExtendedMapping method testValidMainTableForNestedExtendedMapping.
@Test
public void testValidMainTableForNestedExtendedMapping() {
String testSourceCode = "###Pure\n" + "import test::*;\n" + "\n" + "Class test::RoadVehicle extends Vehicle\n" + "{\n" + " \n" + "}\n" + "\n" + "Class test::Bicycle extends RoadVehicle\n" + "{\n" + " \n" + "}\n" + "\n" + "###Mapping\n" + "import test::*;\n" + "\n" + "Mapping test::RoadVehicleMapping\n" + "( \n" + " include VehicleMapping\n" + " \n" + " RoadVehicle extends [test_Vehicle]: Relational\n" + " {\n" + " }\n" + ")\n" + "\n" + "Mapping test::BicycleMapping\n" + "( \n" + " include RoadVehicleMapping\n" + " \n" + " Bicycle extends [test_RoadVehicle]: Relational\n" + " {\n" + " }\n" + ")\n";
this.runtime.createInMemorySource(MAIN_SOURCE_ID, MAIN_SOURCE_CODE);
this.runtime.createInMemorySource(TEST_SOURCE_ID, testSourceCode);
this.runtime.compile();
Mapping vehicleMapping = (Mapping) this.runtime.getCoreInstance("test::VehicleMapping");
RootRelationalInstanceSetImplementation vehicleSetImplementation = (RootRelationalInstanceSetImplementation) vehicleMapping._classMappings().selectWith(CLASS_MAPPING_BY_ID, "test_Vehicle").getFirst();
Mapping roadVehicleMapping = (Mapping) this.runtime.getCoreInstance("test::RoadVehicleMapping");
RootRelationalInstanceSetImplementation roadVehicleSetImplementation = (RootRelationalInstanceSetImplementation) roadVehicleMapping._classMappings().selectWith(CLASS_MAPPING_BY_ID, "test_RoadVehicle").getFirst();
Mapping bicycleMapping = (Mapping) this.runtime.getCoreInstance("test::BicycleMapping");
RootRelationalInstanceSetImplementation bicycleSetImplementation = (RootRelationalInstanceSetImplementation) bicycleMapping._classMappings().selectWith(CLASS_MAPPING_BY_ID, "test_Bicycle").getFirst();
Assert.assertEquals(vehicleSetImplementation._mainTableAlias()._relationalElement(), roadVehicleSetImplementation._mainTableAlias()._relationalElement());
Assert.assertEquals(vehicleSetImplementation._mainTableAlias()._database(), roadVehicleSetImplementation._mainTableAlias()._database());
Assert.assertEquals(roadVehicleSetImplementation._mainTableAlias()._relationalElement(), bicycleSetImplementation._mainTableAlias()._relationalElement());
Assert.assertEquals(roadVehicleSetImplementation._mainTableAlias()._database(), bicycleSetImplementation._mainTableAlias()._database());
}
use of org.finos.legend.pure.m3.coreinstance.meta.relational.mapping.RootRelationalInstanceSetImplementation in project legend-pure by finos.
the class TestMainTableForExtendedMapping method testValidMainTableForNestedExtendedMappingWithStoreSubstitution.
@Test
public void testValidMainTableForNestedExtendedMappingWithStoreSubstitution() {
String testSourceCode = "###Pure\n" + "import test::*;\n" + "\n" + "Class test::RoadVehicle extends Vehicle\n" + "{\n" + " \n" + "}\n" + "\n" + "Class test::Bicycle extends RoadVehicle\n" + "{\n" + " \n" + "}\n" + "\n" + "###Relational\n" + "Database test::RoadVehicleDatabase\n" + "(\n" + " include test::VehicleDatabase\n" + ")\n" + "\n" + "###Relational\n" + "Database test::BicycleDatabase\n" + "(\n" + " include test::RoadVehicleDatabase\n" + ")\n" + "\n" + "###Mapping\n" + "import test::*;\n" + "\n" + "Mapping test::RoadVehicleMapping\n" + "( \n" + " include VehicleMapping[VehicleDatabase->RoadVehicleDatabase]\n" + " \n" + " RoadVehicle extends [test_Vehicle]: Relational\n" + " {\n" + " vehicleName : concat(\'roadVehicle_\', [RoadVehicleDatabase]VehicleTable.vehicleName)\n" + " }\n" + ")\n" + "\n" + "Mapping test::BicycleMapping\n" + "( \n" + " include RoadVehicleMapping[RoadVehicleDatabase->BicycleDatabase]\n" + " \n" + " Bicycle extends [test_RoadVehicle]: Relational\n" + " {\n" + " vehicleType : [BicycleDatabase]VehicleTable.vehicleType\n" + " }\n" + ")\n";
this.runtime.createInMemorySource(MAIN_SOURCE_ID, MAIN_SOURCE_CODE);
this.runtime.createInMemorySource(TEST_SOURCE_ID, testSourceCode);
this.runtime.compile();
Mapping vehicleMapping = (Mapping) this.runtime.getCoreInstance("test::VehicleMapping");
RootRelationalInstanceSetImplementation vehicleSetImplementation = (RootRelationalInstanceSetImplementation) vehicleMapping._classMappings().selectWith(CLASS_MAPPING_BY_ID, "test_Vehicle").getFirst();
Mapping roadVehicleMapping = (Mapping) this.runtime.getCoreInstance("test::RoadVehicleMapping");
RootRelationalInstanceSetImplementation roadVehicleSetImplementation = (RootRelationalInstanceSetImplementation) roadVehicleMapping._classMappings().selectWith(CLASS_MAPPING_BY_ID, "test_RoadVehicle").getFirst();
Mapping bicycleMapping = (Mapping) this.runtime.getCoreInstance("test::BicycleMapping");
RootRelationalInstanceSetImplementation bicycleSetImplementation = (RootRelationalInstanceSetImplementation) bicycleMapping._classMappings().selectWith(CLASS_MAPPING_BY_ID, "test_Bicycle").getFirst();
Assert.assertEquals(vehicleSetImplementation._mainTableAlias()._relationalElement(), roadVehicleSetImplementation._mainTableAlias()._relationalElement());
Assert.assertNotEquals(vehicleSetImplementation._mainTableAlias()._database(), roadVehicleSetImplementation._mainTableAlias()._database());
Assert.assertEquals(roadVehicleSetImplementation._mainTableAlias()._relationalElement(), bicycleSetImplementation._mainTableAlias()._relationalElement());
Assert.assertNotEquals(roadVehicleSetImplementation._mainTableAlias()._database(), bicycleSetImplementation._mainTableAlias()._database());
}
use of org.finos.legend.pure.m3.coreinstance.meta.relational.mapping.RootRelationalInstanceSetImplementation in project legend-pure by finos.
the class TestMilestoningPropertyMapping method testProcessingMilestoningPropertyMapping.
@Test
public void testProcessingMilestoningPropertyMapping() {
this.runtime.createInMemorySource(MODEL_ID, PROCESSING_MILESTONING_MODEL_CODE);
this.runtime.createInMemorySource(STORE_ID, MILESTONED_STORE_CODE);
this.runtime.createInMemorySource(MAPPING_ID, MAPPING_CODE);
this.runtime.compile();
Mapping mapping = (Mapping) this.runtime.getCoreInstance("milestoning::Amap");
RootRelationalInstanceSetImplementation rootRelationalInstanceSetImplementation = mapping._classMappings().selectInstancesOf(RootRelationalInstanceSetImplementation.class).getFirst();
EmbeddedRelationalInstanceSetImplementation milestoningEmbeddedRelationalInstance = (EmbeddedRelationalInstanceSetImplementation) rootRelationalInstanceSetImplementation._propertyMappings().detectWith(MILESTONING_PROPERTY_MAPPING, this.processorSupport);
Assert.assertNotNull(milestoningEmbeddedRelationalInstance);
validateProperty(milestoningEmbeddedRelationalInstance._property(), "milestoning", "milestoning::A");
MutableList<RelationalPropertyMapping> relationalPropertyMappings = (MutableList<RelationalPropertyMapping>) milestoningEmbeddedRelationalInstance._propertyMappings().toList();
Assert.assertEquals(2, relationalPropertyMappings.size());
RelationalPropertyMapping inPropertyMapping = relationalPropertyMappings.get(0);
validateProperty(inPropertyMapping._property(), "in", "meta::pure::milestoning::ProcessingDateMilestoning");
validateTableAliasColumn(inPropertyMapping._relationalOperationElement(), "in_z");
RelationalPropertyMapping outPropertyMapping = relationalPropertyMappings.get(1);
validateProperty(outPropertyMapping._property(), "out", "meta::pure::milestoning::ProcessingDateMilestoning");
validateTableAliasColumn(outPropertyMapping._relationalOperationElement(), "out_z");
}
use of org.finos.legend.pure.m3.coreinstance.meta.relational.mapping.RootRelationalInstanceSetImplementation in project legend-pure by finos.
the class TestMilestoningPropertyMapping method testBusinessMilestoningPropertyMappingForTemporalEmbedded.
@Test
public void testBusinessMilestoningPropertyMappingForTemporalEmbedded() {
this.runtime.createInMemorySource(MODEL_ID, BUSINESS_MILESTONING_MODEL_CODE);
this.runtime.createInMemorySource(EMBEDDED_MODEL_ID, TEMPORAL_EMBEDDED_MODEL_CODE);
this.runtime.createInMemorySource(STORE_ID, MILESTONED_STORE_CODE);
this.runtime.createInMemorySource(MAPPING_ID, EMBEDDED_MAPPING_CODE);
this.runtime.compile();
Mapping mapping = (Mapping) this.runtime.getCoreInstance("milestoning::Bmap");
RootRelationalInstanceSetImplementation rootRelationalInstance = mapping._classMappings().selectInstancesOf(RootRelationalInstanceSetImplementation.class).getFirst();
EmbeddedRelationalInstanceSetImplementation milestoningEmbeddedRelationalInstance = (EmbeddedRelationalInstanceSetImplementation) rootRelationalInstance._propertyMappings().detectWith(MILESTONING_PROPERTY_MAPPING, this.processorSupport);
Assert.assertNotNull(milestoningEmbeddedRelationalInstance);
validateProperty(milestoningEmbeddedRelationalInstance._property(), "milestoning", "milestoning::B");
MutableList<RelationalPropertyMapping> relationalPropertyMappings = (MutableList<RelationalPropertyMapping>) milestoningEmbeddedRelationalInstance._propertyMappings().toList();
Assert.assertEquals(2, relationalPropertyMappings.size());
RelationalPropertyMapping fromPropertyMapping = relationalPropertyMappings.get(0);
validateProperty(fromPropertyMapping._property(), "from", "meta::pure::milestoning::BusinessDateMilestoning");
validateTableAliasColumn(fromPropertyMapping._relationalOperationElement(), "from_z");
RelationalPropertyMapping thruPropertyMapping = relationalPropertyMappings.get(1);
validateProperty(thruPropertyMapping._property(), "thru", "meta::pure::milestoning::BusinessDateMilestoning");
validateTableAliasColumn(thruPropertyMapping._relationalOperationElement(), "thru_z");
EmbeddedRelationalInstanceSetImplementation embeddedRelationalInstance = rootRelationalInstance._propertyMappings().selectInstancesOf(EmbeddedRelationalInstanceSetImplementation.class).getFirst();
milestoningEmbeddedRelationalInstance = (EmbeddedRelationalInstanceSetImplementation) embeddedRelationalInstance._propertyMappings().detectWith(MILESTONING_PROPERTY_MAPPING, this.processorSupport);
Assert.assertNotNull(milestoningEmbeddedRelationalInstance);
validateProperty(milestoningEmbeddedRelationalInstance._property(), "milestoning", "milestoning::A");
relationalPropertyMappings = (MutableList<RelationalPropertyMapping>) milestoningEmbeddedRelationalInstance._propertyMappings().toList();
Assert.assertEquals(2, relationalPropertyMappings.size());
fromPropertyMapping = relationalPropertyMappings.get(0);
validateProperty(fromPropertyMapping._property(), "from", "meta::pure::milestoning::BusinessDateMilestoning");
validateTableAliasColumn(fromPropertyMapping._relationalOperationElement(), "from_z");
thruPropertyMapping = relationalPropertyMappings.get(1);
validateProperty(thruPropertyMapping._property(), "thru", "meta::pure::milestoning::BusinessDateMilestoning");
validateTableAliasColumn(thruPropertyMapping._relationalOperationElement(), "thru_z");
}
Aggregations