Skip to content

Commit

Permalink
Add service url as init default parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
DimuthuMadushan committed Mar 29, 2024
1 parent ac60a8e commit e3db74a
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 22 deletions.
22 changes: 17 additions & 5 deletions ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[ballerina]
dependencies-toml-version = "2"
distribution-version = "2201.8.6"
distribution-version = "2201.8.5"

[[package]]
org = "ballerina"
Expand Down Expand Up @@ -103,9 +103,6 @@ dependencies = [
org = "ballerina"
name = "jballerina.java"
version = "0.0.0"
modules = [
{org = "ballerina", packageName = "jballerina.java", moduleName = "jballerina.java"}
]

[[package]]
org = "ballerina"
Expand Down Expand Up @@ -302,6 +299,21 @@ dependencies = [
{org = "ballerina", name = "jballerina.java"}
]

[[package]]
org = "ballerina"
name = "uuid"
version = "1.7.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "crypto"},
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.int"},
{org = "ballerina", name = "time"}
]
modules = [
{org = "ballerina", packageName = "uuid", moduleName = "uuid"}
]

[[package]]
org = "ballerinai"
name = "observe"
Expand All @@ -320,11 +332,11 @@ name = "googleapis.gsheets"
version = "4.0.0"
dependencies = [
{org = "ballerina", name = "http"},
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.regexp"},
{org = "ballerina", name = "log"},
{org = "ballerina", name = "os"},
{org = "ballerina", name = "test"},
{org = "ballerina", name = "uuid"},
{org = "ballerinai", name = "observe"}
]
modules = [
Expand Down
27 changes: 27 additions & 0 deletions ballerina/tests/utils.bal
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com) All Rights Reserved.
//
// WSO2 LLC. licenses this file to you under the Apache License,
// Version 2.0 (the "License"); you may not use this file except
// in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
import ballerina/uuid;

# Create a random Uuid removing the unnecessary hyphens which will interrupt querying opearations.
#
# + return - A string Uuid without hyphens
function createRandomUuidWithoutHyphens() returns string {
string? stringUuid = uuid:createType4AsString();
if stringUuid is string {
return re `-`.replaceAll(stringUuid, "");
}
return "";
}
17 changes: 0 additions & 17 deletions ballerina/utils.bal
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
// under the License.

import ballerina/http;
import ballerina/jballerina.java as java;
import ballerina/lang.regexp;

isolated function sendRequestWithPayload(http:Client httpClient, string path, json jsonPayload = ())
returns json|error {
Expand Down Expand Up @@ -83,17 +81,6 @@ isolated function getErrorMessage(http:Response response) returns error {
return error(payload.toString());
}

# Create a random Uuid removing the unnecessary hyphens which will interrupt querying opearations.
#
# + return - A string Uuid without hyphens
function createRandomUuidWithoutHyphens() returns string {
string? stringUuid = java:toString(createRandomUuid());
if stringUuid is string {
return regexp:replaceAll(re `-`, stringUuid, "");
}
return "";
}

# Get a string containing the A1 Annotation from A1Range.
#
# + a1Range - A1Range filter.
Expand All @@ -112,7 +99,3 @@ isolated function getA1RangeString(A1Range a1Range) returns string|error {
return filter;
}

function createRandomUuid() returns handle = @java:Method {
name: "randomUUID",
'class: "java.util.UUID"
} external;

0 comments on commit e3db74a

Please sign in to comment.