<commit_before><commit_msg>Added script to run local tests<commit_after>#!/bin/sh
cd `dirname $0`
SCRIPT_DIR=`pwd`

JDBC_URL=jdbc:mysql://localhost:3306/irida_test
TMP_DIRECTORY=/tmp
GALAXY_DOCKER=phacnml/galaxy-irida-17.01:0.17.0-it
GALAXY_DOCKER_PORT=48888

check_dependencies() {
	mvn --version 1>/dev/null 2>/dev/null
	if [ $? -ne 0 ];
	then
		echo "Command 'mvn' does not exist.  Please install Maven (e.g., 'apt-get install maven') to continue."
		exit 1
	fi

	xvfb-run -h 1>/dev/null 2>/dev/null
	if [ $? -ne 0 ];
	then
		echo "Command 'xvfb-run' does not exist.  Please install xvfb (e.g., 'apt-get install xvfb') to continue."
		exit 1
	fi

	docker --version 1>/dev/null 2>/dev/null
	if [ $? -ne 0 ];
	then
		echo "Command 'docker' does not exist.  Please install Docker (e.g., 'curl -sSL https://get.docker.com/ | sh') to continue."
		exit 1
	fi
}

test_service() {
	mvn clean verify -B -Pservice_testing -Djdbc.url=$JDBC_URL -Dirida.it.rootdirectory=$TMP_DIRECTORY
}

test_rest() {
	mvn clean verify -Prest_testing -B
}

test_ui() {
	xvfb-run --auto-servernum --server-num=1 mvn clean verify -B -Pui_testing -Dwebdriver.chrome.driver=./src/main/webapp/node_modules/chromedriver/lib/chromedriver/chromedriver -Dirida.it.nosandbox=true -Djdbc.url=$JDBC_URL -Dirida.it.rootdirectory=$TMP_DIRECTORY
}

test_galaxy() {
	mvn clean verify -B -Pgalaxy_testing -Djdbc.url=$JDBC_URL -Dirida.it.rootdirectory=$TMP_DIRECTORY
}

############
### MAIN ###
############

if [ $# -eq 0 ];
then
	echo -e "Usage: $0 [type]"
	echo -e "\t[type]: One of {service, ui, rest, galaxy, all}."
	exit 0
fi

check_dependencies

# Change to IRIDA root
cd $SCRIPT_DIR/..

case "$1" in
	service)
	test_service
	;;
	ui)
	test_ui
	;;
	rest)
	test_rest
	;;
	galaxy)
	test_galaxy
	;;
	all)
	test_service
	test_ui
	test_rest
	test_galaxy
	;;
	*)
	echo "Unrecogized test [$1]"
	exit 1
esac
{'fraction_non_alphanumeric': 0.15780998389694043, 'fraction_numerical': 0.019860440150295224, 'mean_word_length': 3.7551020408163267, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2319778', 'n_tokens_mistral': 822, 'n_tokens_neox': 765, 'n_words': 182}