Emmanuel BENOîT
75c5245764
Implemented the ImportEvents command line tool, which allows event definitions to be imported. In all cases the tool will try to import all definitions; if an error occurs, the process continues but the transaction is rolled back. It skips existing definitions rather than taking the risk of doing something inappropriate (e.g. deletion of existing events).
51 lines
1.9 KiB
Bash
51 lines
1.9 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 ImportEvents data/event-definitions.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 ImportTechGraph data/tech-graph.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
|