Skip to content

Commit

Permalink
Merge pull request #1654 from ballerina-platform/beta1-migration
Browse files Browse the repository at this point in the history
Beta1 BBE migration
  • Loading branch information
niveathika committed May 6, 2021
2 parents f050229 + 5818536 commit bcdbd81
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 40 deletions.
5 changes: 1 addition & 4 deletions ballerina/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (<float> 2) * pi() * r;
io:println(l);
}
8 changes: 4 additions & 4 deletions examples/log-api/tests/log_api_test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/streams/streams.bal
Original file line number Diff line number Diff line change
Expand Up @@ -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 + <float>student.score / studentList.length();
return accum + student.score / <float> studentList.length();
}, 0.0);

if (avg is float) {
Expand Down
15 changes: 2 additions & 13 deletions examples/the-main-function/tests/the_main_function_test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand All @@ -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\")");
Expand Down
4 changes: 2 additions & 2 deletions examples/the-main-function/the_main_function.bal
Original file line number Diff line number Diff line change
Expand Up @@ -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? {

Expand Down
14 changes: 1 addition & 13 deletions examples/the-main-function/the_main_function.out
Original file line number Diff line number Diff line change
@@ -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`.
Expand All @@ -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"}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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-beta.1-20210506-035400-36fc9a4
Expand Down Expand Up @@ -53,8 +52,9 @@ stdlibWebsubhubVersion=0.2.0-beta.1-20210506-051500-2e62521
# Stdlib Level 07
stdlibSqlVersion=0.6.0-beta.1-20210506-053000-65f020a

# Dev Tools JS Libraries
# Dev Tools
devToolsVersion=0.10.3
ballerinaCommandVersion=1.3.4

# Open API Module
openapiVersion=0.9.0-beta.1-20210506-051500-ec15322
Expand Down
4 changes: 4 additions & 0 deletions stdlib-integration-tests/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
"name": "JWT standard library ",
"path": "jwt"
},
{
"name": "Task standard library ",
"path": "task"
},
{
"name": "OAuth2 standard library ",
"path": "oauth2"
Expand Down

0 comments on commit bcdbd81

Please sign in to comment.