ballerina-lang icon indicating copy to clipboard operation
ballerina-lang copied to clipboard

Add runtime APIs to call module init, start, stop and function invocations from a Ballerina project

Open gabilang opened this issue 1 year ago • 4 comments

Purpose

$title

Fixes #42128

Approach

Describe how you are implementing the solutions along with the design details.

Samples

Runtime balRuntime = Runtime.from(new Module("orgName", "moduleName", "majorVersion"));
balRuntime.init();
balRuntime.start();
Object[] args = [];
balRuntime.invokeMethodAsync(“functionName”, args, callback);
balRuntime.stop(“org”, “module”, 1.0.0);

Remarks

List any other known issues, related PRs, TODO items, or any other notes related to the PR.

Check List

  • [x] Read the Contributing Guide
  • [ ] Updated Change Log
  • [ ] Checked Tooling Support (#<Issue Number>)
  • [ ] Added necessary tests
    • [ ] Unit Tests
    • [ ] Spec Conformance Tests
    • [x] Integration Tests
    • [ ] Ballerina By Example Tests
  • [ ] Increased Test Coverage
  • [ ] Added necessary documentation
    • [ ] API documentation
    • [ ] Module documentation in Module.md files
    • [ ] Ballerina By Examples

gabilang avatar Mar 20 '24 11:03 gabilang

Codecov Report

Attention: Patch coverage is 8.79121% with 83 lines in your changes are missing coverage. Please review.

Project coverage is 76.55%. Comparing base (572e01d) to head (85939a4). Report is 122 commits behind head on master.

Files Patch % Lines
...java/io/ballerina/runtime/internal/BalRuntime.java 7.27% 51 Missing :warning:
.../ballerina/runtime/internal/util/RuntimeUtils.java 0.00% 30 Missing :warning:
...rc/main/java/io/ballerina/runtime/api/Runtime.java 0.00% 2 Missing :warning:
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #42363      +/-   ##
============================================
- Coverage     76.56%   76.55%   -0.01%     
- Complexity    53422    53521      +99     
============================================
  Files          2902     2905       +3     
  Lines        201858   202259     +401     
  Branches      26271    26334      +63     
============================================
+ Hits         154547   154848     +301     
- Misses        38840    38924      +84     
- Partials       8471     8487      +16     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Mar 20 '24 13:03 codecov[bot]

@gabilang Shall we create an issue to investigate why code coverage is low even tests are covered?

warunalakshitha avatar Mar 28 '24 11:03 warunalakshitha

Will fix the code-coverage issue separately. Created a task for it https://github.com/ballerina-platform/ballerina-lang/issues/42427

gabilang avatar Mar 28 '24 11:03 gabilang

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Mar 28 '24 13:03 CLAassistant