You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by mr...@apache.org on 2017/07/10 20:54:05 UTC
[incubator-openwhisk-wskdeploy] branch master updated: Fixing JAR
failure (#278)
This is an automated email from the ASF dual-hosted git repository.
mrutkowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-wskdeploy.git
The following commit(s) were added to refs/heads/master by this push:
new bd782fb Fixing JAR failure (#278)
bd782fb is described below
commit bd782fb6153a9d2d8ff766bbb5340102c828d750
Author: Priti Desai <pd...@us.ibm.com>
AuthorDate: Mon Jul 10 13:54:03 2017 -0700
Fixing JAR failure (#278)
* Fixing JAR failure
Adding support for command line argument "--main" which is used to specify the name of the action entry point when such function is part of a class in case of Java runtime.
* Update manifest_parser.go
Fixing formatting issue.
* Update yamlparser.go
Fixing formatting issue
* Update manifest_parser.go
* Update manifest_parser.go
---
parsers/manifest_parser.go | 5 ++++
parsers/yamlparser.go | 1 +
tests/src/integration/jaraction/jaraction_test.go | 27 ++++++++++++++++++++++
tests/src/integration/jaraction/manifest.yaml | 7 ++++++
tests/src/integration/jaraction/src/Hello.java | 11 +++++++++
tests/src/integration/jaraction/src/hello.jar | Bin 0 -> 966 bytes
6 files changed, 51 insertions(+)
diff --git a/parsers/manifest_parser.go b/parsers/manifest_parser.go
index 01ad3ef..ce78662 100644
--- a/parsers/manifest_parser.go
+++ b/parsers/manifest_parser.go
@@ -274,6 +274,11 @@ func (dm *YAMLParser) ComposeActions(mani *ManifestYAML, manipath string) (ar []
wskaction.Exec.Kind = action.Runtime
}
+ // we can specify the name of the action entry point using main
+ if (action.Main != "") {
+ wskaction.Exec.Main = action.Main
+ }
+
keyValArr := make(whisk.KeyValueArr, 0)
for name, param := range action.Inputs {
var keyVal whisk.KeyValue
diff --git a/parsers/yamlparser.go b/parsers/yamlparser.go
index 1688946..384c054 100644
--- a/parsers/yamlparser.go
+++ b/parsers/yamlparser.go
@@ -64,6 +64,7 @@ type Action struct {
//Parameters map[string]interface{} `yaml:parameters` // used in manifest.yaml
ExposedUrl string `yaml:"exposedUrl"` // used in manifest.yaml
Webexport string `yaml:"web-export"` // used in manifest.yaml
+ Main string `yaml:"main"` // used in manifest.yaml
}
type Sequence struct {
diff --git a/tests/src/integration/jaraction/jaraction_test.go b/tests/src/integration/jaraction/jaraction_test.go
new file mode 100644
index 0000000..94b5363
--- /dev/null
+++ b/tests/src/integration/jaraction/jaraction_test.go
@@ -0,0 +1,27 @@
+// +build integration
+
+package tests
+
+import (
+ "github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/common"
+ "github.com/stretchr/testify/assert"
+ "os"
+ "testing"
+)
+
+
+var wskprops = common.GetWskprops()
+
+func TestZipAction(t *testing.T) {
+ os.Setenv("__OW_API_HOST", wskprops.APIHost)
+ wskdeploy := common.NewWskdeploy()
+ _, err := wskdeploy.Deploy(manifestPath, deploymentPath)
+ assert.Equal(t, nil, err, "Failed to deploy based on the manifest and deployment files.")
+ _, err = wskdeploy.Undeploy(manifestPath, deploymentPath)
+ assert.Equal(t, nil, err, "Failed to undeploy based on the manifest and deployment files.")
+}
+
+var (
+ manifestPath = os.Getenv("GOPATH") + "/src/github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/jaraction/manifest.yaml"
+ deploymentPath = ""
+)
diff --git a/tests/src/integration/jaraction/manifest.yaml b/tests/src/integration/jaraction/manifest.yaml
new file mode 100644
index 0000000..34befa4
--- /dev/null
+++ b/tests/src/integration/jaraction/manifest.yaml
@@ -0,0 +1,7 @@
+package:
+ name: helloworldjar
+ actions:
+ helloworld:
+ location: src/hello.jar
+ runtime: java
+ main: Hello
diff --git a/tests/src/integration/jaraction/src/Hello.java b/tests/src/integration/jaraction/src/Hello.java
new file mode 100644
index 0000000..7412e54
--- /dev/null
+++ b/tests/src/integration/jaraction/src/Hello.java
@@ -0,0 +1,11 @@
+import com.google.gson.JsonObject;
+public class Hello {
+ public static JsonObject main(JsonObject args) {
+ String name = "stranger";
+ if (args.has("name"))
+ name = args.getAsJsonPrimitive("name").getAsString();
+ JsonObject response = new JsonObject();
+ response.addProperty("greeting", "Hello " + name + "!");
+ return response;
+ }
+}
diff --git a/tests/src/integration/jaraction/src/hello.jar b/tests/src/integration/jaraction/src/hello.jar
new file mode 100644
index 0000000..b05753f
Binary files /dev/null and b/tests/src/integration/jaraction/src/hello.jar differ
--
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].