diff --git a/devportal/devportal-domain-service/ballerina/Ballerina.toml b/devportal/devportal-domain-service/ballerina/Ballerina.toml index 141ccf57e..38abcbeee 100644 --- a/devportal/devportal-domain-service/ballerina/Ballerina.toml +++ b/devportal/devportal-domain-service/ballerina/Ballerina.toml @@ -2,7 +2,7 @@ org = "wso2" name = "devportal_service" version = "0.0.1-SNAPSHOT" -distribution = "2201.5.0" +distribution = "2201.8.0" [build-options] observabilityIncluded = true diff --git a/devportal/devportal-domain-service/ballerina/Ballerina.toml.template b/devportal/devportal-domain-service/ballerina/Ballerina.toml.template index 126c5ba49..1656149e4 100644 --- a/devportal/devportal-domain-service/ballerina/Ballerina.toml.template +++ b/devportal/devportal-domain-service/ballerina/Ballerina.toml.template @@ -2,7 +2,7 @@ org = "wso2" name = "devportal_service" version = "PROJECT_VERSION" -distribution = "2201.5.0" +distribution = "2201.8.0" [build-options] observabilityIncluded = true diff --git a/devportal/devportal-domain-service/ballerina/Dependencies.toml b/devportal/devportal-domain-service/ballerina/Dependencies.toml index 5ec27bfd6..44d7d0eb7 100644 --- a/devportal/devportal-domain-service/ballerina/Dependencies.toml +++ b/devportal/devportal-domain-service/ballerina/Dependencies.toml @@ -5,25 +5,24 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.5.0" +distribution-version = "2201.8.0" [[package]] org = "ballerina" name = "auth" -version = "2.7.0" +version = "2.10.0" dependencies = [ {org = "ballerina", name = "crypto"}, {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "lang.array"}, {org = "ballerina", name = "lang.string"}, - {org = "ballerina", name = "log"}, - {org = "ballerina", name = "regex"} + {org = "ballerina", name = "log"} ] [[package]] org = "ballerina" name = "cache" -version = "3.4.0" +version = "3.7.0" dependencies = [ {org = "ballerina", name = "constraint"}, {org = "ballerina", name = "jballerina.java"}, @@ -37,7 +36,7 @@ modules = [ [[package]] org = "ballerina" name = "constraint" -version = "1.1.0" +version = "1.4.0" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] @@ -48,7 +47,7 @@ modules = [ [[package]] org = "ballerina" name = "crypto" -version = "2.3.0" +version = "2.5.0" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "time"} @@ -57,13 +56,11 @@ dependencies = [ [[package]] org = "ballerina" name = "file" -version = "1.7.0" +version = "1.9.0" dependencies = [ {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "log"}, {org = "ballerina", name = "os"}, - {org = "ballerina", name = "regex"}, {org = "ballerina", name = "time"} ] modules = [ @@ -73,7 +70,7 @@ modules = [ [[package]] org = "ballerina" name = "grpc" -version = "1.7.0" +version = "1.10.1" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "crypto"}, @@ -83,14 +80,13 @@ dependencies = [ {org = "ballerina", name = "log"}, {org = "ballerina", name = "oauth2"}, {org = "ballerina", name = "protobuf"}, - {org = "ballerina", name = "regex"}, {org = "ballerina", name = "time"} ] [[package]] org = "ballerina" name = "http" -version = "2.7.0" +version = "2.10.1" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "cache"}, @@ -103,6 +99,7 @@ dependencies = [ {org = "ballerina", name = "lang.array"}, {org = "ballerina", name = "lang.decimal"}, {org = "ballerina", name = "lang.int"}, + {org = "ballerina", name = "lang.regexp"}, {org = "ballerina", name = "lang.runtime"}, {org = "ballerina", name = "lang.string"}, {org = "ballerina", name = "lang.value"}, @@ -110,18 +107,18 @@ dependencies = [ {org = "ballerina", name = "mime"}, {org = "ballerina", name = "oauth2"}, {org = "ballerina", name = "observe"}, - {org = "ballerina", name = "regex"}, {org = "ballerina", name = "time"}, {org = "ballerina", name = "url"} ] modules = [ - {org = "ballerina", packageName = "http", moduleName = "http"} + {org = "ballerina", packageName = "http", moduleName = "http"}, + {org = "ballerina", packageName = "http", moduleName = "http.httpscerr"} ] [[package]] org = "ballerina" name = "io" -version = "1.4.1" +version = "1.6.0" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "lang.value"} @@ -141,7 +138,7 @@ modules = [ [[package]] org = "ballerina" name = "jballerina.java.arrays" -version = "1.2.3" +version = "1.4.0" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] @@ -152,7 +149,7 @@ modules = [ [[package]] org = "ballerina" name = "jwt" -version = "2.7.0" +version = "2.10.0" dependencies = [ {org = "ballerina", name = "cache"}, {org = "ballerina", name = "crypto"}, @@ -160,7 +157,6 @@ dependencies = [ {org = "ballerina", name = "lang.int"}, {org = "ballerina", name = "lang.string"}, {org = "ballerina", name = "log"}, - {org = "ballerina", name = "regex"}, {org = "ballerina", name = "time"} ] modules = [ @@ -193,6 +189,15 @@ dependencies = [ {org = "ballerina", name = "jballerina.java"} ] +[[package]] +org = "ballerina" +name = "lang.error" +version = "0.0.0" +scope = "testOnly" +dependencies = [ + {org = "ballerina", name = "jballerina.java"} +] + [[package]] org = "ballerina" name = "lang.int" @@ -247,7 +252,7 @@ modules = [ [[package]] org = "ballerina" name = "log" -version = "2.7.0" +version = "2.9.0" dependencies = [ {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"}, @@ -261,7 +266,7 @@ modules = [ [[package]] org = "ballerina" name = "mime" -version = "2.7.0" +version = "2.9.0" dependencies = [ {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"}, @@ -271,7 +276,7 @@ dependencies = [ [[package]] org = "ballerina" name = "oauth2" -version = "2.7.0" +version = "2.10.0" dependencies = [ {org = "ballerina", name = "cache"}, {org = "ballerina", name = "crypto"}, @@ -284,7 +289,7 @@ dependencies = [ [[package]] org = "ballerina" name = "observe" -version = "1.0.7" +version = "1.2.0" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] @@ -292,7 +297,7 @@ dependencies = [ [[package]] org = "ballerina" name = "os" -version = "1.6.0" +version = "1.8.0" dependencies = [ {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"} @@ -301,7 +306,7 @@ dependencies = [ [[package]] org = "ballerina" name = "protobuf" -version = "1.3.2" +version = "1.6.0" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "time"} @@ -322,7 +327,7 @@ modules = [ [[package]] org = "ballerina" name = "sql" -version = "1.8.0" +version = "1.11.0" dependencies = [ {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"}, @@ -336,7 +341,7 @@ modules = [ [[package]] org = "ballerina" name = "task" -version = "2.3.2" +version = "2.5.0" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "time"} @@ -348,7 +353,8 @@ name = "test" version = "0.0.0" scope = "testOnly" dependencies = [ - {org = "ballerina", name = "jballerina.java"} + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.error"} ] modules = [ {org = "ballerina", packageName = "test", moduleName = "test"} @@ -357,7 +363,7 @@ modules = [ [[package]] org = "ballerina" name = "time" -version = "2.2.4" +version = "2.4.0" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] @@ -368,7 +374,7 @@ modules = [ [[package]] org = "ballerina" name = "url" -version = "2.2.3" +version = "2.4.0" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] @@ -379,12 +385,11 @@ modules = [ [[package]] org = "ballerina" name = "uuid" -version = "1.5.0" +version = "1.7.0" dependencies = [ {org = "ballerina", name = "crypto"}, {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "lang.int"}, - {org = "ballerina", name = "regex"}, {org = "ballerina", name = "time"} ] modules = [ @@ -406,7 +411,7 @@ modules = [ [[package]] org = "ballerinax" name = "postgresql" -version = "1.8.0" +version = "1.11.0" dependencies = [ {org = "ballerina", name = "crypto"}, {org = "ballerina", name = "io"}, @@ -430,6 +435,7 @@ dependencies = [ {org = "ballerina", name = "lang.value"}, {org = "ballerina", name = "log"}, {org = "ballerina", name = "os"}, + {org = "ballerina", name = "regex"}, {org = "ballerina", name = "sql"}, {org = "ballerina", name = "uuid"}, {org = "ballerinax", name = "postgresql"} diff --git a/devportal/devportal-domain-service/ballerina/Dependencies.toml.template b/devportal/devportal-domain-service/ballerina/Dependencies.toml.template index 5ec27bfd6..f132c7f52 100644 --- a/devportal/devportal-domain-service/ballerina/Dependencies.toml.template +++ b/devportal/devportal-domain-service/ballerina/Dependencies.toml.template @@ -5,25 +5,24 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.5.0" +distribution-version = "2201.8.0" [[package]] org = "ballerina" name = "auth" -version = "2.7.0" +version = "2.10.0" dependencies = [ {org = "ballerina", name = "crypto"}, {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "lang.array"}, {org = "ballerina", name = "lang.string"}, - {org = "ballerina", name = "log"}, - {org = "ballerina", name = "regex"} + {org = "ballerina", name = "log"} ] [[package]] org = "ballerina" name = "cache" -version = "3.4.0" +version = "3.7.0" dependencies = [ {org = "ballerina", name = "constraint"}, {org = "ballerina", name = "jballerina.java"}, @@ -37,7 +36,7 @@ modules = [ [[package]] org = "ballerina" name = "constraint" -version = "1.1.0" +version = "1.4.0" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] @@ -48,7 +47,7 @@ modules = [ [[package]] org = "ballerina" name = "crypto" -version = "2.3.0" +version = "2.5.0" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "time"} @@ -57,13 +56,11 @@ dependencies = [ [[package]] org = "ballerina" name = "file" -version = "1.7.0" +version = "1.9.0" dependencies = [ {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "log"}, {org = "ballerina", name = "os"}, - {org = "ballerina", name = "regex"}, {org = "ballerina", name = "time"} ] modules = [ @@ -73,7 +70,7 @@ modules = [ [[package]] org = "ballerina" name = "grpc" -version = "1.7.0" +version = "1.10.1" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "crypto"}, @@ -83,14 +80,13 @@ dependencies = [ {org = "ballerina", name = "log"}, {org = "ballerina", name = "oauth2"}, {org = "ballerina", name = "protobuf"}, - {org = "ballerina", name = "regex"}, {org = "ballerina", name = "time"} ] [[package]] org = "ballerina" name = "http" -version = "2.7.0" +version = "2.10.1" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "cache"}, @@ -103,6 +99,7 @@ dependencies = [ {org = "ballerina", name = "lang.array"}, {org = "ballerina", name = "lang.decimal"}, {org = "ballerina", name = "lang.int"}, + {org = "ballerina", name = "lang.regexp"}, {org = "ballerina", name = "lang.runtime"}, {org = "ballerina", name = "lang.string"}, {org = "ballerina", name = "lang.value"}, @@ -110,18 +107,18 @@ dependencies = [ {org = "ballerina", name = "mime"}, {org = "ballerina", name = "oauth2"}, {org = "ballerina", name = "observe"}, - {org = "ballerina", name = "regex"}, {org = "ballerina", name = "time"}, {org = "ballerina", name = "url"} ] modules = [ - {org = "ballerina", packageName = "http", moduleName = "http"} + {org = "ballerina", packageName = "http", moduleName = "http"}, + {org = "ballerina", packageName = "http", moduleName = "http.httpscerr"} ] [[package]] org = "ballerina" name = "io" -version = "1.4.1" +version = "1.6.0" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "lang.value"} @@ -141,7 +138,7 @@ modules = [ [[package]] org = "ballerina" name = "jballerina.java.arrays" -version = "1.2.3" +version = "1.4.0" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] @@ -152,7 +149,7 @@ modules = [ [[package]] org = "ballerina" name = "jwt" -version = "2.7.0" +version = "2.10.0" dependencies = [ {org = "ballerina", name = "cache"}, {org = "ballerina", name = "crypto"}, @@ -160,7 +157,6 @@ dependencies = [ {org = "ballerina", name = "lang.int"}, {org = "ballerina", name = "lang.string"}, {org = "ballerina", name = "log"}, - {org = "ballerina", name = "regex"}, {org = "ballerina", name = "time"} ] modules = [ @@ -193,6 +189,15 @@ dependencies = [ {org = "ballerina", name = "jballerina.java"} ] +[[package]] +org = "ballerina" +name = "lang.error" +version = "0.0.0" +scope = "testOnly" +dependencies = [ + {org = "ballerina", name = "jballerina.java"} +] + [[package]] org = "ballerina" name = "lang.int" @@ -247,7 +252,7 @@ modules = [ [[package]] org = "ballerina" name = "log" -version = "2.7.0" +version = "2.9.0" dependencies = [ {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"}, @@ -261,7 +266,7 @@ modules = [ [[package]] org = "ballerina" name = "mime" -version = "2.7.0" +version = "2.9.0" dependencies = [ {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"}, @@ -271,7 +276,7 @@ dependencies = [ [[package]] org = "ballerina" name = "oauth2" -version = "2.7.0" +version = "2.10.0" dependencies = [ {org = "ballerina", name = "cache"}, {org = "ballerina", name = "crypto"}, @@ -284,7 +289,7 @@ dependencies = [ [[package]] org = "ballerina" name = "observe" -version = "1.0.7" +version = "1.2.0" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] @@ -292,7 +297,7 @@ dependencies = [ [[package]] org = "ballerina" name = "os" -version = "1.6.0" +version = "1.8.0" dependencies = [ {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"} @@ -301,7 +306,7 @@ dependencies = [ [[package]] org = "ballerina" name = "protobuf" -version = "1.3.2" +version = "1.6.0" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "time"} @@ -322,7 +327,7 @@ modules = [ [[package]] org = "ballerina" name = "sql" -version = "1.8.0" +version = "1.11.0" dependencies = [ {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"}, @@ -336,7 +341,7 @@ modules = [ [[package]] org = "ballerina" name = "task" -version = "2.3.2" +version = "2.5.0" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "time"} @@ -348,7 +353,8 @@ name = "test" version = "0.0.0" scope = "testOnly" dependencies = [ - {org = "ballerina", name = "jballerina.java"} + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.error"} ] modules = [ {org = "ballerina", packageName = "test", moduleName = "test"} @@ -357,7 +363,7 @@ modules = [ [[package]] org = "ballerina" name = "time" -version = "2.2.4" +version = "2.4.0" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] @@ -368,7 +374,7 @@ modules = [ [[package]] org = "ballerina" name = "url" -version = "2.2.3" +version = "2.4.0" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] @@ -379,12 +385,11 @@ modules = [ [[package]] org = "ballerina" name = "uuid" -version = "1.5.0" +version = "1.7.0" dependencies = [ {org = "ballerina", name = "crypto"}, {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "lang.int"}, - {org = "ballerina", name = "regex"}, {org = "ballerina", name = "time"} ] modules = [ @@ -406,7 +411,7 @@ modules = [ [[package]] org = "ballerinax" name = "postgresql" -version = "1.8.0" +version = "1.11.0" dependencies = [ {org = "ballerina", name = "crypto"}, {org = "ballerina", name = "io"}, @@ -430,6 +435,7 @@ dependencies = [ {org = "ballerina", name = "lang.value"}, {org = "ballerina", name = "log"}, {org = "ballerina", name = "os"}, + {org = "ballerina", name = "regex"}, {org = "ballerina", name = "sql"}, {org = "ballerina", name = "uuid"}, {org = "ballerinax", name = "postgresql"} @@ -457,7 +463,7 @@ modules = [ [[package]] org = "wso2" name = "devportal_service" -version = "0.0.1-SNAPSHOT" +version = "PROJECT_VERSION" dependencies = [ {org = "ballerina", name = "cache"}, {org = "ballerina", name = "constraint"}, diff --git a/devportal/devportal-domain-service/ballerina/apiImpl.bal b/devportal/devportal-domain-service/ballerina/apiImpl.bal index 1d598e057..628caa18a 100644 --- a/devportal/devportal-domain-service/ballerina/apiImpl.bal +++ b/devportal/devportal-domain-service/ballerina/apiImpl.bal @@ -242,6 +242,7 @@ isolated function getDocumentList(string apiId, int 'limit, int offset) returns return documents; } } else { - return api; + string message = "Internal Error occured while retrieving API for Docuements retieval"; + return error(message, message = message, description = message, code = 909001, statusCode = 500); } } diff --git a/devportal/devportal-domain-service/ballerina/applicationImpl.bal b/devportal/devportal-domain-service/ballerina/applicationImpl.bal index a82af97db..2f4f2386d 100644 --- a/devportal/devportal-domain-service/ballerina/applicationImpl.bal +++ b/devportal/devportal-domain-service/ballerina/applicationImpl.bal @@ -200,7 +200,8 @@ isolated function deleteOauthApps(string appId, commons:Organization organizatio isolated function generateAPIKey(APIKeyGenerateRequest payload, string appId, string keyType, string user, commons:Organization org) returns APIKey|commons:APKError|NotFoundError { Application|NotFoundError application = check getApplicationById(appId, org); if application !is Application { - return application; + string message = "Internal Error occured while retrieving Application Info for API Key"; + return error(message, message = message, description = message, code = 909001, statusCode = 500); } else { boolean userAllowed = checkUserAccessAllowedForApplication(application, user); if userAllowed { diff --git a/devportal/devportal-domain-service/ballerina/devportal-api_service.bal b/devportal/devportal-domain-service/ballerina/devportal-api_service.bal index 7d8cd796d..207cbae72 100644 --- a/devportal/devportal-domain-service/ballerina/devportal-api_service.bal +++ b/devportal/devportal-domain-service/ballerina/devportal-api_service.bal @@ -20,7 +20,12 @@ import ballerina/http; import ballerina/log; import wso2/apk_common_lib as commons; -isolated service /api/devportal on ep0 { +isolated service http:InterceptableService /api/devportal on ep0 { + + public function createInterceptors() returns http:Interceptor|http:Interceptor[] { + http:Interceptor[] interceptors = [jwtValidationInterceptor, requestErrorInterceptor, responseErrorInterceptor]; + return interceptors; + } # Retrieve/Search APIs # # + 'limit - Maximum size of resource array to return. diff --git a/devportal/devportal-domain-service/ballerina/init.bal b/devportal/devportal-domain-service/ballerina/init.bal index 770629f1f..05b58415c 100644 --- a/devportal/devportal-domain-service/ballerina/init.bal +++ b/devportal/devportal-domain-service/ballerina/init.bal @@ -41,7 +41,7 @@ configurable commons:IDPConfiguration & readonly idpConfiguration = { }; configurable KeyManagerConfigs[] keyManagerConfigs = []; commons:DBBasedOrgResolver organizationResolver = new (datasourceConfiguration); -commons:JWTValidationInterceptor jwtValidationInterceptor = new (idpConfiguration, organizationResolver); +commons:JWTValidationInterceptor jwtValidationInterceptor = new (idpConfiguration, organizationResolver, ["/health"]); commons:RequestErrorInterceptor requestErrorInterceptor = new; commons:ResponseErrorInterceptor responseErrorInterceptor = new; apk_keymanager_libs:KeyManagerTypeInitializer keyManagerTypeInitializer = new (); @@ -51,7 +51,8 @@ listener http:Listener ep0 = new (DEVPORTAL_PORT, secureSocket = { certFile: keyStores.tls.certFilePath, keyFile: keyStores.tls.keyFilePath } -}, interceptors = [jwtValidationInterceptor, userRegistrationInterceptor, requestErrorInterceptor, responseErrorInterceptor]); +}); + configurable string keyManagerConntectorConfigurationFilePath = "/home/wso2apk/devportal/keymanager"; listener http:Listener keyManagerConnectorListener = new (9445); diff --git a/devportal/devportal-domain-service/ballerina/modules/java.lang/Object.bal b/devportal/devportal-domain-service/ballerina/modules/java.lang/Object.bal index bfed60309..fecc99e43 100644 --- a/devportal/devportal-domain-service/ballerina/modules/java.lang/Object.bal +++ b/devportal/devportal-domain-service/ballerina/modules/java.lang/Object.bal @@ -20,7 +20,7 @@ public distinct class Object { # # + return - The `string` form of the Java object instance. public function toString() returns string { - return java:toString(self.jObj) ?: "null"; + return java:toString(self.jObj) ?: ""; } # The function that maps to the `equals` method of `java.lang.Object`. # diff --git a/devportal/devportal-domain-service/ballerina/modules/org.wso2.apk.devportal.sdk/APIClientGenerationManager.bal b/devportal/devportal-domain-service/ballerina/modules/org.wso2.apk.devportal.sdk/APIClientGenerationManager.bal index c5448a444..d0856e4f1 100644 --- a/devportal/devportal-domain-service/ballerina/modules/org.wso2.apk.devportal.sdk/APIClientGenerationManager.bal +++ b/devportal/devportal-domain-service/ballerina/modules/org.wso2.apk.devportal.sdk/APIClientGenerationManager.bal @@ -1,7 +1,8 @@ -import ballerina/jballerina.java; import devportal_service.java.lang as javalang; import devportal_service.java.util as javautil; +import ballerina/jballerina.java; + # Ballerina class mapping for the Java `org.wso2.apk.devportal.sdk.APIClientGenerationManager` class. @java:Binding {'class: "org.wso2.apk.devportal.sdk.APIClientGenerationManager"} public distinct class APIClientGenerationManager { @@ -23,7 +24,7 @@ public distinct class APIClientGenerationManager { # # + return - The `string` form of the Java object instance. public function toString() returns string { - return java:toString(self.jObj) ?: "null"; + return java:toString(self.jObj) ?: ""; } # The function that maps to the `cleanTempDirectory` method of `org.wso2.apk.devportal.sdk.APIClientGenerationManager`. # @@ -74,8 +75,8 @@ public distinct class APIClientGenerationManager { # The function that maps to the `getSupportedSDKLanguages` method of `org.wso2.apk.devportal.sdk.APIClientGenerationManager`. # # + return - The `string` value returning from the Java mapping. - public isolated function getSupportedSDKLanguages() returns string? { - return java:toString(org_wso2_apk_devportal_sdk_APIClientGenerationManager_getSupportedSDKLanguages(self.jObj)); + public isolated function getSupportedSDKLanguages() returns string { + return java:toString(org_wso2_apk_devportal_sdk_APIClientGenerationManager_getSupportedSDKLanguages(self.jObj)) ?: ""; } # The function that maps to the `hashCode` method of `org.wso2.apk.devportal.sdk.APIClientGenerationManager`. diff --git a/devportal/devportal-domain-service/ballerina/subscriptionImpl.bal b/devportal/devportal-domain-service/ballerina/subscriptionImpl.bal index 990a721f9..67d7ed4c2 100644 --- a/devportal/devportal-domain-service/ballerina/subscriptionImpl.bal +++ b/devportal/devportal-domain-service/ballerina/subscriptionImpl.bal @@ -251,7 +251,8 @@ isolated function getSubscriptions(string? apiId, string? applicationId, string? SubscriptionList subList = {count: count, list: subs}; return subList; } else { - return subscription; + string message = "Internal Error occured while retrieving Subscription"; + return error(message, message = message, description = message, code = 909001, statusCode = 500); } } else if apiId is string { // Retrieve Subscriptions per given API Id diff --git a/devportal/devportal-domain-service/ballerina/tests/applicationTests.bal b/devportal/devportal-domain-service/ballerina/tests/applicationTests.bal index efc6628d6..630fc9bb8 100644 --- a/devportal/devportal-domain-service/ballerina/tests/applicationTests.bal +++ b/devportal/devportal-domain-service/ballerina/tests/applicationTests.bal @@ -20,6 +20,7 @@ import ballerina/test; import ballerina/log; import wso2/apk_common_lib as commons; import ballerina/uuid; +import wso2/notification_grpc_client as _; @test:Mock {functionName: "generateToken"} test:MockFunction generateTokenMock = new (); diff --git a/devportal/devportal-domain-service/ballerina/tests/subscriptionTests.bal b/devportal/devportal-domain-service/ballerina/tests/subscriptionTests.bal index 2b2a523a4..e5ff4858d 100644 --- a/devportal/devportal-domain-service/ballerina/tests/subscriptionTests.bal +++ b/devportal/devportal-domain-service/ballerina/tests/subscriptionTests.bal @@ -20,6 +20,7 @@ import ballerina/test; import ballerina/log; import ballerina/uuid; import wso2/apk_common_lib as commons; +import wso2/notification_grpc_client as _; Subscription sub = {apiId: "01ed75e2-b30b-18c8-wwf2-25da7edd2231", applicationId: "21212"}; Application applicationNew = {name: "sampleAppNew", description: "sample application"}; @@ -255,7 +256,7 @@ function getSubscriptionListTest1() { string? appId = applicationNew.applicationId; if appId is string { SubscriptionList|commons:APKError|NotFoundError subscriptionList = getSubscriptions("01ed75e2-b30b-18c8-wwf2-25da7edd2231", appId, "", 0, 0, organiztion); - if subscriptionList is ApplicationList { + if subscriptionList is SubscriptionList { test:assertTrue(true, "Successfully retrieved all subscriptions by API ID and App ID"); } else { test:assertFail("Error occured while retrieving all subscriptions"); @@ -269,7 +270,7 @@ function getSubscriptionListTest1() { function getSubscriptionListTest2() { // Providing only API ID SubscriptionList|commons:APKError|NotFoundError subscriptionList = getSubscriptions("01ed75e2-b30b-18c8-wwf2-25da7edd2231", null, "", 0, 0, organiztion); - if subscriptionList is ApplicationList { + if subscriptionList is SubscriptionList { test:assertTrue(true, "Successfully retrieved all subscriptions by API ID and App ID"); } else { test:assertFail("Error occured while retrieving all subscriptions"); @@ -282,7 +283,7 @@ function getSubscriptionListTest3() { string? appId = applicationNew.applicationId; if appId is string { SubscriptionList|commons:APKError|NotFoundError subscriptionList = getSubscriptions(null, appId, "", 0, 0, organiztion); - if subscriptionList is ApplicationList { + if subscriptionList is SubscriptionList { test:assertTrue(true, "Successfully retrieved all subscriptions by API ID and App ID"); } else { test:assertFail("Error occured while retrieving all subscriptions"); @@ -296,7 +297,7 @@ function getSubscriptionListTest3() { function getSubscriptionListTest4() { // Providing nothing and retrieving all subscriptions SubscriptionList|commons:APKError|NotFoundError subscriptionList = getSubscriptions(null, null, "", 0, 0, organiztion); - if subscriptionList is ApplicationList { + if subscriptionList is SubscriptionList { test:assertTrue(true, "Successfully retrieved all subscriptions by API ID and App ID"); } else { test:assertFail("Error occured while retrieving all subscriptions"); diff --git a/devportal/devportal-domain-service/ballerina/tests/testUtils.bal b/devportal/devportal-domain-service/ballerina/tests/testUtils.bal index 599c08930..50faf7754 100644 --- a/devportal/devportal-domain-service/ballerina/tests/testUtils.bal +++ b/devportal/devportal-domain-service/ballerina/tests/testUtils.bal @@ -118,7 +118,7 @@ public isolated function addApplicationUsagePlanDAO(ApplicationRatePlan atp, str sql:ExecutionResult | sql:Error result = dbClient->execute(query); if result is sql:ExecutionResult { return atp; - } else if result is sql:Error { + } else { log:printDebug(result.toString()); string message = "Error while inserting data into Database"; return error(message, result, message = message, description = message, code = 909000, statusCode = 500); diff --git a/devportal/devportal-domain-service/ballerina/types.bal b/devportal/devportal-domain-service/ballerina/types.bal index bd6bb62c9..026dc191f 100644 --- a/devportal/devportal-domain-service/ballerina/types.bal +++ b/devportal/devportal-domain-service/ballerina/types.bal @@ -216,7 +216,7 @@ public type ScopeList record { public type APIList record { # Number of APIs returned. int count?; - APIInfo[] list?; + API[] list?; Pagination pagination?; }; @@ -543,7 +543,7 @@ public type KeyManagerApplicationConfiguration record { public type ApplicationList record { # Number of applications returned. int count?; - ApplicationInfo[] list?; + Application[] list?; Pagination pagination?; }; diff --git a/devportal/devportal-domain-service/docker/Dockerfile b/devportal/devportal-domain-service/docker/Dockerfile index f5365f762..37e6ce38c 100644 --- a/devportal/devportal-domain-service/docker/Dockerfile +++ b/devportal/devportal-domain-service/docker/Dockerfile @@ -9,18 +9,18 @@ RUN apt-get update \ && locale-gen en_US.UTF-8 \ && rm -rf /var/lib/apt/lists/* -ENV JAVA_VERSION jdk-11.0.17+8 +ENV JAVA_VERSION jdk-17.0.8.1+1 RUN set -eux; \ ARCH="$(dpkg --print-architecture)"; \ case "${ARCH}" in \ amd64|i386:x86-64) \ - ESUM='752616097e09d7f60a3ad8bd312f90eaf50ac72577e55df229fe6e8091148f79'; \ - BINARY_URL='https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.17%2B8/OpenJDK11U-jre_x64_linux_hotspot_11.0.17_8.tar.gz'; \ + ESUM='ab68857594792474a3049ede09ea1178e42df29803a6a41be771794f571b2d4e'; \ + BINARY_URL='https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.8.1%2B1/OpenJDK17U-jre_x64_linux_hotspot_17.0.8.1_1.tar.gz'; \ ;; \ aarch64|arm64) \ - ESUM='bd6efe3290c8b5a42f695a55a26f3e3c9c284288574879d4b7089f31f5114177'; \ - BINARY_URL='https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.17%2B8/OpenJDK11U-jre_aarch64_linux_hotspot_11.0.17_8.tar.gz'; \ + ESUM='0a1c5c9ee9d20832c87bd1e99a4c4a96947b59bb35c72683fe895d705f202737'; \ + BINARY_URL='https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.8.1%2B1/OpenJDK17U-jre_aarch64_linux_hotspot_17.0.8.1_1.tar.gz'; \ ;; \ *) \ echo "Unsupported arch: ${ARCH}"; \ diff --git a/devportal/devportal-domain-service/java/src/main/java/org/wso2/apk/devportal/sdk/APIClientGenerationManager.java b/devportal/devportal-domain-service/java/src/main/java/org/wso2/apk/devportal/sdk/APIClientGenerationManager.java index a92736278..14ba92af3 100644 --- a/devportal/devportal-domain-service/java/src/main/java/org/wso2/apk/devportal/sdk/APIClientGenerationManager.java +++ b/devportal/devportal-domain-service/java/src/main/java/org/wso2/apk/devportal/sdk/APIClientGenerationManager.java @@ -19,15 +19,12 @@ package org.wso2.apk.devportal.sdk; import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.openapitools.codegen.ClientOptInput; import org.openapitools.codegen.DefaultGenerator; import org.openapitools.codegen.config.CodegenConfigurator; -import org.wso2.apk.devportal.sdk.SDKConstants; -import org.wso2.apk.devportal.sdk.ZIPUtils; import java.io.BufferedWriter; import java.io.File; @@ -39,7 +36,6 @@ import java.util.HashMap; import java.util.Map; import java.util.UUID; -import java.util.zip.ZipOutputStream; /* * This class is used to generate SDKs for a given API