Emmanuel BENOîT
cb2553d1e5
* Added tests of the command line tools to the post-build scripts * Local deployment documentation mentions ImportResources
49 lines
1.7 KiB
Bash
49 lines
1.7 KiB
Bash
#!/bin/bash
|
|
|
|
TESTDIR=`mktemp -d`
|
|
cp -Rapv legacyworlds-server-DIST/target/legacyworlds/legacyworlds-server-* $TESTDIR
|
|
|
|
|
|
cd $TESTDIR/legacyworlds-server-*/sql
|
|
cat > db-config.txt <<EOF
|
|
admin=$USER
|
|
db=tests
|
|
user=tests
|
|
password=tests
|
|
EOF
|
|
psql -vQUIET=1 -vON_ERROR_STOP=1 -e --file database.sql || exit 1
|
|
cd ..
|
|
|
|
cat > data-source.xml <<EOF
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
|
|
|
|
<bean name="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
|
|
<property name="driverClassName" value="org.postgresql.Driver" />
|
|
<property name="url" value="jdbc:postgresql:tests" />
|
|
<property name="username" value="tests" />
|
|
<property name="password" value="tests" />
|
|
</bean>
|
|
|
|
</beans>
|
|
EOF
|
|
|
|
java legacyworlds-server-main-*.jar --run-tool ImportText data/i18n-text.xml || exit 1
|
|
java legacyworlds-server-main-*.jar --run-tool ImportResources data/resources.xml || exit 1
|
|
java legacyworlds-server-main-*.jar --run-tool ImportTechs data/techs.xml || exit 1
|
|
java legacyworlds-server-main-*.jar --run-tool ImportBuildables data/buildables.xml || exit 1
|
|
|
|
java legacyworlds-server-main-*.jar &
|
|
sleep 10
|
|
if ! ps ux | grep -q 'java -jar legacyworlds-server-main'; then
|
|
exit 1;
|
|
fi
|
|
java legacyworlds-server-main-*.jar --run-tool Stop || {
|
|
killall java
|
|
exit 1;
|
|
}
|
|
|
|
java -jar legacyworlds-server-main-1.0.0-0.jar --run-tool CreateUser 'test@example.org 12blah34bleh en' || exit 1
|
|
java -jar legacyworlds-server-main-1.0.0-0.jar --run-tool CreateSuperuser 'test@example.org Turlututu' || exit 1
|