public abstract class org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest extends java.lang.Object
{
protected static org.finos.legend.pure.m.execution.FunctionExecution functionExecution;
public void <init>()
{
org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest v;
v := @this: org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest;
specialinvoke v.<java.lang.Object: void <init>()>();
return;
}
protected static org.finos.legend.pure.m.serialization.runtime.PureRuntime setUpRuntime(org.finos.legend.pure.m.coreinstance.CoreInstanceFactoryRegistry) throws java.lang.Exception
{
java.lang.Object[] v;
org.eclipse.collections.api.block.function.Function v;
org.eclipse.collections.api.block.predicate.Predicate v;
org.finos.legend.pure.m.serialization.runtime.VoidPureRuntimeStatus v;
org.eclipse.collections.api.RichIterable v, v, v;
org.finos.legend.pure.m.serialization.runtime.PureRuntimeBuilder v, v, v, v, v;
java.lang.String v, v, v;
org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest$1 v;
boolean v;
java.io.PrintStream v, v;
org.finos.legend.pure.m.serialization.runtime.PureRuntime v;
org.finos.legend.pure.m.serialization.filesystem.usercodestorage.classpath.ClassLoaderCodeStorage v;
org.finos.legend.pure.m.coreinstance.CoreInstanceFactoryRegistry v;
org.finos.legend.pure.m.serialization.filesystem.usercodestorage.composite.CompositeCodeStorage v;
org.finos.legend.pure.m.serialization.runtime.cache.CacheState v;
v := @parameter: org.finos.legend.pure.m.coreinstance.CoreInstanceFactoryRegistry;
v = <java.lang.System: java.io.PrintStream out>;
virtualinvoke v.<java.io.PrintStream: void println(java.lang.String)>("starting to setup runtime");
v = staticinvoke <org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest: org.eclipse.collections.api.RichIterable getRepositories()>();
v = staticinvoke <org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest$lambda_setUpRuntime_56236435_1__1: org.eclipse.collections.api.block.predicate.Predicate bootstrap$()>();
v = interfaceinvoke v.<org.eclipse.collections.api.RichIterable: org.eclipse.collections.api.RichIterable select(org.eclipse.collections.api.block.predicate.Predicate)>(v);
v = <java.lang.System: java.io.PrintStream out>;
v = staticinvoke <org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest$getName__2: org.eclipse.collections.api.block.function.Function bootstrap$()>();
v = interfaceinvoke v.<org.eclipse.collections.api.RichIterable: org.eclipse.collections.api.RichIterable collect(org.eclipse.collections.api.block.function.Function)>(v);
v = interfaceinvoke v.<org.eclipse.collections.api.RichIterable: java.lang.String makeString(java.lang.String,java.lang.String,java.lang.String)>("Code Repos: ", ", ", "");
virtualinvoke v.<java.io.PrintStream: void println(java.lang.String)>(v);
v = new org.finos.legend.pure.m.serialization.filesystem.usercodestorage.composite.CompositeCodeStorage;
v = newarray (org.finos.legend.pure.m.serialization.filesystem.usercodestorage.RepositoryCodeStorage)[1];
v = new org.finos.legend.pure.m.serialization.filesystem.usercodestorage.classpath.ClassLoaderCodeStorage;
specialinvoke v.<org.finos.legend.pure.m.serialization.filesystem.usercodestorage.classpath.ClassLoaderCodeStorage: void <init>(java.lang.Iterable)>(v);
v[0] = v;
specialinvoke v.<org.finos.legend.pure.m.serialization.filesystem.usercodestorage.composite.CompositeCodeStorage: void <init>(org.finos.legend.pure.m.serialization.filesystem.usercodestorage.RepositoryCodeStorage[])>(v);
v = new org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest$1;
specialinvoke v.<org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest$1: void <init>()>();
v = new org.finos.legend.pure.m.serialization.runtime.PureRuntimeBuilder;
specialinvoke v.<org.finos.legend.pure.m.serialization.runtime.PureRuntimeBuilder: void <init>(org.finos.legend.pure.m.serialization.filesystem.usercodestorage.MutableRepositoryCodeStorage)>(v);
v = <org.finos.legend.pure.m.serialization.runtime.VoidPureRuntimeStatus: org.finos.legend.pure.m.serialization.runtime.VoidPureRuntimeStatus VOID_PURE_RUNTIME_STATUS>;
v = virtualinvoke v.<org.finos.legend.pure.m.serialization.runtime.PureRuntimeBuilder: org.finos.legend.pure.m.serialization.runtime.PureRuntimeBuilder withRuntimeStatus(org.finos.legend.pure.m.serialization.runtime.PureRuntimeStatus)>(v);
v = virtualinvoke v.<org.finos.legend.pure.m.serialization.runtime.PureRuntimeBuilder: org.finos.legend.pure.m.serialization.runtime.PureRuntimeBuilder setTransactionalByDefault(boolean)>(0);
v = virtualinvoke v.<org.finos.legend.pure.m.serialization.runtime.PureRuntimeBuilder: org.finos.legend.pure.m.serialization.runtime.PureRuntimeBuilder withFactoryRegistryOverride(org.finos.legend.pure.m.coreinstance.CoreInstanceFactoryRegistry)>(v);
v = virtualinvoke v.<org.finos.legend.pure.m.serialization.runtime.PureRuntimeBuilder: org.finos.legend.pure.m.serialization.runtime.PureRuntimeBuilder withCache(org.finos.legend.pure.m.serialization.runtime.cache.PureGraphCache)>(v);
v = virtualinvoke v.<org.finos.legend.pure.m.serialization.runtime.PureRuntimeBuilder: org.finos.legend.pure.m.serialization.runtime.PureRuntime buildAndTryToInitializeFromCache()>();
v = virtualinvoke v.<org.finos.legend.pure.m.serialization.runtime.cache.ClassLoaderPureGraphCache: org.finos.legend.pure.m.serialization.runtime.cache.CacheState getCacheState()>();
v = virtualinvoke v.<org.finos.legend.pure.m.serialization.runtime.cache.CacheState: java.lang.String getLastErrorMessage()>();
v = dynamicinvoke "makeConcatWithConstants" <java.lang.String (java.lang.String)>(v) <java.lang.invoke.StringConcatFactory: java.lang.invoke.CallSite makeConcatWithConstants(java.lang.invoke.MethodHandles$Lookup,java.lang.String,java.lang.invoke.MethodType,java.lang.String,java.lang.Object[])>("Fail to init cache: \u0001");
v = virtualinvoke v.<org.finos.legend.pure.m.serialization.runtime.PureRuntime: boolean isInitialized()>();
staticinvoke <org.junit.Assert: void assertTrue(java.lang.String,boolean)>(v, v);
return v;
}
public void testPlanExecution()
{
org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest v;
v := @this: org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest;
specialinvoke v.<org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest: void test(java.lang.String,java.lang.String,java.lang.String)>("|test::Types.all()->graphFetch(#{test::Types{string}}#)->from(test::simpleModelMapping, $runtime)->serialize(#{test::Types{string}}#)", "[]", "{\"builder\":{\"_type\":\"json\"},\"values\":[{\"string\":\"string1\"},{\"string\":\"string2\"}]}");
return;
}
public void testStringVariable()
{
org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest v;
v := @this: org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest;
specialinvoke v.<org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest: void test(java.lang.String,java.lang.String,java.lang.String)>("{pref: String[1], suf:String[1]|\n  let tree = #{test::Types{string, \'prefixed\': string($pref, $suf)}}#;\n  test::Types.all()->graphFetch($tree)->from(test::simpleModelMapping, $runtime)->serialize($tree);}", "[pair(\'pref\', \'hello_\'), pair(\'suf\', \'_bye\')]", "{\"builder\":{\"_type\":\"json\"},\"values\":[{\"string\":\"string1\",\"prefixed\":\"hello_string1_bye\"},{\"string\":\"string2\",\"prefixed\":\"hello_string2_bye\"}]}");
return;
}
public void testStrictDateVariable()
{
org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest v;
v := @this: org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest;
specialinvoke v.<org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest: void test(java.lang.String,java.lang.String,java.lang.String)>("{asOf: StrictDate[1]|\n      let tree = #{test::Types{date, \'years\': years($asOf)}}#;\n      test::Types.all()->graphFetch($tree)->from(test::simpleModelMapping, $runtime)->serialize($tree);}", "pair(\'asOf\', %2020-01-01)", " {\"builder\":{\"_type\":\"json\"},\"values\":[{\"date\":\"2020-01-01\",\"years\":0},{\"date\":\"2019-01-01\",\"years\":1}]}");
return;
}
public void testDateTimeVariable()
{
org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest v;
v := @this: org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest;
specialinvoke v.<org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest: void test(java.lang.String,java.lang.String,java.lang.String)>("{asOf: DateTime[1]|\n      let tree = #{test::Types{dateTime, \'seconds\': seconds($asOf)}}#;\n      test::Types.all()->graphFetch($tree)->from(test::simpleModelMapping, $runtime)->serialize($tree);}", "pair(\'asOf\', %2020-01-01T01:01:01.123)", "{\"builder\":{\"_type\":\"json\"},\"values\":[{\"dateTime\":\"2021-01-02T01:02:11.1223\",\"seconds\":-31708869},{\"dateTime\":\"2023-01-02T05:02:11.1223\",\"seconds\":-94795269}]}");
return;
}
public void testBooleanVariable()
{
org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest v;
v := @this: org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest;
specialinvoke v.<org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest: void test(java.lang.String,java.lang.String,java.lang.String)>("{bool: Boolean[1]|\n  let tree = #{test::Types{bool, \'and\': and($bool)}}#;\n  test::Types.all()->graphFetch($tree)->from(test::simpleModelMapping, $runtime)->serialize($tree);}", "pair(\'bool\', true)", "{\"builder\":{\"_type\":\"json\"},\"values\":[{\"bool\":true,\"and\":true},{\"bool\":false,\"and\":false}]}");
return;
}
public void testFloatVariable()
{
org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest v;
v := @this: org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest;
specialinvoke v.<org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest: void test(java.lang.String,java.lang.String,java.lang.String)>("{num: Float[1]|\n  let tree = #{test::Types{float, \'mult\': mult($num)}}#;\n  test::Types.all()->graphFetch($tree)->from(test::simpleModelMapping, $runtime)->serialize($tree);}", "pair(\'num\', 1.1234)", "{\"builder\":{\"_type\":\"json\"},\"values\":[{\"float\":123.123,\"mult\":138.3163782},{\"float\":125.125,\"mult\":140.565425}]}");
return;
}
public void testIntegerVariable()
{
org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest v;
v := @this: org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest;
specialinvoke v.<org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest: void test(java.lang.String,java.lang.String,java.lang.String)>("{num: Integer[1]|\n  let tree = #{test::Types{int, \'mult\': mult($num)}}#;\n  test::Types.all()->graphFetch($tree)->from(test::simpleModelMapping, $runtime)->serialize($tree);}", "pair(\'num\', 123)", "{\"builder\":{\"_type\":\"json\"},\"values\":[{\"int\":123456,\"mult\":15185088},{\"int\":654321,\"mult\":80481483}]}");
return;
}
public void testDecimalVariable()
{
org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest v;
v := @this: org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest;
specialinvoke v.<org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest: void test(java.lang.String,java.lang.String,java.lang.String)>("{num: Decimal[1]|\n  let tree = #{test::Types{decimal, \'mult\': mult($num)}}#;\n  test::Types.all()->graphFetch($tree)->from(test::simpleModelMapping, $runtime)->serialize($tree);}", "pair(\'num\', 1.1234->meta::pure::functions::math::toDecimal())", "{\"builder\":{\"_type\":\"json\"},\"values\":[{\"decimal\":789.123,\"mult\":886.5007782},{\"decimal\":345.219,\"mult\":387.8190246}]}");
return;
}
public void testToManyVariable()
{
org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest v;
v := @this: org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest;
specialinvoke v.<org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest: void test(java.lang.String,java.lang.String,java.lang.String)>("{nums: Integer[*]|\n  let tree = #{test::Types{int, \'sum\': sum($nums)}}#;\n  test::Types.all()->graphFetch($tree)->from(test::simpleModelMapping, $runtime)->serialize($tree);}", "pair(\'nums\', meta::pure::functions::collection::list([1, 2, 3, 4, 5]))", "{\"builder\":{\"_type\":\"json\"},\"values\":[{\"int\":123456,\"sum\":123471},{\"int\":654321,\"sum\":654336}]}");
return;
}
private void test(java.lang.String, java.lang.String, java.lang.String)
{
java.lang.Throwable v, v;
java.nio.charset.Charset v;
java.lang.String v, v, v, v, v, v, v;
org.eclipse.collections.api.tuple.Pair v;
org.finos.legend.pure.m.serialization.runtime.PureRuntime v, v, v, v;
java.io.IOException v;
org.finos.legend.pure.m.coreinstance.CoreInstance v;
java.io.UncheckedIOException v;
java.util.List v, v;
org.eclipse.collections.api.list.ImmutableList v;
org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest v;
java.lang.Class v;
java.lang.Object v;
org.eclipse.collections.api.factory.list.ImmutableListFactory v;
org.finos.legend.pure.m.execution.FunctionExecution v, v, v, v, v;
java.io.InputStream v;
v := @this: org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest;
v := @parameter: java.lang.String;
v := @parameter: java.lang.String;
v := @parameter: java.lang.String;
label:
v = class "Lorg/finos/legend/engine/pure/runtime/execution/LegendExecuteTest;";
v = virtualinvoke v.<java.lang.Class: java.io.InputStream getResourceAsStream(java.lang.String)>("/testModels.txt");
v = staticinvoke <java.util.Objects: java.lang.Object requireNonNull(java.lang.Object)>(v);
label:
v = <java.nio.charset.StandardCharsets: java.nio.charset.Charset UTF_8>;
v = staticinvoke <org.apache.commons.io.IOUtils: java.util.List readLines(java.io.InputStream,java.nio.charset.Charset)>(v, v);
interfaceinvoke v.<java.util.List: boolean add(java.lang.Object)>("function test():Any[*]{");
interfaceinvoke v.<java.util.List: boolean add(java.lang.Object)>("  let extensions = meta::pure::extension::defaultExtensions();");
interfaceinvoke v.<java.util.List: boolean add(java.lang.Object)>("  let runtime = ^Runtime(");
interfaceinvoke v.<java.util.List: boolean add(java.lang.Object)>("                      connectionStores = [");
interfaceinvoke v.<java.util.List: boolean add(java.lang.Object)>("                        ^ConnectionStore(");
interfaceinvoke v.<java.util.List: boolean add(java.lang.Object)>("                         element = ^ModelStore(),");
interfaceinvoke v.<java.util.List: boolean add(java.lang.Object)>("                         connection=");
interfaceinvoke v.<java.util.List: boolean add(java.lang.Object)>("                         ^JsonModelConnection(");
interfaceinvoke v.<java.util.List: boolean add(java.lang.Object)>("                          class = test::_S_Types,");
interfaceinvoke v.<java.util.List: boolean add(java.lang.Object)>("                          url = \'data:application/json,\\n{\"string\": \"string1\", \"float\": 123.123, \"int\": 123456, \"bool\": true, \"decimal\": \"789.123\", \"date\": \"2020-01-01\", \"dateTime\": \"2021-01-02T01:02:11.1223Z\"}\\n{\"string\": \"string2\", \"float\": 125.125, \"int\": 654321, \"bool\": false, \"decimal\": \"345.219\", \"date\": \"2019-01-01\", \"dateTime\": \"2023-01-02T05:02:11.1223Z\"}\'");
interfaceinvoke v.<java.util.List: boolean add(java.lang.Object)>("                          )");
interfaceinvoke v.<java.util.List: boolean add(java.lang.Object)>("                        )");
interfaceinvoke v.<java.util.List: boolean add(java.lang.Object)>("                      ]");
interfaceinvoke v.<java.util.List: boolean add(java.lang.Object)>("                    );");
v = dynamicinvoke "makeConcatWithConstants" <java.lang.String (java.lang.String)>(v) <java.lang.invoke.StringConcatFactory: java.lang.invoke.CallSite makeConcatWithConstants(java.lang.invoke.MethodHandles$Lookup,java.lang.String,java.lang.invoke.MethodType,java.lang.String,java.lang.Object[])>("  let toExecute = \u;");
interfaceinvoke v.<java.util.List: boolean add(java.lang.Object)>(v);
v = dynamicinvoke "makeConcatWithConstants" <java.lang.String (java.lang.String)>(v) <java.lang.invoke.StringConcatFactory: java.lang.invoke.CallSite makeConcatWithConstants(java.lang.invoke.MethodHandles$Lookup,java.lang.String,java.lang.invoke.MethodType,java.lang.String,java.lang.Object[])>("  let vars = \u;");
interfaceinvoke v.<java.util.List: boolean add(java.lang.Object)>(v);
interfaceinvoke v.<java.util.List: boolean add(java.lang.Object)>("  let result = meta::legend::execute($toExecute, $vars, ^ExecutionContext(), $extensions);");
v = dynamicinvoke "makeConcatWithConstants" <java.lang.String (java.lang.String)>(v) <java.lang.invoke.StringConcatFactory: java.lang.invoke.CallSite makeConcatWithConstants(java.lang.invoke.MethodHandles$Lookup,java.lang.String,java.lang.invoke.MethodType,java.lang.String,java.lang.Object[])>("  let expectedPlanResult = \'\u0001\';");
interfaceinvoke v.<java.util.List: boolean add(java.lang.Object)>(v);
interfaceinvoke v.<java.util.List: boolean add(java.lang.Object)>("  assertJsonStringsEqual($result, $expectedPlanResult);");
interfaceinvoke v.<java.util.List: boolean add(java.lang.Object)>("}");
v = staticinvoke <java.lang.String: java.lang.String join(java.lang.CharSequence,java.lang.Iterable)>("\n", v);
v = <org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest: org.finos.legend.pure.m.execution.FunctionExecution functionExecution>;
v = interfaceinvoke v.<org.finos.legend.pure.m.execution.FunctionExecution: org.finos.legend.pure.m.serialization.runtime.PureRuntime getRuntime()>();
v = staticinvoke <org.eclipse.collections.impl.tuple.Tuples: org.eclipse.collections.api.tuple.Pair pair(java.lang.Object,java.lang.Object)>("testSource.pure", v);
v = staticinvoke <java.util.Collections: java.util.List singletonList(java.lang.Object)>(v);
virtualinvoke v.<org.finos.legend.pure.m.serialization.runtime.PureRuntime: org.finos.legend.pure.m.SourceMutation createInMemoryAndCompile(java.lang.Iterable)>(v);
v = <org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest: org.finos.legend.pure.m.execution.FunctionExecution functionExecution>;
v = interfaceinvoke v.<org.finos.legend.pure.m.execution.FunctionExecution: org.finos.legend.pure.m.serialization.runtime.PureRuntime getRuntime()>();
v = virtualinvoke v.<org.finos.legend.pure.m.serialization.runtime.PureRuntime: org.finos.legend.pure.m.coreinstance.CoreInstance getFunction(java.lang.String)>("test():Any[*]");
v = <org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest: org.finos.legend.pure.m.execution.FunctionExecution functionExecution>;
v = <org.eclipse.collections.api.factory.Lists: org.eclipse.collections.api.factory.list.ImmutableListFactory immutable>;
v = interfaceinvoke v.<org.eclipse.collections.api.factory.list.ImmutableListFactory: org.eclipse.collections.api.list.ImmutableList empty()>();
interfaceinvoke v.<org.finos.legend.pure.m.execution.FunctionExecution: org.finos.legend.pure.m.coreinstance.CoreInstance start(org.finos.legend.pure.m.coreinstance.CoreInstance,org.eclipse.collections.api.list.ListIterable)>(v, v);
label:
if v == null goto label;
virtualinvoke v.<java.io.InputStream: void close()>();
goto label;
label:
v := @caughtexception;
throw v;
label:
v = <org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest: org.finos.legend.pure.m.execution.FunctionExecution functionExecution>;
v = interfaceinvoke v.<org.finos.legend.pure.m.execution.FunctionExecution: org.finos.legend.pure.m.serialization.runtime.PureRuntime getRuntime()>();
virtualinvoke v.<org.finos.legend.pure.m.serialization.runtime.PureRuntime: void delete(java.lang.String)>("testSource.pure");
goto label;
label:
v := @caughtexception;
v = new java.io.UncheckedIOException;
specialinvoke v.<java.io.UncheckedIOException: void <init>(java.io.IOException)>(v);
throw v;
label:
v := @caughtexception;
v = <org.finos.legend.engine.pure.runtime.execution.LegendExecuteTest: org.finos.legend.pure.m.execution.FunctionExecution functionExecution>;
v = interfaceinvoke v.<org.finos.legend.pure.m.execution.FunctionExecution: org.finos.legend.pure.m.serialization.runtime.PureRuntime getRuntime()>();
virtualinvoke v.<org.finos.legend.pure.m.serialization.runtime.PureRuntime: void delete(java.lang.String)>("testSource.pure");
throw v;
label:
return;
catch java.lang.Throwable from label to label with label;
catch java.io.IOException from label to label with label;
catch java.lang.Throwable from label to label with label;
}
private static org.eclipse.collections.api.RichIterable getRepositories()
{
org.eclipse.collections.api.RichIterable v;
v = staticinvoke <org.finos.legend.pure.m.serialization.filesystem.repository.CodeRepositoryProviderHelper: org.eclipse.collections.api.RichIterable findCodeRepositories(boolean)>(1);
return v;
}
}