diff --git a/legend-engine-core/legend-engine-core-language-pure/legend-engine-language-pure-compiler/pom.xml b/legend-engine-core/legend-engine-core-language-pure/legend-engine-language-pure-compiler/pom.xml
index 5a8822e0f69..cec746cfad8 100644
--- a/legend-engine-core/legend-engine-core-language-pure/legend-engine-language-pure-compiler/pom.xml
+++ b/legend-engine-core/legend-engine-core-language-pure/legend-engine-language-pure-compiler/pom.xml
@@ -218,6 +218,11 @@
legend-pure-runtime-java-extension-functions-json
test
+
+ org.hamcrest
+ hamcrest-core
+ test
+
diff --git a/legend-engine-core/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/test/java/org/finos/legend/engine/language/pure/compiler/test/TestCompilationFromGrammar.java b/legend-engine-core/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/test/java/org/finos/legend/engine/language/pure/compiler/test/TestCompilationFromGrammar.java
index af1d0b18a53..a416cda9074 100644
--- a/legend-engine-core/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/test/java/org/finos/legend/engine/language/pure/compiler/test/TestCompilationFromGrammar.java
+++ b/legend-engine-core/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/test/java/org/finos/legend/engine/language/pure/compiler/test/TestCompilationFromGrammar.java
@@ -15,6 +15,9 @@
package org.finos.legend.engine.language.pure.compiler.test;
import com.fasterxml.jackson.databind.ObjectMapper;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
import org.eclipse.collections.api.tuple.Pair;
import org.eclipse.collections.impl.tuple.Tuples;
import org.finos.legend.engine.language.pure.compiler.Compiler;
@@ -25,13 +28,11 @@
import org.finos.legend.engine.shared.core.ObjectMapperFactory;
import org.finos.legend.engine.shared.core.deployment.DeploymentMode;
import org.finos.legend.engine.shared.core.operational.errorManagement.EngineException;
+import org.hamcrest.CoreMatchers;
+import org.hamcrest.MatcherAssert;
import org.junit.Assert;
import org.junit.Test;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-
public class TestCompilationFromGrammar
{
public abstract static class TestCompilationFromGrammarTestSuite
@@ -78,8 +79,7 @@ public static Pair test(String str, String expe
if (expectedWarnings != null)
{
- List warnings = pureModel.getWarnings().stream().map(Warning::buildPrettyWarningMessage).collect(Collectors.toList());
- Collections.sort(warnings);
+ List warnings = pureModel.getWarnings().stream().map(Warning::buildPrettyWarningMessage).sorted().collect(Collectors.toList());
Collections.sort(expectedWarnings);
Assert.assertEquals(expectedWarnings, warnings);
}
@@ -93,7 +93,8 @@ public static Pair test(String str, String expe
throw e;
}
Assert.assertNotNull("No source information provided in error", e.getSourceInformation());
- Assert.assertEquals(expectedErrorMsg, EngineException.buildPrettyErrorMessage(e.getMessage(), e.getSourceInformation(), e.getErrorType()));
+ MatcherAssert.assertThat(EngineException.buildPrettyErrorMessage(e.getMessage(), e.getSourceInformation(),
+ e.getErrorType()), CoreMatchers.startsWith(expectedErrorMsg));
return null;
}
catch (Exception e)
@@ -312,7 +313,7 @@ public void testCompilationCme()
"['includedDate', 'calendarAgg'])" +
"}");
}
-
+
@Test
public void testCompilationCw()
{
diff --git a/legend-engine-core/legend-engine-core-language-pure/legend-engine-language-pure-grammar-api/src/test/java/org/finos/legend/engine/language/pure/grammar/api/test/TestGrammarToJsonApi.java b/legend-engine-core/legend-engine-core-language-pure/legend-engine-language-pure-grammar-api/src/test/java/org/finos/legend/engine/language/pure/grammar/api/test/TestGrammarToJsonApi.java
index b378d567897..a059a7ad820 100644
--- a/legend-engine-core/legend-engine-core-language-pure/legend-engine-language-pure-grammar-api/src/test/java/org/finos/legend/engine/language/pure/grammar/api/test/TestGrammarToJsonApi.java
+++ b/legend-engine-core/legend-engine-core-language-pure/legend-engine-language-pure-grammar-api/src/test/java/org/finos/legend/engine/language/pure/grammar/api/test/TestGrammarToJsonApi.java
@@ -83,7 +83,7 @@ public void testLambdaParsingError()
@Test
public void testMixedParsingErrors()
{
- test("{\"code\": \"Class A {,\", \"isolatedLambdas\": {\"good\": \"|'good'\", \"bad\": \"|,\"}}", "{\"codeError\":{\"message\":\"Unexpected token ','\",\"sourceInformation\":{\"endColumn\":10,\"endLine\":1,\"sourceId\":\"\",\"startColumn\":10,\"startLine\":1}},\"isolatedLambdas\":{\"lambdaErrors\":{\"bad\":{\"message\":\"Unexpected token ','\",\"sourceInformation\":{\"endColumn\":2,\"endLine\":1,\"sourceId\":\"bad\",\"startColumn\":2,\"startLine\":1}}},\"lambdas\":{\"good\":{\"_type\":\"lambda\",\"body\":[{\"_type\":\"string\",\"sourceInformation\":{\"endColumn\":7,\"endLine\":1,\"sourceId\":\"good\",\"startColumn\":2,\"startLine\":1},\"value\":\"good\"}],\"parameters\":[],\"sourceInformation\":{\"endColumn\":7,\"endLine\":1,\"sourceId\":\"good\",\"startColumn\":1,\"startLine\":1}}}},\"renderStyle\":\"STANDARD\"}");
+ test("{\"code\": \"Class A {,\", \"isolatedLambdas\": {\"good\": \"|'good'\", \"bad\": \"|,\"}}", "{\"codeError\":{\"message\":\"Unexpected token ','. Valid alternatives: ['import', 'Class', 'Association', 'Profile', 'Enum', 'Measure', 'function', 'extends', 'stereotypes', 'tags', 'Error', 'Warn', 'native', 'projects', 'as', 'composite', 'shared', 'none', 'all', 'let', 'allVersions', 'allVersionsInRange', 'toBytes', '(', '<']\",\"sourceInformation\":{\"endColumn\":10,\"endLine\":1,\"sourceId\":\"\",\"startColumn\":10,\"startLine\":1}},\"isolatedLambdas\":{\"lambdaErrors\":{\"bad\":{\"message\":\"Unexpected token ','. Valid alternatives: ['import', 'Class', 'Association', 'Profile', 'Enum', 'Measure', 'function', 'extends', 'stereotypes', 'tags', 'Error', 'Warn', 'native', 'projects', 'as', 'composite', 'shared', 'none', 'all', 'let', 'allVersions', 'allVersionsInRange', 'toBytes', '!', '[', '(', '$', '^', '|', '@', '+', '-']\",\"sourceInformation\":{\"endColumn\":2,\"endLine\":1,\"sourceId\":\"bad\",\"startColumn\":2,\"startLine\":1}}},\"lambdas\":{\"good\":{\"_type\":\"lambda\",\"body\":[{\"_type\":\"string\",\"sourceInformation\":{\"endColumn\":7,\"endLine\":1,\"sourceId\":\"good\",\"startColumn\":2,\"startLine\":1},\"value\":\"good\"}],\"parameters\":[],\"sourceInformation\":{\"endColumn\":7,\"endLine\":1,\"sourceId\":\"good\",\"startColumn\":1,\"startLine\":1}}}},\"renderStyle\":\"STANDARD\"}");
}
@Test
diff --git a/legend-engine-core/legend-engine-core-language-pure/legend-engine-language-pure-grammar/pom.xml b/legend-engine-core/legend-engine-core-language-pure/legend-engine-language-pure-grammar/pom.xml
index b4313acdd1d..4e50e627e2c 100644
--- a/legend-engine-core/legend-engine-core-language-pure/legend-engine-language-pure-grammar/pom.xml
+++ b/legend-engine-core/legend-engine-core-language-pure/legend-engine-language-pure-grammar/pom.xml
@@ -172,6 +172,11 @@
junit
test
+
+ org.hamcrest
+ hamcrest-core
+ test
+
\ No newline at end of file
diff --git a/legend-engine-core/legend-engine-core-language-pure/legend-engine-language-pure-grammar/src/main/java/org/finos/legend/engine/language/pure/grammar/from/ParserErrorListener.java b/legend-engine-core/legend-engine-core-language-pure/legend-engine-language-pure-grammar/src/main/java/org/finos/legend/engine/language/pure/grammar/from/ParserErrorListener.java
index 83393076711..21793863c51 100644
--- a/legend-engine-core/legend-engine-core-language-pure/legend-engine-language-pure-grammar/src/main/java/org/finos/legend/engine/language/pure/grammar/from/ParserErrorListener.java
+++ b/legend-engine-core/legend-engine-core-language-pure/legend-engine-language-pure-grammar/src/main/java/org/finos/legend/engine/language/pure/grammar/from/ParserErrorListener.java
@@ -57,7 +57,7 @@ public void syntaxError(
{
if (e != null && e.getOffendingToken() != null && e instanceof InputMismatchException)
{
- List expectedSymbols = dereferenceTokens(e.getExpectedTokens().toList());
+ List expectedSymbols = dereferenceTokens(e.getExpectedTokens().toList(), recognizer.getVocabulary());
if (expectedSymbols.isEmpty())
{
msg = "Unexpected token '" + e.getOffendingToken().getText() + "'";
@@ -103,13 +103,11 @@ else if (e == null || e.getOffendingToken() == null)
charPositionInLine + 1 + (line == 1 ? this.walkerSourceInformation.getColumnOffset() : 0),
offendingToken.getLine() + this.walkerSourceInformation.getLineOffset(),
charPositionInLine + offendingToken.getText().length() + (line == 1 ? this.walkerSourceInformation.getColumnOffset() : 0));
- throw new EngineException(msg, sourceInformation, EngineErrorType.PARSER);
+ throw new EngineException(msg, sourceInformation, EngineErrorType.PARSER, e);
}
- protected List dereferenceTokens(List expectedTokens)
+ protected List dereferenceTokens(List expectedTokens, Vocabulary vocabulary)
{
- return vocabulary
- .>map(v -> ListIterate.collect(expectedTokens, v::getLiteralName).select(Objects::nonNull))
- .orElse(Collections.emptyList());
+ return ListIterate.collect(expectedTokens, vocabulary::getLiteralName).select(Objects::nonNull);
}
}
\ No newline at end of file
diff --git a/legend-engine-core/legend-engine-core-language-pure/legend-engine-language-pure-grammar/src/test/java/org/finos/legend/engine/language/pure/grammar/test/TestGrammarParser.java b/legend-engine-core/legend-engine-core-language-pure/legend-engine-language-pure-grammar/src/test/java/org/finos/legend/engine/language/pure/grammar/test/TestGrammarParser.java
index 84b3e68b55a..d3534abe020 100644
--- a/legend-engine-core/legend-engine-core-language-pure/legend-engine-language-pure-grammar/src/test/java/org/finos/legend/engine/language/pure/grammar/test/TestGrammarParser.java
+++ b/legend-engine-core/legend-engine-core-language-pure/legend-engine-language-pure-grammar/src/test/java/org/finos/legend/engine/language/pure/grammar/test/TestGrammarParser.java
@@ -28,6 +28,8 @@
import org.finos.legend.engine.shared.core.operational.errorManagement.EngineException;
import org.finos.legend.engine.shared.core.operational.logs.LogInfo;
import org.finos.legend.engine.shared.core.operational.logs.LoggingEventType;
+import org.hamcrest.CoreMatchers;
+import org.hamcrest.MatcherAssert;
import org.junit.Assert;
import org.junit.Test;
@@ -101,7 +103,8 @@ protected static void test(String val, String expectedErrorMsg)
{
LogInfo errorResponse = new LogInfo(null, LoggingEventType.PARSE_ERROR, e);
Assert.assertNotNull("No source information provided in error", errorResponse.sourceInformation);
- Assert.assertEquals(expectedErrorMsg, EngineException.buildPrettyErrorMessage(errorResponse.message, errorResponse.sourceInformation, EngineErrorType.PARSER));
+ MatcherAssert.assertThat(EngineException.buildPrettyErrorMessage(errorResponse.message, errorResponse.sourceInformation,
+ EngineErrorType.PARSER), CoreMatchers.startsWith(expectedErrorMsg));
}
}
}
diff --git a/legend-engine-core/legend-engine-core-language-pure/legend-engine-protocol-pure/src/main/java/org/finos/legend/engine/protocol/pure/v1/model/context/PackageableElementPointer.java b/legend-engine-core/legend-engine-core-language-pure/legend-engine-protocol-pure/src/main/java/org/finos/legend/engine/protocol/pure/v1/model/context/PackageableElementPointer.java
index 83cc92e27c9..dc356ad1bcb 100644
--- a/legend-engine-core/legend-engine-core-language-pure/legend-engine-protocol-pure/src/main/java/org/finos/legend/engine/protocol/pure/v1/model/context/PackageableElementPointer.java
+++ b/legend-engine-core/legend-engine-core-language-pure/legend-engine-protocol-pure/src/main/java/org/finos/legend/engine/protocol/pure/v1/model/context/PackageableElementPointer.java
@@ -14,7 +14,9 @@
package org.finos.legend.engine.protocol.pure.v1.model.context;
+import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
import org.finos.legend.engine.protocol.pure.v1.model.SourceInformation;
import java.util.Objects;
@@ -36,11 +38,20 @@ public PackageableElementPointer(PackageableElementType type, String path)
this.path = path;
}
+ @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
public PackageableElementPointer(String path)
{
this.path = path;
}
+ @JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
+ public PackageableElementPointer(@JsonProperty("type") PackageableElementType type, @JsonProperty("path") String path, @JsonProperty("sourceInformation") SourceInformation sourceInformation)
+ {
+ this.type = type;
+ this.path = path;
+ this.sourceInformation = sourceInformation;
+ }
+
@Override
public String toString()
{
diff --git a/legend-engine-core/legend-engine-core-language-pure/legend-engine-protocol-pure/src/main/java/org/finos/legend/engine/protocol/pure/v1/model/context/PackageableElementType.java b/legend-engine-core/legend-engine-core-language-pure/legend-engine-protocol-pure/src/main/java/org/finos/legend/engine/protocol/pure/v1/model/context/PackageableElementType.java
index 978cf34e88a..2e5ddb9f15f 100644
--- a/legend-engine-core/legend-engine-core-language-pure/legend-engine-protocol-pure/src/main/java/org/finos/legend/engine/protocol/pure/v1/model/context/PackageableElementType.java
+++ b/legend-engine-core/legend-engine-core-language-pure/legend-engine-protocol-pure/src/main/java/org/finos/legend/engine/protocol/pure/v1/model/context/PackageableElementType.java
@@ -21,6 +21,7 @@ public enum PackageableElementType
CLASS,
ASSOCIATION,
ENUMERATION,
+ FUNCTION,
STORE,
RUNTIME,
MAPPING,
diff --git a/legend-engine-core/legend-engine-core-language-pure/legend-engine-protocol-pure/src/test/java/org/finos/legend/engine/protocol/test/TestCompatibilityAndMigration.java b/legend-engine-core/legend-engine-core-language-pure/legend-engine-protocol-pure/src/test/java/org/finos/legend/engine/protocol/test/TestCompatibilityAndMigration.java
index 2b74f87ad19..189a3bab8ff 100644
--- a/legend-engine-core/legend-engine-core-language-pure/legend-engine-protocol-pure/src/test/java/org/finos/legend/engine/protocol/test/TestCompatibilityAndMigration.java
+++ b/legend-engine-core/legend-engine-core-language-pure/legend-engine-protocol-pure/src/test/java/org/finos/legend/engine/protocol/test/TestCompatibilityAndMigration.java
@@ -18,13 +18,15 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import net.javacrumbs.jsonunit.JsonAssert;
import org.finos.legend.engine.protocol.pure.v1.PureProtocolObjectMapperFactory;
+import org.finos.legend.engine.protocol.pure.v1.model.context.PackageableElementPointer;
import org.finos.legend.engine.protocol.pure.v1.model.context.PureModelContextData;
import org.junit.Assert;
import org.junit.Test;
public class TestCompatibilityAndMigration
{
- private static final ObjectMapper objectMapper = PureProtocolObjectMapperFactory.getNewObjectMapper();
+ private static final ObjectMapper objectMapper = PureProtocolObjectMapperFactory.getNewObjectMapper()
+ .setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
@Test
public void testStringValueSpecification() throws Exception
@@ -1201,10 +1203,21 @@ public void testModelStoreData() throws Exception
"}\n");
}
+ @Test
+ public void testPackageableElementPointerCompatibility() throws Exception
+ {
+ String asString = "\"abc::myPath::MyName\"";
+ String expected = "{\"path\":\"abc::myPath::MyName\"}";
+ PackageableElementPointer pointerFromStringConstructor = objectMapper.readValue(asString, PackageableElementPointer.class);
+ String json = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(pointerFromStringConstructor);
+ JsonAssert.assertJsonEquals(expected, json);
+ PackageableElementPointer expectedPointerFromObjectConstructor = objectMapper.readValue(expected, PackageableElementPointer.class);
+ Assert.assertEquals(expectedPointerFromObjectConstructor, pointerFromStringConstructor);
+ }
+
private void check(String input, String output) throws Exception
{
PureModelContextData context = objectMapper.readValue(input, PureModelContextData.class);
- objectMapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
String json = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(context);
JsonAssert.assertJsonEquals(output, json);
}
diff --git a/legend-engine-xts-bigqueryFunction/legend-engine-xt-bigqueryFunction-compiler/src/main/java/org/finos/legend/engine/language/bigqueryFunction/compiler/toPureGraph/BigQueryFunctionCompilerExtension.java b/legend-engine-xts-bigqueryFunction/legend-engine-xt-bigqueryFunction-compiler/src/main/java/org/finos/legend/engine/language/bigqueryFunction/compiler/toPureGraph/BigQueryFunctionCompilerExtension.java
index 50d127e75b1..af3d68c6d7f 100644
--- a/legend-engine-xts-bigqueryFunction/legend-engine-xt-bigqueryFunction-compiler/src/main/java/org/finos/legend/engine/language/bigqueryFunction/compiler/toPureGraph/BigQueryFunctionCompilerExtension.java
+++ b/legend-engine-xts-bigqueryFunction/legend-engine-xt-bigqueryFunction-compiler/src/main/java/org/finos/legend/engine/language/bigqueryFunction/compiler/toPureGraph/BigQueryFunctionCompilerExtension.java
@@ -58,7 +58,7 @@ public Root_meta_external_function_activator_bigQueryFunction_BigQueryFunction b
{
try
{
- PackageableFunction> func = (PackageableFunction>) context.resolvePackageableElement(FunctionDescriptor.functionDescriptorToId(bigQueryFunction.function), bigQueryFunction.sourceInformation);
+ PackageableFunction> func = (PackageableFunction>) context.resolvePackageableElement(FunctionDescriptor.functionDescriptorToId(bigQueryFunction.function.path), bigQueryFunction.sourceInformation);
return new Root_meta_external_function_activator_bigQueryFunction_BigQueryFunction_Impl(
bigQueryFunction.name,
null,
diff --git a/legend-engine-xts-bigqueryFunction/legend-engine-xt-bigqueryFunction-grammar/src/main/java/org/finos/legend/engine/language/bigqueryFunction/grammar/from/BigQueryFunctionTreeWalker.java b/legend-engine-xts-bigqueryFunction/legend-engine-xt-bigqueryFunction-grammar/src/main/java/org/finos/legend/engine/language/bigqueryFunction/grammar/from/BigQueryFunctionTreeWalker.java
index 306d4a91388..c8449c6ca78 100644
--- a/legend-engine-xts-bigqueryFunction/legend-engine-xt-bigqueryFunction-grammar/src/main/java/org/finos/legend/engine/language/bigqueryFunction/grammar/from/BigQueryFunctionTreeWalker.java
+++ b/legend-engine-xts-bigqueryFunction/legend-engine-xt-bigqueryFunction-grammar/src/main/java/org/finos/legend/engine/language/bigqueryFunction/grammar/from/BigQueryFunctionTreeWalker.java
@@ -21,7 +21,8 @@
import org.finos.legend.engine.language.pure.grammar.from.PureGrammarParserUtility;
import org.finos.legend.engine.language.pure.grammar.from.antlr4.BigQueryFunctionParserGrammar;
import org.finos.legend.engine.protocol.bigqueryFunction.metamodel.BigQueryFunctionDeploymentConfiguration;
-import org.finos.legend.engine.protocol.functionActivator.metamodel.DeploymentConfiguration;
+import org.finos.legend.engine.protocol.pure.v1.model.context.PackageableElementPointer;
+import org.finos.legend.engine.protocol.pure.v1.model.context.PackageableElementType;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.PackageableElement;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.connection.ConnectionPointer;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.StereotypePtr;
@@ -84,7 +85,12 @@ private BigQueryFunction visitBigQueryFunction(BigQueryFunctionParserGrammar.Big
BigQueryFunctionParserGrammar.FunctionNameContext functionNameContext = PureGrammarParserUtility.validateAndExtractRequiredField(ctx.functionName(), "functionName", bigQueryFunction.sourceInformation);
bigQueryFunction.functionName = PureGrammarParserUtility.fromGrammarString(functionNameContext.STRING().getText(), true);
BigQueryFunctionParserGrammar.FunctionContext functionContext = PureGrammarParserUtility.validateAndExtractRequiredField(ctx.function(), "function", bigQueryFunction.sourceInformation);
- bigQueryFunction.function = functionContext.functionIdentifier().getText();
+ bigQueryFunction.function = new PackageableElementPointer(
+ PackageableElementType.FUNCTION,
+ functionContext.functionIdentifier().getText(),
+ walkerSourceInformation.getSourceInformation(functionContext.functionIdentifier())
+ );
+
BigQueryFunctionParserGrammar.OwnerContext ownerContext = PureGrammarParserUtility.validateAndExtractOptionalField(ctx.owner(), "owner", bigQueryFunction.sourceInformation);
if (ownerContext != null)
{
diff --git a/legend-engine-xts-bigqueryFunction/legend-engine-xt-bigqueryFunction-grammar/src/main/java/org/finos/legend/engine/language/bigqueryFunction/grammar/to/BigQueryFunctionGrammarComposer.java b/legend-engine-xts-bigqueryFunction/legend-engine-xt-bigqueryFunction-grammar/src/main/java/org/finos/legend/engine/language/bigqueryFunction/grammar/to/BigQueryFunctionGrammarComposer.java
index 7c2f5ef1d8a..cdfffb9616e 100644
--- a/legend-engine-xts-bigqueryFunction/legend-engine-xt-bigqueryFunction-grammar/src/main/java/org/finos/legend/engine/language/bigqueryFunction/grammar/to/BigQueryFunctionGrammarComposer.java
+++ b/legend-engine-xts-bigqueryFunction/legend-engine-xt-bigqueryFunction-grammar/src/main/java/org/finos/legend/engine/language/bigqueryFunction/grammar/to/BigQueryFunctionGrammarComposer.java
@@ -49,7 +49,7 @@ private static String renderBigQueryFunction(BigQueryFunction app)
return "BigQueryFunction " + renderAnnotations(app.stereotypes, app.taggedValues) + packageName + "\n" +
"{\n" +
" functionName : '" + app.functionName + "';\n" +
- " function : " + app.function + ";\n" +
+ " function : " + app.function.path + ";\n" +
(app.owner == null ? "" : " owner : '" + app.owner + "';\n") +
(app.description == null ? "" : " description : '" + app.description + "';\n") +
(app.activationConfiguration == null ? "" : " activationConfiguration : " + ((BigQueryFunctionDeploymentConfiguration) app.activationConfiguration).activationConnection.connection + ";\n") +
diff --git a/legend-engine-xts-functionActivator/legend-engine-xt-functionActivator-protocol/src/main/java/org/finos/legend/engine/protocol/functionActivator/metamodel/FunctionActivator.java b/legend-engine-xts-functionActivator/legend-engine-xt-functionActivator-protocol/src/main/java/org/finos/legend/engine/protocol/functionActivator/metamodel/FunctionActivator.java
index 8d90c71b066..1e1c45f8943 100644
--- a/legend-engine-xts-functionActivator/legend-engine-xt-functionActivator-protocol/src/main/java/org/finos/legend/engine/protocol/functionActivator/metamodel/FunctionActivator.java
+++ b/legend-engine-xts-functionActivator/legend-engine-xt-functionActivator-protocol/src/main/java/org/finos/legend/engine/protocol/functionActivator/metamodel/FunctionActivator.java
@@ -14,6 +14,7 @@
package org.finos.legend.engine.protocol.functionActivator.metamodel;
+import org.finos.legend.engine.protocol.pure.v1.model.context.PackageableElementPointer;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.PackageableElement;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.StereotypePtr;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.TaggedValue;
@@ -28,6 +29,6 @@ public abstract class FunctionActivator extends PackageableElement
{
public List stereotypes = Collections.emptyList();
public List taggedValues = Collections.emptyList();
- public String function;
+ public PackageableElementPointer function;
public DeploymentConfiguration activationConfiguration;
}
diff --git a/legend-engine-xts-hostedService/legend-engine-xt-hostedService-compiler/src/main/java/org/finos/legend/engine/language/hostedService/compiler/toPureGraph/HostedServiceCompilerExtension.java b/legend-engine-xts-hostedService/legend-engine-xt-hostedService-compiler/src/main/java/org/finos/legend/engine/language/hostedService/compiler/toPureGraph/HostedServiceCompilerExtension.java
index c25ca1a6ec2..495f2d4f83e 100644
--- a/legend-engine-xts-hostedService/legend-engine-xt-hostedService-compiler/src/main/java/org/finos/legend/engine/language/hostedService/compiler/toPureGraph/HostedServiceCompilerExtension.java
+++ b/legend-engine-xts-hostedService/legend-engine-xt-hostedService-compiler/src/main/java/org/finos/legend/engine/language/hostedService/compiler/toPureGraph/HostedServiceCompilerExtension.java
@@ -88,7 +88,7 @@ public Root_meta_external_function_activator_hostedService_HostedService buildHo
{
try
{
- PackageableFunction> func = (PackageableFunction>) context.resolvePackageableElement(FunctionDescriptor.functionDescriptorToId(app.function), app.sourceInformation);
+ PackageableFunction> func = (PackageableFunction>) context.resolvePackageableElement(FunctionDescriptor.functionDescriptorToId(app.function.path), app.sourceInformation);
return new Root_meta_external_function_activator_hostedService_HostedService_Impl(
app.name,
null,
diff --git a/legend-engine-xts-hostedService/legend-engine-xt-hostedService-grammar/src/main/java/org/finos/legend/engine/language/hostedService/grammar/from/HostedServiceTreeWalker.java b/legend-engine-xts-hostedService/legend-engine-xt-hostedService-grammar/src/main/java/org/finos/legend/engine/language/hostedService/grammar/from/HostedServiceTreeWalker.java
index 6465d2a8c3d..28eb8a08aad 100644
--- a/legend-engine-xts-hostedService/legend-engine-xt-hostedService-grammar/src/main/java/org/finos/legend/engine/language/hostedService/grammar/from/HostedServiceTreeWalker.java
+++ b/legend-engine-xts-hostedService/legend-engine-xt-hostedService-grammar/src/main/java/org/finos/legend/engine/language/hostedService/grammar/from/HostedServiceTreeWalker.java
@@ -14,6 +14,9 @@
package org.finos.legend.engine.language.hostedService.grammar.from;
+import java.util.Collections;
+import java.util.List;
+import java.util.function.Consumer;
import org.antlr.v4.runtime.CharStream;
import org.eclipse.collections.impl.factory.Lists;
import org.eclipse.collections.impl.utility.ListIterate;
@@ -21,31 +24,26 @@
import org.finos.legend.engine.language.pure.grammar.from.PureGrammarParserContext;
import org.finos.legend.engine.language.pure.grammar.from.PureGrammarParserUtility;
import org.finos.legend.engine.language.pure.grammar.from.antlr4.HostedServiceParserGrammar;
-import org.finos.legend.engine.language.pure.grammar.from.antlr4.ServiceParserGrammar;
import org.finos.legend.engine.language.pure.grammar.from.runtime.RuntimeParser;
-import org.finos.legend.engine.protocol.functionActivator.metamodel.DeploymentStage;
+import org.finos.legend.engine.protocol.hostedService.metamodel.HostedService;
import org.finos.legend.engine.protocol.hostedService.metamodel.HostedServiceDeploymentConfiguration;
import org.finos.legend.engine.protocol.hostedService.metamodel.control.Deployment;
import org.finos.legend.engine.protocol.hostedService.metamodel.control.UserList;
import org.finos.legend.engine.protocol.pure.v1.model.SourceInformation;
+import org.finos.legend.engine.protocol.pure.v1.model.context.PackageableElementPointer;
+import org.finos.legend.engine.protocol.pure.v1.model.context.PackageableElementType;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.PackageableElement;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.StereotypePtr;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.TagPtr;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.TaggedValue;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.runtime.Runtime;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.runtime.RuntimePointer;
-import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.section.DefaultCodeSection;
-import org.finos.legend.engine.protocol.hostedService.metamodel.HostedService;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.section.ImportAwareCodeSection;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.ExecutionEnvironmentInstance;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.MultiExecutionParameters;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.service.SingleExecutionParameters;
import org.finos.legend.engine.shared.core.operational.errorManagement.EngineException;
-import java.util.Collections;
-import java.util.List;
-import java.util.function.Consumer;
-
public class HostedServiceTreeWalker
{
private final CharStream input;
@@ -92,7 +90,11 @@ private HostedService visitHostedService(HostedServiceParserGrammar.ServiceConte
HostedServiceParserGrammar.ServicePatternContext patternContext = PureGrammarParserUtility.validateAndExtractRequiredField(ctx.servicePattern(), "pattern", hostedService.sourceInformation);
hostedService.pattern = PureGrammarParserUtility.fromGrammarString(patternContext.STRING().getText(), true);
HostedServiceParserGrammar.ServiceFuncContext functionContext = PureGrammarParserUtility.validateAndExtractRequiredField(ctx.serviceFunc(), "function", hostedService.sourceInformation);
- hostedService.function = functionContext.functionIdentifier().getText();
+ hostedService.function = new PackageableElementPointer(
+ PackageableElementType.FUNCTION,
+ functionContext.functionIdentifier().getText(),
+ walkerSourceInformation.getSourceInformation(functionContext.functionIdentifier())
+ );
HostedServiceParserGrammar.ServiceOwnershipContext ownerContext = PureGrammarParserUtility.validateAndExtractOptionalField(ctx.serviceOwnership(), "owners", hostedService.sourceInformation);
if (ownerContext != null)
{
diff --git a/legend-engine-xts-hostedService/legend-engine-xt-hostedService-grammar/src/main/java/org/finos/legend/engine/language/hostedService/grammar/to/HostedServiceGrammarComposer.java b/legend-engine-xts-hostedService/legend-engine-xt-hostedService-grammar/src/main/java/org/finos/legend/engine/language/hostedService/grammar/to/HostedServiceGrammarComposer.java
index 2b2285a0a63..6006c0db268 100644
--- a/legend-engine-xts-hostedService/legend-engine-xt-hostedService-grammar/src/main/java/org/finos/legend/engine/language/hostedService/grammar/to/HostedServiceGrammarComposer.java
+++ b/legend-engine-xts-hostedService/legend-engine-xt-hostedService-grammar/src/main/java/org/finos/legend/engine/language/hostedService/grammar/to/HostedServiceGrammarComposer.java
@@ -57,7 +57,7 @@ private static String renderHostedService(HostedService app)
"{\n" +
" pattern : " + PureGrammarComposerUtility.convertString(app.pattern,true) + ";\n" +
" ownership : " + renderServiceOwner(app.ownership) +
- " function : " + app.function + ";\n" +
+ " function : " + app.function.path + ";\n" +
(app.documentation == null ? "" : " documentation : '" + app.documentation + "';\n") +
" autoActivateUpdates : " + app.autoActivateUpdates + ";\n" +
"}";
diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-api/src/test/java/org.finos.legend.engine.language.pure.grammar.api.relationalOperationElement.test/TestRelationalOperationElementApi.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-api/src/test/java/org.finos.legend.engine.language.pure.grammar.api.relationalOperationElement.test/TestRelationalOperationElementApi.java
index a0a2efcf70c..1c82eb4e140 100644
--- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-api/src/test/java/org.finos.legend.engine.language.pure.grammar.api.relationalOperationElement.test/TestRelationalOperationElementApi.java
+++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-api/src/test/java/org.finos.legend.engine.language.pure.grammar.api.relationalOperationElement.test/TestRelationalOperationElementApi.java
@@ -42,7 +42,7 @@ public void testSimple()
@Test
public void testSimpleError()
{
- testError("add(1,", "Unexpected token ''", new SourceInformation("", 1, 7, 1, 11));
+ testError("add(1,", "Unexpected token ''. Valid alternatives: ['Database', 'include', 'Table', 'Schema', 'View', 'Filter', 'MultiGrainFilter', 'Join', '{target}', 'and', 'or', 'milestoning', 'business', 'BUS_FROM', 'BUS_THRU', 'THRU_IS_INCLUSIVE', 'BUS_SNAPSHOT_DATE', 'processing', 'PROCESSING_IN', 'PROCESSING_OUT', 'OUT_IS_INCLUSIVE', 'INFINITY_DATE', 'AssociationMapping', 'EnumerationMapping', 'Otherwise', 'Inline', 'Binding', 'scope', '[', '(', '@']", new SourceInformation("", 1, 7, 1, 11));
}
@Test
@@ -58,7 +58,7 @@ public void testBatchError()
testBatchError(createBatchInput(Tuples.pair("1", "add(1"),
Tuples.pair("2", "'4'")),
createExpectedBatchResult(Tuples.pair("1",
- "{\"message\":\"Unexpected token ''\",\"sourceInformation\":{\"endColumn\":10,\"endLine\":1,\"sourceId\":\"\",\"startColumn\":6,\"startLine\":1}}"),
+ "{\"message\":\"Unexpected token ''. Valid alternatives: [',', ')']\",\"sourceInformation\":{\"endColumn\":10,\"endLine\":1,\"sourceId\":\"\",\"startColumn\":6,\"startLine\":1}}"),
Tuples.pair("2", "'4'"))
);
}
diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/pom.xml
index b8d20853566..3c62dcf1488 100644
--- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/pom.xml
+++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/pom.xml
@@ -244,6 +244,11 @@
legend-engine-testable
test
+
+ org.hamcrest
+ hamcrest-core
+ test
+
diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/src/test/java/org/finos/legend/engine/language/pure/grammar/test/TestRelationalOperationElementGrammarRoundtrip.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/src/test/java/org/finos/legend/engine/language/pure/grammar/test/TestRelationalOperationElementGrammarRoundtrip.java
index 94adb39e60e..dd388d00e7b 100644
--- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/src/test/java/org/finos/legend/engine/language/pure/grammar/test/TestRelationalOperationElementGrammarRoundtrip.java
+++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/src/test/java/org/finos/legend/engine/language/pure/grammar/test/TestRelationalOperationElementGrammarRoundtrip.java
@@ -23,6 +23,8 @@
import org.finos.legend.engine.shared.core.operational.errorManagement.EngineException;
import org.finos.legend.engine.shared.core.operational.logs.LogInfo;
import org.finos.legend.engine.shared.core.operational.logs.LoggingEventType;
+import org.hamcrest.CoreMatchers;
+import org.hamcrest.MatcherAssert;
import org.junit.Assert;
import org.junit.Test;
@@ -47,7 +49,8 @@ protected static void test(String val, String expectedErrorMsg)
{
LogInfo errorResponse = new LogInfo(null, LoggingEventType.PARSE_ERROR, e);
Assert.assertNotNull("No source information provided in error", errorResponse.sourceInformation);
- Assert.assertEquals(expectedErrorMsg, EngineException.buildPrettyErrorMessage(errorResponse.message, errorResponse.sourceInformation, EngineErrorType.PARSER));
+ MatcherAssert.assertThat(EngineException.buildPrettyErrorMessage(errorResponse.message, errorResponse.sourceInformation, EngineErrorType.PARSER),
+ CoreMatchers.startsWith(expectedErrorMsg));
}
String renderedOperation = RelationalGrammarComposerExtension.renderRelationalOperationElement(operation);
diff --git a/legend-engine-xts-snowflakeApp/legend-engine-xt-snowflakeApp-compiler/src/main/java/org/finos/legend/engine/language/snowflakeApp/compiler/toPureGraph/SnowflakeAppCompilerExtension.java b/legend-engine-xts-snowflakeApp/legend-engine-xt-snowflakeApp-compiler/src/main/java/org/finos/legend/engine/language/snowflakeApp/compiler/toPureGraph/SnowflakeAppCompilerExtension.java
index 9b29beeedd9..da0d044e18c 100644
--- a/legend-engine-xts-snowflakeApp/legend-engine-xt-snowflakeApp-compiler/src/main/java/org/finos/legend/engine/language/snowflakeApp/compiler/toPureGraph/SnowflakeAppCompilerExtension.java
+++ b/legend-engine-xts-snowflakeApp/legend-engine-xt-snowflakeApp-compiler/src/main/java/org/finos/legend/engine/language/snowflakeApp/compiler/toPureGraph/SnowflakeAppCompilerExtension.java
@@ -53,7 +53,7 @@ public Root_meta_external_function_activator_snowflakeApp_SnowflakeApp buildSnow
{
try
{
- PackageableFunction> func = (PackageableFunction>) context.resolvePackageableElement(FunctionDescriptor.functionDescriptorToId(app.function), app.sourceInformation);
+ PackageableFunction> func = (PackageableFunction>) context.resolvePackageableElement(FunctionDescriptor.functionDescriptorToId(app.function.path), app.sourceInformation);
return new Root_meta_external_function_activator_snowflakeApp_SnowflakeApp_Impl(
app.name,
null,
diff --git a/legend-engine-xts-snowflakeApp/legend-engine-xt-snowflakeApp-grammar/src/main/java/org/finos/legend/engine/language/snowflakeApp/grammar/from/SnowflakeAppTreeWalker.java b/legend-engine-xts-snowflakeApp/legend-engine-xt-snowflakeApp-grammar/src/main/java/org/finos/legend/engine/language/snowflakeApp/grammar/from/SnowflakeAppTreeWalker.java
index 61b72fae5fb..a733f04b428 100644
--- a/legend-engine-xts-snowflakeApp/legend-engine-xt-snowflakeApp-grammar/src/main/java/org/finos/legend/engine/language/snowflakeApp/grammar/from/SnowflakeAppTreeWalker.java
+++ b/legend-engine-xts-snowflakeApp/legend-engine-xt-snowflakeApp-grammar/src/main/java/org/finos/legend/engine/language/snowflakeApp/grammar/from/SnowflakeAppTreeWalker.java
@@ -20,8 +20,9 @@
import org.finos.legend.engine.language.pure.grammar.from.ParseTreeWalkerSourceInformation;
import org.finos.legend.engine.language.pure.grammar.from.PureGrammarParserUtility;
import org.finos.legend.engine.language.pure.grammar.from.antlr4.SnowflakeAppParserGrammar;
-import org.finos.legend.engine.protocol.functionActivator.metamodel.DeploymentStage;
import org.finos.legend.engine.protocol.pure.v1.model.context.EngineErrorType;
+import org.finos.legend.engine.protocol.pure.v1.model.context.PackageableElementPointer;
+import org.finos.legend.engine.protocol.pure.v1.model.context.PackageableElementType;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.PackageableElement;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.connection.ConnectionPointer;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.domain.StereotypePtr;
@@ -72,7 +73,11 @@ private SnowflakeApp visitSnowflakeApp(SnowflakeAppParserGrammar.SnowflakeAppCon
SnowflakeAppParserGrammar.ApplicationNameContext applicationNameContext = PureGrammarParserUtility.validateAndExtractRequiredField(ctx.applicationName(), "applicationName", snowflakeApp.sourceInformation);
snowflakeApp.applicationName = PureGrammarParserUtility.fromGrammarString(applicationNameContext.STRING().getText(), true);
SnowflakeAppParserGrammar.FunctionContext functionContext = PureGrammarParserUtility.validateAndExtractRequiredField(ctx.function(), "function", snowflakeApp.sourceInformation);
- snowflakeApp.function = functionContext.functionIdentifier().getText();
+ snowflakeApp.function = new PackageableElementPointer(
+ PackageableElementType.FUNCTION,
+ functionContext.functionIdentifier().getText(),
+ walkerSourceInformation.getSourceInformation(functionContext.functionIdentifier())
+ );
SnowflakeAppParserGrammar.OwnerContext ownerContext = PureGrammarParserUtility.validateAndExtractOptionalField(ctx.owner(), "owner", snowflakeApp.sourceInformation);
if (ownerContext != null)
{
diff --git a/legend-engine-xts-snowflakeApp/legend-engine-xt-snowflakeApp-grammar/src/main/java/org/finos/legend/engine/language/snowflakeApp/grammar/to/SnowflakeAppGrammarComposer.java b/legend-engine-xts-snowflakeApp/legend-engine-xt-snowflakeApp-grammar/src/main/java/org/finos/legend/engine/language/snowflakeApp/grammar/to/SnowflakeAppGrammarComposer.java
index d8c4ede601d..4d7ece0c413 100644
--- a/legend-engine-xts-snowflakeApp/legend-engine-xt-snowflakeApp-grammar/src/main/java/org/finos/legend/engine/language/snowflakeApp/grammar/to/SnowflakeAppGrammarComposer.java
+++ b/legend-engine-xts-snowflakeApp/legend-engine-xt-snowflakeApp-grammar/src/main/java/org/finos/legend/engine/language/snowflakeApp/grammar/to/SnowflakeAppGrammarComposer.java
@@ -51,7 +51,7 @@ private static String renderSnowflakeApp(SnowflakeApp app)
return "SnowflakeApp " + renderAnnotations(app.stereotypes, app.taggedValues) + packageName + "\n" +
"{\n" +
" applicationName : '" + app.applicationName + "';\n" +
- " function : " + app.function + ";\n" +
+ " function : " + app.function.path + ";\n" +
(app.owner == null ? "" : " owner : '" + app.owner + "';\n") +
(app.description == null ? "" : " description : '" + app.description + "';\n") +
(app.type == null ? "" : " type : " + app.type.name() + ";\n") +