Initial check-in of package test code for wskdeploy GitHub webhook integration. (#2)
* Initial check-in of package test code for wskdeploy GitHub webhook integration.
* Initial check-in of package test code for wskdeploy GitHub webhook integration.
diff --git a/README.md b/README.md
index b7397e1..6452c38 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,12 @@
# incubator-openwhisk-test
-Test repo for gitbox
-just testing provenance :)
-sending borks..
+[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0)
-makin ponies
+This repository is used for integration testing of OpenWhisk tooling with GitHub itself.
-More ponies!!
+Currently, it is being used to test GitHub (event) integration for the following sub-projects:
+- [https://github.com/apache/incubator-openwhisk-wskdeploy](https://github.com/apache/incubator-openwhisk-wskdeploy).
+ Used to test GitHub as an Event Provider using the OpenWhisk GitHub webhook:
+ * [Test -> Integration -> Dependency](https://github.com/apache/incubator-openwhisk-wskdeploy/tree/master/tests/src/integration/dependency)
+ * [Test -> Use Cases -> GitHub](https://github.com/apache/incubator-openwhisk-wskdeploy/tree/master/tests/usecases/github)
+ * [Test -> Use Cases -> Dependency](https://github.com/apache/incubator-openwhisk-wskdeploy/tree/master/tests/usecases/dependency)
diff --git a/manifest.yaml b/manifest.yaml
new file mode 100644
index 0000000..6af8f54
--- /dev/null
+++ b/manifest.yaml
@@ -0,0 +1,9 @@
+# Test manifest for incubator-openwhisk-wskdeploy utility
+# See https://github.com/apache/incubator-openwhisk-wskdeploy/tree/master/tests/src/integration/dependency
+package:
+ name: hellowhisk
+ actions:
+ greeting:
+ location: src/greeting.js
+ httpGet:
+ location: src/httpGet.swift
diff --git a/src/greeting.js b/src/greeting.js
new file mode 100644
index 0000000..2a6fc73
--- /dev/null
+++ b/src/greeting.js
@@ -0,0 +1,14 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more contributor
+// license agreements; and to You under the Apache License, Version 2.0.
+
+**
+ * Return a simple greeting message for someone.
+ *
+ * @param name A person's name.
+ * @param place Where the person is from.
+ */
+function main(params) {
+ var name = params.name || params.payload || 'stranger';
+ var place = params.place || 'somewhere';
+ return {payload: 'Hello, ' + name + ' from ' + place + '!'};
+}
diff --git a/src/httpGet.swift b/src/httpGet.swift
new file mode 100644
index 0000000..fd2cc65
--- /dev/null
+++ b/src/httpGet.swift
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more contributor
+// license agreements; and to You under the Apache License, Version 2.0.
+
+**
+ * Sample code using the experimental Swift 3 runtime
+ * with links to KituraNet and GCD
+ */
+
+import KituraNet
+import Dispatch
+import Foundation
+import SwiftyJSON
+
+func main(args:[String:Any]) -> [String:Any] {
+
+ // Force KituraNet call to run synchronously on a global queue
+ var str = "No response"
+
+ HTTP.get("https://httpbin.org/get") { response in
+ do {
+ str = try response!.readString()!
+ } catch {
+ print("Error \(error)")
+ }
+ }
+
+
+ // Assume string is JSON
+ print("Got string \(str)")
+ var result:[String:Any]?
+
+ // Convert to NSData
+ let data = str.data(using: String.Encoding.utf8, allowLossyConversion: true)!
+
+ // test SwiftyJSON
+ let json = JSON(data: data)
+ if let jsonUrl = json["url"].string {
+ print("Got json url \(jsonUrl)")
+ } else {
+ print("JSON DID NOT PARSE")
+ }
+
+ // create result object to return
+
+ do {
+
+ result = try JSONSerialization.jsonObject(with: data, options: []) as? [String:Any] } catch {
+ print("Error \(error)")
+ }
+
+ // return, which should be a dictionary
+ print("Result is \(result!)")
+ return result!
+}