...
Sqoop source code contains many unit tests that exercise its functionality. These tests can be run simply by using the following command:
Code Block |
---|
ant test |
...
Setting up and running third-party tests
Third-party tests are end-to-end integration tests that exercise the basic Sqoop functionality against third-party systems like relational databases. You should run these tests in order to rule out regression when testing any changes to the core system. To set thisBefore you run these tests, you must setup the following databases:
Create third-party lib directory
Create a directory somewhere convenient on your development system. This directory will hold all the JDBC drivers that the tests will use. Once created, create (or edit) the build.properties
file in Sqoop workspace root directory and set the the full path of this directory as the value of the property sqoop.thirdparty.lib.dir
. For example:
Code Block |
---|
sqoop.thirdparty.lib.dir=/opt/ws/3rd-party-lib
|
Setting up MySQL
- Install MySQL version 5.1.x with necessary client tools. You can install the server in a different host than your development host if necessary. However, you must have the client tools available on your development host including the JDBC driver, and batch utilities such as
mysqldump
andmysqlimport
. - Place the JDBC driver in the third-party lib directory that you created earlier.
- If your MySQL server is installed on a different host, enter its location in the
build.properties
file as follows:Code Block sqoop.test.mysql.connectstring.host_url=jdbc:mysql://mysqlhost/
- In order to run the MySQL third-party tests, you would need to configure the database as follows:
Code Block $ mysql -u root -p mysql> CREATE DATABASE sqooppasstest; mysql> CREATE DATABASE sqooptestdb; mysql> use mysql; mysql> GRANT ALL PRIVILEGES on sqooppasstest.* TO 'sqooptest'@'localhost' IDENTIFIED BY '12345'; mysql> GRANT ALL PRIVILEGES ON sqooptestdb.* TO 'yourusername'@'localhost'; mysql> flush privileges;
Note:
- If the installation of MySQL server is on a different host, you must replace the
localhost
with the appropriate client host value.- You should replace
yourusername
with your actual user name before issuing the command.