Search in sources :

Example 1 with DateCoreInstance

use of org.finos.legend.pure.m4.coreinstance.primitive.DateCoreInstance in project legend-pure by finos.

the class TestMilestonedPropertyUsageInFunctionExpressions method testPropagationOfSingleDateFromBiTemporalAll.

@Test
public void testPropagationOfSingleDateFromBiTemporalAll() {
    String domain = "import meta::relational::tests::milestoning::*;\n" + "Class <<temporal.bitemporal>> meta::relational::tests::milestoning::Product { exchange : Exchange[0..1]; }\n" + "Class <<temporal.businesstemporal>> meta::relational::tests::milestoning::Exchange{ location : Location[1];}\n" + "Class <<temporal.businesstemporal>> meta::relational::tests::milestoning::Location{ street : String[1];}\n" + "function go():Any[*] { {|Product.all(%9999, %2017-8-14).exchange.location.street} }";
    runtime.createInMemorySource("domain.pure", domain);
    runtime.compile();
    CoreInstance locationMilestonedQp = getLocationQualifiedProperty();
    Assert.assertEquals("location", locationMilestonedQp.getValueForMetaPropertyToOne(M3Properties.qualifiedPropertyName).getValueForMetaPropertyToOne(M3Properties.values).getName());
    Assert.assertEquals(DateFunctions.newPureDate(2017, 8, 14), ((DateCoreInstance) locationMilestonedQp.getValueForMetaPropertyToMany(M3Properties.parametersValues).get(1).getValueForMetaPropertyToOne(M3Properties.values)).getValue());
}
Also used : DateCoreInstance(org.finos.legend.pure.m4.coreinstance.primitive.DateCoreInstance) CoreInstance(org.finos.legend.pure.m4.coreinstance.CoreInstance) Test(org.junit.Test)

Example 2 with DateCoreInstance

use of org.finos.legend.pure.m4.coreinstance.primitive.DateCoreInstance in project legend-pure by finos.

the class TestMilestonedPropertyUsageInFunctionExpressions method testPropagationOfSingleDateFromBiTemporalQualifiedProperty.

@Test
public void testPropagationOfSingleDateFromBiTemporalQualifiedProperty() {
    String domain = "import meta::relational::tests::milestoning::*;\n" + "Class meta::relational::tests::milestoning::Product { exchange : Exchange[0..1]; }\n" + "Class <<temporal.bitemporal>> meta::relational::tests::milestoning::Exchange{ location : Location[1];}\n" + "Class <<temporal.businesstemporal>> meta::relational::tests::milestoning::Location{ street : String[1];}\n" + "function go():Any[*] { {|Product.all().exchange(%9999, %2017-8-14).location.street} }";
    runtime.createInMemorySource("domain.pure", domain);
    runtime.compile();
    CoreInstance locationMilestonedQp = getLocationQualifiedProperty();
    Assert.assertEquals("location", locationMilestonedQp.getValueForMetaPropertyToOne(M3Properties.qualifiedPropertyName).getValueForMetaPropertyToOne(M3Properties.values).getName());
    Assert.assertEquals(DateFunctions.newPureDate(2017, 8, 14), ((DateCoreInstance) locationMilestonedQp.getValueForMetaPropertyToMany(M3Properties.parametersValues).get(1).getValueForMetaPropertyToOne(M3Properties.values)).getValue());
}
Also used : DateCoreInstance(org.finos.legend.pure.m4.coreinstance.primitive.DateCoreInstance) CoreInstance(org.finos.legend.pure.m4.coreinstance.CoreInstance) Test(org.junit.Test)

Aggregations

CoreInstance (org.finos.legend.pure.m4.coreinstance.CoreInstance)2 DateCoreInstance (org.finos.legend.pure.m4.coreinstance.primitive.DateCoreInstance)2 Test (org.junit.Test)2