Search in sources :

Example 1 with Root_meta_data_BinaryData

use of org.finos.legend.pure.generated.Root_meta_data_BinaryData in project legend-engine by finos.

the class TestDataCompilationFromGrammar method testBinaryDataCompilation.

@Test
public void testBinaryDataCompilation() {
    Pair<PureModelContextData, PureModel> result = test("###Data\n" + "Data <<meta::pure::profiles::typemodifiers.abstract>> {doc.doc = 'something'} meta::data::MyData\n" + "Binary #{\n" + "  contentType: 'application/x-protobuf';\n" + "  data: '1B4A 9DEA 230F FF20';\n" + "}#\n");
    PackageableElement element = result.getTwo().getPackageableElement("meta::data::MyData");
    Assert.assertTrue(element instanceof Root_meta_data_DataElement);
    Root_meta_data_DataElement dataElement = (Root_meta_data_DataElement) element;
    Assert.assertTrue(dataElement._data() instanceof Root_meta_data_BinaryData);
    Root_meta_data_BinaryData binaryData = (Root_meta_data_BinaryData) dataElement._data();
    Assert.assertEquals("application/x-protobuf", binaryData._contentType());
    Assert.assertEquals("1B4A9DEA230FFF20", binaryData._hexData());
}
Also used : PackageableElement(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.PackageableElement) Root_meta_data_BinaryData(org.finos.legend.pure.generated.Root_meta_data_BinaryData) PureModel(org.finos.legend.engine.language.pure.compiler.toPureGraph.PureModel) PureModelContextData(org.finos.legend.engine.protocol.pure.v1.model.context.PureModelContextData) Root_meta_data_DataElement(org.finos.legend.pure.generated.Root_meta_data_DataElement) Test(org.junit.Test)

Aggregations

PureModel (org.finos.legend.engine.language.pure.compiler.toPureGraph.PureModel)1 PureModelContextData (org.finos.legend.engine.protocol.pure.v1.model.context.PureModelContextData)1 Root_meta_data_BinaryData (org.finos.legend.pure.generated.Root_meta_data_BinaryData)1 Root_meta_data_DataElement (org.finos.legend.pure.generated.Root_meta_data_DataElement)1 PackageableElement (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.PackageableElement)1 Test (org.junit.Test)1