diff --git a/.travis.yml b/.travis.yml index 8f4c9d6..933d299 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,20 +1,41 @@ language: java +services: + - mysql + install: true +addons: + apt: + sources: + - mysql-5.7-trusty + packages: + - mysql-server + - mysql-client + before_install: - chmod +x pandamonium-theorem-prover/gradlew - cd pandamonium-theorem-prover +before_script: + - mysql_upgrade --force -uroot + - mysql -u root -e 'CREATE DATABASE IF NOT EXISTS pandamonium;' + - mysql -u root -e "CREATE USER 'panda'@'localhost';" + - mysql -u root -e "GRANT ALL PRIVILEGES ON *.* to 'panda'@'localhost';" + - mysql -u root pandamonium < persistence/scripts/mysql/local_development.sql + stages: - - name: build - - name: unit tests - - name: integration tests + - name: Load Database + - name: Build + - name: Unit Tests + - name: Integration Tests jobs: include: - - stage: build + - stage: Load Database + script: ./gradlew loaddb + - stage: Build script: ./gradlew build - - stage: unit tests + - stage: Unit Tests script: ./gradlew test - - stage: integration tests + - stage: Integration Tests script: ./gradlew integrationTest diff --git a/pandamonium-theorem-prover/.travis.yml b/pandamonium-theorem-prover/.travis.yml deleted file mode 100644 index 3dcae7a..0000000 --- a/pandamonium-theorem-prover/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -language: java -install: true - -sudo: false -addons: - apt: - packages: - - oracle-java8-installer - -before_install: - - chmod +x pandamonium-theorem-prover/gradlew - -stages: - - name: build - - name: unitTest - - name: integrationTest - -jobs: - include: - - stage: build - script: ./pandamonium-theorem-prover/gradlew build - - stage: unitTest - script: ./pandamonium-theorem-prover/gradlew test - - stage: integrationTest - script: ./pandamonium-theorem-prover/gradlew integrationTest diff --git a/pandamonium-theorem-prover/persistence/build.gradle b/pandamonium-theorem-prover/persistence/build.gradle index b8e0e3f..24c2f75 100644 --- a/pandamonium-theorem-prover/persistence/build.gradle +++ b/pandamonium-theorem-prover/persistence/build.gradle @@ -2,6 +2,7 @@ plugins { id 'java' } +description = 'Provides database access and connectivity' group 'edu.msudenver.tsp' version '1.0' @@ -14,4 +15,19 @@ repositories { dependencies { testCompile group: 'junit', name: 'junit', version: '4.12' compile fileTree(dir: 'lib', include: '**/*.jar') + + compile 'com.mchange:c3p0:0.9.5.2' + compile 'mysql:mysql-connector-java:5.1.35' + compile 'org.hibernate:hibernate-validator:5.3.4.Final' + compile 'javax.validation:validation-api:1.1.0.Final' + compile('com.googlecode.log4jdbc:log4jdbc:1.2') { + exclude(group: 'org.slf4j') + } + + testCompile 'javax.el:javax.el-api:3.0.0' +} + +task loadDb(type: Exec, group: 'Verification', description: 'Reloads the local database.') { + workingDir "./scripts/mysql" + commandLine './loaddb.sh' } diff --git a/pandamonium-theorem-prover/persistence/scripts/mysql/loaddb.sh b/pandamonium-theorem-prover/persistence/scripts/mysql/loaddb.sh new file mode 100755 index 0000000..974a80b --- /dev/null +++ b/pandamonium-theorem-prover/persistence/scripts/mysql/loaddb.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +export MYSQL_PWD=secret + +for sqlScript in $( find . -name "*.sql" -print | sort); + do + echo "**** $sqlScript ****" + mysql --batch --quick --raw --line-numbers --force --user=panda < $sqlScript + done \ No newline at end of file diff --git a/pandamonium-theorem-prover/persistence/scripts/mysql/local_development.sql b/pandamonium-theorem-prover/persistence/scripts/mysql/local_development.sql new file mode 100644 index 0000000..1f885cc --- /dev/null +++ b/pandamonium-theorem-prover/persistence/scripts/mysql/local_development.sql @@ -0,0 +1,25 @@ +drop database if exists pandamonium; +create database pandamonium; +use pandamonium; +create table accounts ( +id int not null auto_increment primary key unique, +username varchar(50) not null unique, +password varchar(256) not null, +administrator_status boolean default false, +last_login date, +version int default 1 +); +insert into accounts (username, password, administrator_status) +values ('admin', 'secret', true), +('atusa', 'secret', true), +('dantanxiaotian', 'secret', true), +('BrittanyBi', 'secret', true), +('lanlanzeliu', 'secret', true), +('tramanh305', 'secret', true); +create table definitions ( +id int not null auto_increment primary key unique, +name varchar(200) not null, +definition json not null, +notation json, +version int default 1 +); \ No newline at end of file