8.9.5 Running Tests

The test-fabric target in the build.xml file runs JUnit tests on these servers. It requires only the setup described in Section 8.9.4, “MySQL Fabric Configuration for Running Samples”. All necessary tables and data are created during test run.

The parameters for the servers must be provided to Ant to verify that the correct information is received from the Fabric node. This includes server host names and ports. This data can be provided on the command line with -D arguments to Ant or in a build.properties file. This file should be placed in the root of the source directory, where build.xml is located. Based on the information given so far, this file would contain the following entries:

com.mysql.fabric.testsuite.hostname=localhost
com.mysql.fabric.testsuite.port=32274

com.mysql.fabric.testsuite.fabricUsername=admin
com.mysql.fabric.testsuite.fabricPassword=secret

com.mysql.fabric.testsuite.username=root
com.mysql.fabric.testsuite.password=
com.mysql.fabric.testsuite.database=employees
com.mysql.fabric.testsuite.global.host=127.0.0.1
com.mysql.fabric.testsuite.global.port=3401
com.mysql.fabric.testsuite.shard1.host=127.0.0.1
com.mysql.fabric.testsuite.shard1.port=3402
com.mysql.fabric.testsuite.shard2.host=127.0.0.1
com.mysql.fabric.testsuite.shard2.port=3403

Sample Ant calls are shown below. If the parameters are specified in your build.properties file, it is not necessary to include them on the command line.

shell> JAVA_HOME=/opt/jdk1.5/ ant \
		-Dcom.mysql.fabric.testsuite.password=pwd \
		-Dcom.mysql.fabric.testsuite.global.port=3401 \
		-Dcom.mysql.fabric.testsuite.shard1.port=3402 \
		-Dcom.mysql.fabric.testsuite.shard2.port=3403 \
		test-fabric