diff --git a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-grammar-integration/src/main/java/org/finos/legend/engine/language/pure/grammar/integration/connection/MongoDBConnectionParseTreeWalker.java b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-grammar-integration/src/main/java/org/finos/legend/engine/language/pure/grammar/integration/connection/MongoDBConnectionParseTreeWalker.java index 9b468941432..d3b8032020c 100644 --- a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-grammar-integration/src/main/java/org/finos/legend/engine/language/pure/grammar/integration/connection/MongoDBConnectionParseTreeWalker.java +++ b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-grammar-integration/src/main/java/org/finos/legend/engine/language/pure/grammar/integration/connection/MongoDBConnectionParseTreeWalker.java @@ -42,19 +42,14 @@ public MongoDBConnectionParseTreeWalker(ParseTreeWalkerSourceInformation walkerS public void visitMongoDBConnectionValue(MongoDBConnectionParserGrammar.DefinitionContext ctx, MongoDBConnection connectionValue, boolean isEmbedded) { // store (optional if the store is provided by embedding context, if not provided, it is required) - MongoDBConnectionParserGrammar.ConnectionStoreContext connectionStoreContext = PureGrammarParserUtility.validateAndExtractRequiredField(ctx.connectionStore(), "store", connectionValue.sourceInformation); + MongoDBConnectionParserGrammar.ConnectionStoreContext connectionStoreContext = PureGrammarParserUtility.validateAndExtractOptionalField(ctx.connectionStore(), "store", connectionValue.sourceInformation); if (connectionStoreContext != null) { connectionValue.element = PureGrammarParserUtility.fromQualifiedName(connectionStoreContext.qualifiedName().packagePath() == null ? Collections.emptyList() : connectionStoreContext.qualifiedName().packagePath().identifier(), connectionStoreContext.qualifiedName().identifier()); connectionValue.elementSourceInformation = this.walkerSourceInformation.getSourceInformation(connectionStoreContext.qualifiedName()); - connectionValue.type = DatabaseType.MongoDb; - } - else if (!isEmbedded) - { - // Copied from service store, do we need this?? - PureGrammarParserUtility.validateAndExtractRequiredField(ctx.connectionStore(), "store", connectionValue.sourceInformation); } // database type + connectionValue.type = DatabaseType.MongoDb; MongoDBDatasourceSpecification dsSpecification = getMongoDBDatasourceSpecification(ctx, connectionValue); connectionValue.dataSourceSpecification = dsSpecification; diff --git a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-grammar-integration/src/test/java/org/finos/legend/engine/language/pure/grammar/integration/TestMongoDBConnectionCompiler.java b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-grammar-integration/src/test/java/org/finos/legend/engine/language/pure/grammar/integration/TestMongoDBConnectionCompiler.java index 4899126013e..c2e61c3c0ca 100644 --- a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-grammar-integration/src/test/java/org/finos/legend/engine/language/pure/grammar/integration/TestMongoDBConnectionCompiler.java +++ b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-grammar-integration/src/test/java/org/finos/legend/engine/language/pure/grammar/integration/TestMongoDBConnectionCompiler.java @@ -28,7 +28,6 @@ protected String getDuplicatedElementTestCode() "MongoDBConnection test::mongodb::connection" + "{\n" + " database: legend_db;\n" + - " store: mongo::test::db;\n" + " serverURLs: [localhost:27071];\n" + " authentication: # UserPassword {\n" + " username: 'mongo_ro';\n" + @@ -47,7 +46,7 @@ protected String getDuplicatedElementTestCode() @Override protected String getDuplicatedElementTestExpectedErrorMessage() { - return "COMPILATION error at [16:1-18:1]: Duplicated element 'test::mongodb::connection'"; + return "COMPILATION error at [15:1-17:1]: Duplicated element 'test::mongodb::connection'"; } @Test @@ -60,7 +59,6 @@ public void testMongoDBConnectionDefinitionv1() "MongoDBConnection test::testConnection\n" + "{\n" + " database: legend_db;\n" + - " store: meta::external::store::mongodb::showcase::store::PersonDatabase;\n" + " serverURLs: [localhost:27071];\n" + " authentication: # UserPassword {\n" + " username: 'mongo_ro';\n" + diff --git a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-grammar-integration/src/test/java/org/finos/legend/engine/language/pure/grammar/integration/TestMongoDBConnectionGrammarParser.java b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-grammar-integration/src/test/java/org/finos/legend/engine/language/pure/grammar/integration/TestMongoDBConnectionGrammarParser.java index a2b236777d1..e02bd27b11d 100644 --- a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-grammar-integration/src/test/java/org/finos/legend/engine/language/pure/grammar/integration/TestMongoDBConnectionGrammarParser.java +++ b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-grammar-integration/src/test/java/org/finos/legend/engine/language/pure/grammar/integration/TestMongoDBConnectionGrammarParser.java @@ -37,7 +37,6 @@ public String getParserGrammarIdentifierInclusionTestCode(List keywords) "MongoDBConnection " + ListAdapter.adapt(keywords).makeString("::") + "\n" + "{\n" + " database: legend_db;\n" + - " store: mongo::test::db;\n" + " serverURLs: [localhost:27071];\n" + " authentication: # UserPassword {\n" + " username: 'mongo_ro';\n" + diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/src/main/java/org/finos/legend/engine/language/pure/grammar/from/RelationalDatabaseConnectionParseTreeWalker.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/src/main/java/org/finos/legend/engine/language/pure/grammar/from/RelationalDatabaseConnectionParseTreeWalker.java index d14fe27502a..848debb5114 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/src/main/java/org/finos/legend/engine/language/pure/grammar/from/RelationalDatabaseConnectionParseTreeWalker.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-grammar/src/main/java/org/finos/legend/engine/language/pure/grammar/from/RelationalDatabaseConnectionParseTreeWalker.java @@ -50,11 +50,6 @@ public void visitRelationalDatabaseConnectionValue(RelationalDatabaseConnectionP connectionValue.element = PureGrammarParserUtility.fromQualifiedName(storeContext.qualifiedName().packagePath() == null ? Collections.emptyList() : storeContext.qualifiedName().packagePath().identifier(), storeContext.qualifiedName().identifier()); connectionValue.elementSourceInformation = this.walkerSourceInformation.getSourceInformation(storeContext.qualifiedName()); } - else if (!isEmbedded) - { - // non-embedded connection requires store - PureGrammarParserUtility.validateAndExtractRequiredField(ctx.connectionStore(), "store", connectionValue.sourceInformation); - } // database type RelationalDatabaseConnectionParserGrammar.DbTypeContext dbTypeCtx = PureGrammarParserUtility.validateAndExtractRequiredField(ctx.dbType(), "type", connectionValue.sourceInformation); try 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/compiler/test/TestRelationalCompilationFromGrammar.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/compiler/test/TestRelationalCompilationFromGrammar.java index 2278dfbd4f8..aaf0ccca908 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/compiler/test/TestRelationalCompilationFromGrammar.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/compiler/test/TestRelationalCompilationFromGrammar.java @@ -2170,7 +2170,6 @@ public void testForMultipleRelationalConnections() "###Connection\n" + "RelationalDatabaseConnection relational::graphFetch::RelationalConnection\n" + "{\n" + - " store: relational::graphFetch::dbInc;\n" + " type: H2;\n" + " specification: Static\n" + " {\n" + @@ -2225,7 +2224,7 @@ public void testForMultipleRelationalConnections() " connection_1: relational::graphFetch::OneMappingConnection\n" + " ]\n" + " ];\n" + - "}\n", "COMPILATION error at [90:1-108:1]: Found 2 connections against store [dbInc] under a single runtime."); + "}\n", "COMPILATION error at [89:1-107:1]: Found 2 connections against store [dbInc] under a single runtime."); } @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/TestRelationalConnectionGrammarParser.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/TestRelationalConnectionGrammarParser.java index 717141de685..0decfd55cbf 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/TestRelationalConnectionGrammarParser.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/TestRelationalConnectionGrammarParser.java @@ -60,7 +60,7 @@ public void testRelationalDatabaseConnection() test("###Connection\n" + "RelationalDatabaseConnection meta::mySimpleConnection\n" + "{\n" + - "}\n\n", "PARSER error at [2:1-4:1]: Field 'store' is required"); + "}\n\n", "PARSER error at [2:1-4:1]: Field 'type' is required"); test("###Connection\n" + "RelationalDatabaseConnection meta::mySimpleConnection\n" + "{\n" +