-
Notifications
You must be signed in to change notification settings - Fork 63
Support array result include sequence action #140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dgrove-oss
merged 14 commits into
apache:master
from
ningyougang:support-array-result-include-sequence-action
Aug 15, 2022
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
3e1cbcd
Support array result
ningyougang 3ea32fd
Change Launcher to support array
ningyougang 95bbf04
Make javaactionloop to support array as input
ningyougang 6274269
Fix test case error
ningyougang da7cc6d
Add test case
ningyougang ccffe21
Change depend
ningyougang d107659
Optimize test case
ningyougang 4a40fe0
Use go1.18 to build actionloop
ningyougang b99e99c
Change depend on master branch
ningyougang babd2c3
Add another test case for sequence action
ningyougang 574da16
Add document
ningyougang 177e122
Support sequence action for java8
ningyougang ea9e1bf
Fix test case
ningyougang 5bd39e4
Use relase for build java runtime
ningyougang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,9 +157,7 @@ class JavaActionContainerTests extends BasicActionRunnerTests with WskActorSyste | |
|
||
val expected = m match { | ||
case c if c == "x" || c == "!" => s"$errPrefix java.lang.ClassNotFoundException: example.HelloWhisk$c" | ||
case "#bogus" => | ||
s"$errPrefix java.lang.NoSuchMethodException: example.HelloWhisk.bogus(com.google.gson.JsonObject)" | ||
case _ => s"$errPrefix java.lang.NoSuchMethodException: example.HelloWhisk.main(com.google.gson.JsonObject)" | ||
case _ => s"$errPrefix java.lang.NoSuchMethodException" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Due to https://github.com/apache/openwhisk-runtime-java/pull/140/files#r939487201, need to change test case here for a small change as above. |
||
} | ||
|
||
val error = out.get.fields.get("error").get.toString() | ||
|
@@ -301,6 +299,56 @@ class JavaActionContainerTests extends BasicActionRunnerTests with WskActorSyste | |
}) | ||
} | ||
|
||
it should "support return array result" in { | ||
val (out, err) = withActionContainer() { c => | ||
val jar = JarBuilder.mkBase64Jar( | ||
Seq("", "HelloArrayWhisk.java") -> | ||
""" | ||
| import com.google.gson.JsonArray; | ||
| import com.google.gson.JsonObject; | ||
| | ||
| public class HelloArrayWhisk { | ||
| public static JsonArray main(JsonObject args) throws Exception { | ||
| JsonArray jsonArray = new JsonArray(); | ||
| jsonArray.add("a"); | ||
| jsonArray.add("b"); | ||
| return jsonArray; | ||
| } | ||
| } | ||
""".stripMargin.trim) | ||
|
||
val (initCode, _) = c.init(initPayload(jar, "HelloArrayWhisk")) | ||
initCode should be(200) | ||
|
||
val (runCode, runRes) = c.runForJsArray(runPayload(JsObject())) | ||
runCode should be(200) | ||
runRes shouldBe Some(JsArray(JsString("a"), JsString("b"))) | ||
} | ||
} | ||
|
||
it should "support array as input param" in { | ||
val (out, err) = withActionContainer() { c => | ||
val jar = JarBuilder.mkBase64Jar( | ||
Seq("", "HelloArrayWhisk.java") -> | ||
""" | ||
| import com.google.gson.JsonArray; | ||
| | ||
| public class HelloArrayWhisk { | ||
| public static JsonArray main(JsonArray args) throws Exception { | ||
| return args; | ||
| } | ||
| } | ||
""".stripMargin.trim) | ||
|
||
val (initCode, _) = c.init(initPayload(jar, "HelloArrayWhisk")) | ||
initCode should be(200) | ||
|
||
val (runCode, runRes) = c.runForJsArray(runPayload(JsArray(JsString("a"), JsString("b")))) | ||
runCode should be(200) | ||
runRes shouldBe Some(JsArray(JsString("a"), JsString("b"))) | ||
} | ||
} | ||
|
||
it should "survive System.exit" in { | ||
val (out, err) = withActionContainer() { c => | ||
val jar = JarBuilder.mkBase64Jar( | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because need to support array result, cannot instantiate mainMethod in
/init
step, should move this relative logic to/run
logic due to input param/out result can beJsonObject or JsonArray