From 1a216111153bbc772addc9f44d8d1ad7d43b9d7a Mon Sep 17 00:00:00 2001 From: niveathika Date: Thu, 6 May 2021 00:30:01 +0530 Subject: [PATCH 1/4] Reformat --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index d8755e254e..eb71112dbf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,6 @@ shortVersion=slbeta1 ballerinaJreVersion=0.8.0 specVersion=v2020-12-17 versionDisplayText=Beta 1 -ballerinaCommandVersion=1.3.4 # Stdlib Level 01 stdlibIoVersion=0.6.0-alpha9-20210503-004600-2ff5049 @@ -53,8 +52,9 @@ stdlibWebsubhubVersion=0.2.0-alpha9-20210503-103800-141913c # Stdlib Level 07 stdlibSqlVersion=0.6.0-alpha10-20210503-112100-4c91ca0 -# Dev Tools JS Libraries +# Dev Tools devToolsVersion=0.10.3 +ballerinaCommandVersion=1.3.4 # Open API Module openapiVersion=0.9.0-beta.1-20210504-160000-7f1acd5 From c070fcb100654e18a6ac59b5cbe479f2a0c2ba4a Mon Sep 17 00:00:00 2001 From: niveathika Date: Thu, 6 May 2021 01:27:34 +0530 Subject: [PATCH 2/4] Migrate to latest lang --- .../access_mutate_java_fields.bal | 2 +- examples/log-api/tests/log_api_test.bal | 8 ++++---- examples/streams/streams.bal | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/access-mutate-java-fields/access_mutate_java_fields.bal b/examples/access-mutate-java-fields/access_mutate_java_fields.bal index 0d9f9168e2..043f8a51dc 100644 --- a/examples/access-mutate-java-fields/access_mutate_java_fields.bal +++ b/examples/access-mutate-java-fields/access_mutate_java_fields.bal @@ -10,6 +10,6 @@ public function pi() returns float = @java:FieldGet { public function main() { float r = 4; // If a field is an instance field, the receiver instance has to be provided as the first parameter. - float l = 2 * pi() * r; + float l = ( 2) * pi() * r; io:println(l); } diff --git a/examples/log-api/tests/log_api_test.bal b/examples/log-api/tests/log_api_test.bal index 7ad82db799..546465a4d3 100644 --- a/examples/log-api/tests/log_api_test.bal +++ b/examples/log-api/tests/log_api_test.bal @@ -14,7 +14,7 @@ string printWarn = ""; } test:MockFunction mock_printDebug = new(); -public function mockPrintDebug(string msg, *log:KeyValues keyValues, error? err = ()) { +public function mockPrintDebug(string msg, error? err = (), *log:KeyValues keyValues) { printDebug = msg; } @@ -24,7 +24,7 @@ public function mockPrintDebug(string msg, *log:KeyValues keyValues, error? err } test:MockFunction mock_printError = new(); -public function mockPrintError(string msg, *log:KeyValues keyValues, error? err = ()) { +public function mockPrintError(string msg, error? err = (), *log:KeyValues keyValues) { printError = msg; } @@ -34,7 +34,7 @@ public function mockPrintError(string msg, *log:KeyValues keyValues, error? err } test:MockFunction mock_printInfo = new(); -public function mockPrintInfo(string msg, *log:KeyValues keyValues, error? err = ()) { +public function mockPrintInfo(string msg, error? err = (), *log:KeyValues keyValues) { printInfo = msg; } @@ -44,7 +44,7 @@ public function mockPrintInfo(string msg, *log:KeyValues keyValues, error? err = } test:MockFunction mock_printWarn = new(); -public function mockPrintWarn(string msg, *log:KeyValues keyValues, error? err = ()) { +public function mockPrintWarn(string msg, error? err = (), *log:KeyValues keyValues) { printWarn = msg; } diff --git a/examples/streams/streams.bal b/examples/streams/streams.bal index 42f332666f..2847804ba2 100644 --- a/examples/streams/streams.bal +++ b/examples/streams/streams.bal @@ -78,7 +78,7 @@ public function main() { //The `reduce` function reduces the stream to a single value. float? avg = subscriptionStream.reduce( function (float accum, Student student) returns float { - return accum + student.score / studentList.length(); + return accum + student.score / studentList.length(); }, 0.0); if (avg is float) { From c5e3bab0856acb9f791802f03146aaab409ee5fd Mon Sep 17 00:00:00 2001 From: Kalaiyarasi Date: Thu, 6 May 2021 10:49:00 +0530 Subject: [PATCH 3/4] Enable task BBE and integration test --- ballerina/build.gradle | 5 +---- stdlib-integration-tests/index.json | 4 ++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ballerina/build.gradle b/ballerina/build.gradle index 9be96bb09e..916559f46c 100644 --- a/ballerina/build.gradle +++ b/ballerina/build.gradle @@ -713,10 +713,7 @@ task testExamples() { 'mysql-call-stored-procedures', 'local-transactions', 'xa-transactions', - 'retry-transactions', - - 'task-one-time-job-execution', - 'task-frequency-job-execution' + 'retry-transactions' ] // The following BBEs will be excluded from output verification, which means verifying the output of the `.bal` file diff --git a/stdlib-integration-tests/index.json b/stdlib-integration-tests/index.json index 13e8283779..88fac717f0 100644 --- a/stdlib-integration-tests/index.json +++ b/stdlib-integration-tests/index.json @@ -23,6 +23,10 @@ "name": "JWT standard library ", "path": "jwt" }, + { + "name": "Task standard library ", + "path": "task" + }, { "name": "OAuth2 standard library ", "path": "oauth2" From 24027fae817d20cd07cc410e8109aae5c74ea153 Mon Sep 17 00:00:00 2001 From: riyafa Date: Thu, 6 May 2021 10:20:14 +0530 Subject: [PATCH 4/4] Fix failure in the-main-function example --- .../tests/the_main_function_test.bal | 15 ++------------- examples/the-main-function/the_main_function.bal | 4 ++-- examples/the-main-function/the_main_function.out | 14 +------------- 3 files changed, 5 insertions(+), 28 deletions(-) diff --git a/examples/the-main-function/tests/the_main_function_test.bal b/examples/the-main-function/tests/the_main_function_test.bal index 02ec40e7fa..98354cffe3 100644 --- a/examples/the-main-function/tests/the_main_function_test.bal +++ b/examples/the-main-function/tests/the_main_function_test.bal @@ -21,20 +21,9 @@ public function mockPrint(any|error... s) { function testFunc() { test:when(mock_printLn).call("mockPrint"); - // Invoking the main function. - error? e = main("Alice"); - test:assertTrue(e is ()); - test:assertExactEquals(outputs[0], "Name: Alice, Age: 18, Year: Freshman"); - - // Invoking the main function. - counter = 0; - e = main("Alice", 20); - test:assertTrue(e is ()); - test:assertExactEquals(outputs[0], "Name: Alice, Age: 20, Year: Freshman"); - // Invoking the main function. counter = 0; - e = main("Alice", 18, "Sophomore"); + error? e = main("Alice", 18, "Sophomore"); test:assertTrue(e is ()); test:assertExactEquals(outputs[0], "Name: Alice, Age: 18, Year: Sophomore"); @@ -46,7 +35,7 @@ function testFunc() { // Invoking the main function. counter = 0; - e = main("Ali"); + e = main("Ali", 30, "Freshman"); if (e is error) { test:assertExactEquals(e.message(), "InvalidName"); test:assertExactEquals(e.toString(), "error(\"InvalidName\",message=\"invalid length\")"); diff --git a/examples/the-main-function/the_main_function.bal b/examples/the-main-function/the_main_function.bal index 783ea95d84..e431462de2 100644 --- a/examples/the-main-function/the_main_function.bal +++ b/examples/the-main-function/the_main_function.bal @@ -6,8 +6,8 @@ import ballerina/io; // The rest parameter `modules` represents the additional arguments. // The `main` function may return an `error` or `()`. public function main(string name, - int age = 18, - string year = "Freshman", + int age, + string year, string... modules) returns error? { diff --git a/examples/the-main-function/the_main_function.out b/examples/the-main-function/the_main_function.out index de491261ed..a6a9353e2d 100644 --- a/examples/the-main-function/the_main_function.out +++ b/examples/the-main-function/the_main_function.out @@ -1,18 +1,6 @@ # To run this sample, navigate to the directory that contains the # `.bal` file, and execute the `bal run` command below. -# Use the ballerina `run` command to invoke the `main` function specifying `Alice` -# as the string argument for `name`. `18` would be set as the value for -# `age` and `Freshman` would be set as the value for `year`. -bal run the_main_function.bal -- Alice -Name: Alice, Age: 18, Year: Freshman - -# Use the ballerina `run` command to invoke the `main` function specifying `Alice` -# as the string argument for `name` and `20` as the integer value for -# `age`. Both arguments are specified as operands. -bal run the_main_function.bal -- Alice 20 -Name: Alice, Age: 20, Year: Freshman - # Use the ballerina `run` command to invoke the `main` function specifying `Alice` # as the string argument for `name`, 18 as the `age` and `Sophomore` as the string # argument for `year`. @@ -27,5 +15,5 @@ Name: Alice, Age: 20, Year: Sophomore, Module(s): ["math","physics"] # Use the ballerina `run` command to invoke the `main` function specifying an invalid # string as the argument for `name`. The `error` returned would be printed. -bal run the_main_function.bal -- Ali + bal run the_main_function.bal -- Ali 30 Freshman error: InvalidName {"message":"invalid length"}