You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sqoop.apache.org by hs...@apache.org on 2014/12/20 00:34:29 UTC
sqoop git commit: Sqoop2: Add test categories
Repository: sqoop
Updated Branches:
refs/heads/sqoop2 8cb7fc48a -> 2fdeeb06d
Sqoop2: Add test categories
(Abraham Elmahrek via Hari Shreedharan)
Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/2fdeeb06
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/2fdeeb06
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/2fdeeb06
Branch: refs/heads/sqoop2
Commit: 2fdeeb06d6a7dc41e18c61f32a3ada73203cf545
Parents: 8cb7fc4
Author: Hari Shreedharan <hs...@apache.org>
Authored: Fri Dec 19 15:33:43 2014 -0800
Committer: Hari Shreedharan <hs...@apache.org>
Committed: Fri Dec 19 15:33:43 2014 -0800
----------------------------------------------------------------------
.../sqoop/common/test/categories/SlowTests.java | 27 ++++++++++++++++
common/pom.xml | 4 +++
.../sqoop/connector/kafka/TestKafkaLoader.java | 3 ++
docs/pom.xml | 8 +++++
docs/src/site/sphinx/BuildingSqoop2.rst | 9 +++++-
pom.xml | 34 ++++++++++++++++++--
6 files changed, 82 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/sqoop/blob/2fdeeb06/common-test/src/main/java/org/apache/sqoop/common/test/categories/SlowTests.java
----------------------------------------------------------------------
diff --git a/common-test/src/main/java/org/apache/sqoop/common/test/categories/SlowTests.java b/common-test/src/main/java/org/apache/sqoop/common/test/categories/SlowTests.java
new file mode 100644
index 0000000..f8ce474
--- /dev/null
+++ b/common-test/src/main/java/org/apache/sqoop/common/test/categories/SlowTests.java
@@ -0,0 +1,27 @@
+/**
+ * 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.common.test.categories;
+
+/**
+ * Slow tests interface for JUnit categories.
+ * This should be used if your unit tests rely on
+ * some piece of infrastructure that takes time to start.
+ * For example, using a MySQL database takes time to setup
+ * and start because it is in a separate process.
+ */
+public interface SlowTests {}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/2fdeeb06/common/pom.xml
----------------------------------------------------------------------
diff --git a/common/pom.xml b/common/pom.xml
index 04119f2..e8a8010 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -33,6 +33,10 @@ limitations under the License.
<dependencies>
<dependency>
+ <groupId>org.apache.sqoop</groupId>
+ <artifactId>sqoop-common-test</artifactId>
+ </dependency>
+ <dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
</dependency>
http://git-wip-us.apache.org/repos/asf/sqoop/blob/2fdeeb06/connector/connector-kafka/src/test/java/org/apache/sqoop/connector/kafka/TestKafkaLoader.java
----------------------------------------------------------------------
diff --git a/connector/connector-kafka/src/test/java/org/apache/sqoop/connector/kafka/TestKafkaLoader.java b/connector/connector-kafka/src/test/java/org/apache/sqoop/connector/kafka/TestKafkaLoader.java
index f896e9e..4ed027f 100644
--- a/connector/connector-kafka/src/test/java/org/apache/sqoop/connector/kafka/TestKafkaLoader.java
+++ b/connector/connector-kafka/src/test/java/org/apache/sqoop/connector/kafka/TestKafkaLoader.java
@@ -18,6 +18,7 @@
package org.apache.sqoop.connector.kafka;
import kafka.message.MessageAndMetadata;
+import org.apache.sqoop.common.test.categories.SlowTests;
import org.apache.sqoop.connector.kafka.configuration.ToJobConfiguration;
import org.apache.sqoop.connector.kafka.configuration.LinkConfiguration;
import org.apache.sqoop.common.test.kafka.TestUtil;
@@ -27,11 +28,13 @@ import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.experimental.categories.Category;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+@Category({ SlowTests.class })
public class TestKafkaLoader {
private static TestUtil testUtil = TestUtil.getInstance();
http://git-wip-us.apache.org/repos/asf/sqoop/blob/2fdeeb06/docs/pom.xml
----------------------------------------------------------------------
diff --git a/docs/pom.xml b/docs/pom.xml
index 75f428c..f8ccc34 100644
--- a/docs/pom.xml
+++ b/docs/pom.xml
@@ -31,6 +31,14 @@ limitations under the License.
<artifactId>sqoop-docs</artifactId>
<name>Sqoop Documentation</name>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
<reporting>
<plugins>
http://git-wip-us.apache.org/repos/asf/sqoop/blob/2fdeeb06/docs/src/site/sphinx/BuildingSqoop2.rst
----------------------------------------------------------------------
diff --git a/docs/src/site/sphinx/BuildingSqoop2.rst b/docs/src/site/sphinx/BuildingSqoop2.rst
index ad07d46..35b22d4 100644
--- a/docs/src/site/sphinx/BuildingSqoop2.rst
+++ b/docs/src/site/sphinx/BuildingSqoop2.rst
@@ -54,7 +54,7 @@ Maven target ``package`` can be used to create Sqoop packages similar to the one
Running tests
-------------
-Sqoop supports two different sets of tests. First smaller and much faster set is called unit tests and will be executed on maven target ``test``. Second larger set of integration tests will be executed on maven target ``integration-test``. Please note that integration tests might require manual steps for installing various JDBC drivers into your local maven cache.
+Sqoop supports two different sets of tests. First smaller and much faster set is called **unit tests** and will be executed on maven target ``test``. Second larger set of **integration tests** will be executed on maven target ``integration-test``. Please note that integration tests might require manual steps for installing various JDBC drivers into your local maven cache.
Example for running unit tests:
@@ -67,3 +67,10 @@ Example for running integration tests:
::
mvn integration-test
+
+For the **unit tests**, there are two helpful profiles: **fast** and **slow**. The **fast** unit tests do not start or use any services. The **slow** unit tests, may start services or use an external service (ie. MySQL).
+
+::
+
+ mvn test -Pfast,hadoop200
+ mvn test -Pslow,hadoop200
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/sqoop/blob/2fdeeb06/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index aa4231e..afdeb75 100644
--- a/pom.xml
+++ b/pom.xml
@@ -133,6 +133,37 @@ limitations under the License.
<!-- Profiles for various supported Hadoop distributions -->
<profiles>
+ <profile>
+ <id>fast</id>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludedGroups>org.apache.sqoop.common.test.categories.SlowTests</excludedGroups>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>slow</id>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <groups>org.apache.sqoop.common.test.categories.SlowTests</groups>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
<!-- Hadoop 1.x -->
<profile>
@@ -639,11 +670,10 @@ limitations under the License.
<version>2.3.2</version>
</plugin>
-
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>2.12</version>
+ <version>2.13</version>
<configuration>
<forkMode>always</forkMode>
<forkedProcessTimeoutInSeconds>3600</forkedProcessTimeoutInSeconds>