diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..a2a9c388 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,82 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +dist: trusty +sudo: true +language: java +jdk: +- oraclejdk8 +services: +- docker +env: +- TEST_TASK=test +- TEST_TASK=oracleXeTest +- TEST_TASK=sqlServerTest +- TEST_TASK=mySqlTest +- TEST_TASK=postgreSqlTest +- TEST_TASK=db2Test +- TEST_TASK=cubridTest +- TEST_TASK=mainFrameTest +before_install: +- if [ "$TEST_TASK" = "postgreSqlTest" ]; + then + ./src/scripts/thirdpartytest/start-thirdpartytest-db-containers.sh postgresql; + sleep 60; + elif [ "$TEST_TASK" = "mySqlTest" ]; + then + ./src/scripts/thirdpartytest/start-thirdpartytest-db-containers.sh mysql; + sleep 60; + elif [ "$TEST_TASK" = "cubridTest" ]; + then + ./src/scripts/thirdpartytest/start-thirdpartytest-db-containers.sh cubrid; + sleep 60; + elif [ "$TEST_TASK" = "sqlServerTest" ]; + then + ./src/scripts/thirdpartytest/start-thirdpartytest-db-containers.sh mssql; + sleep 60; + elif [ "$TEST_TASK" = "db2Test" ]; + then + ./src/scripts/thirdpartytest/start-thirdpartytest-db-containers.sh db2; + sleep 60; + elif [ "$TEST_TASK" = "mainFrameTest" ]; + then + ./src/scripts/thirdpartytest/start-thirdpartytest-db-containers.sh mainframe; + sleep 60; + elif [ "$TEST_TASK" = "oracleXeTest" ]; + then + if [ -n "$ORACLE_DRIVER_URL" ]; + then + mkdir -p drivers; + wget -q $ORACLE_DRIVER_URL --output-document ./drivers/oracledriver.jar; + ./src/scripts/thirdpartytest/start-thirdpartytest-db-containers.sh oracle; + sleep 90; + fi + fi +script: +- if [ "$TEST_TASK" != "oracleXeTest" ] || [ -n "$ORACLE_DRIVER_URL" ]; + then + ./gradlew -Dsqoop.thirdparty.lib.dir=./drivers $TEST_TASK; + else + echo 'Skipping Oracle XE test execution because ORACLE_DRIVER_URL is not set.'; + fi +before_cache: +- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock +- rm -fr $HOME/.gradle/caches/*/plugin-resolution/ +cache: + directories: + - $HOME/.gradle/caches/ + - $HOME/.gradle/wrapper/ diff --git a/COMPILING.txt b/COMPILING.txt index b399ba82..348dae0f 100644 --- a/COMPILING.txt +++ b/COMPILING.txt @@ -87,22 +87,22 @@ The following table shows the currently supported test categories and their hier .Available test categories [width="40%",frame="topbot",options="header"] -|====================== -|Category |Subcategory -.3+|+SqoopTest+ |+UnitTest+ - |+IntegrationTest+ - |+ManualTest+ -.9+|+ThirdPartyTest+ |+CubridTest+ - |+Db2Test+ - |+MainFrameTest+ - |+MysqlTest+ - |+NetezzaTest+ - |+OracleTest+ - |+PostgresqlTest+ - |+SqlServerTest+ - |+S3Test+ -|+KerberizedTest+ | -|====================== +|=============================================================== +|Category |Subcategories | +.3+|+SqoopTest+ |+UnitTest+ | + |+IntegrationTest+ | + |+ManualTest+ | +.9+|+ThirdPartyTest+ |+CubridTest+ | + |+Db2Test+ | + |+MainFrameTest+ | + |+MysqlTest+ | + |+NetezzaTest+ | + |+OracleTest+ |+OracleEeTest+ + |+PostgresqlTest+ | + |+SqlServerTest+ | + |+S3Test+ | +|+KerberizedTest+ | | +|=============================================================== ==== SqoopTest A general category including UnitTest, IntegrationTest and ManualTest. @@ -143,6 +143,14 @@ corresponding marker interface to it. * +integrationTest+: Runs integration tests which do not need a docker container or an external database/service. * +kerberizedTest+: Runs kerberized tests. * +thirdPartyTest+: Runs third-party tests. For more information see the 'Third party tests' section. +* +postgreSqlTest+: Runs PostgreSql third-party tests. +* +mySqlTest+: Runs MySql third-party tests. +* +cubridTest+: Runs Cubrid third-party tests. +* +db2Test+: Runs DB2 third-party tests. +* +oracleTest+: Runs Oracle third-party tests. +* +oracleXeTest+: Run Oracle third party tests which can be run with Oracle Express Edition too. +* +oracleEeTest+: Run Oracle third party tests which require Oracle Enterprise Edition. +* +sqlServerTest+: Runs SqlServer third-party tests. * +test+: Runs tests that do not need external JDBC driver and/or a docker container. This the same as running unitTest, integrationTest and kerberizedTest. * +s3Test+: Runs S3 tests. For more information see the 'Amazon S3 tests' section. @@ -172,36 +180,41 @@ JDBC. Instructions for configuring the MySQL database are in MySQLAuthTest and DirectMySQLTest. Use the following system properties to configure connection to the MySQL host used for testing: -sqoop.test.mysql.connectstring.host_url, sqoop.test.mysql.databasename, sqoop.test.mysql.username and -sqoop.test.mysql.password. ++sqoop.test.mysql.connectstring.host_url+, +sqoop.test.mysql.databasename+, +sqoop.test.mysql.username+ and ++sqoop.test.mysql.password+. Specify these properties on the command line or via the build.properties file. For example: -sqoop.test.mysql.connectstring.host_url=jdbc:mysql://host.example.com/ -sqoop.test.mysql.databasename=MYDB -sqoop.test.mysql.username=MYUSR -sqoop.test.mysql.password=MYPWD ++sqoop.test.mysql.connectstring.host_url=jdbc:mysql://host.example.com/+ ++sqoop.test.mysql.databasename=MYDB+ ++sqoop.test.mysql.username=MYUSR+ ++sqoop.test.mysql.password=MYPWD+ If not specified, the default value used for this property is: -jdbc:mysql://localhost/ ++jdbc:mysql://127.0.0.1:13306/+ ===== Oracle Install Oracle Enterprise Edition 10.2.0+. Instructions for configuring the -database are in OracleManagerTest. Download the ojdbc6_g jar. +database are in +OracleManagerTest+. Download the ojdbc6_g jar. If running the tests against Oracle XE (Express Edition) - a lot of them will fail as it does not include the partitioning feature. -Use the following system properties to configure connection to the Oracle host used for testing: -sqoop.test.oracle.connectstring, sqoop.test.oracle.username and sqoop.test.oracle.password. +Use the following system properties to configure connection to the Oracle XE host used for testing: ++sqoop.test.oracle.connectstring+, +sqoop.test.oracle.username+ and +sqoop.test.oracle.password+. +You can configure the connection properties separately for tests requiring Oracle EE: ++sqoop.test.oracle-ee.connectstring+, +sqoop.test.oracle-ee.username+ and +sqoop.test.oracle-ee.password+. Specify these properties on the command line or via the build.properties file. For example: -sqoop.test.oracle.connectstring=jdbc:oracle:thin:@//host.example.com/xe -sqoop.test.oracle.username=MYUSR -sqoop.test.oracle.password=MYPWD ++sqoop.test.oracle.connectstring=jdbc:oracle:thin:@//host.example.com/xe+ ++sqoop.test.oracle.username=MYUSR+ ++sqoop.test.oracle.password=MYPWD+ -If not specified, the default value used for this property is: -jdbc:oracle:thin:@//localhost/xe +If not specified, the default value used for +sqoop.test.oracle.connectstring+ property is: ++jdbc:oracle:thin:@//localhost:1521/xe+ + +The default value used for +sqoop.test.oracle-ee.connectstring+ property is: ++jdbc:oracle:thin:@//localhost:1522/sqoop+ Users sqooptest and sqooptest2 should be created prior to running the tests. SQL script is available in src/test/oraoop/create_users.sql @@ -209,106 +222,104 @@ SQL script is available in src/test/oraoop/create_users.sql ===== PostgreSQL Install PostgreSQL 8.3.9. Download the postgresql 8.4 jdbc driver. Instructions -for configuring the database are in PostgresqlTest. +for configuring the database are in +PostgresqlTest+. Use the following system properties to configure connection to the PostgreSQL host used for testing: -sqoop.test.postgresql.connectstring.host_url, sqoop.test.postgresql.database, sqoop.test.postgresql.username and -sqoop.test.postgresql.password. ++sqoop.test.postgresql.connectstring.host_url+, +sqoop.test.postgresql.database+, +sqoop.test.postgresql.username+ and ++sqoop.test.postgresql.password+. Specify this property on the command line or via the build.properties file. For example: -sqoop.test.postgresql.connectstring.host_url=jdbc:postgresql://sqoop-dbs.sf.cloudera.com/ -sqoop.test.postgresql.database=MYDB -sqoop.test.postgresql.username=MYUSR -sqoop.test.postgresql.password=MYPWD ++sqoop.test.postgresql.connectstring.host_url=jdbc:postgresql://sqoop-dbs.sf.cloudera.com/+ ++sqoop.test.postgresql.database=MYDB+ ++sqoop.test.postgresql.username=MYUSR+ ++sqoop.test.postgresql.password=MYPWD+ If not specified, the default value used for this property is: -jdbc:postgresql://localhost/ ++jdbc:postgresql://localhost:15432/+ ===== SQL Server Install SQL Server Express 2012 and create a database instance and download the appropriate JDBC driver. Instructions for configuring the -database can be found in SQLServerManagerImportManualTest. +database can be found in +SQLServerManagerImportManualTest+. Use the following system properties to configure connection to the SQL Server host used for testing: -sqoop.test.sqlserver.connectstring.host_url, sqoop.test.sqlserver.database, sqoop.test.sqlserver.username and -sqoop.test.sqlserver.password. ++sqoop.test.sqlserver.connectstring.host_url+, +sqoop.test.sqlserver.database+, +ms.sqlserver.username+ and ++ms.sqlserver.password+. the URL for the SQL Server host used for testing. Specify this property on the command line or via the build.properties file. For example: -sqoop.test.sqlserver.connectstring.host_url=jdbc:sqlserver://sqlserverhost:1433 -sqoop.test.sqlserver.database=MYDB -ms.sqlserver.username=MYUSR -ms.sqlserver.password=MYPWD ++sqoop.test.sqlserver.connectstring.host_url=jdbc:sqlserver://sqlserverhost:1433+ ++sqoop.test.sqlserver.database=MYDB+ ++ms.sqlserver.username=MYUSR+ ++ms.sqlserver.password=MYPWD+ If not specified, the default value used for this property is: -jdbc:sqlserver://sqlserverhost:1433 - -This can be useful if you have the hostname sqlserverhost mapped to the IP -address of the SQL Server instance. ++jdbc:sqlserver://localhost:1433+ ===== Cubrid Install Cubrid 9.2.2.0003 and create a database instance and download the appropriate JDBC driver. Instructions for configuring the database are in -CubridAuthTest, CubridCompatTest, CubridManagerImportTest -and CubridManagerExportTest. ++CubridAuthTest+, +CubridCompatTest+, +CubridManagerImportTest+ +and +CubridManagerExportTest+. Use the following system properties to configure connection to the Cubrid host used for testing: -sqoop.test.cubrid.connectstring.host_url, sqoop.test.cubrid.connectstring.database, -sqoop.test.cubrid.connectstring.username and sqoop.test.cubrid.connectstring.password. ++sqoop.test.cubrid.connectstring.host_url+, +sqoop.test.cubrid.connectstring.database+, ++sqoop.test.cubrid.connectstring.username+ and +sqoop.test.cubrid.connectstring.password+. Specify this property on the command line or via the build.properties file. For example: -sqoop.test.cubrid.connectstring.host_url=jdbc:cubrid:localhost -sqoop.test.cubrid.connectstring.database=MYDB -sqoop.test.cubrid.connectstring.username=MYUSR -sqoop.test.cubrid.connectstring.password=MYPWD ++sqoop.test.cubrid.connectstring.host_url=jdbc:cubrid:localhost+ ++sqoop.test.cubrid.connectstring.database=MYDB+ ++sqoop.test.cubrid.connectstring.username=MYUSR+ ++sqoop.test.cubrid.connectstring.password=MYPWD+ If not specified, the default value used for this property is: -jdbc:cubrid:localhost ++jdbc:cubrid:localhost:33000+ ===== DB2 Install DB2 9.74 Express C and download the appropriate JDBC driver. Instructions for configuring the server can be found in -DB2ManagerImportManualTest. ++DB2ManagerImportManualTest+. Use the following system properties to configure connection to the DB2 host used for testing: -sqoop.test.db2.connectstring.host_url, sqoop.test.db2.connectstring.database, sqoop.test.db2.connectstring.username and -sqoop.test.db2.connectstring.password. ++sqoop.test.db2.connectstring.host_url+, +sqoop.test.db2.connectstring.database+, +sqoop.test.db2.connectstring.username+ and ++sqoop.test.db2.connectstring.password+. Specify this property on the command line or via build.properties file. For example: -sqoop.test.db2.connectstring.host_url=jdbc:db2://db2host:50000 -sqoop.test.db2.connectstring.database=MYDB -sqoop.test.db2.connectstring.username=MYUSR -sqoop.test.db2.connectstring.password=MYPWD ++sqoop.test.db2.connectstring.host_url=jdbc:db2://db2host:50000+ ++sqoop.test.db2.connectstring.database=MYDB+ ++sqoop.test.db2.connectstring.username=MYUSR+ ++sqoop.test.db2.connectstring.password=MYPWD+ If not specified, the default value used for this property is: -jdbc:db2://db2host:50000 - -This can be useful if you have the hostname db2host mapped to the IP -address of the DB2 Server instance. ++jdbc:db2://localhost:50000+ ==== Running the Third-party Tests on native database servers After the third-party databases are installed and configured, run: -++++ -ant test -Dthirdparty=true -Dsqoop.thirdparty.lib.dir=/path/to/jdbc/drivers/ -./gradlew -Dsqoop.thirdparty.lib.dir=/relative/path/to/jdbc/drivers/ thirdPartyTest -++++ +---- +ant test -Dthirdparty=true -Dsqoop.thirdparty.lib.dir=/path/to/jdbc/drivers/ [-DconnectionProperty1=propertyValue1 +-DconnectionProperty2=propertyValue ...] +./gradlew -Dsqoop.thirdparty.lib.dir=/relative/path/to/jdbc/drivers/ thirdPartyTest [-DconnectionProperty1=propertyValue1 +-DconnectionProperty2=propertyValue ...] +---- This command will run all thirdparty tests except some DB2 tests. To run these DB2 test, specify the property "manual" instead of "thirdparty" as follows: -++++ -ant test -Dmanual=true -Dsqoop.thirdparty.lib.dir=/path/to/jdbc/drivers/ -./gradlew -Dsqoop.thirdparty.lib.dir=/relative/path/to/jdbc/drivers/ manualTest -++++ +---- +ant test -Dmanual=true -Dsqoop.thirdparty.lib.dir=/path/to/jdbc/drivers/ [-DconnectionProperty1=propertyValue1 +-DconnectionProperty2=propertyValue ...] +./gradlew -Dsqoop.thirdparty.lib.dir=/relative/path/to/jdbc/drivers/ manualTest [-DconnectionProperty1=propertyValue1 +-DconnectionProperty2=propertyValue ...] +---- Note that +sqoop.thirdparty.lib.dir+ can also be specified in +build.properties+. @@ -326,11 +337,11 @@ https://docs.docker.com/compose/install/ ===== Downloading docker images -MySQL, PostgreSQL, MSSQL, DB2 and Cubrid images are freely available on Docker Hub so they will be pulled automatically by the startup command specified below however the Oracle EE image has to be built manually. Please refer to the README.md file on the below Github project for building instructions: +MySQL, PostgreSQL, MSSQL, DB2, Oracle XE and Cubrid images are freely available on Docker Hub so they will be pulled automatically by the startup command specified below however the Oracle EE image has to be built manually. Please refer to the README.md file on the below Github project for building instructions: https://github.com/oracle/docker-images/tree/master/OracleDatabase -Please note that Sqoop third party tests require Oracle Enterprise Edition and the startup command assumes version 12.2.0.1. +Please note that some Sqoop third party tests require Oracle Enterprise Edition and the startup command assumes version 12.2.0.1. ===== Starting the Docker containers @@ -350,7 +361,8 @@ If it is executed without parameters it starts the following services: |+postgresql+ |PostgreSQL 9.6.4 |+mssql+ |MSSQL 14.0.1000.169 Developer Edition |+cubrid+ |Cubrid 10.0 -|+oracle+ |Oracle EE 12.2.0.1 +|+oracle-ee+ |Oracle EE 12.2.0.1 +|+oracle+ |Oracle XE 11g Release 2 |+db2+ |DB2 Express Edition 10.5.0.5-3.10.0 |====================== @@ -367,7 +379,8 @@ After the startup script is executed the containers need some time to initialize 158e5421d134 ibmcom/db2express-c:10.5.0.5-3.10.0 "/home/db2inst1/db..." 43 seconds ago Up 40 seconds (health: starting) 22/tcp, 0.0.0.0:50000->50000/tcp sqoop_db2_container ---- -Most of the containers need less than 1 minute to start up but DB2 needs ~5 minutes and Oracle needs ~15 minutes. The Docker images need ~17GB free disk space and Docker requires ~5GB of memory to start all of them at the same time. +Most of the containers need less than 1 minute to start up but DB2 needs \~5 minutes and Oracle EE needs \~15 minutes. +The Docker images need \~17GB free disk space and Docker requires ~5GB of memory to start all of them at the same time. ===== Stopping the Docker containers @@ -384,31 +397,6 @@ You can execute the third party tests against the DBs running in Docker containe ---- ant clean test -Dthirdparty=true -Dsqoop.thirdparty.lib.dir= \ - -Dsqoop.test.mysql.connectstring.host_url=jdbc:mysql://127.0.0.1:3306/ \ - -Dsqoop.test.mysql.databasename=sqoop \ - -Dsqoop.test.mysql.password=Sqoop12345 \ - -Dsqoop.test.mysql.username=sqoop \ - -Dsqoop.test.oracle.connectstring=jdbc:oracle:thin:@//localhost:1521/sqoop \ - -Dsqoop.test.oracle.username=SYSTEM \ - -Dsqoop.test.oracle.password=Sqoop12345 \ - -Dsqoop.test.postgresql.connectstring.host_url=jdbc:postgresql://localhost/ \ - -Dsqoop.test.postgresql.database=sqoop \ - -Dsqoop.test.postgresql.username=sqoop \ - -Dsqoop.test.postgresql.password=Sqoop12345 \ - -Dsqoop.test.cubrid.connectstring.host_url=jdbc:cubrid:localhost:33000 \ - -Dsqoop.test.cubrid.connectstring.username=sqoop \ - -Dsqoop.test.cubrid.connectstring.database=sqoop \ - -Dsqoop.test.cubrid.connectstring.password=Sqoop12345 \ - -Dmapred.child.java.opts="\-Djava.security.egd=file:/dev/../dev/urandom" \ - -Dtest.timeout=10000000 \ - -Dsqoop.test.sqlserver.connectstring.host_url=jdbc:sqlserver://localhost:1433 \ - -Dsqoop.test.sqlserver.database=master \ - -Dms.sqlserver.username=sa \ - -Dms.sqlserver.password=Sqoop12345 \ - -Dsqoop.test.db2.connectstring.host_url=jdbc:db2://localhost:50000 \ - -Dsqoop.test.db2.connectstring.database=SQOOP \ - -Dsqoop.test.db2.connectstring.username=DB2INST1 \ - -Dsqoop.test.db2.connectstring.password=Sqoop12345 \ -Ds3.bucket.url= \ -Ds3.generator.command= ---- @@ -417,36 +405,14 @@ or ---- ./gradlew -Dsqoop.thirdparty.lib.dir= \ - -Dsqoop.test.mysql.connectstring.host_url=jdbc:mysql://127.0.0.1:3306/ \ - -Dsqoop.test.mysql.databasename=sqoop \ - -Dsqoop.test.mysql.password=Sqoop12345 \ - -Dsqoop.test.mysql.username=sqoop \ - -Dsqoop.test.oracle.connectstring=jdbc:oracle:thin:@//localhost:1521/sqoop \ - -Dsqoop.test.oracle.username=SYSTEM \ - -Dsqoop.test.oracle.password=Sqoop12345 \ - -Dsqoop.test.postgresql.connectstring.host_url=jdbc:postgresql://localhost/ \ - -Dsqoop.test.postgresql.database=sqoop \ - -Dsqoop.test.postgresql.username=sqoop \ - -Dsqoop.test.postgresql.password=Sqoop12345 \ - -Dsqoop.test.cubrid.connectstring.host_url=jdbc:cubrid:localhost:33000 \ - -Dsqoop.test.cubrid.connectstring.username=sqoop \ - -Dsqoop.test.cubrid.connectstring.database=sqoop \ - -Dsqoop.test.cubrid.connectstring.password=Sqoop12345 \ - -Dmapred.child.java.opts="\-Djava.security.egd=file:/dev/../dev/urandom" \ - -Dtest.timeout=10000000 \ - -Dsqoop.test.sqlserver.connectstring.host_url=jdbc:sqlserver://localhost:1433 \ - -Dsqoop.test.sqlserver.database=master \ - -Dms.sqlserver.username=sa \ - -Dms.sqlserver.password=Sqoop12345 \ - -Dsqoop.test.db2.connectstring.host_url=jdbc:db2://localhost:50000 \ - -Dsqoop.test.db2.connectstring.database=SQOOP \ - -Dsqoop.test.db2.connectstring.username=DB2INST1 \ - -Dsqoop.test.db2.connectstring.password=Sqoop12345 \ -Ds3.bucket.url= \ -Ds3.generator.command= \ thirdPartyTest ---- +Gradle is able download all of the necessary drivers except the Oracle one but the Ant build has to be provided +with the drivers for all the databases. + Please note that even if you do not need to install RDBMSs to run Sqoop third party tests against the Docker containers you still need to install the following tools: * mysqldump @@ -651,4 +617,20 @@ export XML_CATALOG_FILES=/usr/local/etc/xml/catalog * +./gradlew build --refresh-dependencies+ to refresh dependencies for a build * +./gradle build -x test+ for skipping a single test or a set of tests * +./gradlew dependencyInsight --configuration optionalConfiguration --dependency searchedForDependency+ to get a dependency tree -* +./gradlew dependencies+ to get the list of the dependencies of the selected project, broken down by configuration \ No newline at end of file +* +./gradlew dependencies+ to get the list of the dependencies of the selected project, broken down by configuration + +== Setting up Travis CI +You can now set up a Travis CI job for your own Sqoop fork so you can easily test your patches before uploading them for review. +The steps for setting up the CI job are the following: + +- Go to https://github.com/apache/sqoop and fork the project if it is not already forked for your GitHub account. +- Go to https://travis-ci.com and Sign up with GitHub. +- Accept the Authorization of Travis CI. You’ll be redirected to GitHub. +- Click the green Activate button, and select the Sqoop repository. + +The Travis CI job uses Gradle to build and test the project and it is able to execute all of the tests except the +ones requiring an Oracle EE database. +Note that by default the Oracle XE tests are also disabled because the necessary +ojdbc6.jar+ is not publicly available. +Contributors have to upload +ojdbc6.jar+ to a public drive and make it available to the CI job by setting +the +ORACLE_DRIVER_URL+ environment variable in Travis (for more information see Travis +https://docs.travis-ci.com/user/environment-variables/#defining-variables-in-repository-settings[documentation]). diff --git a/build.gradle b/build.gradle index efe980d6..c7372e83 100644 --- a/build.gradle +++ b/build.gradle @@ -38,6 +38,14 @@ repositories { maven { url 'http://conjars.org/repo/' } + maven { + url 'http://maven.cubrid.org/' + } + + // DB2 driver repository + maven { + url 'https://artifacts.alfresco.com/nexus/content/repositories/public/' + } } sourceSets { @@ -152,6 +160,12 @@ dependencies { testCompile group: 'org.mockito', name: 'mockito-core', version: mockitoallVersion testCompile group: 'com.github.stefanbirkner', name: 'system-rules', version: systemRulesVersion testCompile group: 'org.apache.zookeeper', name: 'zookeeper', version: zookeeperVersion, ext: 'jar' + + // JDBC drivers + testCompile group: 'mysql', name: 'mysql-connector-java', version: mySqlConnectorVersion + testCompile group: 'cubrid', name: 'cubrid-jdbc', version: cubridJdbcDriverVersion + testCompile group: 'com.microsoft.sqlserver', name: 'mssql-jdbc', version: msSqlJdbcDriverVersion + testCompile group: 'com.ibm.db2.jcc', name: 'db2jcc4', version: db2JdbcDriverVersion } task unitTest (type: Test) { @@ -186,6 +200,92 @@ task thirdPartyTest (type: Test) { systemProperty "ms.datatype.test.hdfsprefix" ,"file:///" } +task postgreSqlTest (type: Test) { + description 'Run Postgresql third party tests.' + useJUnit { + includeCategories 'org.apache.sqoop.testcategories.thirdpartytest.PostgresqlTest' + excludeCategories 'org.apache.sqoop.testcategories.sqooptest.ManualTest' + excludeCategories 'org.apache.sqoop.testcategories.KerberizedTest' + } +} + +task mySqlTest (type: Test) { + description 'Run MySql third party tests.' + useJUnit { + includeCategories 'org.apache.sqoop.testcategories.thirdpartytest.MysqlTest' + excludeCategories 'org.apache.sqoop.testcategories.sqooptest.ManualTest' + excludeCategories 'org.apache.sqoop.testcategories.KerberizedTest' + } +} + +task cubridTest (type: Test) { + description 'Run Cubrid third party tests.' + useJUnit { + includeCategories 'org.apache.sqoop.testcategories.thirdpartytest.CubridTest' + excludeCategories 'org.apache.sqoop.testcategories.sqooptest.ManualTest' + excludeCategories 'org.apache.sqoop.testcategories.KerberizedTest' + } +} + +task db2Test (type: Test) { + description 'Run DB2 third party tests.' + useJUnit { + includeCategories 'org.apache.sqoop.testcategories.thirdpartytest.Db2Test' + excludeCategories 'org.apache.sqoop.testcategories.sqooptest.ManualTest' + excludeCategories 'org.apache.sqoop.testcategories.KerberizedTest' + } +} + +task mainFrameTest (type: Test) { + description 'Run Mainframe third party tests.' + useJUnit { + includeCategories 'org.apache.sqoop.testcategories.thirdpartytest.MainFrameTest' + excludeCategories 'org.apache.sqoop.testcategories.sqooptest.ManualTest' + excludeCategories 'org.apache.sqoop.testcategories.KerberizedTest' + } +} + +task oracleTest (type: Test) { + description 'Run Oracle third party tests.' + useJUnit { + includeCategories 'org.apache.sqoop.testcategories.thirdpartytest.OracleTest' + excludeCategories 'org.apache.sqoop.testcategories.sqooptest.ManualTest' + excludeCategories 'org.apache.sqoop.testcategories.KerberizedTest' + } +} + +task oracleXeTest (type: Test) { + description 'Run Oracle third party tests which can be run with Oracle Express Edition too.' + useJUnit { + includeCategories 'org.apache.sqoop.testcategories.thirdpartytest.OracleTest' + excludeCategories 'org.apache.sqoop.testcategories.thirdpartytest.OracleEeTest' + excludeCategories 'org.apache.sqoop.testcategories.sqooptest.ManualTest' + excludeCategories 'org.apache.sqoop.testcategories.KerberizedTest' + } +} + +task oracleEeTest (type: Test) { + description 'Run Oracle third party tests which require Oracle Enterprise Edition.' + useJUnit { + includeCategories 'org.apache.sqoop.testcategories.thirdpartytest.OracleEeTest' + excludeCategories 'org.apache.sqoop.testcategories.sqooptest.ManualTest' + excludeCategories 'org.apache.sqoop.testcategories.KerberizedTest' + } +} + +task sqlServerTest (type: Test) { + description 'Run MS SqlServer third party tests.' + useJUnit { + includeCategories 'org.apache.sqoop.testcategories.thirdpartytest.SqlServerTest' + excludeCategories 'org.apache.sqoop.testcategories.sqooptest.ManualTest' + excludeCategories 'org.apache.sqoop.testcategories.KerberizedTest' + } + systemProperty "ms.datatype.test.data.file.export" ,"DatatypeTestData-export-lite.txt" + systemProperty "ms.datatype.test.data.file.import" ,"DatatypeTestData-import-lite.txt" + systemProperty "ms.datatype.test.data.file.delim" ,"," + systemProperty "ms.datatype.test.hdfsprefix" ,"file:///" +} + test { description 'Run tests that do not need external JDBC driver and/or a docker container. ' + 'This is the same as running unitTest, integrationTest and kerberizedTest.' diff --git a/build.xml b/build.xml index a0e25191..9245f3e4 100644 --- a/build.xml +++ b/build.xml @@ -185,59 +185,63 @@ value="${name}/[conf]/[artifact]-[revision](-[classifier]).[ext]"/> - - - + + + + + + + + value="jdbc:mysql://127.0.0.1:13306/"/> - + value="sqoop"/> + + value="sqoop"/> - - - + value="jdbc:cubrid:localhost:33000"/> + + + + value="jdbc:postgresql://localhost:15432/"/> + value="sqoop" /> + value="sqoop" /> + value="sqoop" /> + value="Sqoop12345" /> + value="jdbc:sqlserver://localhost:1433"/> + value="master"/> + value="sa"/> + value="Sqoop12345"/> - + - - + + @@ -835,6 +839,15 @@ + + + + + + @@ -949,7 +962,7 @@ excludes="**/${test.exclude}.java,**/KerberizedTest.java,**/IntegrationTest.java,**/SqoopTest.java, **/UnitTest.java,**/CubridTest.java,**/Db2Test.java,**/MainFrameTest.java,**/MysqlTest.java, **/NetezzaTest.java,**/OracleTest.java,**/PostgresqlTest.java,**/S3Test.java,**/SqlServerTest.java, - **/ThirdPartyTest.java"/> + **/ThirdPartyTest.java,**/OracleEeTest.java"/> diff --git a/gradle.properties b/gradle.properties index 722bc8bb..924ce190 100644 --- a/gradle.properties +++ b/gradle.properties @@ -51,6 +51,11 @@ mockitoallVersion=1.9.5 systemRulesVersion=1.17.0 assertjVersion=2.8.0 +mySqlConnectorVersion=5.1.47 +cubridJdbcDriverVersion=10.1.2.7694 +msSqlJdbcDriverVersion=7.0.0.jre8 +db2JdbcDriverVersion=10.1 + checkstyleVersion=5.5 version=1.5.0-SNAPSHOT diff --git a/src/scripts/thirdpartytest/docker-compose/oraclescripts/ee-healthcheck.sh b/src/scripts/thirdpartytest/docker-compose/oraclescripts/ee-healthcheck.sh new file mode 100755 index 00000000..fb7800ef --- /dev/null +++ b/src/scripts/thirdpartytest/docker-compose/oraclescripts/ee-healthcheck.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +echo "SELECT 1 from DUAL;" | sqlplus -L SQOOPTEST2/ABCDEF@//localhost:1521/sqoop diff --git a/src/scripts/thirdpartytest/docker-compose/oraclescripts/healthcheck.sh b/src/scripts/thirdpartytest/docker-compose/oraclescripts/healthcheck.sh index fb7800ef..f5a94963 100755 --- a/src/scripts/thirdpartytest/docker-compose/oraclescripts/healthcheck.sh +++ b/src/scripts/thirdpartytest/docker-compose/oraclescripts/healthcheck.sh @@ -16,4 +16,4 @@ # limitations under the License. -echo "SELECT 1 from DUAL;" | sqlplus -L SQOOPTEST2/ABCDEF@//localhost:1521/sqoop +echo "SELECT 1 from DUAL;" | sqlplus -L SQOOPTEST2/ABCDEF@//localhost:1521/xe diff --git a/src/scripts/thirdpartytest/docker-compose/sqoop-thirdpartytest-db-services.yml b/src/scripts/thirdpartytest/docker-compose/sqoop-thirdpartytest-db-services.yml index b4cf4886..d3ffc252 100644 --- a/src/scripts/thirdpartytest/docker-compose/sqoop-thirdpartytest-db-services.yml +++ b/src/scripts/thirdpartytest/docker-compose/sqoop-thirdpartytest-db-services.yml @@ -25,7 +25,7 @@ services: MYSQL_PASSWORD: Sqoop12345 MYSQL_DATABASE: sqoop ports: - - 3306:3306 + - 13306:3306 command: mysqld --sql_mode="ANSI_QUOTES" healthcheck: @@ -42,7 +42,7 @@ services: POSTGRES_USER: sqoop POSTGRES_PASSWORD: Sqoop12345 ports: - - 5432:5432 + - 15432:5432 healthcheck: test: ["CMD", "pg_isready"] interval: 30s @@ -77,22 +77,37 @@ services: interval: 30s timeout: 10s retries: 10 - oracle: + oracle-ee: image: oracle/database:12.2.0.1-ee - container_name: sqoop_oracle_container + container_name: sqoop_oracle-ee_container environment: COMPOSE_HTTP_TIMEOUT: 200 ORACLE_SID: sqoop ORACLE_PWD: Sqoop12345 ports: - - 1521:1521 + - 1522:1521 volumes: - ./oraclescripts:/opt/oracle/scripts healthcheck: - test: ["CMD", "/opt/oracle/scripts/healthcheck.sh"] + test: ["CMD", "/opt/oracle/scripts/ee-healthcheck.sh"] interval: 30s timeout: 10s retries: 60 + oracle: + image: sath89/oracle-xe-11g + container_name: sqoop_oracle_container + environment: + COMPOSE_HTTP_TIMEOUT: 200 + ports: + - 1521:1521 + volumes: + - ./oraclescripts:/opt/oracle/scripts + - ./oraclescripts/startup:/docker-entrypoint-initdb.d + healthcheck: + test: ["CMD", "/opt/oracle/scripts/healthcheck.sh"] + interval: 5s + timeout: 5s + retries: 50 db2: image: ibmcom/db2express-c:10.5.0.5-3.10.0 container_name: sqoop_db2_container diff --git a/src/test/org/apache/sqoop/manager/cubrid/CubridTestUtils.java b/src/test/org/apache/sqoop/manager/cubrid/CubridTestUtils.java index 4fd522ba..0d95e3d3 100644 --- a/src/test/org/apache/sqoop/manager/cubrid/CubridTestUtils.java +++ b/src/test/org/apache/sqoop/manager/cubrid/CubridTestUtils.java @@ -51,17 +51,17 @@ public class CubridTestUtils { public static final String HOST_URL = System .getProperty("sqoop.test.cubrid.connectstring.host_url", - "jdbc:cubrid:localhost:30000"); + "jdbc:cubrid:localhost:33000"); static final String TEST_DATABASE = System .getProperty("sqoop.test.cubrid.connectstring.database", - "SQOOPCUBRIDTEST"); + "sqoop"); static final String TEST_USER = System .getProperty("sqoop.test.cubrid.connectstring.username", - "SQOOPUSER"); + "sqoop"); static final String TEST_PASS = System .getProperty("sqoop.test.cubrid.connectstring.password", - "PASSWORD"); + "Sqoop12345"); static final String TABLE_NAME = "EMPLOYEES_CUBRID"; static final String NULL_TABLE_NAME = "NULL_EMPLOYEES_CUBRID"; static final String CONNECT_STRING = HOST_URL + ":" diff --git a/src/test/org/apache/sqoop/manager/db2/DB2ImportAllTableWithSchemaManualTest.java b/src/test/org/apache/sqoop/manager/db2/DB2ImportAllTableWithSchemaManualTest.java index ed949b98..1f057dcd 100644 --- a/src/test/org/apache/sqoop/manager/db2/DB2ImportAllTableWithSchemaManualTest.java +++ b/src/test/org/apache/sqoop/manager/db2/DB2ImportAllTableWithSchemaManualTest.java @@ -51,6 +51,10 @@ import org.apache.sqoop.util.LoggingUtils; import org.junit.experimental.categories.Category; +import static org.apache.sqoop.manager.db2.DB2TestUtils.CONNECT_STRING; +import static org.apache.sqoop.manager.db2.DB2TestUtils.DATABASE_PASSWORD; +import static org.apache.sqoop.manager.db2.DB2TestUtils.DATABASE_USER; +import static org.apache.sqoop.manager.db2.DB2TestUtils.HOST_URL; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -81,24 +85,8 @@ public class DB2ImportAllTableWithSchemaManualTest extends ImportJobTestCase { public static final Log LOG = LogFactory.getLog( DB2ImportAllTableWithSchemaManualTest.class.getName()); - static final String HOST_URL = System.getProperty( - "sqoop.test.db2.connectstring.host_url", - "jdbc:db2://9.30.245.234:60000"); - - static final String DATABASE_NAME = System.getProperty( - "sqoop.test.db2.connectstring.database", - "TESTDB"); - static final String DATABASE_USER = System.getProperty( - "sqoop.test.db2.connectstring.username", - "DB2FENC1"); - static final String DATABASE_PASSWORD = System.getProperty( - "sqoop.test.db2.connectstring.password", - "DB2FENC1"); - static final String TABLE_NAME = "TEST.COMPANY"; static final String TABLE_SCHEMA = "TEST"; - static final String CONNECT_STRING = HOST_URL - + "/" + DATABASE_NAME; static String ExpectedResults = "1,doc1"; diff --git a/src/test/org/apache/sqoop/manager/db2/DB2ManagerImportManualTest.java b/src/test/org/apache/sqoop/manager/db2/DB2ManagerImportManualTest.java index 32dfc5eb..a32478a5 100644 --- a/src/test/org/apache/sqoop/manager/db2/DB2ManagerImportManualTest.java +++ b/src/test/org/apache/sqoop/manager/db2/DB2ManagerImportManualTest.java @@ -44,6 +44,9 @@ import org.apache.sqoop.util.FileListing; import org.junit.experimental.categories.Category; +import static org.apache.sqoop.manager.db2.DB2TestUtils.CONNECT_STRING; +import static org.apache.sqoop.manager.db2.DB2TestUtils.DATABASE_PASSWORD; +import static org.apache.sqoop.manager.db2.DB2TestUtils.DATABASE_USER; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -74,24 +77,8 @@ public class DB2ManagerImportManualTest extends ImportJobTestCase { public static final Log LOG = LogFactory.getLog( DB2ManagerImportManualTest.class.getName()); - static final String HOST_URL = System.getProperty( - "sqoop.test.db2.connectstring.host_url", - "jdbc:db2://db2host:50000"); - - static final String DATABASE_NAME = System.getProperty( - "sqoop.test.db2.connectstring.database", - "SQOOP"); - static final String DATABASE_USER = System.getProperty( - "sqoop.test.db2.connectstring.username", - "SQOOP"); - static final String DATABASE_PASSWORD = System.getProperty( - "sqoop.test.db2.connectstring.password", - "SQOOP"); static final String TABLE_NAME = "EMPLOYEES_DB2"; static final String QUALIFIED_TABLE_NAME = DATABASE_USER + ".EMPLOYEES_DB2"; - static final String CONNECT_STRING = HOST_URL - + "/" + DATABASE_NAME - + ":currentSchema=" + DATABASE_USER +";"; static { LOG.info("Using DB2 CONNECT_STRING: " + CONNECT_STRING); diff --git a/src/test/org/apache/sqoop/manager/db2/DB2TestUtils.java b/src/test/org/apache/sqoop/manager/db2/DB2TestUtils.java new file mode 100644 index 00000000..55a2da85 --- /dev/null +++ b/src/test/org/apache/sqoop/manager/db2/DB2TestUtils.java @@ -0,0 +1,28 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.sqoop.manager.db2; + +public class DB2TestUtils { + + public static final String HOST_URL = System.getProperty("sqoop.test.db2.connectstring.host_url", "jdbc:db2://localhost:50000"); + public static final String DATABASE_NAME = System.getProperty("sqoop.test.db2.connectstring.database", "SQOOP"); + public static final String DATABASE_USER = System.getProperty("sqoop.test.db2.connectstring.username", "DB2INST1"); + public static final String DATABASE_PASSWORD = System.getProperty("sqoop.test.db2.connectstring.password", "Sqoop12345"); + public static final String CONNECT_STRING = HOST_URL + "/" + DATABASE_NAME + ":currentSchema=" + DATABASE_USER +";"; +} diff --git a/src/test/org/apache/sqoop/manager/db2/DB2XmlTypeImportManualTest.java b/src/test/org/apache/sqoop/manager/db2/DB2XmlTypeImportManualTest.java index 494c75b0..57606383 100644 --- a/src/test/org/apache/sqoop/manager/db2/DB2XmlTypeImportManualTest.java +++ b/src/test/org/apache/sqoop/manager/db2/DB2XmlTypeImportManualTest.java @@ -44,6 +44,10 @@ import org.apache.sqoop.util.FileListing; import org.junit.experimental.categories.Category; +import static org.apache.sqoop.manager.db2.DB2TestUtils.CONNECT_STRING; +import static org.apache.sqoop.manager.db2.DB2TestUtils.DATABASE_PASSWORD; +import static org.apache.sqoop.manager.db2.DB2TestUtils.DATABASE_USER; +import static org.apache.sqoop.manager.db2.DB2TestUtils.HOST_URL; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -74,23 +78,7 @@ public class DB2XmlTypeImportManualTest extends ImportJobTestCase { public static final Log LOG = LogFactory.getLog( DB2XmlTypeImportManualTest.class.getName()); - static final String HOST_URL = System.getProperty( - "sqoop.test.db2.connectstring.host_url", - "jdbc:db2://db2host:60000"); - - static final String DATABASE_NAME = System.getProperty( - "sqoop.test.db2.connectstring.database", - "SQOOP"); - static final String DATABASE_USER = System.getProperty( - "sqoop.test.db2.connectstring.username", - "SQOOP"); - static final String DATABASE_PASSWORD = System.getProperty( - "sqoop.test.db2.connectstring.password", - "SQOOP"); - static final String TABLE_NAME = "COMPANY"; - static final String CONNECT_STRING = HOST_URL - + "/" + DATABASE_NAME; static final String HIVE_TABLE_NAME = "HCOMPANY"; static String ExpectedResults = "1,doc1,Laura BrownFinance"; diff --git a/src/test/org/apache/sqoop/manager/mysql/MySQLTestUtils.java b/src/test/org/apache/sqoop/manager/mysql/MySQLTestUtils.java index be205c87..a7a6de24 100644 --- a/src/test/org/apache/sqoop/manager/mysql/MySQLTestUtils.java +++ b/src/test/org/apache/sqoop/manager/mysql/MySQLTestUtils.java @@ -43,18 +43,18 @@ public final class MySQLTestUtils { private String userName; private String userPass; - private String mysqlDbNAme; + private String mysqlDbName; private String mySqlConnectString; public MySQLTestUtils() { hostUrl = System.getProperty( "sqoop.test.mysql.connectstring.host_url", - "jdbc:mysql://localhost/"); - userName = System.getProperty("sqoop.test.mysql.username", getCurrentUser()); - userPass = System.getProperty("sqoop.test.mysql.password"); + "jdbc:mysql://127.0.0.1:13306/"); + userName = System.getProperty("sqoop.test.mysql.username", "sqoop"); + userPass = System.getProperty("sqoop.test.mysql.password", "Sqoop12345"); - mysqlDbNAme = System.getProperty("sqoop.test.mysql.databasename", "sqooptestdb"); - mySqlConnectString = getHostUrl() + getMysqlDbNAme(); + mysqlDbName = System.getProperty("sqoop.test.mysql.databasename", "sqoop"); + mySqlConnectString = getHostUrl() + getMysqlDbName(); } public String getHostUrl() { @@ -69,8 +69,8 @@ public String getUserPass() { return userPass; } - public String getMysqlDbNAme() { - return mysqlDbNAme; + public String getMysqlDbName() { + return mysqlDbName; } diff --git a/src/test/org/apache/sqoop/manager/oracle/ExportTest.java b/src/test/org/apache/sqoop/manager/oracle/ExportTest.java index a6016871..1de12c87 100644 --- a/src/test/org/apache/sqoop/manager/oracle/ExportTest.java +++ b/src/test/org/apache/sqoop/manager/oracle/ExportTest.java @@ -18,15 +18,19 @@ package org.apache.sqoop.manager.oracle; +import org.apache.sqoop.manager.oracle.util.OracleUtils; +import org.apache.sqoop.testcategories.thirdpartytest.OracleEeTest; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import org.junit.experimental.categories.Category; import static org.junit.Assert.assertEquals; /** * Test exporting data into Oracle. */ +@Category(OracleEeTest.class) public class ExportTest extends OraOopTestCase { private static final ExportTest TEST_CASE = new ExportTest(); @@ -67,4 +71,15 @@ public static void cleanUpHdfsData() throws Exception { TEST_CASE.closeTestEnvConnection(); } + protected String getConnectString() { + return org.apache.sqoop.manager.oracle.util.OracleUtils.EE_CONNECT_STRING; + } + + protected String getUsername() { + return org.apache.sqoop.manager.oracle.util.OracleUtils.ORACLE_EE_USER_NAME; + } + + protected String getPassword() { + return OracleUtils.ORACLE_EE_USER_PASS; + } } diff --git a/src/test/org/apache/sqoop/manager/oracle/ImportTest.java b/src/test/org/apache/sqoop/manager/oracle/ImportTest.java index 5db9fe34..bd5f3733 100644 --- a/src/test/org/apache/sqoop/manager/oracle/ImportTest.java +++ b/src/test/org/apache/sqoop/manager/oracle/ImportTest.java @@ -21,13 +21,17 @@ import org.apache.hadoop.conf.Configuration; import org.apache.sqoop.manager.oracle.OraOopConstants. OraOopOracleDataChunkMethod; +import org.apache.sqoop.manager.oracle.util.OracleUtils; +import org.apache.sqoop.testcategories.thirdpartytest.OracleEeTest; import org.junit.Test; +import org.junit.experimental.categories.Category; import static org.junit.Assert.assertEquals; /** * Test import data from Oracle. */ +@Category(OracleEeTest.class) public class ImportTest extends OraOopTestCase { private static final boolean DISABLE_ORACLE_ESCAPING_FLAG = false; @@ -275,4 +279,15 @@ public void testProductPartIotImport() throws Exception { } } + protected String getConnectString() { + return OracleUtils.EE_CONNECT_STRING; + } + + protected String getUsername() { + return OracleUtils.ORACLE_EE_USER_NAME; + } + + protected String getPassword() { + return OracleUtils.ORACLE_EE_USER_PASS; + } } diff --git a/src/test/org/apache/sqoop/manager/oracle/OraOopTestCase.java b/src/test/org/apache/sqoop/manager/oracle/OraOopTestCase.java index 1598813d..796a6e78 100644 --- a/src/test/org/apache/sqoop/manager/oracle/OraOopTestCase.java +++ b/src/test/org/apache/sqoop/manager/oracle/OraOopTestCase.java @@ -108,9 +108,7 @@ protected void setSqoopGenClassName(String sqoopGenClassName) { protected Connection getTestEnvConnection() throws SQLException { if (this.conn == null) { - this.conn = - DriverManager.getConnection(OracleUtils.CONNECT_STRING, - OracleUtils.ORACLE_USER_NAME, OracleUtils.ORACLE_USER_PASS); + this.conn = DriverManager.getConnection(getConnectString(), getUsername(), getPassword()); this.conn.setAutoCommit(false); } return this.conn; @@ -231,13 +229,13 @@ protected int runImport(String tableName, Configuration sqoopConf, } sqoopArgs.add("--connect"); - sqoopArgs.add(OracleUtils.CONNECT_STRING); + sqoopArgs.add(getConnectString()); sqoopArgs.add("--username"); - sqoopArgs.add(OracleUtils.ORACLE_USER_NAME); + sqoopArgs.add(getUsername()); sqoopArgs.add("--password"); - sqoopArgs.add(OracleUtils.ORACLE_USER_PASS); + sqoopArgs.add(getPassword()); sqoopArgs.add("--table"); sqoopArgs.add(tableName); @@ -309,13 +307,13 @@ protected int runExport(String tableName, List additionalArgs, Map jdbcFetchSize * 1.05) { + if (rowsPerFetch < jdbcFetchSize * 0.925 + || rowsPerFetch > jdbcFetchSize * 1.075) { Assert .fail(String .format( diff --git a/src/test/org/apache/sqoop/manager/oracle/TimestampDataTest.java b/src/test/org/apache/sqoop/manager/oracle/TimestampDataTest.java index be086c5c..adfd9b67 100644 --- a/src/test/org/apache/sqoop/manager/oracle/TimestampDataTest.java +++ b/src/test/org/apache/sqoop/manager/oracle/TimestampDataTest.java @@ -19,7 +19,10 @@ package org.apache.sqoop.manager.oracle; import org.apache.hadoop.conf.Configuration; +import org.apache.sqoop.manager.oracle.util.OracleUtils; +import org.apache.sqoop.testcategories.thirdpartytest.OracleEeTest; import org.junit.Test; +import org.junit.experimental.categories.Category; import static org.junit.Assert.assertEquals; @@ -28,6 +31,7 @@ * requires the tests to be run in a different process. Maven needs to be setup * to fork per test class. */ +@Category(OracleEeTest.class) public class TimestampDataTest extends OraOopTestCase { private static final boolean DISABLE_ORACLE_ESCAPING_FLAG = false; @@ -50,4 +54,15 @@ public void testProductImportTimezone() throws Exception { } } + protected String getConnectString() { + return org.apache.sqoop.manager.oracle.util.OracleUtils.EE_CONNECT_STRING; + } + + protected String getUsername() { + return org.apache.sqoop.manager.oracle.util.OracleUtils.ORACLE_EE_USER_NAME; + } + + protected String getPassword() { + return OracleUtils.ORACLE_EE_USER_PASS; + } } diff --git a/src/test/org/apache/sqoop/manager/oracle/util/OracleUtils.java b/src/test/org/apache/sqoop/manager/oracle/util/OracleUtils.java index 14b57f91..9c65e3d8 100644 --- a/src/test/org/apache/sqoop/manager/oracle/util/OracleUtils.java +++ b/src/test/org/apache/sqoop/manager/oracle/util/OracleUtils.java @@ -36,12 +36,13 @@ public final class OracleUtils { public static final Log LOG = LogFactory.getLog(OracleUtils.class.getName()); - // Express edition hardcoded name. - public static final String ORACLE_DATABASE_NAME = "xe"; + public static final String CONNECT_STRING = System.getProperty("sqoop.test.oracle.connectstring", "jdbc:oracle:thin:@//localhost:1521/xe"); + public static final String ORACLE_USER_NAME = System.getProperty("sqoop.test.oracle.username", "SYSTEM"); + public static final String ORACLE_USER_PASS = System.getProperty("sqoop.test.oracle.password", "oracle"); - public static final String CONNECT_STRING = System.getProperty("sqoop.test.oracle.connectstring", "jdbc:oracle:thin:@//localhost/" + ORACLE_DATABASE_NAME); - public static final String ORACLE_USER_NAME = System.getProperty("sqoop.test.oracle.username", "SQOOPTEST"); - public static final String ORACLE_USER_PASS = System.getProperty("sqoop.test.oracle.password", "12345"); + public static final String EE_CONNECT_STRING = System.getProperty("sqoop.test.oracle-ee.connectstring", "jdbc:oracle:thin:@//localhost:1522/sqoop"); + public static final String ORACLE_EE_USER_NAME = System.getProperty("sqoop.test.oracle-ee.username", "SYSTEM"); + public static final String ORACLE_EE_USER_PASS = System.getProperty("sqoop.test.oracle-ee.password", "Sqoop12345"); public static final String ORACLE_SECONDARY_USER_NAME = "SQOOPTEST2"; public static final String ORACLE_SECONDARY_USER_PASS = "ABCDEF"; diff --git a/src/test/org/apache/sqoop/manager/postgresql/DirectPostgreSQLExportManualTest.java b/src/test/org/apache/sqoop/manager/postgresql/DirectPostgreSQLExportManualTest.java index 7dd6efcf..9f8dd201 100644 --- a/src/test/org/apache/sqoop/manager/postgresql/DirectPostgreSQLExportManualTest.java +++ b/src/test/org/apache/sqoop/manager/postgresql/DirectPostgreSQLExportManualTest.java @@ -18,6 +18,10 @@ package org.apache.sqoop.manager.postgresql; +import static org.apache.sqoop.manager.postgresql.PostgresqlTestUtil.CONNECT_STRING; +import static org.apache.sqoop.manager.postgresql.PostgresqlTestUtil.DATABASE_USER; +import static org.apache.sqoop.manager.postgresql.PostgresqlTestUtil.PASSWORD; + import java.io.IOException; import java.sql.Connection; import java.sql.SQLException; @@ -63,17 +67,6 @@ public class DirectPostgreSQLExportManualTest extends TestExport { LogFactory.getLog(DirectPostgreSQLExportManualTest.class.getName()); private DBConfiguration dbConf; - static final String HOST_URL = - System.getProperty("sqoop.test.postgresql.connectstring.host_url", - "jdbc:postgresql://localhost/"); - static final String DATABASE = - System.getProperty("sqoop.test.postgresql.database", "sqooptest"); - static final String USERNAME = - System.getProperty("sqoop.test.postgresql.username", "sqooptest"); - static final String PASSWORD = System.getProperty( - "sqoop.test.postgresql.password"); - static final String CONNECT_STRING = HOST_URL + DATABASE; - public DirectPostgreSQLExportManualTest() { JobConf conf = new JobConf(getConf()); DBConfiguration.configureDB(conf, @@ -95,7 +88,7 @@ protected String getConnectString() { } protected String getUserName() { - return USERNAME; + return DATABASE_USER; } @Override diff --git a/src/test/org/apache/sqoop/manager/postgresql/PGBulkloadManagerManualTest.java b/src/test/org/apache/sqoop/manager/postgresql/PGBulkloadManagerManualTest.java index 1fe26445..88490228 100644 --- a/src/test/org/apache/sqoop/manager/postgresql/PGBulkloadManagerManualTest.java +++ b/src/test/org/apache/sqoop/manager/postgresql/PGBulkloadManagerManualTest.java @@ -18,6 +18,9 @@ package org.apache.sqoop.manager.postgresql; +import static org.apache.sqoop.manager.postgresql.PostgresqlTestUtil.CONNECT_STRING; +import static org.apache.sqoop.manager.postgresql.PostgresqlTestUtil.DATABASE_USER; + import java.io.IOException; import java.sql.Connection; import java.sql.PreparedStatement; @@ -71,18 +74,10 @@ public class PGBulkloadManagerManualTest extends TestExport { public static final Log LOG = LogFactory.getLog(PGBulkloadManagerManualTest.class.getName()); private DBConfiguration dbConf; - static final String HOST_URL = - System.getProperty("sqoop.test.postgresql.connectstring.host_url", - "jdbc:postgresql://localhost/"); - static final String DATABASE = - System.getProperty("sqoop.test.postgresql.database", "sqooptest"); static final String TABLESPACE = - System.getProperty("sqoop.test.postgresql.tablespace", "sqooptest"); - static final String USERNAME = - System.getProperty("sqoop.test.postgresql.username", "sqooptest"); + System.getProperty("sqoop.test.postgresql.tablespace", "sqoop"); static final String PG_BULKLOAD = System.getProperty("sqoop.test.postgresql.pg_bulkload", "pg_bulkload"); - static final String CONNECT_STRING = HOST_URL + DATABASE; public PGBulkloadManagerManualTest() { JobConf conf = new JobConf(getConf()); @@ -108,7 +103,7 @@ protected String getConnectString() { protected String getUserName() { - return USERNAME; + return DATABASE_USER; } diff --git a/src/test/org/apache/sqoop/manager/postgresql/PostgresqlExportTest.java b/src/test/org/apache/sqoop/manager/postgresql/PostgresqlExportTest.java index eb798fa9..457b398a 100644 --- a/src/test/org/apache/sqoop/manager/postgresql/PostgresqlExportTest.java +++ b/src/test/org/apache/sqoop/manager/postgresql/PostgresqlExportTest.java @@ -17,6 +17,10 @@ */ package org.apache.sqoop.manager.postgresql; +import static org.apache.sqoop.manager.postgresql.PostgresqlTestUtil.CONNECT_STRING; +import static org.apache.sqoop.manager.postgresql.PostgresqlTestUtil.DATABASE_USER; +import static org.apache.sqoop.manager.postgresql.PostgresqlTestUtil.PASSWORD; + import org.apache.sqoop.SqoopOptions; import org.apache.sqoop.testcategories.thirdpartytest.PostgresqlTest; import org.apache.sqoop.testutil.CommonArgs; @@ -52,24 +56,11 @@ public class PostgresqlExportTest extends ExportJobTestCase { public static final Log LOG = LogFactory.getLog( PostgresqlExportTest.class.getName()); - static final String HOST_URL = System.getProperty( - "sqoop.test.postgresql.connectstring.host_url", - "jdbc:postgresql://localhost/"); - static final String DATABASE_USER = System.getProperty( - "sqoop.test.postgresql.username", - "sqooptest"); - static final String DATABASE_NAME = System.getProperty( - "sqoop.test.postgresql.database", - "sqooptest"); - static final String PASSWORD = System.getProperty( - "sqoop.test.postgresql.password"); - static final String TABLE_NAME = "EMPLOYEES_PG"; static final String PROCEDURE_NAME = "INSERT_AN_EMPLOYEE"; static final String STAGING_TABLE_NAME = "STAGING"; static final String SCHEMA_PUBLIC = "public"; static final String SCHEMA_SPECIAL = "special"; - static final String CONNECT_STRING = HOST_URL + DATABASE_NAME; protected Connection connection; diff --git a/src/test/org/apache/sqoop/manager/postgresql/PostgresqlExternalTableImportTest.java b/src/test/org/apache/sqoop/manager/postgresql/PostgresqlExternalTableImportTest.java index 8c3d2fd9..c089291d 100644 --- a/src/test/org/apache/sqoop/manager/postgresql/PostgresqlExternalTableImportTest.java +++ b/src/test/org/apache/sqoop/manager/postgresql/PostgresqlExternalTableImportTest.java @@ -17,6 +17,9 @@ */ package org.apache.sqoop.manager.postgresql; +import static org.apache.sqoop.manager.postgresql.PostgresqlTestUtil.CONNECT_STRING; +import static org.apache.sqoop.manager.postgresql.PostgresqlTestUtil.DATABASE_USER; +import static org.apache.sqoop.manager.postgresql.PostgresqlTestUtil.PASSWORD; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -54,13 +57,6 @@ public class PostgresqlExternalTableImportTest extends ImportJobTestCase { public static final Log LOG = LogFactory .getLog(PostgresqlExternalTableImportTest.class.getName()); - static final String HOST_URL = System.getProperty("sqoop.test.postgresql.connectstring.host_url", - "jdbc:postgresql://localhost/"); - static final String DATABASE_USER = System.getProperty( - "sqoop.test.postgresql.username", "sqooptest"); - static final String DATABASE_NAME = System.getProperty( - "sqoop.test.postgresql.database", "sqooptest"); - static final String PASSWORD = System.getProperty("sqoop.test.postgresql.password"); static final String TABLE_NAME = "EMPLOYEES_PG"; static final String NULL_TABLE_NAME = "NULL_EMPLOYEES_PG"; @@ -68,7 +64,6 @@ public class PostgresqlExternalTableImportTest extends ImportJobTestCase { static final String DIFFERENT_TABLE_NAME = "DIFFERENT_TABLE"; static final String SCHEMA_PUBLIC = "public"; static final String SCHEMA_SPECIAL = "special"; - static final String CONNECT_STRING = HOST_URL + DATABASE_NAME; static final String EXTERNAL_TABLE_DIR = "/tmp/external/employees_pg"; protected Connection connection; diff --git a/src/test/org/apache/sqoop/manager/postgresql/PostgresqlTestUtil.java b/src/test/org/apache/sqoop/manager/postgresql/PostgresqlTestUtil.java index e9705e5d..146e4b3c 100644 --- a/src/test/org/apache/sqoop/manager/postgresql/PostgresqlTestUtil.java +++ b/src/test/org/apache/sqoop/manager/postgresql/PostgresqlTestUtil.java @@ -22,20 +22,20 @@ public class PostgresqlTestUtil { public static final String HOST_URL = System.getProperty( "sqoop.test.postgresql.connectstring.host_url", - "jdbc:postgresql://localhost/"); + "jdbc:postgresql://localhost:15432/"); public static final String DATABASE_USER = System.getProperty( "sqoop.test.postgresql.username", - "sqooptest"); + "sqoop"); public static final String DATABASE_NAME = System.getProperty( "sqoop.test.postgresql.database", - "sqooptest"); + "sqoop"); public static final String CONNECT_STRING = HOST_URL + DATABASE_NAME; public static final String PASSWORD = System.getProperty( - "sqoop.test.postgresql.password"); + "sqoop.test.postgresql.password", "Sqoop12345"); static final String TABLE_NAME = "EMPLOYEES_PG"; diff --git a/src/test/org/apache/sqoop/manager/sqlserver/MSSQLTestUtils.java b/src/test/org/apache/sqoop/manager/sqlserver/MSSQLTestUtils.java index bd12c556..401d2faf 100644 --- a/src/test/org/apache/sqoop/manager/sqlserver/MSSQLTestUtils.java +++ b/src/test/org/apache/sqoop/manager/sqlserver/MSSQLTestUtils.java @@ -38,15 +38,15 @@ public class MSSQLTestUtils { MSSQLTestUtils.class.getName()); public static final String DATABASE_USER = System.getProperty( - "ms.sqlserver.username", "SQOOPUSER"); + "ms.sqlserver.username", "sa"); public static final String DATABASE_PASSWORD = System.getProperty( - "ms.sqlserver.password", "PASSWORD"); + "ms.sqlserver.password", "Sqoop12345"); public static final String DATABASE_NAME = System.getProperty( "sqoop.test.sqlserver.database", - "sqooptest"); + "master"); public static final String HOST_URL = System.getProperty( "sqoop.test.sqlserver.connectstring.host_url", - "jdbc:sqlserver://sqlserverhost:1433"); + "jdbc:sqlserver://localhost:1433"); public static final String CONNECT_STRING = HOST_URL + ";database=" + DATABASE_NAME; diff --git a/src/test/org/apache/sqoop/manager/sqlserver/SQLServerManagerExportTest.java b/src/test/org/apache/sqoop/manager/sqlserver/SQLServerManagerExportTest.java index ab1e8ff2..9d019a83 100644 --- a/src/test/org/apache/sqoop/manager/sqlserver/SQLServerManagerExportTest.java +++ b/src/test/org/apache/sqoop/manager/sqlserver/SQLServerManagerExportTest.java @@ -42,6 +42,10 @@ import java.sql.Statement; import java.util.ArrayList; +import static org.apache.sqoop.manager.sqlserver.MSSQLTestUtils.DATABASE_NAME; +import static org.apache.sqoop.manager.sqlserver.MSSQLTestUtils.DATABASE_USER; +import static org.apache.sqoop.manager.sqlserver.MSSQLTestUtils.DATABASE_PASSWORD; +import static org.apache.sqoop.manager.sqlserver.MSSQLTestUtils.HOST_URL; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; @@ -54,19 +58,6 @@ public class SQLServerManagerExportTest extends ExportJobTestCase { public static final Log LOG = LogFactory.getLog( SQLServerManagerExportTest.class.getName()); - static final String HOST_URL = System.getProperty( - "sqoop.test.sqlserver.connectstring.host_url", - "jdbc:sqlserver://sqlserverhost:1433"); - static final String DATABASE_NAME = System.getProperty( - "sqoop.test.sqlserver.database", - "sqooptest"); - static final String DATABASE_USER = System.getProperty( - "ms.sqlserver.username", - "sqoopuser"); - static final String DATABASE_PASSWORD = System.getProperty( - "ms.sqlserver.password", - "password"); - static final String SCHEMA_DBO = "dbo"; static final String DBO_TABLE_NAME = "EMPLOYEES_MSSQL"; static final String DBO_BINARY_TABLE_NAME = "BINARYTYPE_MSSQL"; diff --git a/src/test/org/apache/sqoop/manager/sqlserver/SQLServerManagerImportTest.java b/src/test/org/apache/sqoop/manager/sqlserver/SQLServerManagerImportTest.java index 3c5bb327..42ac7661 100644 --- a/src/test/org/apache/sqoop/manager/sqlserver/SQLServerManagerImportTest.java +++ b/src/test/org/apache/sqoop/manager/sqlserver/SQLServerManagerImportTest.java @@ -52,6 +52,10 @@ import java.sql.Statement; import java.util.Arrays; +import static org.apache.sqoop.manager.sqlserver.MSSQLTestUtils.DATABASE_NAME; +import static org.apache.sqoop.manager.sqlserver.MSSQLTestUtils.DATABASE_USER; +import static org.apache.sqoop.manager.sqlserver.MSSQLTestUtils.DATABASE_PASSWORD; +import static org.apache.sqoop.manager.sqlserver.MSSQLTestUtils.HOST_URL; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -86,19 +90,6 @@ public class SQLServerManagerImportTest extends ImportJobTestCase { public static final Log LOG = LogFactory.getLog( SQLServerManagerImportTest.class.getName()); - static final String HOST_URL = System.getProperty( - "sqoop.test.sqlserver.connectstring.host_url", - "jdbc:sqlserver://sqlserverhost:1433"); - static final String DATABASE_NAME = System.getProperty( - "sqoop.test.sqlserver.database", - "sqooptest"); - static final String DATABASE_USER = System.getProperty( - "ms.sqlserver.username", - "sqoopuser"); - static final String DATABASE_PASSWORD = System.getProperty( - "ms.sqlserver.password", - "password"); - static final String SCHEMA_DBO = "dbo"; static final String DBO_TABLE_NAME = "EMPLOYEES_MSSQL"; static final String SCHEMA_SCH = "sch"; diff --git a/src/test/org/apache/sqoop/metastore/db2/DB2JobToolTest.java b/src/test/org/apache/sqoop/metastore/db2/DB2JobToolTest.java index 81ef5fce..578c6040 100644 --- a/src/test/org/apache/sqoop/metastore/db2/DB2JobToolTest.java +++ b/src/test/org/apache/sqoop/metastore/db2/DB2JobToolTest.java @@ -18,6 +18,10 @@ package org.apache.sqoop.metastore.db2; +import static org.apache.sqoop.manager.db2.DB2TestUtils.CONNECT_STRING; +import static org.apache.sqoop.manager.db2.DB2TestUtils.DATABASE_PASSWORD; +import static org.apache.sqoop.manager.db2.DB2TestUtils.DATABASE_USER; + import org.apache.sqoop.metastore.JobToolTestBase; import org.apache.sqoop.testcategories.thirdpartytest.Db2Test; import org.junit.experimental.categories.Category; @@ -44,23 +48,6 @@ @Category(Db2Test.class) public class DB2JobToolTest extends JobToolTestBase { - private static final String HOST_URL = System.getProperty( - "sqoop.test.db2.connectstring.host_url", - "jdbc:db2://db2host:50000"); - - private static final String DATABASE_NAME = System.getProperty( - "sqoop.test.db2.connectstring.database", - "SQOOP"); - private static final String DATABASE_USER = System.getProperty( - "sqoop.test.db2.connectstring.username", - "SQOOP"); - private static final String DATABASE_PASSWORD = System.getProperty( - "sqoop.test.db2.connectstring.password", - "SQOOP"); - private static final String CONNECT_STRING = HOST_URL - + "/" + DATABASE_NAME - + ":currentSchema=" + DATABASE_USER +";"; - public DB2JobToolTest() { super(CONNECT_STRING, DATABASE_USER, DATABASE_PASSWORD); } diff --git a/src/test/org/apache/sqoop/metastore/db2/DB2MetaConnectIncrementalImportTest.java b/src/test/org/apache/sqoop/metastore/db2/DB2MetaConnectIncrementalImportTest.java index 5403908e..08baec8c 100644 --- a/src/test/org/apache/sqoop/metastore/db2/DB2MetaConnectIncrementalImportTest.java +++ b/src/test/org/apache/sqoop/metastore/db2/DB2MetaConnectIncrementalImportTest.java @@ -18,6 +18,10 @@ package org.apache.sqoop.metastore.db2; +import static org.apache.sqoop.manager.db2.DB2TestUtils.CONNECT_STRING; +import static org.apache.sqoop.manager.db2.DB2TestUtils.DATABASE_PASSWORD; +import static org.apache.sqoop.manager.db2.DB2TestUtils.DATABASE_USER; + import org.apache.sqoop.metastore.MetaConnectIncrementalImportTestBase; import org.apache.sqoop.testcategories.thirdpartytest.Db2Test; import org.junit.experimental.categories.Category; @@ -44,23 +48,6 @@ @Category(Db2Test.class) public class DB2MetaConnectIncrementalImportTest extends MetaConnectIncrementalImportTestBase { - private static final String HOST_URL = System.getProperty( - "sqoop.test.db2.connectstring.host_url", - "jdbc:db2://db2host:50000"); - - private static final String DATABASE_NAME = System.getProperty( - "sqoop.test.db2.connectstring.database", - "SQOOP"); - private static final String DATABASE_USER = System.getProperty( - "sqoop.test.db2.connectstring.username", - "SQOOP"); - private static final String DATABASE_PASSWORD = System.getProperty( - "sqoop.test.db2.connectstring.password", - "SQOOP"); - private static final String CONNECT_STRING = HOST_URL - + "/" + DATABASE_NAME - + ":currentSchema=" + DATABASE_USER +";"; - public DB2MetaConnectIncrementalImportTest() { super(CONNECT_STRING, DATABASE_USER, DATABASE_PASSWORD); } diff --git a/src/test/org/apache/sqoop/metastore/db2/DB2SavedJobsTest.java b/src/test/org/apache/sqoop/metastore/db2/DB2SavedJobsTest.java index b41eda11..ca5d87d4 100644 --- a/src/test/org/apache/sqoop/metastore/db2/DB2SavedJobsTest.java +++ b/src/test/org/apache/sqoop/metastore/db2/DB2SavedJobsTest.java @@ -18,6 +18,10 @@ package org.apache.sqoop.metastore.db2; +import static org.apache.sqoop.manager.db2.DB2TestUtils.CONNECT_STRING; +import static org.apache.sqoop.manager.db2.DB2TestUtils.DATABASE_PASSWORD; +import static org.apache.sqoop.manager.db2.DB2TestUtils.DATABASE_USER; + import org.apache.sqoop.metastore.SavedJobsTestBase; import org.apache.sqoop.manager.JdbcDrivers; import org.apache.sqoop.testcategories.thirdpartytest.Db2Test; @@ -45,23 +49,6 @@ @Category(Db2Test.class) public class DB2SavedJobsTest extends SavedJobsTestBase { - private static final String HOST_URL = System.getProperty( - "sqoop.test.db2.connectstring.host_url", - "jdbc:db2://db2host:50000"); - - private static final String DATABASE_NAME = System.getProperty( - "sqoop.test.db2.connectstring.database", - "SQOOP"); - private static final String DATABASE_USER = System.getProperty( - "sqoop.test.db2.connectstring.username", - "SQOOP"); - private static final String DATABASE_PASSWORD = System.getProperty( - "sqoop.test.db2.connectstring.password", - "SQOOP"); - private static final String CONNECT_STRING = HOST_URL - + "/" + DATABASE_NAME - + ":currentSchema=" + DATABASE_USER +";"; - public DB2SavedJobsTest() { super(CONNECT_STRING, DATABASE_USER, DATABASE_PASSWORD, JdbcDrivers.DB2.getDriverClass()); } diff --git a/src/test/org/apache/sqoop/metastore/postgres/PostgresJobToolTest.java b/src/test/org/apache/sqoop/metastore/postgres/PostgresJobToolTest.java index 59ea151a..bc74abd1 100644 --- a/src/test/org/apache/sqoop/metastore/postgres/PostgresJobToolTest.java +++ b/src/test/org/apache/sqoop/metastore/postgres/PostgresJobToolTest.java @@ -18,6 +18,10 @@ package org.apache.sqoop.metastore.postgres; +import static org.apache.sqoop.manager.postgresql.PostgresqlTestUtil.CONNECT_STRING; +import static org.apache.sqoop.manager.postgresql.PostgresqlTestUtil.DATABASE_USER; +import static org.apache.sqoop.manager.postgresql.PostgresqlTestUtil.PASSWORD; + import org.apache.sqoop.metastore.JobToolTestBase; import org.apache.sqoop.testcategories.thirdpartytest.PostgresqlTest; import org.junit.experimental.categories.Category; @@ -40,15 +44,6 @@ @Category(PostgresqlTest.class) public class PostgresJobToolTest extends JobToolTestBase { - private static final String HOST_URL = System.getProperty("sqoop.test.postgresql.connectstring.host_url", - "jdbc:postgresql://localhost/"); - private static final String DATABASE_USER = System.getProperty( - "sqoop.test.postgresql.username", "sqooptest"); - private static final String DATABASE_NAME = System.getProperty( - "sqoop.test.postgresql.database", "sqooptest"); - private static final String PASSWORD = System.getProperty("sqoop.test.postgresql.password"); - private static final String CONNECT_STRING = HOST_URL + DATABASE_NAME; - public PostgresJobToolTest() { super(CONNECT_STRING, DATABASE_USER, PASSWORD); } diff --git a/src/test/org/apache/sqoop/metastore/postgres/PostgresMetaConnectIncrementalImportTest.java b/src/test/org/apache/sqoop/metastore/postgres/PostgresMetaConnectIncrementalImportTest.java index afc6bd23..648333a3 100644 --- a/src/test/org/apache/sqoop/metastore/postgres/PostgresMetaConnectIncrementalImportTest.java +++ b/src/test/org/apache/sqoop/metastore/postgres/PostgresMetaConnectIncrementalImportTest.java @@ -18,6 +18,10 @@ package org.apache.sqoop.metastore.postgres; +import static org.apache.sqoop.manager.postgresql.PostgresqlTestUtil.CONNECT_STRING; +import static org.apache.sqoop.manager.postgresql.PostgresqlTestUtil.DATABASE_USER; +import static org.apache.sqoop.manager.postgresql.PostgresqlTestUtil.PASSWORD; + import org.apache.sqoop.metastore.MetaConnectIncrementalImportTestBase; import org.apache.sqoop.testcategories.thirdpartytest.PostgresqlTest; import org.junit.experimental.categories.Category; @@ -40,15 +44,6 @@ @Category(PostgresqlTest.class) public class PostgresMetaConnectIncrementalImportTest extends MetaConnectIncrementalImportTestBase { - private static final String HOST_URL = System.getProperty("sqoop.test.postgresql.connectstring.host_url", - "jdbc:postgresql://localhost/"); - private static final String DATABASE_USER = System.getProperty( - "sqoop.test.postgresql.username", "sqooptest"); - private static final String DATABASE_NAME = System.getProperty( - "sqoop.test.postgresql.database", "sqooptest"); - private static final String PASSWORD = System.getProperty("sqoop.test.postgresql.password"); - private static final String CONNECT_STRING = HOST_URL + DATABASE_NAME; - public PostgresMetaConnectIncrementalImportTest() { super(CONNECT_STRING, DATABASE_USER, PASSWORD); } diff --git a/src/test/org/apache/sqoop/metastore/postgres/PostgresSavedJobsTest.java b/src/test/org/apache/sqoop/metastore/postgres/PostgresSavedJobsTest.java index 9f9e865b..7b1559d8 100644 --- a/src/test/org/apache/sqoop/metastore/postgres/PostgresSavedJobsTest.java +++ b/src/test/org/apache/sqoop/metastore/postgres/PostgresSavedJobsTest.java @@ -18,6 +18,10 @@ package org.apache.sqoop.metastore.postgres; +import static org.apache.sqoop.manager.postgresql.PostgresqlTestUtil.CONNECT_STRING; +import static org.apache.sqoop.manager.postgresql.PostgresqlTestUtil.DATABASE_USER; +import static org.apache.sqoop.manager.postgresql.PostgresqlTestUtil.PASSWORD; + import org.apache.sqoop.metastore.SavedJobsTestBase; import org.apache.sqoop.manager.JdbcDrivers; import org.apache.sqoop.testcategories.thirdpartytest.PostgresqlTest; @@ -41,15 +45,6 @@ @Category(PostgresqlTest.class) public class PostgresSavedJobsTest extends SavedJobsTestBase { - private static final String HOST_URL = System.getProperty("sqoop.test.postgresql.connectstring.host_url", - "jdbc:postgresql://localhost/"); - private static final String DATABASE_USER = System.getProperty( - "sqoop.test.postgresql.username", "sqooptest"); - private static final String DATABASE_NAME = System.getProperty( - "sqoop.test.postgresql.database", "sqooptest"); - private static final String PASSWORD = System.getProperty("sqoop.test.postgresql.password"); - private static final String CONNECT_STRING = HOST_URL + DATABASE_NAME; - public PostgresSavedJobsTest() { super(CONNECT_STRING, DATABASE_USER, PASSWORD, JdbcDrivers.POSTGRES.getDriverClass()); } diff --git a/src/test/org/apache/sqoop/testcategories/thirdpartytest/OracleEeTest.java b/src/test/org/apache/sqoop/testcategories/thirdpartytest/OracleEeTest.java new file mode 100644 index 00000000..c2063f8f --- /dev/null +++ b/src/test/org/apache/sqoop/testcategories/thirdpartytest/OracleEeTest.java @@ -0,0 +1,26 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.sqoop.testcategories.thirdpartytest; + +/** + * An Oracle EE test shall test scenarios where a Oracle Enterprise Edition database is needed, + * for example because of partitioning. + */ +public interface OracleEeTest extends OracleTest { +}