diff --git a/modules/export/pom.xml b/modules/export/pom.xml
index 5b83c9dcb..163f5901f 100644
--- a/modules/export/pom.xml
+++ b/modules/export/pom.xml
@@ -32,6 +32,10 @@
${project.artifactId}
+
+ net.jodah
+ failsafe
+ org.apache.httpcomponentshttpclient
diff --git a/modules/export/src/main/java/com/intuit/wasabi/export/rest/RestEndPoint.java b/modules/export/src/main/java/com/intuit/wasabi/export/rest/RestEndPoint.java
index 181ef8848..e8935a4ef 100644
--- a/modules/export/src/main/java/com/intuit/wasabi/export/rest/RestEndPoint.java
+++ b/modules/export/src/main/java/com/intuit/wasabi/export/rest/RestEndPoint.java
@@ -15,6 +15,8 @@
*******************************************************************************/
package com.intuit.wasabi.export.rest;
+import net.jodah.failsafe.RetryPolicy;
+
import java.net.URI;
/**
@@ -40,6 +42,12 @@ public interface RestEndPoint {
*/
int getRetries();
+ /**
+ * Retry policy
+ * @return retry policy
+ */
+ RetryPolicy getRetryPolicy();
+
/**
* Configuration parames for rest endpoint
*/
@@ -80,5 +88,20 @@ interface Configuration {
* @return retries
*/
int getRetries();
+
+ /**
+ * Is exponential backoff enabled
+ */
+ boolean isExponentialBackoffEnabled();
+
+ /**
+ * Get exponential backoff initial delay
+ */
+ long getExponentialBackoffDelay();
+
+ /**
+ * Get exponential backoff max delay
+ */
+ long getExponentialBackoffMaxDelay();
}
}
diff --git a/modules/export/src/main/java/com/intuit/wasabi/export/rest/impl/DefaultRestEndPoint.java b/modules/export/src/main/java/com/intuit/wasabi/export/rest/impl/DefaultRestEndPoint.java
index 374a51658..8332ee4bc 100644
--- a/modules/export/src/main/java/com/intuit/wasabi/export/rest/impl/DefaultRestEndPoint.java
+++ b/modules/export/src/main/java/com/intuit/wasabi/export/rest/impl/DefaultRestEndPoint.java
@@ -17,11 +17,13 @@
import com.google.inject.Inject;
import com.intuit.wasabi.export.rest.RestEndPoint;
+import net.jodah.failsafe.RetryPolicy;
import org.apache.http.client.utils.URIBuilder;
import org.slf4j.Logger;
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.concurrent.TimeUnit;
import static org.slf4j.LoggerFactory.getLogger;
@@ -62,4 +64,14 @@ public Boolean useProxy() {
public int getRetries() {
return configuration.getRetries();
}
+
+ @Override
+ public RetryPolicy getRetryPolicy() {
+ RetryPolicy retryPolicy = new RetryPolicy().withMaxRetries(configuration.getRetries());
+ if (configuration.isExponentialBackoffEnabled()) {
+ retryPolicy = retryPolicy.withBackoff(configuration.getExponentialBackoffDelay(),
+ configuration.getExponentialBackoffMaxDelay(), TimeUnit.SECONDS);
+ }
+ return retryPolicy;
+ }
}
diff --git a/modules/export/src/main/java/com/intuit/wasabi/export/rest/impl/DefaultRestEndPointConfiguration.java b/modules/export/src/main/java/com/intuit/wasabi/export/rest/impl/DefaultRestEndPointConfiguration.java
index 9b88cb78a..528654f8d 100644
--- a/modules/export/src/main/java/com/intuit/wasabi/export/rest/impl/DefaultRestEndPointConfiguration.java
+++ b/modules/export/src/main/java/com/intuit/wasabi/export/rest/impl/DefaultRestEndPointConfiguration.java
@@ -93,4 +93,34 @@ public Boolean useProxy() {
public int getRetries() {
return Integer.parseInt((String) properties.get("export.rest.retries"));
}
+
+ /**
+ * Returns the export rest endpoint is exponential backoff enabled property.
+ *
+ * @return whether exponential backoff is enabled for retries
+ */
+ @Override
+ public boolean isExponentialBackoffEnabled() {
+ return Boolean.parseBoolean(properties.getProperty("export.rest.isExponentialBackoffEnabled"));
+ }
+
+ /**
+ * Returns the export rest endpoint exponential backoff initial delay
+ *
+ * @return initial interval size between retries with exponential backoff enabled
+ */
+ @Override
+ public long getExponentialBackoffDelay() {
+ return Long.parseLong(properties.getProperty("export.rest.exponentialBackoffDelay"));
+ }
+
+ /**
+ * Returns the export rest endpoint exponential backoff max delay
+ *
+ * @return the maximum interval size until which retries are going to continue with exponential backoff strategy
+ */
+ @Override
+ public long getExponentialBackoffMaxDelay() {
+ return Long.parseLong(properties.getProperty("export.rest.exponentialBackoffMaxDelay"));
+ }
}
diff --git a/modules/functional-test/README.md b/modules/functional-test/README.md
index d8945b6b3..6bde893ff 100644
--- a/modules/functional-test/README.md
+++ b/modules/functional-test/README.md
@@ -5,6 +5,30 @@ The tests use [TestNG](http://testng.org/doc/) and are implemented using
[rest-assured](https://github.com/jayway/rest-assured/wiki/Usage) and
[Gson](https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/index.html).
+#Running Integration Test in Vagrant
+
+Prerequisite:
+* cd [workspace]/wasabi. mvn clean install
+* Install Oracle VM VirtualBox (version 5.1.18 or higher) and Vagrant (version 1.9.3 or higher).
+
+Mac installation instructions with brew
+```shell
+# install vagrant
+% brew cask install vagrant
+# install virtualbox
+% brew cask install virtualbox
+% brew cask install vagrant-manager
+# install vagrant's omnibus
+% vagrant plugin install vagrant-omnibus
+```
+
+To run all integration tests defined in testng.xml, simply do the following.
+* cd [workspace]/wasabi/modules/functional-test
+* vagrant up (this step will install dependencies (jdk, Cassandra, MySQL), install Wasabi app, create Cassandra tables, start up Wasabi app, run integration tests, stops Wasabi app and generate Jacoco file for code coverage)
+* Test output will be saved in [workspace]/wasabi/modules/functional-test/target/integration-test.out
+* vagrant destroy (this will destroy the VM)
+
+**NOTE:** jacoco-it.exec will be stored at [workspace]/wasabi/modules/functional-test/target/jacoco
#Checklist
diff --git a/modules/functional-test/Vagrantfile b/modules/functional-test/Vagrantfile
new file mode 100644
index 000000000..0d982588f
--- /dev/null
+++ b/modules/functional-test/Vagrantfile
@@ -0,0 +1,21 @@
+Vagrant.configure("2") do |config|
+
+ config.vm.box = 'bento/centos-7.2'
+ config.vm.provision "shell", :path => "provision.sh"
+ config.vm.provision "shell", :path => "target/scripts/migration.sh"
+ config.vm.provision "shell", :path => "target/scripts/server-start.sh"
+ config.vm.provision "shell", :path => "target/scripts/run-it.sh"
+ config.vm.provision "shell", :path => "target/scripts/server-stop.sh"
+
+ config.vm.define :wasabiosit do |dev|
+ dev.vm.hostname = "wasabi.os.it"
+ dev.vm.boot_timeout = 3000
+
+ dev.vm.provider "virtualbox" do |v|
+ v.name = "wasabi.os.it.vbox"
+ v.memory = 4096
+ v.cpus = 4
+ v.customize ["modifyvm", :id, "--cableconnected1", "on"]
+ end
+ end
+end
\ No newline at end of file
diff --git a/modules/functional-test/pom.xml b/modules/functional-test/pom.xml
index 130bf0681..e28dfd331 100755
--- a/modules/functional-test/pom.xml
+++ b/modules/functional-test/pom.xml
@@ -66,6 +66,132 @@
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ unpack
+ prepare-package
+
+ unpack
+
+
+
+
+ com.intuit.wasabi
+ wasabi-repository-datastax
+ ${version}
+ jar
+ com/intuit/wasabi/repository/impl/cassandra/migration/*.*
+ ./target/mutation
+
+
+
+
+
+
+
+ maven-resources-plugin
+ 2.7
+
+
+ copy-main-resource
+ package
+
+ copy-resources
+
+
+ ${basedir}/target
+
+
+ ${basedir}/../../modules/main/target/
+
+ *-all.jar
+
+
+
+
+
+
+
+
+ maven-resources-plugin
+ 2.7
+
+
+ filter-resources
+ package
+
+ copy-resources
+
+
+ ${basedir}/target/scripts
+
+
+ src/main/resources-filtered
+ true
+
+ **/server-start.sh
+ **/cassandra_migration_rc.sh
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ copy-jacoco-runtime-resource
+ package
+
+ copy
+
+
+
+
+ org.jacoco
+ org.jacoco.agent
+ ${jacoco.version}
+ runtime
+ jar
+
+
+ ./target
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ copy-cassandra-migration-resource
+ package
+
+ copy
+
+
+
+
+ com.builtamont
+ cassandra-migration
+ ${cassandra.migration.version}
+ jar-with-dependencies
+ jar
+
+
+ ./target
+
+
+
+
diff --git a/modules/functional-test/provision.sh b/modules/functional-test/provision.sh
new file mode 100755
index 000000000..a54d05585
--- /dev/null
+++ b/modules/functional-test/provision.sh
@@ -0,0 +1,61 @@
+###############################################################################
+# Copyright 2017 Intuit
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###############################################################################
+#!/usr/bin/env bash
+
+exec > >(tee ./provision.log|logger -t provision -s 2>/dev/console)
+
+sudo yum -y install wget
+sudo yum -y install vim
+
+# install apache
+yum -y install httpd
+sudo service httpd start
+
+# install Oracle JDK
+wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u92-b14/jdk-8u92-linux-x64.rpm"
+sudo yum -y localinstall jdk-8u92-linux-x64.rpm
+
+cat <>${CONSOLE_LOG} 2>&1 &
diff --git a/modules/functional-test/src/main/scripts/create_keyspace.sh b/modules/functional-test/src/main/scripts/create_keyspace.sh
new file mode 100755
index 000000000..b5385377a
--- /dev/null
+++ b/modules/functional-test/src/main/scripts/create_keyspace.sh
@@ -0,0 +1,39 @@
+###############################################################################
+# Copyright 2017 Intuit
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###############################################################################
+#!/usr/bin/env bash
+
+echo "Creating Keyspace ${CASSANDRA_KEYSPACE_PREFIX}_experiments if it not exits"
+echo "cqlsh " \
+ "-e \"CREATE KEYSPACE IF NOT EXISTS ${CASSANDRA_KEYSPACE_PREFIX}_experiments WITH replication = {'class' : 'NetworkTopologyStrategy', 'datacenter1' : ${CASSANDRA_REPLICATION:-1}};\"" \
+ "--username=${CQLSH_USERNAME}" \
+ "--password=\"${CQLSH_PASSWORD}\"" \
+ "${CQLSH_HOST:-localhost}" \
+ "${CASSANDRA_PORT:-9042}"
+
+cqlsh \
+ -e "CREATE KEYSPACE IF NOT EXISTS ${CASSANDRA_KEYSPACE_PREFIX}_experiments WITH replication = {'class' : 'NetworkTopologyStrategy', 'datacenter1' : ${CASSANDRA_REPLICATION:-1}};" \
+ --username=${CQLSH_USERNAME} \
+ --password="${CQLSH_PASSWORD}" \
+ ${CQLSH_HOST:-localhost} \
+ ${CASSANDRA_PORT:-9042}
+
+
+if [ $? -ne 0 ]; then
+ echo "failed to execute the create keyspace command. Please contact administrator."
+ exit 1;
+fi
+
+echo "Done creating keyspace"
\ No newline at end of file
diff --git a/modules/functional-test/src/main/scripts/logback.xml b/modules/functional-test/src/main/scripts/logback.xml
new file mode 100644
index 000000000..9c85377ae
--- /dev/null
+++ b/modules/functional-test/src/main/scripts/logback.xml
@@ -0,0 +1,29 @@
+
+
+
+ wasabi-intuit-main
+
+
+
+ %-4relative [%thread] %-5level %logger{35} - %msg %n
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/functional-test/src/main/scripts/logging.properties b/modules/functional-test/src/main/scripts/logging.properties
new file mode 100644
index 000000000..204406459
--- /dev/null
+++ b/modules/functional-test/src/main/scripts/logging.properties
@@ -0,0 +1,73 @@
+###############################################################################
+# Copyright 2017 Intuit
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###############################################################################
+############################################################
+# Default Logging Configuration File
+#
+# You can use a different file by specifying a filename
+# with the java.util.logging.config.file system property.
+# For example java -Djava.util.logging.config.file=myfile
+############################################################
+
+############################################################
+# Global properties
+############################################################
+
+# "handlers" specifies a comma separated list of log Handler
+# classes. These handlers will be installed during VM startup.
+# Note that these classes must be on the system classpath.
+# By default we only configure a ConsoleHandler, which will only
+# show messages at the INFO and above levels.
+handlers= java.util.logging.ConsoleHandler
+
+# To also add the FileHandler, use the following line instead.
+#handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler
+
+# Default global logging level.
+# This specifies which kinds of events are logged across
+# all loggers. For any given facility this global level
+# can be overriden by a facility specific level
+# Note that the ConsoleHandler also has a separate level
+# setting to limit messages printed to the console.
+.level= WARNING
+
+############################################################
+# Handler specific properties.
+# Describes specific configuration info for Handlers.
+############################################################
+
+# default file output is in user's home directory.
+java.util.logging.FileHandler.pattern = %h/java%u.log
+java.util.logging.FileHandler.limit = 50000
+java.util.logging.FileHandler.count = 1
+java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
+
+# Limit the message that are printed on the console to INFO and above.
+java.util.logging.ConsoleHandler.level = INFO
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+
+# Example to customize the SimpleFormatter output format
+# to print one-line log message like this:
+# : []
+#
+# java.util.logging.SimpleFormatter.format=%4$s: %5$s [%1$tc]%n
+
+############################################################
+# Facility specific properties.
+# Provides extra control for each logger.
+############################################################
+
+# For example, set the com.xyz.foo logger to only log SEVERE
+# messages:
diff --git a/modules/functional-test/src/main/scripts/migration.sh b/modules/functional-test/src/main/scripts/migration.sh
new file mode 100755
index 000000000..6740844c8
--- /dev/null
+++ b/modules/functional-test/src/main/scripts/migration.sh
@@ -0,0 +1,24 @@
+###############################################################################
+# Copyright 2017 Intuit
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###############################################################################
+#!/usr/bin/env bash
+
+# source environment variables needed for migration tool
+source /vagrant/target/scripts/cassandra_migration_rc.sh
+
+# create keyspace
+source /vagrant/target/scripts/create_keyspace.sh
+# run migration tool to execute cql scripts
+source /vagrant/target/scripts/schema_migration.sh
\ No newline at end of file
diff --git a/modules/functional-test/src/main/scripts/run-functional-tests.sh b/modules/functional-test/src/main/scripts/run-functional-tests.sh
new file mode 100755
index 000000000..857664cfa
--- /dev/null
+++ b/modules/functional-test/src/main/scripts/run-functional-tests.sh
@@ -0,0 +1,102 @@
+###############################################################################
+# Copyright 2017 Intuit
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###############################################################################
+#!/usr/bin/env bash
+# Script to run the Java/TestNG based functional tests for Wasabi
+#
+# Relying on
+# 1: Maven's maven-assembly-plugin producing a jar with all dependencies
+# 2: Maven filtering to substitue values for variables: application.http.host, application.http.port, version
+
+# Reading command line args
+while getopts ":s:h:p:n:" opt; do
+ case $opt in
+ s) api_server="$OPTARG"
+ ;;
+ h) proxy_host="$OPTARG"
+ ;;
+ p) proxy_port="$OPTARG"
+ ;;
+ n) non_proxy_hosts="$OPTARG"
+ ;;
+ \?) echo "Invalid option -$OPTARG" >&2
+ ;;
+ esac
+done
+
+# Prep
+root=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd ) # The dir above the location of this script
+cd "$root" # ..../modules/wasabi-functional-test/target
+echo "wasabi-functional-test's root = $root"
+
+archivedir=functional-test-archive # To collect files for Jenkins to archive
+mkdir -p $archivedir
+
+# Next lines will give error "bad substituion" if the vars are not substitueted by Maven,
+# but script works with default values set below.
+HOST=${application.http.host}
+PORT=${application.http.port}
+USER_NAME=${application.user.name}
+USER_PWD=${application.user.password}
+EMAIL=${application.user.email}
+LASTNAME=${application.user.lastname}
+
+HOST=${HOST:-"localhost"}
+PORT=${PORT:-"8080"}
+USER_NAME=${USER_NAME:-"admin"}
+USER_PWD=${USER_PWD:-"admin"}
+EMAIL=${EMAIL:-"admin@example.com"}
+LASTNAME=${LASTNAME:-"Admin"}
+
+functional_test_jar=`ls wasabi-functional-test-*-jar-with-dependencies.jar`
+outputdir=$archivedir/functional-testng-out
+testngxml=classes/testng.xml
+logxmldir=classes # Directory that has logback.xml configurration file
+
+echo "functional_test_jar = $functional_test_jar"
+echo "outputdir = $outputdir"
+echo "archivedir = $archivedir"
+echo "testngxml = $testngxml"
+echo "logxmldir = $logxmldir"
+
+echo "USER_NAME=${USER_NAME}"
+echo "USER_PWD=${USER_PWD}"
+echo "EMAIL=${EMAIL}"
+echo "LASTNAME=${LASTNAME}"
+if [[ -z "$api_server" ]]; then
+ api_server=${HOST}:${PORT}
+fi
+
+command="java -Duser-name=${USER_NAME} -Dpassword=${USER_PWD} -Duser-email=${EMAIL} \
+ -Duser-lastname=${LASTNAME} -Dapi.server.name=$api_server -Dhttp.proxyHost=$proxy_host \
+ -Dhttp.proxyPort=$proxy_port -Dhttp.nonProxyHosts=$non_proxy_hosts -Duser.name=${USER_NAME} \
+ -Duser.password=${USER_PWD} -classpath $logxmldir/:$functional_test_jar org.testng.TestNG -d $outputdir $testngxml"
+
+# Run
+echo Going to run $command
+echo "command = $command"
+$command
+
+# Post process. Prep archive for jenkins
+echo "Copying post process archive files for Jenkins"
+cp ../*.xml $archivedir/
+cp ./*.log $archivedir/
+cp -rp apidocs $archivedir/
+cp -rp scripts $archivedir/
+cp classes/*xml $archivedir/
+cp classes/config.properties $archivedir/
+if test -e surefire-reports; then
+ mv surefire-reports $archivedir/surefire-reports-tests-for-unit-tests
+fi
diff --git a/modules/functional-test/src/main/scripts/run-it.sh b/modules/functional-test/src/main/scripts/run-it.sh
new file mode 100755
index 000000000..d216a01ab
--- /dev/null
+++ b/modules/functional-test/src/main/scripts/run-it.sh
@@ -0,0 +1,49 @@
+###############################################################################
+# Copyright 2017 Intuit
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###############################################################################
+#!/usr/bin/env bash
+
+MAX_WAIT_SECS=210
+SLEEP_INTERVAL_SECS=3
+
+#let total_secs_elapsed=12
+#echo "sleeping for $total_secs_elapsed to wait for service startup"
+#sleep $total_secs_elapsed
+
+let total_secs_elapsed=0
+echo "waiting for service startup.."
+health_check_count=`nohup curl http://localhost:8080/api/v1/ping 2>&1 | grep \"healthy\":true | wc -l`
+while [ ${health_check_count} = "0" ] && [ $total_secs_elapsed -le $MAX_WAIT_SECS ]
+do
+ sleep $SLEEP_INTERVAL_SECS
+ echo -n "."
+ let total_secs_elapsed=total_secs_elapsed+$SLEEP_INTERVAL_SECS
+ health_check_count=`nohup curl http://localhost:8080/api/v1/ping 2>&1 | grep \"healthy\":true | wc -l`
+done
+echo "total_secs_elapsed = $total_secs_elapsed"
+
+begin_time=$(date +"%s")
+
+#(sh /vagrant/target/scripts/run-functional-tests.sh > /vagrant/target/integration-test.out)
+(sh /vagrant/target/scripts/run-functional-tests.sh)
+echo "integration test exit status = $?"
+
+end_time=$(date +"%s")
+
+diff_time=$(($end_time-$begin_time))
+echo "$(($diff_time / 60)) minutes and $(($diff_time % 60)) seconds elapsed for running Java functional tests."
+
+
+
diff --git a/modules/functional-test/src/main/scripts/schema_migration.sh b/modules/functional-test/src/main/scripts/schema_migration.sh
new file mode 100755
index 000000000..d937ca067
--- /dev/null
+++ b/modules/functional-test/src/main/scripts/schema_migration.sh
@@ -0,0 +1,41 @@
+###############################################################################
+# Copyright 2017 Intuit
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###############################################################################
+#!/usr/bin/env bash
+
+echo "applying open source migration scripts"
+echo "java -jar -Dcassandra.migration.keyspace.name=${CASSANDRA_KEYSPACE} \
+ -Dcassandra.migration.cluster.port=${CASSANDRA_PORT:-9042} \
+ -Dcassandra.migration.cluster.username=${CQLSH_USERNAME} \
+ -Dcassandra.migration.cluster.password=${CQLSH_PASSWORD} \
+ -Dcassandra.migration.scripts.locations=filesystem:${MIGRATION_SCRIPT_1} \
+ -Dcassandra.migration.cluster.contactpoints=${CQLSH_HOST:-localhost} \
+ -Dcassandra.migration.table.prefix=wasabi_ \
+ ${CASSANDRA_MIGRATION} migrate"
+
+java -jar -Dcassandra.migration.keyspace.name=${CASSANDRA_KEYSPACE} \
+ -Dcassandra.migration.cluster.port=${CASSANDRA_PORT:-9042} \
+ -Dcassandra.migration.cluster.username=${CQLSH_USERNAME} \
+ -Dcassandra.migration.cluster.password=${CQLSH_PASSWORD} \
+ -Dcassandra.migration.scripts.locations=filesystem:${MIGRATION_SCRIPT_1} \
+ -Dcassandra.migration.cluster.contactpoints=${CQLSH_HOST:-localhost} \
+ -Dcassandra.migration.table.prefix=wasabi_ \
+ ${CASSANDRA_MIGRATION} migrate
+
+if [ $? -ne 0 ]; then
+ echo "failed to execute the oss migration script. Please contact administrator."
+ exit 1;
+fi
+
diff --git a/modules/functional-test/src/main/scripts/server-stop.sh b/modules/functional-test/src/main/scripts/server-stop.sh
new file mode 100755
index 000000000..eb1fd0b18
--- /dev/null
+++ b/modules/functional-test/src/main/scripts/server-stop.sh
@@ -0,0 +1,27 @@
+###############################################################################
+# Copyright 2017 Intuit
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###############################################################################
+#!/usr/bin/env bash
+
+PIDS=$(ps ax | grep -i 'wasabi' | grep java | grep -v grep | awk '{print $1}')
+echo PIDS $PIDS
+
+if [ -z "$PIDS" ]; then
+ echo "No wasabi server to stop"
+ exit 1
+else
+ kill -s TERM $PIDS
+ echo "Killed wasabi server"
+fi
\ No newline at end of file
diff --git a/modules/ui/app/scripts/controllers/DialogModalCtrl.js b/modules/ui/app/scripts/controllers/DialogModalCtrl.js
index e44b3079e..3f692ab50 100644
--- a/modules/ui/app/scripts/controllers/DialogModalCtrl.js
+++ b/modules/ui/app/scripts/controllers/DialogModalCtrl.js
@@ -7,8 +7,9 @@ angular.module('wasabi.controllers')
$scope.header = options.header;
- // Use $sce (Strict Contextual Escaping) to safely insert HTML into the message.
- $scope.description = $sce.trustAsHtml(options.description);
+ $scope.description = options.description;
+ $scope.descriptionWithHTML = $sce.trustAsHtml(options.descriptionWithHTML);
+ $scope.showWithHTML = (options.descriptionWithHTML && options.descriptionWithHTML.length > 0);
$scope.okLabel = 'OK';
if (options.okLabel) {
diff --git a/modules/ui/app/scripts/controllers/FeedbackModalCtrl.js b/modules/ui/app/scripts/controllers/FeedbackModalCtrl.js
index 853f5c0e1..6d5d40c64 100644
--- a/modules/ui/app/scripts/controllers/FeedbackModalCtrl.js
+++ b/modules/ui/app/scripts/controllers/FeedbackModalCtrl.js
@@ -33,20 +33,20 @@ angular.module('wasabi.controllers')
delete $scope.feedback.comments;
}
if (!$scope.userInteractedWithScore) {
- delete $scope.feedback.score;
+ $scope.feedback.score = '6';
+ if (!$scope.feedback.comments) {
+ $scope.feedback.comments = '';
+ }
+ $scope.feedback.comments += ' [[NOTE: Score defaulted to 6 due to bug]]';
}
FeedbackFactory.sendFeedback($scope.feedback).$promise.then(function(/*result*/) {
UtilitiesFactory.trackEvent('saveItemSuccess',
{key: 'dialog_name', value: 'feedback'});
- //$modalInstance.close();
}, function(reason) {
console.log(reason);
- //$modalInstance.close();
});
};
$scope.cancel = function () {
- //$modalInstance.close();
- //$modalInstance.dismiss('cancel');
};
}]);
diff --git a/modules/ui/app/scripts/services/DialogsFactory.js b/modules/ui/app/scripts/services/DialogsFactory.js
index 6eb0af1a1..067f33182 100644
--- a/modules/ui/app/scripts/services/DialogsFactory.js
+++ b/modules/ui/app/scripts/services/DialogsFactory.js
@@ -26,7 +26,7 @@ angular.module('wasabi.services').factory('DialogsFactory', ['$modal',
});
},
- confirmDialog: function(msg, title, resultFunction, cancelFunction, okLabel, cancelLabel) {
+ confirmDialog: function(msg, title, resultFunction, cancelFunction, okLabel, cancelLabel, msgWithHTML) {
var modalInstance = $modal.open({
templateUrl: 'views/DialogModal.html',
controller: 'DialogModalCtrl',
@@ -36,6 +36,7 @@ angular.module('wasabi.services').factory('DialogsFactory', ['$modal',
options: function() {
var theOptions = {
description: msg,
+ descriptionWithHTML: msgWithHTML,
header: title,
okCallback: resultFunction,
showCancel: true
diff --git a/modules/ui/app/scripts/services/UtilitiesFactory.js b/modules/ui/app/scripts/services/UtilitiesFactory.js
index 5fc2be3e1..75b33cf88 100644
--- a/modules/ui/app/scripts/services/UtilitiesFactory.js
+++ b/modules/ui/app/scripts/services/UtilitiesFactory.js
@@ -1015,9 +1015,11 @@ angular.module('wasabi.services').factory('UtilitiesFactory', ['Session', '$stat
title = 'Permanently Terminate Experiment';
break;
}
- var msg = 'Are you sure you want to ' + stateChange + ' the experiment ' + experiment.label + '?';
+ var msg = 'Are you sure you want to ' + stateChange + ' the experiment ' + experiment.label + '?',
+ msgWithHTML = null;
if (state.toLowerCase() === 'terminated') {
- msg = 'Are you sure you want to PERMANENTLY TERMINATE the experiment ' + experiment.label + '?';
+ msg = null;
+ msgWithHTML = 'Are you sure you want to PERMANENTLY TERMINATE the experiment ' + experiment.label + '?';
}
DialogsFactory.confirmDialog(msg, title,
function() {
@@ -1045,7 +1047,7 @@ angular.module('wasabi.services').factory('UtilitiesFactory', ['Session', '$stat
that.handleGlobalError(response, 'The state of your experiment could not be changed.');
});
},
- function() {/* Don't do the state change */});
+ function() {/* Don't do the state change */}, null, null, msgWithHTML);
},
deleteExperiment: function (experiment, afterDeleteFunction) {
diff --git a/modules/ui/app/views/DialogModal.html b/modules/ui/app/views/DialogModal.html
index 1ac43cb65..cd265d4a4 100644
--- a/modules/ui/app/views/DialogModal.html
+++ b/modules/ui/app/views/DialogModal.html
@@ -2,7 +2,8 @@