Skip to content

Commit

Permalink
Fix for rafael
Browse files Browse the repository at this point in the history
  • Loading branch information
haroonsherjan committed Mar 1, 2024
1 parent f83d57b commit 3467f08
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
import org.eclipse.collections.api.block.function.Function3;
import org.eclipse.collections.impl.factory.Maps;
import org.eclipse.collections.impl.utility.ListIterate;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.data.core.EmbeddedDataCompilerExtension;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.data.core.EmbeddedDataCompilerHelper;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.extension.CompilerExtension;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.extension.Processor;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.handlers.IncludedMappingHandler;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.handlers.MappingIncludedMappingHandler;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.handlers.StoreProviderCompilerExtension;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.handlers.StoreProviderCompilerHelper;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.test.assertion.core.TestAssertionCompilerHelper;
import org.finos.legend.engine.protocol.pure.v1.model.context.PackageableElementType;
import org.finos.legend.engine.protocol.pure.v1.model.context.PureModelContextData;
Expand All @@ -45,7 +45,7 @@
import java.util.Map;
import java.util.Set;

public class CoreCompilerExtension implements CompilerExtension, EmbeddedDataCompilerExtension, StoreProviderCompilerExtension
public class CoreCompilerExtension implements CompilerExtension, EmbeddedDataCompilerHelper, StoreProviderCompilerHelper
{
@Override
public Iterable<? extends Processor<?>> getExtraProcessors()
Expand All @@ -56,7 +56,7 @@ public Iterable<? extends Processor<?>> getExtraProcessors()
@Override
public List<Function3<EmbeddedData, CompileContext, ProcessingContext, Root_meta_pure_data_EmbeddedData>> getExtraEmbeddedDataProcessors()
{
return Collections.singletonList(EmbeddedDataCompilerExtension::compileCoreEmbeddedDataTypes);
return Collections.singletonList(EmbeddedDataCompilerHelper::compileCoreEmbeddedDataTypes);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import org.eclipse.collections.impl.factory.Lists;
import org.eclipse.collections.impl.utility.ListIterate;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.data.EmbeddedDataFirstPassBuilder;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.handlers.StoreProviderCompilerExtension;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.handlers.StoreProviderCompilerHelper;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.test.TestBuilderHelper;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.test.assertion.TestAssertionFirstPassBuilder;
import org.finos.legend.engine.protocol.pure.v1.model.context.EngineErrorType;
Expand Down Expand Up @@ -116,7 +116,7 @@ else if (test instanceof FunctionTest)
private static Root_meta_legend_function_metamodel_StoreTestData buildFunctionTestData(org.finos.legend.pure.generated.Root_meta_core_runtime_Runtime runtime, StoreTestData storeTestData, CompileContext compileContext, ProcessingContext ctx)
{
Root_meta_legend_function_metamodel_StoreTestData_Impl metamodelStoreTestData = new Root_meta_legend_function_metamodel_StoreTestData_Impl("", SourceInformationHelper.toM3SourceInformation(storeTestData.sourceInformation), compileContext.pureModel.getClass("meta::legend::function::metamodel::StoreTestData"));
Store resolvedStore = StoreProviderCompilerExtension.getStoreFromStoreProviderPointers(storeTestData.store, compileContext);
Store resolvedStore = StoreProviderCompilerHelper.getStoreFromStoreProviderPointers(storeTestData.store, compileContext);
try
{
org.finos.legend.pure.generated.Root_meta_core_runtime_Connection connection = runtime.connectionByElement(resolvedStore, compileContext.pureModel.getExecutionSupport());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import org.eclipse.collections.api.RichIterable;
import org.eclipse.collections.impl.factory.Lists;
import org.eclipse.collections.impl.utility.ListIterate;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.handlers.StoreProviderCompilerExtension;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.handlers.StoreProviderCompilerHelper;
import org.finos.legend.engine.protocol.pure.v1.model.SourceInformation;
import org.finos.legend.engine.protocol.pure.v1.model.context.EngineErrorType;
import org.finos.legend.engine.protocol.pure.v1.model.context.PackageableElementType;
Expand Down Expand Up @@ -272,7 +272,7 @@ public static Store getStore(String element, SourceInformation sourceInformation

public static Store getStore(StoreProviderPointer storeProviderPointer, CompileContext context)
{
return StoreProviderCompilerExtension.getStoreFromStoreProviderPointers(storeProviderPointer, context);
return StoreProviderCompilerHelper.getStoreFromStoreProviderPointers(storeProviderPointer, context);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import java.util.List;
import java.util.Objects;

public interface EmbeddedDataCompilerExtension
public interface EmbeddedDataCompilerHelper
{
static Root_meta_pure_data_EmbeddedData compileCoreEmbeddedDataTypes(EmbeddedData embeddedData, CompileContext context, ProcessingContext processingContext)
{
Expand Down Expand Up @@ -127,8 +127,8 @@ default Iterable<? extends Function2<DataElementReference, PureModelContextData,
static EmbeddedData getEmbeddedDataFromDataElement(DataElementReference dataElementReference, PureModelContextData pureModelContextData)
{
List<EmbeddedData> dataList = ListIterate
.selectInstancesOf(CompilerExtensions.fromAvailableExtensions().getExtensions(), EmbeddedDataCompilerExtension.class)
.flatCollect(EmbeddedDataCompilerExtension::getExtraDataElementReferencePMCDTraversers)
.selectInstancesOf(CompilerExtensions.fromAvailableExtensions().getExtensions(), EmbeddedDataCompilerHelper.class)
.flatCollect(EmbeddedDataCompilerHelper::getExtraDataElementReferencePMCDTraversers)
.flatCollect(f -> f.apply(dataElementReference, pureModelContextData))
.select(Objects::nonNull);
if (dataList.size() > 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

import java.util.Map;

public interface StoreProviderCompilerExtension
public interface StoreProviderCompilerHelper
{
default Map<PackageableElementType, Function2<StoreProviderPointer, CompileContext, Store>> getExtraStoreProviderHandlers()
{
Expand All @@ -35,13 +35,14 @@ default Map<PackageableElementType, Function2<StoreProviderPointer, CompileConte

static Store getStoreFromStoreProviderPointers(StoreProviderPointer storeProviderPointer, CompileContext context)
{
if (storeProviderPointer.path.equals("ModelStore"))
{
return new Root_meta_external_store_model_ModelStore_Impl("", null, context.pureModel.getClass("meta::external::store::model::ModelStore"))
}
Map<PackageableElementType, Function2<StoreProviderPointer, CompileContext, Store>> extraStoreProviderPointerHandlers = Maps.mutable.empty();
ListIterate
.selectInstancesOf(CompilerExtensions.fromAvailableExtensions().getExtensions(), StoreProviderCompilerExtension.class)
.selectInstancesOf(CompilerExtensions.fromAvailableExtensions().getExtensions(), StoreProviderCompilerHelper.class)
.forEach(e -> extraStoreProviderPointerHandlers.putAll(e.getExtraStoreProviderHandlers()));
return storeProviderPointer.path.equals("ModelStore") ?
new Root_meta_external_store_model_ModelStore_Impl("", null, context.pureModel.getClass("meta::external::store::model::ModelStore"))
: extraStoreProviderPointerHandlers.get(storeProviderPointer.type).apply(storeProviderPointer, context);

return extraStoreProviderPointerHandlers.get(storeProviderPointer.type).apply(storeProviderPointer, context);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import org.finos.legend.engine.language.pure.compiler.toPureGraph.ConnectionFirstPassBuilder;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.HelperModelBuilder;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.PureModel;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.data.core.EmbeddedDataCompilerExtension;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.handlers.StoreProviderCompilerExtension;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.data.core.EmbeddedDataCompilerHelper;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.handlers.StoreProviderCompilerHelper;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.test.ModelStoreTestConnectionFactory;
import org.finos.legend.engine.plan.execution.PlanExecutor;
import org.finos.legend.engine.plan.execution.planHelper.PrimitiveValueSpecificationToObjectVisitor;
Expand Down Expand Up @@ -238,16 +238,16 @@ private void setup(FunctionTestRunnerContext context)
Optional<StoreTestData> optionalStoreTestData = protocolFunctionSuite.testData.stream().filter(
pTestData ->
{
String testDataStorePath = getElementFullPath(StoreProviderCompilerExtension.getStoreFromStoreProviderPointers(pTestData.store, context.getPureModel().getContext()), context.getPureModel().getExecutionSupport());
String testDataStorePath = getElementFullPath(StoreProviderCompilerHelper.getStoreFromStoreProviderPointers(pTestData.store, context.getPureModel().getContext()), context.getPureModel().getExecutionSupport());
return testDataStorePath.equals(connectionStorePath);
}).findFirst();
if (optionalStoreTestData.isPresent())
{
StoreTestData resolvedStoreTestData = optionalStoreTestData.get();
EmbeddedData testData = (resolvedStoreTestData.data instanceof DataElementReference)
? EmbeddedDataCompilerExtension.getEmbeddedDataFromDataElement((DataElementReference) resolvedStoreTestData.data, context.getPureModelContextData())
? EmbeddedDataCompilerHelper.getEmbeddedDataFromDataElement((DataElementReference) resolvedStoreTestData.data, context.getPureModelContextData())
: resolvedStoreTestData.data;
org.finos.legend.pure.m3.coreinstance.meta.pure.store.Store store = StoreProviderCompilerExtension.getStoreFromStoreProviderPointers(resolvedStoreTestData.store, context.getPureModel().getContext());
org.finos.legend.pure.m3.coreinstance.meta.pure.store.Store store = StoreProviderCompilerHelper.getStoreFromStoreProviderPointers(resolvedStoreTestData.store, context.getPureModel().getContext());
Store protocolStore = this.resolveStore(context.getPureModelContextData(), getElementFullPath(store, context.getPureModel().getExecutionSupport()));
storeTestDataList.put(protocolStore, testData);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
import org.eclipse.collections.impl.utility.Iterate;
import org.eclipse.collections.impl.utility.ListIterate;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.data.EmbeddedDataFirstPassBuilder;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.data.core.EmbeddedDataCompilerExtension;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.data.core.EmbeddedDataCompilerHelper;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.extension.CompilerExtension;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.extension.Processor;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.handlers.IncludedMappingHandler;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.handlers.StoreProviderCompilerExtension;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.handlers.StoreProviderCompilerHelper;
import org.finos.legend.engine.protocol.pure.v1.model.context.EngineErrorType;
import org.finos.legend.engine.protocol.pure.v1.model.context.PackageableElementType;
import org.finos.legend.engine.protocol.pure.v1.model.context.PureModelContextData;
Expand Down Expand Up @@ -73,7 +73,7 @@

import static org.finos.legend.engine.language.pure.compiler.toPureGraph.HelperModelBuilder.getElementFullPath;

public class DataSpaceCompilerExtension implements CompilerExtension, EmbeddedDataCompilerExtension, StoreProviderCompilerExtension
public class DataSpaceCompilerExtension implements CompilerExtension, EmbeddedDataCompilerHelper, StoreProviderCompilerHelper
{
static final MutableMap<String, Root_meta_pure_metamodel_dataSpace_DataSpace> dataSpacesIndex = Maps.mutable.empty();

Expand Down Expand Up @@ -289,6 +289,6 @@ private static List<EmbeddedData> getDataFromDataReferencePMCD(DataElementRefere
return ListIterate
.select(pureModelContextData.getElementsOfType(DataSpace.class), e -> dataElementReference.dataElement.path.equals(e.getPath()))
.collect(d -> Iterate.detect(d.executionContexts, e -> e.name.equals(d.defaultExecutionContext)).testData)
.collect(d -> EmbeddedDataCompilerExtension.getEmbeddedDataFromDataElement(d, pureModelContextData));
.collect(d -> EmbeddedDataCompilerHelper.getEmbeddedDataFromDataElement(d, pureModelContextData));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.eclipse.collections.impl.tuple.Tuples;
import org.eclipse.collections.impl.utility.Iterate;
import org.eclipse.collections.impl.utility.ListIterate;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.data.core.EmbeddedDataCompilerExtension;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.data.core.EmbeddedDataCompilerHelper;
import org.finos.legend.engine.protocol.pure.v1.model.context.PureModelContextData;
import org.finos.legend.engine.protocol.pure.v1.model.data.DataElementReference;
import org.finos.legend.engine.protocol.pure.v1.model.data.EmbeddedData;
Expand Down Expand Up @@ -62,7 +62,7 @@ protected static Pair<Runtime, List<Closeable>> getTestRuntimeAndClosableResourc
{
if (connectionTestData.data instanceof DataElementReference)
{
EmbeddedData embeddedData = EmbeddedDataCompilerExtension.getEmbeddedDataFromDataElement((DataElementReference) connectionTestData.data, pureModelContextData);
EmbeddedData embeddedData = EmbeddedDataCompilerHelper.getEmbeddedDataFromDataElement((DataElementReference) connectionTestData.data, pureModelContextData);
data.add(embeddedData);
}
else
Expand Down Expand Up @@ -96,7 +96,7 @@ protected static Pair<Runtime, List<Closeable>> getTestRuntimeAndClosableResourc
{
if (connectionTestData.data instanceof DataElementReference)
{
EmbeddedData d = EmbeddedDataCompilerExtension.getEmbeddedDataFromDataElement((DataElementReference) connectionTestData.data, pureModelContextData);
EmbeddedData d = EmbeddedDataCompilerHelper.getEmbeddedDataFromDataElement((DataElementReference) connectionTestData.data, pureModelContextData);
embeddedData.add(d);
}
else
Expand Down

0 comments on commit 3467f08

Please sign in to comment.