Add travis scripts for RSS package. (#20)

* Add travis scripts for RSS package.

* Add install package script.

* Add test scripts for scala code.
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..568d840
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,31 @@
+# A Travis CI configuration file.
+sudo: required
+
+language: go
+
+go:
+  - 1.8
+
+services:
+  - docker
+
+git:
+  depth: 3
+
+before_install:
+  - ./tools/travis/cloneutils.sh
+
+install:
+  - export DEPLOY_BUILD_READY=false
+  - go get -u github.com/golang/lint/golint
+  - go get -u github.com/stretchr/testify
+
+script:
+  - echo $TRAVIS
+  - echo $TRAVIS_PULL_REQUEST
+  - echo $TRAVIS_SECURE_ENV_VARS
+  - printenv
+  - ./tools/travis/script.sh
+
+after_success:
+  - DEPLOY_BUILD_READY=true
diff --git a/install.sh b/install.sh
index 598265a..99aaf94 100755
--- a/install.sh
+++ b/install.sh
@@ -33,12 +33,12 @@
 PACKAGE_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 echo Installing RSS Package \
 
-$WSK_CLI --apihost $APIHOST package update --auth $AUTH --shared yes -p apiHost $APIHOST -p provider_endpoint $PROVIDER_ENDPOINT rss \
+$WSK_CLI -i --apihost $APIHOST package update rss --auth $AUTH --shared yes \
     -a description "RSS Package" \
     -a parameters '[{"name":"provider_endpoint","required":true,"bindTime":true,"description":"RSS provider host"}]'
 
 
-$WSK_CLI --apihost $APIHOST action update --auth $AUTH --shared yes rss/rss_feed $PACKAGE_HOME/feeds/feed.js \
+$WSK_CLI -i --apihost $APIHOST action update rss/rss_feed $PACKAGE_HOME/feeds/feed.js --auth $AUTH \
     -a feed true \
 	-a description "A feed action to register for rss events meeting user specified criteria" \
 	-a parameters '[{"name":"url","required":true,"bindTime":true,"description":"Source URL"},{"name":"pollingInterval","required":true,"bindTime":true,"description":"RSS polling interval"},{"name":"filter","required":false,"bindTime":true,"description":"Comma separated list of keywords to watch for"}]' \
diff --git a/tests/src/RSSTests.scala b/tests/src/RSSTests.scala
index 81813c5..591b4d4 100644
--- a/tests/src/RSSTests.scala
+++ b/tests/src/RSSTests.scala
@@ -15,28 +15,26 @@
  * limitations under the License.
  */
 
-package packages
+package rss
 
 import common._
 import org.junit.runner.RunWith
 import org.scalatest.Matchers
 import org.scalatest.junit.JUnitRunner
-import spray.json._
-import spray.json.DefaultJsonProtocol.StringJsonFormat
-import scala.collection.immutable.HashMap
-import org.scalatest.FlatSpecLike
+import common.TestHelpers
+import common.TestUtils._
+import common.Wsk
+import common.WskProps
+import common.WskTestHelpers
 
 @RunWith(classOf[JUnitRunner])
-class TemplateTests extends TestHelpers with WskTestHelpers with Matchers {
+class RSSTests extends TestHelpers with WskTestHelpers with Matchers {
 
   implicit val wskprops = WskProps()
   val wsk = new Wsk()
 
-  //val credentials = TestUtils.getVCAPcredentials("openwhisk-local")
-  //val apiKey = credentials.get("apiKey");
-
-  behavior of "Rss Package"
-
+    behavior of "Rss Package"
+    /*
     "trigger creation" should "return ok: created trigger feed" in {
     val triggerName = "trigger_rss_update"
     val feed = Some("/guest/rss/rss_feed")
@@ -47,11 +45,23 @@
     res.toString should include("ok: created trigger feed")
     }
 
+
     "trigger deletion" should "return ok: deleted" in {
     val triggerName = "trigger_rss_update"
 
     var res = wsk.trigger.delete(triggerName);
     res.toString should include("ok: deleted ")
     }
-}
+    */
 
+    it should "not create a trigger when feed fails to initialize" in withAssetCleaner(wskprops) { (wp, assetHelper) =>
+        assetHelper.withCleaner(wsk.trigger, "badfeed", confirmDelete = false) { (trigger, name) =>
+          trigger.create(name, feed = Some(s"bogus"), expectedExitCode = ANY_ERROR_EXIT).exitCode should equal(NOT_FOUND)
+          trigger.get(name, expectedExitCode = NOT_FOUND)
+
+          trigger.create(name, feed = Some(s"bogus/feed"), expectedExitCode = ANY_ERROR_EXIT).exitCode should equal(
+            NOT_FOUND)
+          trigger.get(name, expectedExitCode = NOT_FOUND)
+        }
+      }
+}
diff --git a/tools/travis/build.sh b/tools/travis/build.sh
index f27106a..da55045 100755
--- a/tools/travis/build.sh
+++ b/tools/travis/build.sh
@@ -1,3 +1,4 @@
+#!/usr/bin/env bash
 # Build script for Travis-CI.
 
 SCRIPTDIR=$(cd $(dirname "$0") && pwd)
diff --git a/tools/travis/cloneutils.sh b/tools/travis/cloneutils.sh
new file mode 100755
index 0000000..5a38d3f
--- /dev/null
+++ b/tools/travis/cloneutils.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+set -o xtrace
+
+SCRIPTDIR=$(cd $(dirname "$0") && pwd)
+HOMEDIR="$SCRIPTDIR/../../../"
+
+# clone OpenWhisk repo. in order to run scanCode.py
+cd $HOMEDIR
+git clone https://github.com/apache/incubator-openwhisk-utilities.git
diff --git a/tools/travis/scancode.sh b/tools/travis/scancode.sh
new file mode 100755
index 0000000..2202c45
--- /dev/null
+++ b/tools/travis/scancode.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+set -e
+
+# Build script for Travis-CI.
+SCRIPTDIR=$(cd $(dirname "$0") && pwd)
+ROOTDIR="$SCRIPTDIR/../.."
+UTIL_DIR="$ROOTDIR/../incubator-openwhisk-utilities"
+
+# run scancode
+cd $UTIL_DIR
+scancode/scanCode.py $ROOTDIR
\ No newline at end of file
diff --git a/tools/travis/script.sh b/tools/travis/script.sh
new file mode 100755
index 0000000..6443711
--- /dev/null
+++ b/tools/travis/script.sh
@@ -0,0 +1,51 @@
+#!/usr/bin/env bash
+
+set -e
+
+cd $TRAVIS_BUILD_DIR
+./tools/travis/scancode.sh
+export PATH=$PATH:$TRAVIS_BUILD_DIR
+
+HOMEDIR="$(dirname "$TRAVIS_BUILD_DIR")"
+cd $HOMEDIR
+
+# OpenWhisk clone to fixed directory location
+git clone --depth 3 https://github.com/apache/incubator-openwhisk.git openwhisk
+
+# Build script for Travis-CI.
+WHISKDIR="$HOMEDIR/openwhisk"
+
+cd $WHISKDIR
+./tools/travis/setup.sh
+
+ANSIBLE_CMD="ansible-playbook -i environments/local -e docker_image_prefix=openwhisk"
+
+cd $WHISKDIR/ansible
+$ANSIBLE_CMD setup.yml
+$ANSIBLE_CMD prereq.yml
+$ANSIBLE_CMD couchdb.yml
+$ANSIBLE_CMD initdb.yml
+
+$ANSIBLE_CMD wipe.yml
+$ANSIBLE_CMD openwhisk.yml -e '{"openwhisk_cli":{"installation_mode":"remote","remote":{"name":"OpenWhisk_CLI","dest_name":"OpenWhisk_CLI","location":"https://github.com/apache/incubator-openwhisk-cli/releases/download/latest"}}}'
+
+
+export OPENWHISK_HOME="$(dirname "$TRAVIS_BUILD_DIR")/openwhisk"
+
+WHISKPROPS_FILE="$OPENWHISK_HOME/whisk.properties"
+
+WSK_CLI=$OPENWHISK_HOME/bin/wsk
+AUTH_KEY=$(cat $OPENWHISK_HOME/ansible/files/auth.whisk.system)
+EDGE_HOST=$(grep '^edge.host=' $WHISKPROPS_FILE | cut -d'=' -f2)
+
+# Install the package
+cd $TRAVIS_BUILD_DIR
+source install.sh $EDGE_HOST $AUTH_KEY $WSK_CLI
+
+mkdir $OPENWHISK_HOME/tests/src/test/scala/rss
+cp tests/src/* $OPENWHISK_HOME/tests/src/test/scala/rss/
+
+cd $OPENWHISK_HOME
+X="./gradlew :tests:test --tests rss.RSSTests "
+# for f in $(ls $OPENWHISK_HOME/tests/src/test/scala | sed -e 's/\..*$//'); do X="$X --tests \"rss.$f\""; done
+eval $X