From c88ed400c7cbb6c19a53fc068303da2b838bbe8d Mon Sep 17 00:00:00 2001 From: Thisaru Guruge Date: Mon, 15 Apr 2024 13:38:50 +0530 Subject: [PATCH 1/3] [Automated] Update the toml files --- ballerina/Ballerina.toml | 6 +++--- ballerina/Dependencies.toml | 35 +++++++++++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index 43f0a37..40ce376 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -2,7 +2,7 @@ distribution = "2201.7.0" org = "ballerinax" name = "mongodb" -version = "5.0.0" +version = "5.0.1" license= ["Apache-2.0"] authors = ["Ballerina"] keywords = ["IT Operations/Databases", "Cost/Freemium"] @@ -15,8 +15,8 @@ graalvmCompatible = true [[platform.java17.dependency]] groupId = "io.ballerina.lib" artifactId = "mongodb-native" -version = "5.0.0" -path = "../native/build/libs/mongodb-native-5.0.0.jar" +version = "5.0.1-SNAPSHOT" +path = "../native/build/libs/mongodb-native-5.0.1-SNAPSHOT.jar" [[platform.java17.dependency]] groupId = "org.mongodb" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index 52be793..3599598 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -5,12 +5,12 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.8.6" +distribution-version = "2201.9.0-20240415-023600-e76d71bd" [[package]] org = "ballerina" name = "crypto" -version = "2.5.0" +version = "2.7.0" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "time"} @@ -36,6 +36,26 @@ modules = [ {org = "ballerina", packageName = "jballerina.java", moduleName = "jballerina.java"} ] +[[package]] +org = "ballerina" +name = "lang.__internal" +version = "0.0.0" +scope = "testOnly" +dependencies = [ + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.object"} +] + +[[package]] +org = "ballerina" +name = "lang.array" +version = "0.0.0" +scope = "testOnly" +dependencies = [ + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.__internal"} +] + [[package]] org = "ballerina" name = "lang.error" @@ -45,6 +65,12 @@ dependencies = [ {org = "ballerina", name = "jballerina.java"} ] +[[package]] +org = "ballerina" +name = "lang.object" +version = "0.0.0" +scope = "testOnly" + [[package]] org = "ballerina" name = "lang.value" @@ -70,7 +96,7 @@ modules = [ [[package]] org = "ballerina" name = "observe" -version = "1.2.2" +version = "1.2.3" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] @@ -82,6 +108,7 @@ version = "0.0.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.array"}, {org = "ballerina", name = "lang.error"} ] modules = [ @@ -99,7 +126,7 @@ dependencies = [ [[package]] org = "ballerinax" name = "mongodb" -version = "5.0.0" +version = "5.0.1" dependencies = [ {org = "ballerina", name = "crypto"}, {org = "ballerina", name = "jballerina.java"}, From deb2485ccfe99938db76a8bbf17e498103d777dd Mon Sep 17 00:00:00 2001 From: Thisaru Guruge Date: Mon, 15 Apr 2024 13:41:15 +0530 Subject: [PATCH 2/3] [Automated] Update the toml files --- ballerina/Dependencies.toml | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index 3599598..5f447de 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -5,12 +5,12 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.9.0-20240415-023600-e76d71bd" +distribution-version = "2201.8.6" [[package]] org = "ballerina" name = "crypto" -version = "2.7.0" +version = "2.6.2" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "time"} @@ -36,26 +36,6 @@ modules = [ {org = "ballerina", packageName = "jballerina.java", moduleName = "jballerina.java"} ] -[[package]] -org = "ballerina" -name = "lang.__internal" -version = "0.0.0" -scope = "testOnly" -dependencies = [ - {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "lang.object"} -] - -[[package]] -org = "ballerina" -name = "lang.array" -version = "0.0.0" -scope = "testOnly" -dependencies = [ - {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "lang.__internal"} -] - [[package]] org = "ballerina" name = "lang.error" @@ -65,12 +45,6 @@ dependencies = [ {org = "ballerina", name = "jballerina.java"} ] -[[package]] -org = "ballerina" -name = "lang.object" -version = "0.0.0" -scope = "testOnly" - [[package]] org = "ballerina" name = "lang.value" @@ -96,7 +70,7 @@ modules = [ [[package]] org = "ballerina" name = "observe" -version = "1.2.3" +version = "1.2.2" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] @@ -108,7 +82,6 @@ version = "0.0.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "lang.array"}, {org = "ballerina", name = "lang.error"} ] modules = [ From f5ee21fb1e3f391005c274e915d80c8fa0ecccda Mon Sep 17 00:00:00 2001 From: Thisaru Guruge Date: Mon, 15 Apr 2024 13:42:03 +0530 Subject: [PATCH 3/3] Fix failing tests with Update 9 --- ballerina/Dependencies.toml | 2 +- ballerina/tests/03_collection_tests.bal | 25 +++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index 5f447de..5a3d9f0 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -5,7 +5,7 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.8.6" +distribution-version = "2201.8.0" [[package]] org = "ballerina" diff --git a/ballerina/tests/03_collection_tests.bal b/ballerina/tests/03_collection_tests.bal index 91b4b74..9161896 100644 --- a/ballerina/tests/03_collection_tests.bal +++ b/ballerina/tests/03_collection_tests.bal @@ -47,7 +47,7 @@ isolated function testInsertAndFind() returns error? { } @test:Config { - groups: ["collection", "insert", "insertOne", "find", "projection", "test"] + groups: ["collection", "insert", "insertOne", "find", "projection"] } isolated function testFindOne() returns error? { Database database = check mongoClient->getDatabase("testFindOneDB"); @@ -361,20 +361,21 @@ isolated function testUpdateUnset() returns error? { updateResult = check collection->updateOne({name: "Walter White"}, {"unset": {"address.country": ""}}); test:assertEquals(updateResult.matchedCount, 1); test:assertEquals(updateResult.modifiedCount, 1); - result = check collection->find({name: "Walter White"}); + stream findResult = check collection->find({name: "Walter White"}); - // Trapping the type conversion error and checking for the relevant error message. - // This is to confirm the field is removed from the document. - record {Person value;}|error? movieResult = trap result.next(); - if movieResult !is error { - test:assertFail("Expected an error"); + record {|anydata...;|}? movieResult = check findResult.next(); + if movieResult is () { + test:assertFail("Expected a record value from the stream"); } - var detail = movieResult.detail(); - if detail !is anydata { - test:assertFail("Expected anydata type for error detail"); + if movieResult.hasKey("address") { + var address = movieResult["address"]; + if address !is map { + test:assertFail("Expected a map value for the `address` field"); + } + if address.hasKey("country") { + test:assertFail("Expected the `country` field to be removed from the `address` field"); + } } - string message = detail["message"].toString(); - test:assertTrue(message.includes("missing required field 'address.country' of type 'string'")); check result.close(); check collection->drop(); check database->drop();