diff --git a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/PureModel.java b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/PureModel.java index e7854c77509..f0ede743fc3 100644 --- a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/PureModel.java +++ b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/PureModel.java @@ -19,7 +19,6 @@ import io.opentracing.util.GlobalTracer; import java.lang.management.ManagementFactory; import java.lang.management.ThreadInfo; -import java.util.Arrays; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; @@ -280,7 +279,7 @@ public PureModel(PureModelContextData pureModelContextData, CompilerExtensions e MutableList sectionIndices = classToElements.removeAll(SectionIndex.class); sectionIndices.forEach(sectionIndex -> ((SectionIndex) sectionIndex).sections.forEach(section -> section.elements.forEach(elementPath -> this.sectionsIndex.putIfAbsent(elementPath, section)))); this.maybeParallel(Stream.concat(sectionIndices.stream(), classToElements.removeAll(Profile.class).stream())) - .forEach(handleEngineExceptions(this::processElementFirstPass)); + .forEach(handleEngineExceptions(this::processFirstPass)); MutableMap, Collection>> dependencyGraph = Maps.mutable.empty(); dependencyGraph.put(Class.class, Lists.fixedSize.with(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.Measure.class)); @@ -297,7 +296,7 @@ public PureModel(PureModelContextData pureModelContextData, CompilerExtensions e MutableSet>> disjointDependencyGraphs = dependencyManagement.getDisjointDependencyGraphs(); this.maybeParallel(disjointDependencyGraphs.stream()).forEach(disjointDependencyGraph -> { - processPass("firstPass", classToElements, dependentToDependencies, handleEngineExceptions(this::processElementFirstPass), disjointDependencyGraph); + processPass("firstPass", classToElements, dependentToDependencies, handleEngineExceptions(this::processFirstPass), disjointDependencyGraph); processPass("secondPass", classToElements, dependentToDependencies, handleEngineExceptions(this::processSecondPass), disjointDependencyGraph); processPass("thirdPass", classToElements, dependentToDependencies, handleEngineExceptions(this::processThirdPass), disjointDependencyGraph); processPass("fourthPass", classToElements, dependentToDependencies, handleEngineExceptions(this::processFourthPass), disjointDependencyGraph); @@ -586,17 +585,6 @@ else if (cause instanceof RuntimeException) } } - private void processElementFirstPass(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.PackageableElement element) - { - org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.PackageableElement packageableElement = processFirstPass(element); - String elementName = element.name; - if (element instanceof Function) - { - elementName = HelperModelBuilder.getSignature((Function) element); - } - this.packageableElementsIndex.put(buildPackageString(element._package, elementName), packageableElement); - } - private org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.PackageableElement processFirstPass(org.finos.legend.engine.protocol.pure.v1.model.packageableElement.PackageableElement element) { return visitWithErrorHandling(element, new PackageableElementFirstPassBuilder(getContext(element))); @@ -1632,6 +1620,7 @@ protected test = test(""); + PureModelContextData result = PureGrammarParser.newInstance().parseModel( + "###Connection\n" + + "RelationalDatabaseConnection simple::StaticConnection\n" + + "{\n" + + " store: asasmodel::relational::tests::dbInc;\n" + + " type: MemSQL;\n" + + " specification: Static\n" + + " {\n" + + " name: 'name';\n" + + " host: 'host';\n" + + " port: 1234;\n" + + " };\n" + + " auth: UserNamePassword\n" + + " {\n" + + " baseVaultReference: 'value';\n" + + " userNameVaultReference: 'value';\n" + + " passwordVaultReference: 'value';\n" + + " };\n" + + "}\n"); + + LegacyRuntime runtime = new LegacyRuntime(); + runtime.connections = result.getElementsOfType(PackageableConnection.class).stream().map(x -> x.connectionValue).collect(Collectors.toList()); + HelperRuntimeBuilder.buildPureRuntime(runtime, test.getTwo().getContext()); + } + @Test public void testH2ConnectionPropertiesPropagatedToCompiledGraph() { @@ -109,5 +144,4 @@ public void testH2ConnectionPropertiesPropagatedToCompiledGraph() Assert.assertTrue(quoteIdentifiers); } - }