sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hshreedha...@apache.org
Subject [2/3] sqoop git commit: SQOOP-1950. Sqoop2: Use TestNG
Date Fri, 09 Jan 2015 00:42:16 GMT
http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/connector/connector-hdfs/src/test/java/org/apache/sqoop/connector/hdfs/TestLinkConfig.java
----------------------------------------------------------------------
diff --git a/connector/connector-hdfs/src/test/java/org/apache/sqoop/connector/hdfs/TestLinkConfig.java b/connector/connector-hdfs/src/test/java/org/apache/sqoop/connector/hdfs/TestLinkConfig.java
index 176d0df..27a94c6 100644
--- a/connector/connector-hdfs/src/test/java/org/apache/sqoop/connector/hdfs/TestLinkConfig.java
+++ b/connector/connector-hdfs/src/test/java/org/apache/sqoop/connector/hdfs/TestLinkConfig.java
@@ -18,10 +18,10 @@
 package org.apache.sqoop.connector.hdfs;
 
 import org.apache.sqoop.connector.hdfs.configuration.LinkConfig;
-import org.junit.Test;
+import org.testng.annotations.Test;
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertTrue;
 
 public class TestLinkConfig {
   @Test

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/connector/connector-hdfs/src/test/java/org/apache/sqoop/connector/hdfs/TestLoader.java
----------------------------------------------------------------------
diff --git a/connector/connector-hdfs/src/test/java/org/apache/sqoop/connector/hdfs/TestLoader.java b/connector/connector-hdfs/src/test/java/org/apache/sqoop/connector/hdfs/TestLoader.java
index be57fa0..506dc82 100644
--- a/connector/connector-hdfs/src/test/java/org/apache/sqoop/connector/hdfs/TestLoader.java
+++ b/connector/connector-hdfs/src/test/java/org/apache/sqoop/connector/hdfs/TestLoader.java
@@ -44,14 +44,13 @@ import org.apache.sqoop.connector.hdfs.configuration.ToJobConfiguration;
 import org.apache.sqoop.etl.io.DataReader;
 import org.apache.sqoop.job.etl.Loader;
 import org.apache.sqoop.job.etl.LoaderContext;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-@RunWith(Parameterized.class)
+import org.testng.annotations.AfterMethod;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Factory;
+import org.testng.annotations.Test;
+
 public class TestLoader extends TestHdfsBase {
   private static final String INPUT_ROOT = System.getProperty("maven.build.directory", "/tmp") + "/sqoop/warehouse/";
   private static final int NUMBER_OF_ROWS_PER_FILE = 1000;
@@ -61,6 +60,7 @@ public class TestLoader extends TestHdfsBase {
   private final String outputDirectory;
   private Loader loader;
 
+  @Factory(dataProvider="test-hdfs-loader")
   public TestLoader(ToFormat outputFormat,
                     ToCompression compression)
       throws Exception {
@@ -70,8 +70,8 @@ public class TestLoader extends TestHdfsBase {
     this.loader = new HdfsLoader();
   }
 
-  @Parameterized.Parameters
-  public static Collection<Object[]> data() {
+  @DataProvider(name="test-hdfs-loader")
+  public static Object[][] data() {
     List<Object[]> parameters = new ArrayList<Object[]>();
     for (ToCompression compression : new ToCompression[]{
         ToCompression.DEFAULT,
@@ -82,13 +82,13 @@ public class TestLoader extends TestHdfsBase {
         parameters.add(new Object[]{outputFileType, compression});
       }
     }
-    return parameters;
+    return parameters.toArray(new Object[0][]);
   }
 
-  @Before
+  @BeforeMethod
   public void setUp() throws Exception {}
 
-  @After
+  @AfterMethod
   public void tearDown() throws IOException {
     FileUtils.delete(outputDirectory);
   }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/connector/connector-hdfs/src/test/java/org/apache/sqoop/connector/hdfs/TestPartitioner.java
----------------------------------------------------------------------
diff --git a/connector/connector-hdfs/src/test/java/org/apache/sqoop/connector/hdfs/TestPartitioner.java b/connector/connector-hdfs/src/test/java/org/apache/sqoop/connector/hdfs/TestPartitioner.java
index 04e09cd..952932c 100644
--- a/connector/connector-hdfs/src/test/java/org/apache/sqoop/connector/hdfs/TestPartitioner.java
+++ b/connector/connector-hdfs/src/test/java/org/apache/sqoop/connector/hdfs/TestPartitioner.java
@@ -19,11 +19,10 @@ package org.apache.sqoop.connector.hdfs;
 
 import static org.apache.sqoop.connector.hdfs.configuration.ToFormat.SEQUENCE_FILE;
 import static org.apache.sqoop.connector.hdfs.configuration.ToFormat.TEXT_FILE;
-import static org.junit.Assert.assertEquals;
+import static org.testng.AssertJUnit.assertEquals;
 
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
 
 import org.apache.hadoop.conf.Configuration;
@@ -37,13 +36,12 @@ import org.apache.sqoop.connector.hdfs.configuration.ToFormat;
 import org.apache.sqoop.job.etl.Partition;
 import org.apache.sqoop.job.etl.Partitioner;
 import org.apache.sqoop.job.etl.PartitionerContext;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Factory;
+import org.testng.annotations.Test;
 
-@RunWith(Parameterized.class)
 public class TestPartitioner extends TestHdfsBase {
   private static final String INPUT_ROOT = System.getProperty("maven.build.directory", "/tmp") + "/sqoop/warehouse/";
   private static final int NUMBER_OF_FILES = 5;
@@ -55,13 +53,14 @@ public class TestPartitioner extends TestHdfsBase {
 
   private final String inputDirectory;
 
+  @Factory(dataProvider="test-hdfs-partitioner")
   public TestPartitioner(ToFormat outputFileType, Class<? extends CompressionCodec> compressionClass) {
     this.inputDirectory = INPUT_ROOT + getClass().getSimpleName();
     this.outputFileType = outputFileType;
     this.compressionClass = compressionClass;
   }
 
-  @Before
+  @BeforeMethod
   public void setUp() throws Exception {
     partitioner = new HdfsPartitioner();
     FileUtils.mkdirs(inputDirectory);
@@ -77,20 +76,20 @@ public class TestPartitioner extends TestHdfsBase {
     }
   }
 
-  @After
+  @AfterMethod
   public void tearDown() throws IOException {
     FileUtils.delete(inputDirectory);
   }
 
-  @Parameterized.Parameters
-  public static Collection<Object[]> data() {
+  @DataProvider(name="test-hdfs-partitioner")
+  public static Object[][] data() {
     List<Object[]> parameters = new ArrayList<Object[]>();
     for (Class<?> compressionClass : new Class<?>[]{null, DefaultCodec.class, BZip2Codec.class}) {
       for (Object outputFileType : new Object[]{TEXT_FILE, SEQUENCE_FILE}) {
         parameters.add(new Object[]{outputFileType, compressionClass});
       }
     }
-    return parameters;
+    return parameters.toArray(new Object[0][]);
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/connector/connector-kafka/pom.xml
----------------------------------------------------------------------
diff --git a/connector/connector-kafka/pom.xml b/connector/connector-kafka/pom.xml
index 82e43b3..e0f0684 100644
--- a/connector/connector-kafka/pom.xml
+++ b/connector/connector-kafka/pom.xml
@@ -42,6 +42,12 @@ limitations under the License.
       <groupId>org.apache.sqoop</groupId>
       <artifactId>sqoop-common-test</artifactId>
     </dependency>
+
+    <dependency>
+      <groupId>org.testng</groupId>
+      <artifactId>testng</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/connector/connector-kafka/src/main/java/org/apache/sqoop/connector/kafka/KafkaToDestroyer.java
----------------------------------------------------------------------
diff --git a/connector/connector-kafka/src/main/java/org/apache/sqoop/connector/kafka/KafkaToDestroyer.java b/connector/connector-kafka/src/main/java/org/apache/sqoop/connector/kafka/KafkaToDestroyer.java
index c522d91..e024d56 100644
--- a/connector/connector-kafka/src/main/java/org/apache/sqoop/connector/kafka/KafkaToDestroyer.java
+++ b/connector/connector-kafka/src/main/java/org/apache/sqoop/connector/kafka/KafkaToDestroyer.java
@@ -23,7 +23,7 @@ import org.apache.sqoop.connector.kafka.configuration.LinkConfiguration;
 import org.apache.sqoop.job.etl.Destroyer;
 import org.apache.sqoop.job.etl.DestroyerContext;
 
-public class KafkaToDestroyer extends Destroyer<LinkConfiguration,ToJobConfiguration> {
+public class KafkaToDestroyer extends Destroyer<LinkConfiguration, ToJobConfiguration> {
 
   private static final Logger LOG = Logger.getLogger(KafkaToDestroyer.class);
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/connector/connector-kafka/src/test/java/org/apache/sqoop/connector/kafka/TestConfiguration.java
----------------------------------------------------------------------
diff --git a/connector/connector-kafka/src/test/java/org/apache/sqoop/connector/kafka/TestConfiguration.java b/connector/connector-kafka/src/test/java/org/apache/sqoop/connector/kafka/TestConfiguration.java
index 0aca80d..ecdbdca 100644
--- a/connector/connector-kafka/src/test/java/org/apache/sqoop/connector/kafka/TestConfiguration.java
+++ b/connector/connector-kafka/src/test/java/org/apache/sqoop/connector/kafka/TestConfiguration.java
@@ -21,9 +21,9 @@ import org.apache.sqoop.connector.kafka.configuration.LinkConfiguration;
 import org.apache.sqoop.validation.ConfigValidationResult;
 import org.apache.sqoop.validation.ConfigValidationRunner;
 import org.apache.sqoop.validation.Status;
-import org.junit.Test;
+import org.testng.annotations.Test;
 
-import static org.junit.Assert.assertEquals;
+import static org.testng.AssertJUnit.assertEquals;
 
 public class TestConfiguration {
   @Test

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/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 4ed027f..f060c35 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,23 +18,21 @@
 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;
 import org.apache.sqoop.etl.io.DataReader;
 import org.apache.sqoop.job.etl.LoaderContext;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.testng.annotations.AfterClass;
+import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
 
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
-@Category({ SlowTests.class })
+@Test(groups="slow")
 public class TestKafkaLoader {
 
   private static TestUtil testUtil = TestUtil.getInstance();

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/connector/connector-kite/pom.xml
----------------------------------------------------------------------
diff --git a/connector/connector-kite/pom.xml b/connector/connector-kite/pom.xml
index 17821f9..11ec534 100644
--- a/connector/connector-kite/pom.xml
+++ b/connector/connector-kite/pom.xml
@@ -44,8 +44,8 @@ limitations under the License.
 
     <!-- Testing specified modules -->
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
+      <groupId>org.testng</groupId>
+      <artifactId>testng</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -55,7 +55,7 @@ limitations under the License.
     </dependency>
     <dependency>
       <groupId>org.powermock</groupId>
-      <artifactId>powermock-module-junit4</artifactId>
+      <artifactId>powermock-module-testng</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteExecutor.java
----------------------------------------------------------------------
diff --git a/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteExecutor.java b/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteExecutor.java
index 43736cc..3e7d1f1 100644
--- a/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteExecutor.java
+++ b/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteExecutor.java
@@ -20,24 +20,24 @@ package org.apache.sqoop.connector.kite;
 import org.apache.avro.Schema;
 import org.apache.avro.generic.GenericRecord;
 import org.apache.avro.generic.GenericRecordBuilder;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
 import org.kitesdk.data.Dataset;
 import org.kitesdk.data.DatasetDescriptor;
 import org.kitesdk.data.DatasetReader;
 import org.kitesdk.data.DatasetWriter;
+import org.testng.AssertJUnit;
+import org.testng.IObjectFactory;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.ObjectFactory;
+import org.testng.annotations.Test;
 
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertNull;
-import static junit.framework.TestCase.assertTrue;
 import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyNoMoreInteractions;
 import static org.mockito.Mockito.when;
 import static org.mockito.MockitoAnnotations.initMocks;
+import static org.testng.AssertJUnit.assertTrue;
 
 public class TestKiteExecutor {
 
@@ -55,7 +55,12 @@ public class TestKiteExecutor {
 
   private KiteDatasetExecutor executor;
 
-  @Before
+  @ObjectFactory
+  public IObjectFactory getObjectFactory() {
+    return new org.powermock.modules.testng.PowerMockObjectFactory();
+  }
+
+  @BeforeMethod
   public void setUp() {
     initMocks(this);
     when(datasetMock.newWriter()).thenReturn(writerMock);
@@ -68,7 +73,7 @@ public class TestKiteExecutor {
     executor = new KiteDatasetExecutor(datasetMock);
   }
 
-  @After
+  @AfterMethod
   public void tearDown() {
     executor.closeWriter();
     executor.closeReader();
@@ -117,14 +122,14 @@ public class TestKiteExecutor {
     // exercise & verify
     for (int i = 0; i < NUMBER_OF_ROWS; i++) {
       Object[] actual = executor.readRecord();
-      assertNotNull(actual);
-      assertEquals(2, actual.length);
-      assertEquals(1, actual[0]);
-      assertEquals("foo", actual[1]);
+      AssertJUnit.assertNotNull(actual);
+      AssertJUnit.assertEquals(2, actual.length);
+      AssertJUnit.assertEquals(1, actual[0]);
+      AssertJUnit.assertEquals("foo", actual[1]);
     }
     when(readerMock.hasNext()).thenReturn(false);
     Object[] actual = executor.readRecord();
-    assertNull(actual);
+    AssertJUnit.assertNull(actual);
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteExtractor.java
----------------------------------------------------------------------
diff --git a/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteExtractor.java b/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteExtractor.java
index 0e2c865..d2c2249 100644
--- a/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteExtractor.java
+++ b/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteExtractor.java
@@ -24,9 +24,9 @@ import org.apache.sqoop.etl.io.DataWriter;
 import org.apache.sqoop.job.etl.ExtractorContext;
 import org.apache.sqoop.schema.Schema;
 import org.apache.sqoop.schema.type.Text;
-import org.junit.Before;
-import org.junit.Test;
 import org.mockito.stubbing.OngoingStubbing;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.times;
@@ -56,7 +56,7 @@ public class TestKiteExtractor {
     }
   };
 
-  @Before
+  @BeforeMethod
   public void setUp() {
     initMocks(this);
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteFromInitializer.java
----------------------------------------------------------------------
diff --git a/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteFromInitializer.java b/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteFromInitializer.java
index 557a3c2..027056f 100644
--- a/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteFromInitializer.java
+++ b/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteFromInitializer.java
@@ -20,24 +20,24 @@ package org.apache.sqoop.connector.kite;
 
 import org.apache.sqoop.common.SqoopException;
 import org.apache.sqoop.connector.kite.configuration.FromJobConfiguration;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
 import org.kitesdk.data.Datasets;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
 import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
+import org.powermock.modules.testng.PowerMockTestCase;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 import static org.mockito.Mockito.when;
 import static org.mockito.MockitoAnnotations.initMocks;
 import static org.powermock.api.mockito.PowerMockito.mockStatic;
 
-@RunWith(PowerMockRunner.class)
 @PrepareForTest(Datasets.class)
-public class TestKiteFromInitializer {
+@PowerMockIgnore("org.apache.sqoop.common.ErrorCode")
+public class TestKiteFromInitializer extends PowerMockTestCase {
 
   private KiteFromInitializer initializer;
 
-  @Before
+  @BeforeMethod
   public void setUp() {
     initMocks(this);
     mockStatic(Datasets.class);
@@ -56,7 +56,7 @@ public class TestKiteFromInitializer {
     initializer.initialize(null, null, jobConfig);
   }
 
-  @Test(expected=SqoopException.class)
+  @Test(expectedExceptions = SqoopException.class)
   public void testInitializeFailed() {
     // setup
     FromJobConfiguration jobConfig = new FromJobConfiguration();

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteLoader.java
----------------------------------------------------------------------
diff --git a/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteLoader.java b/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteLoader.java
index d302aef..8f3a5f8 100644
--- a/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteLoader.java
+++ b/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteLoader.java
@@ -25,8 +25,8 @@ import org.apache.sqoop.etl.io.DataReader;
 import org.apache.sqoop.job.etl.LoaderContext;
 import org.apache.sqoop.schema.Schema;
 import org.apache.sqoop.schema.type.Text;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.times;
@@ -40,7 +40,7 @@ public class TestKiteLoader {
   @org.mockito.Mock
   private KiteDatasetExecutor executorMock;
 
-  @Before
+  @BeforeMethod
   public void setUp() {
     initMocks(this);
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteToDestroyer.java
----------------------------------------------------------------------
diff --git a/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteToDestroyer.java b/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteToDestroyer.java
index 92424c4..8c61e75 100644
--- a/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteToDestroyer.java
+++ b/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteToDestroyer.java
@@ -23,12 +23,12 @@ import org.apache.sqoop.connector.kite.configuration.LinkConfiguration;
 import org.apache.sqoop.connector.kite.configuration.ToJobConfiguration;
 import org.apache.sqoop.job.etl.DestroyerContext;
 import org.apache.sqoop.schema.Schema;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
 import org.kitesdk.data.Datasets;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
+import org.powermock.modules.testng.PowerMockTestCase;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
 
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
@@ -37,9 +37,9 @@ import static org.mockito.MockitoAnnotations.initMocks;
 import static org.powermock.api.mockito.PowerMockito.mockStatic;
 import static org.powermock.api.mockito.PowerMockito.verifyStatic;
 
-@RunWith(PowerMockRunner.class)
 @PrepareForTest({KiteDatasetExecutor.class, Datasets.class})
-public class TestKiteToDestroyer {
+@PowerMockIgnore("org.apache.sqoop.common.ErrorCode")
+public class TestKiteToDestroyer extends PowerMockTestCase {
 
   private KiteToDestroyer destroyer;
 
@@ -52,7 +52,7 @@ public class TestKiteToDestroyer {
   @org.mockito.Mock
   private KiteDatasetExecutor executorMock;
 
-  @Before
+  @BeforeMethod
   public void setUp() {
     initMocks(this);
     mockStatic(KiteDatasetExecutor.class);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteToInitializer.java
----------------------------------------------------------------------
diff --git a/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteToInitializer.java b/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteToInitializer.java
index 50c3064..93efa93 100644
--- a/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteToInitializer.java
+++ b/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/TestKiteToInitializer.java
@@ -22,26 +22,26 @@ import org.apache.sqoop.common.SqoopException;
 import org.apache.sqoop.connector.kite.configuration.LinkConfiguration;
 import org.apache.sqoop.connector.kite.configuration.ToJobConfiguration;
 import org.apache.sqoop.schema.Schema;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
 import org.kitesdk.data.Datasets;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
+import org.powermock.modules.testng.PowerMockTestCase;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
 
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
 import static org.mockito.Mockito.when;
 import static org.mockito.MockitoAnnotations.initMocks;
 import static org.powermock.api.mockito.PowerMockito.mockStatic;
 
-@RunWith(PowerMockRunner.class)
 @PrepareForTest(Datasets.class)
-public class TestKiteToInitializer {
+@PowerMockIgnore("org.apache.sqoop.common.ErrorCode")
+public class TestKiteToInitializer extends PowerMockTestCase {
 
   private KiteToInitializer initializer;
 
-  @Before
+  @BeforeMethod
   public void setUp() {
     initMocks(this);
     mockStatic(Datasets.class);
@@ -62,7 +62,7 @@ public class TestKiteToInitializer {
     initializer.initialize(null, linkConfig, toJobConfig);
   }
 
-  @Test(expected = SqoopException.class)
+  @Test(expectedExceptions = SqoopException.class)
   public void testInitializeFailed() {
     // setup
     LinkConfiguration linkConfig = new LinkConfiguration();
@@ -85,4 +85,4 @@ public class TestKiteToInitializer {
     assertTrue(schema.isEmpty());
   }
 
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/configuration/TestConfigUtil.java
----------------------------------------------------------------------
diff --git a/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/configuration/TestConfigUtil.java b/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/configuration/TestConfigUtil.java
index c56ef02..827024b 100644
--- a/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/configuration/TestConfigUtil.java
+++ b/connector/connector-kite/src/test/java/org/apache/sqoop/connector/kite/configuration/TestConfigUtil.java
@@ -17,9 +17,9 @@
  */
 package org.apache.sqoop.connector.kite.configuration;
 
-import org.junit.Test;
+import org.testng.annotations.Test;
 
-import static org.junit.Assert.assertEquals;
+import static org.testng.AssertJUnit.assertEquals;
 
 /**
  * Test configuration objects.

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/connector/connector-sdk/pom.xml
----------------------------------------------------------------------
diff --git a/connector/connector-sdk/pom.xml b/connector/connector-sdk/pom.xml
index 2795084..ff79ec1 100644
--- a/connector/connector-sdk/pom.xml
+++ b/connector/connector-sdk/pom.xml
@@ -41,8 +41,8 @@ limitations under the License.
       <artifactId>commons-codec</artifactId>
     </dependency>
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
+      <groupId>org.testng</groupId>
+      <artifactId>testng</artifactId>
       <scope>test</scope>
     </dependency>
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/common/TestSqoopIDFUtils.java
----------------------------------------------------------------------
diff --git a/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/common/TestSqoopIDFUtils.java b/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/common/TestSqoopIDFUtils.java
index 68890cc..71db8da 100644
--- a/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/common/TestSqoopIDFUtils.java
+++ b/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/common/TestSqoopIDFUtils.java
@@ -17,13 +17,13 @@
  */
 package org.apache.sqoop.connector.common;
 
-import static org.junit.Assert.*;
+import static org.testng.Assert.*;
 import static org.apache.sqoop.connector.common.SqoopIDFUtils.*;
 
 import org.apache.sqoop.schema.type.AbstractComplexListType;
 import org.apache.sqoop.schema.type.Array;
 import org.apache.sqoop.schema.type.Text;
-import org.junit.Test;
+import org.testng.annotations.Test;
 
 import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/idf/TestAVROIntermediateDataFormat.java
----------------------------------------------------------------------
diff --git a/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/idf/TestAVROIntermediateDataFormat.java b/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/idf/TestAVROIntermediateDataFormat.java
index b00b3b9..816cc71 100644
--- a/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/idf/TestAVROIntermediateDataFormat.java
+++ b/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/idf/TestAVROIntermediateDataFormat.java
@@ -20,7 +20,7 @@ package org.apache.sqoop.connector.idf;
 
 import static org.apache.sqoop.connector.common.SqoopAvroUtils.createEnumSchema;
 import static org.apache.sqoop.connector.common.TestSqoopIDFUtils.getByteFieldString;
-import static org.junit.Assert.assertEquals;
+import static org.testng.AssertJUnit.assertEquals;
 
 import org.apache.avro.generic.GenericData;
 import org.apache.avro.generic.GenericRecord;
@@ -34,8 +34,8 @@ import org.apache.sqoop.schema.type.Column;
 import org.apache.sqoop.schema.type.FixedPoint;
 import org.apache.sqoop.schema.type.Text;
 import org.joda.time.LocalDateTime;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
@@ -62,7 +62,7 @@ public class TestAVROIntermediateDataFormat {
   private final static org.joda.time.LocalTime time = new org.joda.time.LocalTime(12, 59, 59);
   private final static org.joda.time.LocalDate date = new org.joda.time.LocalDate(2014, 10, 01);
 
-  @Before
+  @BeforeMethod
   public void setUp() {
     createAvroIDF();
   }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/idf/TestCSVIntermediateDataFormat.java
----------------------------------------------------------------------
diff --git a/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/idf/TestCSVIntermediateDataFormat.java b/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/idf/TestCSVIntermediateDataFormat.java
index 64b18fd..e116f3c 100644
--- a/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/idf/TestCSVIntermediateDataFormat.java
+++ b/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/idf/TestCSVIntermediateDataFormat.java
@@ -18,10 +18,10 @@
  */
 package org.apache.sqoop.connector.idf;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
 import static org.apache.sqoop.connector.common.SqoopIDFUtils.*;
 import static org.apache.sqoop.connector.common.TestSqoopIDFUtils.getByteFieldString;
 
@@ -46,14 +46,14 @@ import org.apache.sqoop.schema.type.FixedPoint;
 import org.apache.sqoop.schema.type.Text;
 import org.apache.sqoop.schema.type.Time;
 import org.joda.time.DateTimeZone;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 public class TestCSVIntermediateDataFormat {
 
   private CSVIntermediateDataFormat dataFormat;
 
-  @Before
+  @BeforeMethod
   public void setUp() {
     dataFormat = new CSVIntermediateDataFormat();
   }
@@ -76,7 +76,7 @@ public class TestCSVIntermediateDataFormat {
     assertNull(out);
   }
 
-  @Test(expected = SqoopException.class)
+  @Test(expectedExceptions = SqoopException.class)
   public void testEmptyInputAsCSVTextInObjectArrayOut() {
     Schema schema = new Schema("test");
     schema.addColumn(new FixedPoint("1")).addColumn(new FixedPoint("2")).addColumn(new Text("3")).addColumn(new Text("4"))
@@ -508,7 +508,7 @@ public class TestCSVIntermediateDataFormat {
   }
 
   // since date is not quoted
-  @Test(expected = Exception.class)
+  @Test(expectedExceptions = Exception.class)
   public void testDateTimeNoQuotesWithFractionTimezoneWithCSVTextInObjectArrayOut() {
     Schema schema = new Schema("test");
     schema.addColumn(new DateTime("1", true, true));
@@ -520,7 +520,7 @@ public class TestCSVIntermediateDataFormat {
   }
 
   // since date is not in expected format
-  @Test(expected = Exception.class)
+  @Test(expectedExceptions = Exception.class)
   public void testDateTimeIncorrectFormatWithCSVTextInObjectArrayOut() {
     Schema schema = new Schema("test");
     schema.addColumn(new DateTime("1", true, true));
@@ -636,7 +636,7 @@ public class TestCSVIntermediateDataFormat {
     assertEquals("true,false", dataFormat.getCSVTextData());
   }
 
-  @Test(expected = SqoopException.class)
+  @Test(expectedExceptions = SqoopException.class)
   public void testUnsupportedBitWithObjectArrayInAndCSVTextOut() {
     Schema schema = new Schema("test");
     schema.addColumn(new Bit("1")).addColumn(new Bit("2"));
@@ -682,7 +682,7 @@ public class TestCSVIntermediateDataFormat {
     }
   }
 
-  @Test(expected = SqoopException.class)
+  @Test(expectedExceptions = SqoopException.class)
   public void testUnsupportedBitWithObjectArrayInAndObjectOut() {
     Schema schema = new Schema("test");
     schema.addColumn(new Bit("1")).addColumn(new Bit("2"));
@@ -695,7 +695,7 @@ public class TestCSVIntermediateDataFormat {
     assertEquals(false, dataFormat.getObjectData()[1]);
   }
 
-  @Test(expected = SqoopException.class)
+  @Test(expectedExceptions = SqoopException.class)
   public void testUnsupportedBitWithCSVTextInAndObjectOut() {
     Schema schema = new Schema("test");
     schema.addColumn(new Bit("1")).addColumn(new Bit("2"));
@@ -1101,7 +1101,7 @@ public class TestCSVIntermediateDataFormat {
     assertEquals(testData, dataFormat.getCSVTextData());
   }
   //**************test cases for schema*******************
-  @Test(expected=SqoopException.class)
+  @Test(expectedExceptions=SqoopException.class)
   public void testEmptySchema() {
     String testData = "10,34,'54','random data'," + getByteFieldString(new byte[] { (byte) -112, (byte) 54})
         + ",'\\n'";
@@ -1113,14 +1113,14 @@ public class TestCSVIntermediateDataFormat {
     Object[] out = dataFormat.getObjectData();
   }
 
-  @Test(expected = SqoopException.class)
+  @Test(expectedExceptions = SqoopException.class)
   public void testNullSchema() {
     dataFormat.setSchema(null);
     @SuppressWarnings("unused")
     Object[] out = dataFormat.getObjectData();
   }
 
-  @Test(expected = SqoopException.class)
+  @Test(expectedExceptions = SqoopException.class)
   public void testNotSettingSchema() {
     @SuppressWarnings("unused")
     Object[] out = dataFormat.getObjectData();

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/idf/TestJSONIntermediateDataFormat.java
----------------------------------------------------------------------
diff --git a/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/idf/TestJSONIntermediateDataFormat.java b/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/idf/TestJSONIntermediateDataFormat.java
index 8672712..44ea4fd 100644
--- a/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/idf/TestJSONIntermediateDataFormat.java
+++ b/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/idf/TestJSONIntermediateDataFormat.java
@@ -19,7 +19,7 @@
 package org.apache.sqoop.connector.idf;
 
 import static org.apache.sqoop.connector.common.TestSqoopIDFUtils.getByteFieldString;
-import static org.junit.Assert.assertEquals;
+import static org.testng.AssertJUnit.assertEquals;
 
 import org.apache.sqoop.connector.common.SqoopIDFUtils;
 import org.apache.sqoop.schema.Schema;
@@ -31,8 +31,8 @@ import org.apache.sqoop.schema.type.Text;
 import org.joda.time.LocalDateTime;
 import org.json.simple.JSONArray;
 import org.json.simple.JSONObject;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 import java.util.Arrays;
 import java.util.HashMap;
@@ -48,7 +48,7 @@ public class TestJSONIntermediateDataFormat {
   private final static String dateTime = "'2014-10-01 12:00:00.000'";
   private final static String time = "'12:59:59'";
 
-  @Before
+  @BeforeMethod
   public void setUp() {
     createJSONIDF();
   }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/matcher/TestLocationMatcher.java
----------------------------------------------------------------------
diff --git a/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/matcher/TestLocationMatcher.java b/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/matcher/TestLocationMatcher.java
index edf5fd9..624fa7b 100644
--- a/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/matcher/TestLocationMatcher.java
+++ b/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/matcher/TestLocationMatcher.java
@@ -20,16 +20,16 @@ package org.apache.sqoop.connector.matcher;
 import org.apache.sqoop.common.SqoopException;
 import org.apache.sqoop.schema.NullSchema;
 import org.apache.sqoop.schema.Schema;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
-import static org.junit.Assert.assertArrayEquals;
+import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
 
 public class TestLocationMatcher {
 
   private LocationMatcher matcher;
 
-  @Before
+  @BeforeMethod
   public void setUp() {
     matcher = null;
   }
@@ -95,7 +95,7 @@ public class TestLocationMatcher {
    * If TO schema has more fields than FROM schema, and NOT all of the extra
    * fields are "nullable", a SqoopException is expected.
    */
-  @Test (expected = SqoopException.class)
+  @Test (expectedExceptions = SqoopException.class)
   public void testConvertWhenToSchemaIsLongerThanFromSchemaFail() {
     Schema from = SchemaFixture.createSchema("from", 2);
     Schema to = SchemaFixture.createSchema("to", 4);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/matcher/TestNameMatcher.java
----------------------------------------------------------------------
diff --git a/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/matcher/TestNameMatcher.java b/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/matcher/TestNameMatcher.java
index 8d5d720..76ff0da 100644
--- a/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/matcher/TestNameMatcher.java
+++ b/connector/connector-sdk/src/test/java/org/apache/sqoop/connector/matcher/TestNameMatcher.java
@@ -20,16 +20,16 @@ package org.apache.sqoop.connector.matcher;
 import org.apache.sqoop.common.SqoopException;
 import org.apache.sqoop.schema.NullSchema;
 import org.apache.sqoop.schema.Schema;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
-import static org.junit.Assert.assertArrayEquals;
+import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
 
 public class TestNameMatcher {
 
   private NameMatcher matcher;
 
-  @Before
+  @BeforeMethod
   public void setUp() {
     matcher = null;
   }
@@ -99,7 +99,7 @@ public class TestNameMatcher {
    * If TO schema has more fields than FROM schema, and NOT all of the extra
    * fields are "nullable", a SqoopException is expected.
    */
-  @Test (expected = SqoopException.class)
+  @Test (expectedExceptions = SqoopException.class)
   public void testConvertWhenToSchemaIsLongerThanFromSchemaFail() {
     Schema from = SchemaFixture.createSchema("from",
         new String[]{"text1", "text2"});

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index b6e9557..0a8ec09 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -49,8 +49,8 @@ limitations under the License.
     </dependency>
 
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
+      <groupId>org.testng</groupId>
+      <artifactId>testng</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/core/src/test/java/org/apache/sqoop/core/TestSqoopConfiguration.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/sqoop/core/TestSqoopConfiguration.java b/core/src/test/java/org/apache/sqoop/core/TestSqoopConfiguration.java
index 4d58bd1..e15691e 100644
--- a/core/src/test/java/org/apache/sqoop/core/TestSqoopConfiguration.java
+++ b/core/src/test/java/org/apache/sqoop/core/TestSqoopConfiguration.java
@@ -20,13 +20,13 @@ package org.apache.sqoop.core;
 import java.util.Properties;
 
 import org.apache.sqoop.common.SqoopException;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 public class TestSqoopConfiguration {
 
-  @Before
+  @BeforeMethod
   public void setUp() throws Exception {
     // Unset any configuration dir if it is set by another test
     System.getProperties().remove(ConfigurationConstants.SYSPROP_CONFIG_DIR);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/core/src/test/java/org/apache/sqoop/driver/TestDriverConfigUpgrader.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/sqoop/driver/TestDriverConfigUpgrader.java b/core/src/test/java/org/apache/sqoop/driver/TestDriverConfigUpgrader.java
index e5201fc..ec548d5 100644
--- a/core/src/test/java/org/apache/sqoop/driver/TestDriverConfigUpgrader.java
+++ b/core/src/test/java/org/apache/sqoop/driver/TestDriverConfigUpgrader.java
@@ -18,8 +18,8 @@
  */
 package org.apache.sqoop.driver;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.Assert.assertNull;
 
 import java.util.LinkedList;
 import java.util.List;
@@ -30,8 +30,8 @@ import org.apache.sqoop.model.MDriverConfig;
 import org.apache.sqoop.model.MInput;
 import org.apache.sqoop.model.MIntegerInput;
 import org.apache.sqoop.model.MStringInput;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 /**
  */
@@ -39,7 +39,7 @@ public class TestDriverConfigUpgrader {
 
   DriverUpgrader upgrader;
 
-  @Before
+  @BeforeMethod
   public void initializeUpgrader() {
     upgrader = new DriverUpgrader();
   }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/core/src/test/java/org/apache/sqoop/driver/TestJobManager.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/sqoop/driver/TestJobManager.java b/core/src/test/java/org/apache/sqoop/driver/TestJobManager.java
index 5bc1b03..926815d 100644
--- a/core/src/test/java/org/apache/sqoop/driver/TestJobManager.java
+++ b/core/src/test/java/org/apache/sqoop/driver/TestJobManager.java
@@ -20,8 +20,8 @@ package org.apache.sqoop.driver;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.Assert.fail;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
@@ -38,8 +38,8 @@ import org.apache.sqoop.repository.JdbcRepository;
 import org.apache.sqoop.repository.Repository;
 import org.apache.sqoop.repository.RepositoryManager;
 import org.apache.sqoop.request.HttpEventContext;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 public class TestJobManager {
   private JobManager jobManager;
@@ -48,7 +48,7 @@ public class TestJobManager {
   private RepositoryManager repositoryManagerMock;
   private Repository jdbcRepoMock;
 
-  @Before
+  @BeforeMethod
   public void setUp() {
     jobManager = new JobManager();
     connectorMgrMock = mock(ConnectorManager.class);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/core/src/test/java/org/apache/sqoop/driver/TestJobRequest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/sqoop/driver/TestJobRequest.java b/core/src/test/java/org/apache/sqoop/driver/TestJobRequest.java
index 3f36030..26560fe 100644
--- a/core/src/test/java/org/apache/sqoop/driver/TestJobRequest.java
+++ b/core/src/test/java/org/apache/sqoop/driver/TestJobRequest.java
@@ -23,17 +23,17 @@ import java.util.Set;
 
 import org.apache.sqoop.driver.JobRequest;
 import org.apache.sqoop.utils.ClassUtils;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.Assert.assertTrue;
 
 public class TestJobRequest {
 
   private JobRequest jobRequest;
 
-  @Before
+  @BeforeMethod
   public void initializeSubmissionRequest() {
     jobRequest = new JobRequest();
   }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/core/src/test/java/org/apache/sqoop/repository/TestJdbcRepository.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/sqoop/repository/TestJdbcRepository.java b/core/src/test/java/org/apache/sqoop/repository/TestJdbcRepository.java
index 56add07..f804a45 100644
--- a/core/src/test/java/org/apache/sqoop/repository/TestJdbcRepository.java
+++ b/core/src/test/java/org/apache/sqoop/repository/TestJdbcRepository.java
@@ -17,8 +17,8 @@
  */
 package org.apache.sqoop.repository;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.Assert.fail;
 import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyLong;
 import static org.mockito.Matchers.anyString;
@@ -62,8 +62,8 @@ import org.apache.sqoop.model.MToConfig;
 import org.apache.sqoop.model.Validator;
 import org.apache.sqoop.validation.Status;
 import org.apache.sqoop.validation.validators.AbstractValidator;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 import org.mockito.InOrder;
 
 public class TestJdbcRepository {
@@ -76,7 +76,7 @@ public class TestJdbcRepository {
   private ConnectorConfigurableUpgrader connectorUpgraderMock;
   private DriverUpgrader driverUpgraderMock;
 
-  @Before
+  @BeforeMethod
   public void setUp() throws Exception {
     repoTransactionMock = mock(JdbcRepositoryTransaction.class);
     connectorMgrMock = mock(ConnectorManager.class);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/core/src/test/java/org/apache/sqoop/repository/TestRepositoryManager.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/sqoop/repository/TestRepositoryManager.java b/core/src/test/java/org/apache/sqoop/repository/TestRepositoryManager.java
index 7cec536..95b868a 100644
--- a/core/src/test/java/org/apache/sqoop/repository/TestRepositoryManager.java
+++ b/core/src/test/java/org/apache/sqoop/repository/TestRepositoryManager.java
@@ -24,8 +24,8 @@ import org.apache.sqoop.core.ConfigurationConstants;
 import org.apache.sqoop.core.PropertiesConfigurationProvider;
 import org.apache.sqoop.core.SqoopConfiguration;
 import org.apache.sqoop.core.TestUtils;
-import org.junit.Assert;
-import org.junit.Test;
+import org.testng.Assert;
+import org.testng.annotations.Test;
 
 public class TestRepositoryManager {
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/docs/pom.xml
----------------------------------------------------------------------
diff --git a/docs/pom.xml b/docs/pom.xml
index f8ccc34..7be68f0 100644
--- a/docs/pom.xml
+++ b/docs/pom.xml
@@ -33,8 +33,8 @@ limitations under the License.
 
   <dependencies>
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
+      <groupId>org.testng</groupId>
+      <artifactId>testng</artifactId>
       <scope>test</scope>
     </dependency>
   </dependencies>

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/execution/mapreduce/pom.xml
----------------------------------------------------------------------
diff --git a/execution/mapreduce/pom.xml b/execution/mapreduce/pom.xml
index ad7f489..7b9eaa0 100644
--- a/execution/mapreduce/pom.xml
+++ b/execution/mapreduce/pom.xml
@@ -35,8 +35,8 @@ limitations under the License.
     </dependency>
 
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
+      <groupId>org.testng</groupId>
+      <artifactId>testng</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/execution/mapreduce/src/test/java/org/apache/sqoop/job/TestMapReduce.java
----------------------------------------------------------------------
diff --git a/execution/mapreduce/src/test/java/org/apache/sqoop/job/TestMapReduce.java b/execution/mapreduce/src/test/java/org/apache/sqoop/job/TestMapReduce.java
index cc0a3cc..10ed33c 100644
--- a/execution/mapreduce/src/test/java/org/apache/sqoop/job/TestMapReduce.java
+++ b/execution/mapreduce/src/test/java/org/apache/sqoop/job/TestMapReduce.java
@@ -17,7 +17,7 @@
  */
 package org.apache.sqoop.job;
 
-import static org.junit.Assert.assertEquals;
+import static org.testng.AssertJUnit.assertEquals;
 
 import java.io.DataInput;
 import java.io.DataOutput;
@@ -54,8 +54,7 @@ import org.apache.sqoop.job.mr.SqoopMapper;
 import org.apache.sqoop.job.mr.SqoopNullOutputFormat;
 import org.apache.sqoop.job.mr.SqoopSplit;
 import org.apache.sqoop.job.util.MRJobTestUtil;
-import org.junit.Assert;
-import org.junit.Test;
+import org.testng.annotations.Test;
 
 public class TestMapReduce {
 
@@ -99,7 +98,7 @@ public class TestMapReduce {
                                       SqoopInputFormat.class,
                                       SqoopMapper.class,
                                       DummyOutputFormat.class);
-    Assert.assertEquals("Job failed!", true, success);
+    assertEquals("Job failed!", true, success);
   }
 
   @Test
@@ -121,7 +120,7 @@ public class TestMapReduce {
                                      SqoopInputFormat.class,
                                      SqoopMapper.class,
                                      SqoopNullOutputFormat.class);
-    Assert.assertEquals("Job failed!", true, success);
+    assertEquals("Job failed!", true, success);
 
     // Make sure both destroyers get called.
     assertEquals(1, DummyFromDestroyer.count);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/execution/mapreduce/src/test/java/org/apache/sqoop/job/TestMatching.java
----------------------------------------------------------------------
diff --git a/execution/mapreduce/src/test/java/org/apache/sqoop/job/TestMatching.java b/execution/mapreduce/src/test/java/org/apache/sqoop/job/TestMatching.java
index 1b791e3..ab2178e 100644
--- a/execution/mapreduce/src/test/java/org/apache/sqoop/job/TestMatching.java
+++ b/execution/mapreduce/src/test/java/org/apache/sqoop/job/TestMatching.java
@@ -19,14 +19,14 @@ package org.apache.sqoop.job;
 
 import static org.apache.sqoop.connector.common.SqoopIDFUtils.BYTE_FIELD_CHARSET;
 import static org.apache.sqoop.connector.common.SqoopIDFUtils.toText;
-import static org.junit.Assert.assertEquals;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
 
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -58,13 +58,11 @@ import org.apache.sqoop.schema.NullSchema;
 import org.apache.sqoop.schema.Schema;
 import org.apache.sqoop.schema.type.FixedPoint;
 import org.apache.sqoop.schema.type.FloatingPoint;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Factory;
+import org.testng.annotations.Test;
 
 
-@RunWith(Parameterized.class)
 public class TestMatching {
   private static final int START_PARTITION = 1;
   private static final int NUMBER_OF_PARTITIONS = 1;
@@ -73,17 +71,14 @@ public class TestMatching {
   private Schema from;
   private Schema to;
 
-  public TestMatching(Schema from,
-                       Schema to)
-      throws Exception {
+  @Factory(dataProvider="test-matching-data")
+  public TestMatching(Schema from, Schema to) {
     this.from = from;
     this.to = to;
-
-    System.out.println("Testing with Schemas\n\tFROM: " + this.from + "\n\tTO: " + this.to);
   }
 
-  @Parameterized.Parameters
-  public static Collection<Object[]> data() {
+  @DataProvider(name="test-matching-data", parallel=true)
+  public static Object[][] data() {
     List<Object[]> parameters = new ArrayList<Object[]>();
 
     Schema emptyFrom = new Schema("FROM-EMPTY");
@@ -125,7 +120,7 @@ public class TestMatching {
         to2
     });
 
-    return parameters;
+    return parameters.toArray(new Object[0][]);
   }
 
   @SuppressWarnings("deprecation")
@@ -147,17 +142,17 @@ public class TestMatching {
         DummyOutputFormat.class);
     if (from.getName().split("-")[1].equals("EMPTY")) {
       if (to.getName().split("-")[1].equals("EMPTY")) {
-        Assert.assertEquals("Job succeeded!", false, success);
+        assertEquals("Job succeeded!", false, success);
       } else {
-        Assert.assertEquals("Job failed!", true, success);
+        assertEquals("Job failed!", true, success);
       }
     } else {
       if (to.getName().split("-")[1].equals("EMPTY")) {
-        Assert.assertEquals("Job failed!", true, success);
+        assertEquals("Job failed!", true, success);
       } else if (from.getName().split("-")[1].equals(to.getName().split("-")[1])) {
-        Assert.assertEquals("Job failed!", true, success);
+        assertEquals("Job failed!", true, success);
       } else {
-        Assert.assertEquals("Job succeeded!", false, success);
+        assertEquals("Job succeeded!", false, success);
       }
     }
   }
@@ -183,7 +178,7 @@ public class TestMatching {
     Object[] validateObj = dataFormat.getObjectData();
 
     assertEquals(testData, validateCSV);
-    assertEquals(testObject, validateObj);
+    assertArrayEquals(testObject, validateObj);
 
     // Setting data as Object
     dataFormat.setObjectData(testObject);
@@ -192,7 +187,7 @@ public class TestMatching {
     validateObj = dataFormat.getObjectData();
 
     assertEquals(testData, validateCSV);
-    assertEquals(testObjectCopy, validateObj);
+    assertArrayEquals(testObjectCopy, validateObj);
   }
 
   public static class DummyPartition extends Partition {

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/execution/mapreduce/src/test/java/org/apache/sqoop/job/io/TestSqoopWritable.java
----------------------------------------------------------------------
diff --git a/execution/mapreduce/src/test/java/org/apache/sqoop/job/io/TestSqoopWritable.java b/execution/mapreduce/src/test/java/org/apache/sqoop/job/io/TestSqoopWritable.java
index 79d6a8f..087d7d3 100644
--- a/execution/mapreduce/src/test/java/org/apache/sqoop/job/io/TestSqoopWritable.java
+++ b/execution/mapreduce/src/test/java/org/apache/sqoop/job/io/TestSqoopWritable.java
@@ -18,10 +18,10 @@
  */
 package org.apache.sqoop.job.io;
 
-import static org.junit.Assert.*;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
+import static org.testng.Assert.assertEquals;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -34,15 +34,15 @@ import java.io.InputStream;
 
 import org.apache.sqoop.connector.idf.CSVIntermediateDataFormat;
 import org.apache.sqoop.connector.idf.IntermediateDataFormat;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 public class TestSqoopWritable {
 
   private SqoopWritable writable;
   private IntermediateDataFormat<?> idfMock;
 
-  @Before
+  @BeforeMethod
   public void setUp() {
     idfMock = mock(IntermediateDataFormat.class);
     writable = new SqoopWritable(idfMock);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/execution/mapreduce/src/test/java/org/apache/sqoop/job/mr/TestMRConfigurationUtils.java
----------------------------------------------------------------------
diff --git a/execution/mapreduce/src/test/java/org/apache/sqoop/job/mr/TestMRConfigurationUtils.java b/execution/mapreduce/src/test/java/org/apache/sqoop/job/mr/TestMRConfigurationUtils.java
index 70ea6d4..a3e6dee 100644
--- a/execution/mapreduce/src/test/java/org/apache/sqoop/job/mr/TestMRConfigurationUtils.java
+++ b/execution/mapreduce/src/test/java/org/apache/sqoop/job/mr/TestMRConfigurationUtils.java
@@ -17,7 +17,7 @@
  */
 package org.apache.sqoop.job.mr;
 
-import static org.junit.Assert.assertEquals;
+import static org.testng.AssertJUnit.assertEquals;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
@@ -31,8 +31,8 @@ import org.apache.sqoop.model.Input;
 import org.apache.sqoop.schema.NullSchema;
 import org.apache.sqoop.schema.Schema;
 import org.apache.sqoop.schema.type.Text;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 /**
  * Current tests are using mockito to propagate credentials from hadoop Job object
@@ -44,7 +44,7 @@ public class TestMRConfigurationUtils {
   Job job;
   JobConf jobConfSpy;
 
-  @Before
+  @BeforeMethod
   public void setUp() throws Exception {
     setUpHadoopJob();
     setUpHadoopJobConf();

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/execution/mapreduce/src/test/java/org/apache/sqoop/job/mr/TestSqoopOutputFormatLoadExecutor.java
----------------------------------------------------------------------
diff --git a/execution/mapreduce/src/test/java/org/apache/sqoop/job/mr/TestSqoopOutputFormatLoadExecutor.java b/execution/mapreduce/src/test/java/org/apache/sqoop/job/mr/TestSqoopOutputFormatLoadExecutor.java
index f5f627d..7ddaa10 100644
--- a/execution/mapreduce/src/test/java/org/apache/sqoop/job/mr/TestSqoopOutputFormatLoadExecutor.java
+++ b/execution/mapreduce/src/test/java/org/apache/sqoop/job/mr/TestSqoopOutputFormatLoadExecutor.java
@@ -40,9 +40,9 @@ import org.apache.sqoop.job.io.SqoopWritable;
 import org.apache.sqoop.job.util.MRJobTestUtil;
 import org.apache.sqoop.schema.NullSchema;
 import org.apache.sqoop.submission.counter.SqoopCounters;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 import java.util.ConcurrentModificationException;
 import java.util.concurrent.BrokenBarrierException;
@@ -149,7 +149,7 @@ public class TestSqoopOutputFormatLoadExecutor {
     return new CSVIntermediateDataFormat();
   }
 
-  @Before
+  @BeforeMethod
   public void setUp() {
     conf = new Configuration();
     conf.setIfUnset(MRJobConstants.TO_INTERMEDIATE_DATA_FORMAT,
@@ -161,7 +161,7 @@ public class TestSqoopOutputFormatLoadExecutor {
     when(jobContextMock.getConfiguration()).thenReturn(testConf);
   }
 
-  @Test(expected = BrokenBarrierException.class)
+  @Test(expectedExceptions = BrokenBarrierException.class)
   public void testWhenLoaderThrows() throws Throwable {
     conf.set(MRJobConstants.JOB_ETL_LOADER, ThrowingLoader.class.getName());
     SqoopOutputFormatLoadExecutor executor = new SqoopOutputFormatLoadExecutor(jobContextMock,
@@ -205,7 +205,7 @@ public class TestSqoopOutputFormatLoadExecutor {
     verify(jobContextMock, times(1)).getCounter(SqoopCounters.ROWS_WRITTEN);
   }
 
-  @Test(expected = SqoopException.class)
+  @Test(expectedExceptions = SqoopException.class)
   public void testSuccessfulLoader() throws Throwable {
     SqoopOutputFormatLoadExecutor executor = new SqoopOutputFormatLoadExecutor(jobContextMock,
         GoodLoader.class.getName(), getIDF(), getMatcher());
@@ -230,7 +230,7 @@ public class TestSqoopOutputFormatLoadExecutor {
     verify(jobContextMock, times(1)).getCounter(SqoopCounters.ROWS_WRITTEN);
   }
 
-  @Test(expected = ConcurrentModificationException.class)
+  @Test(expectedExceptions = ConcurrentModificationException.class)
   public void testThrowingContinuousLoader() throws Throwable {
     conf.set(MRJobConstants.JOB_ETL_LOADER, ThrowingContinuousLoader.class.getName());
     SqoopOutputFormatLoadExecutor executor = new SqoopOutputFormatLoadExecutor(jobContextMock,

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index d1f0a45..3297c00 100644
--- a/pom.xml
+++ b/pom.xml
@@ -100,7 +100,7 @@ limitations under the License.
     <hadoop.2.version>2.6.0</hadoop.2.version>
     <guava.version>11.0.2</guava.version>
     <json-simple.version>1.1</json-simple.version>
-    <junit.version>4.11</junit.version>
+    <testng.version>6.8.13</testng.version>
     <mockito.version>1.9.5</mockito.version>
     <powermock.version>1.5.6</powermock.version>
     <log4j.version>1.2.16</log4j.version>
@@ -144,7 +144,7 @@ limitations under the License.
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-surefire-plugin</artifactId>
             <configuration>
-              <excludedGroups>org.apache.sqoop.common.test.categories.SlowTests</excludedGroups>
+              <excludedGroups>slow</excludedGroups>
             </configuration>
           </plugin>
         </plugins>
@@ -160,7 +160,7 @@ limitations under the License.
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-surefire-plugin</artifactId>
             <configuration>
-              <groups>org.apache.sqoop.common.test.categories.SlowTests</groups>
+              <groups>slow</groups>
             </configuration>
           </plugin>
         </plugins>
@@ -462,9 +462,9 @@ limitations under the License.
         <version>${servlet.version}</version>
       </dependency>
       <dependency>
-        <groupId>junit</groupId>
-        <artifactId>junit</artifactId>
-        <version>${junit.version}</version>
+        <groupId>org.testng</groupId>
+        <artifactId>testng</artifactId>
+        <version>${testng.version}</version>
       </dependency>
       <dependency>
         <groupId>log4j</groupId>
@@ -549,7 +549,7 @@ limitations under the License.
       </dependency>
       <dependency>
         <groupId>org.powermock</groupId>
-        <artifactId>powermock-module-junit4</artifactId>
+        <artifactId>powermock-module-testng</artifactId>
         <version>${powermock.version}</version>
         <scope>test</scope>
       </dependency>
@@ -660,6 +660,7 @@ limitations under the License.
               <exclude>**.patch</exclude>
               <exclude>patch-process/*</exclude>
               <exclude>.metadata/</exclude>
+              <exclude>**/target/*</exclude>
             </excludes>
           </configuration>
         </plugin>
@@ -672,15 +673,21 @@ limitations under the License.
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-surefire-plugin</artifactId>
-          <version>2.13</version>
+          <version>2.14</version>
           <configuration>
-            <forkMode>always</forkMode>
+            <forkCount>1</forkCount>
+            <reuseForks>false</reuseForks>
             <forkedProcessTimeoutInSeconds>3600</forkedProcessTimeoutInSeconds>
             <redirectTestOutputToFile>true</redirectTestOutputToFile>
             <argLine>-Xms512m -Xmx2g -XX:MaxPermSize=1024m</argLine>
+            <properties>
+              <property>
+                <name>usedefaultlisteners</name>
+                <value>false</value> <!-- disabling default listeners is optional -->
+              </property>
+            </properties>
           </configuration>
         </plugin>
-
       </plugins>
     </pluginManagement>
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/repository/repository-common/pom.xml
----------------------------------------------------------------------
diff --git a/repository/repository-common/pom.xml b/repository/repository-common/pom.xml
index 37378c6..c740117 100644
--- a/repository/repository-common/pom.xml
+++ b/repository/repository-common/pom.xml
@@ -43,8 +43,8 @@ limitations under the License.
     </dependency>
 
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
+      <groupId>org.testng</groupId>
+      <artifactId>testng</artifactId>
       <scope>test</scope>
     </dependency>
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/repository/repository-derby/pom.xml
----------------------------------------------------------------------
diff --git a/repository/repository-derby/pom.xml b/repository/repository-derby/pom.xml
index 9be96db..2a3b8fc 100644
--- a/repository/repository-derby/pom.xml
+++ b/repository/repository-derby/pom.xml
@@ -53,8 +53,8 @@ limitations under the License.
     </dependency>
 
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
+      <groupId>org.testng</groupId>
+      <artifactId>testng</artifactId>
       <scope>test</scope>
     </dependency>
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/DerbyTestCase.java
----------------------------------------------------------------------
diff --git a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/DerbyTestCase.java b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/DerbyTestCase.java
index 6cb3eb0..1b6bdc0 100644
--- a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/DerbyTestCase.java
+++ b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/DerbyTestCase.java
@@ -20,7 +20,7 @@ package org.apache.sqoop.repository.derby;
 import static org.apache.sqoop.repository.derby.DerbySchemaUpgradeQuery.*;
 import static org.apache.sqoop.repository.derby.DerbySchemaCreateQuery.*;
 import static org.apache.sqoop.repository.derby.DerbySchemaInsertUpdateDeleteSelectQuery.*;
-import static org.junit.Assert.assertEquals;
+import static org.testng.AssertJUnit.assertEquals;
 
 import java.sql.Connection;
 import java.sql.DriverManager;
@@ -46,8 +46,8 @@ import org.apache.sqoop.model.MLinkConfig;
 import org.apache.sqoop.model.MMapInput;
 import org.apache.sqoop.model.MStringInput;
 import org.apache.sqoop.model.MToConfig;
-import org.junit.After;
-import org.junit.Before;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
 
 /**
  * Abstract class with convenience methods for testing derby repository.
@@ -60,14 +60,14 @@ abstract public class DerbyTestCase {
 
   private Connection connection;
 
-  @Before
+  @BeforeMethod
   public void setUp() throws Exception {
     // Create link to the database
     Class.forName(DERBY_DRIVER).newInstance();
     connection = DriverManager.getConnection(getStartJdbcUrl());
   }
 
-  @After
+  @AfterMethod
   public void tearDown() throws Exception {
     // Close active link
     if (connection != null) {

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestConnectorHandling.java
----------------------------------------------------------------------
diff --git a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestConnectorHandling.java b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestConnectorHandling.java
index efc4418..248873b 100644
--- a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestConnectorHandling.java
+++ b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestConnectorHandling.java
@@ -18,14 +18,14 @@
 package org.apache.sqoop.repository.derby;
 
 import org.apache.sqoop.model.MConnector;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 import java.util.List;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
 
 /**
  * Test connector methods on Derby repository.
@@ -34,7 +34,7 @@ public class TestConnectorHandling extends DerbyTestCase {
 
   DerbyRepositoryHandler handler;
 
-  @Before
+  @BeforeMethod
   public void setUp() throws Exception {
     super.setUp();
     handler = new DerbyRepositoryHandler();

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestDriverHandling.java
----------------------------------------------------------------------
diff --git a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestDriverHandling.java b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestDriverHandling.java
index 25a0093..91d8b92 100644
--- a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestDriverHandling.java
+++ b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestDriverHandling.java
@@ -17,14 +17,14 @@
  */
 package org.apache.sqoop.repository.derby;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
 
 import org.apache.sqoop.model.MDriver;
 import org.apache.sqoop.model.MDriverConfig;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 /**
  * Test driver methods on Derby repository.
@@ -34,7 +34,7 @@ public class TestDriverHandling extends DerbyTestCase {
   private static final Object CURRENT_DRIVER_VERSION = "1";
   DerbyRepositoryHandler handler;
 
-  @Before
+  @BeforeMethod
   public void setUp() throws Exception {
     super.setUp();
     handler = new DerbyRepositoryHandler();

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestInputTypes.java
----------------------------------------------------------------------
diff --git a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestInputTypes.java b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestInputTypes.java
index 71cc763..2cbe255 100644
--- a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestInputTypes.java
+++ b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestInputTypes.java
@@ -17,9 +17,9 @@
  */
 package org.apache.sqoop.repository.derby;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNotSame;
 
 import java.util.HashMap;
 import java.util.LinkedList;
@@ -38,8 +38,8 @@ import org.apache.sqoop.model.MLinkConfig;
 import org.apache.sqoop.model.MMapInput;
 import org.apache.sqoop.model.MPersistableEntity;
 import org.apache.sqoop.model.MStringInput;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 /**
  * Test proper support of all available model types.
@@ -48,7 +48,7 @@ public class TestInputTypes extends DerbyTestCase {
 
   DerbyRepositoryHandler handler;
 
-  @Before
+  @BeforeMethod
   public void setUp() throws Exception {
     super.setUp();
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestJobHandling.java
----------------------------------------------------------------------
diff --git a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestJobHandling.java b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestJobHandling.java
index 309e6b2..3cc6928 100644
--- a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestJobHandling.java
+++ b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestJobHandling.java
@@ -17,12 +17,12 @@
  */
 package org.apache.sqoop.repository.derby;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
 
 import java.sql.Connection;
 import java.util.HashMap;
@@ -37,8 +37,8 @@ import org.apache.sqoop.model.MJob;
 import org.apache.sqoop.model.MMapInput;
 import org.apache.sqoop.model.MStringInput;
 import org.apache.sqoop.repository.common.CommonRepositoryError;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 /**
  * Test job methods on Derby repository.
@@ -48,7 +48,7 @@ public class TestJobHandling extends DerbyTestCase {
   DerbyRepositoryHandler handler;
   Connection derbyConnection;
 
-  @Before
+  @BeforeMethod
   public void setUp() throws Exception {
     super.setUp();
     derbyConnection = getDerbyDatabaseConnection();
@@ -218,7 +218,7 @@ public class TestJobHandling extends DerbyTestCase {
     assertCountForTable("SQOOP.SQ_JOB_INPUT", 12);
   }
 
-  @Test(expected=SqoopException.class)
+  @Test(expectedExceptions=SqoopException.class)
   public void testCreateDuplicateJob() throws Exception {
     // Duplicate jobs
     MJob job = getJob();

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestLinkHandling.java
----------------------------------------------------------------------
diff --git a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestLinkHandling.java b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestLinkHandling.java
index 6274d11..1c96deb 100644
--- a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestLinkHandling.java
+++ b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestLinkHandling.java
@@ -17,12 +17,12 @@
  */
 package org.apache.sqoop.repository.derby;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
 
 import java.util.List;
 
@@ -32,8 +32,8 @@ import org.apache.sqoop.model.MLink;
 import org.apache.sqoop.model.MMapInput;
 import org.apache.sqoop.model.MStringInput;
 import org.apache.sqoop.repository.common.CommonRepositoryError;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 /**
  * Test link methods on Derby repository.
@@ -42,7 +42,7 @@ public class TestLinkHandling extends DerbyTestCase {
 
   DerbyRepositoryHandler handler;
 
-  @Before
+  @BeforeMethod
   public void setUp() throws Exception {
     super.setUp();
 
@@ -200,7 +200,7 @@ public class TestLinkHandling extends DerbyTestCase {
     assertCountForTable("SQOOP.SQ_LINK_INPUT", 4);
   }
 
-  @Test(expected = SqoopException.class)
+  @Test(expectedExceptions = SqoopException.class)
   public void testCreateDuplicateLink() throws Exception {
     MLink link = getLink();
     fillLink(link);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestRepositoryUpgrade.java
----------------------------------------------------------------------
diff --git a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestRepositoryUpgrade.java b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestRepositoryUpgrade.java
index 31154af..b53aeff 100644
--- a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestRepositoryUpgrade.java
+++ b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestRepositoryUpgrade.java
@@ -17,20 +17,20 @@
  */
 package org.apache.sqoop.repository.derby;
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
 
 import java.sql.Connection;
 import java.sql.SQLIntegrityConstraintViolationException;
 
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 public class TestRepositoryUpgrade extends DerbyTestCase {
 
   DerbyRepositoryHandler handler;
 
-  @Before
+  @BeforeMethod
   public void setUp() throws Exception {
     super.setUp();
     handler = new TestDerbyRepositoryHandler();
@@ -63,7 +63,7 @@ public class TestRepositoryUpgrade extends DerbyTestCase {
     assertTrue(handler.isRepositorySuitableForUse(getDerbyDatabaseConnection()));
   }
 
-  @Test(expected = SQLIntegrityConstraintViolationException.class)
+  @Test(expectedExceptions = SQLIntegrityConstraintViolationException.class)
   public void testUpgradeVersion4WithNonUniqueJobNameFailure() throws Exception {
     super.createOrUpgradeSchema(4);
     // try loading duplicate job names in version 4 and it should throw an
@@ -71,7 +71,7 @@ public class TestRepositoryUpgrade extends DerbyTestCase {
     super.loadNonUniqueJobsInVersion4();
   }
 
-  @Test(expected = SQLIntegrityConstraintViolationException.class)
+  @Test(expectedExceptions = SQLIntegrityConstraintViolationException.class)
   public void testUpgradeVersion4WithNonUniqueLinkNamesAdded() throws Exception {
     super.createOrUpgradeSchema(4);
     // try loading duplicate link names in version 4 and it should throw an
@@ -79,7 +79,7 @@ public class TestRepositoryUpgrade extends DerbyTestCase {
     super.loadNonUniqueLinksInVersion4();
   }
 
-  @Test(expected = SQLIntegrityConstraintViolationException.class)
+  @Test(expectedExceptions = SQLIntegrityConstraintViolationException.class)
   public void testUpgradeVersion4WithNonUniqueConfigurableNamesAdded() throws Exception {
     super.createOrUpgradeSchema(4);
     // try loading duplicate configurable names in version 4 and it should throw
@@ -87,7 +87,7 @@ public class TestRepositoryUpgrade extends DerbyTestCase {
     super.loadNonUniqueConfigurablesInVersion4();
   }
 
-  @Test(expected = SQLIntegrityConstraintViolationException.class)
+  @Test(expectedExceptions = SQLIntegrityConstraintViolationException.class)
   public void testUpgradeVersion4WithNonUniqueConfigNameAndTypeAdded() throws Exception {
     super.createOrUpgradeSchema(4);
     super.addConnectorB();
@@ -115,7 +115,7 @@ public class TestRepositoryUpgrade extends DerbyTestCase {
     super.loadNonUniqueConfigNameAndTypeButUniqueConfigurableInVersion4();
   }
 
-  @Test(expected = SQLIntegrityConstraintViolationException.class)
+  @Test(expectedExceptions = SQLIntegrityConstraintViolationException.class)
   public void testUpgradeVersion4WithNonUniqueInputNameAndTypeAdded() throws Exception {
     super.createOrUpgradeSchema(4);
     super.addConnectorB();

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestSubmissionHandling.java
----------------------------------------------------------------------
diff --git a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestSubmissionHandling.java b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestSubmissionHandling.java
index b479266..523ddc7 100644
--- a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestSubmissionHandling.java
+++ b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestSubmissionHandling.java
@@ -22,14 +22,14 @@ import org.apache.sqoop.submission.SubmissionStatus;
 import org.apache.sqoop.submission.counter.Counter;
 import org.apache.sqoop.submission.counter.CounterGroup;
 import org.apache.sqoop.submission.counter.Counters;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
-import static org.junit.Assert.*;
+import static org.testng.Assert.*;
 
 /**
  *
@@ -38,7 +38,7 @@ public class TestSubmissionHandling extends DerbyTestCase {
 
   DerbyRepositoryHandler handler;
 
-  @Before
+  @BeforeMethod
   public void setUp() throws Exception {
     super.setUp();
 
@@ -130,8 +130,8 @@ public class TestSubmissionHandling extends DerbyTestCase {
 
     assertEquals(1, submission.getJobId());
     assertEquals(SubmissionStatus.RUNNING, submission.getStatus());
-    assertEquals(creationDate, submission.getCreationDate());
-    assertEquals(updateDate, submission.getLastUpdateDate());
+    assertEquals(creationDate.getTime(), submission.getCreationDate().getTime());
+    assertEquals(updateDate.getTime(), submission.getLastUpdateDate().getTime());
     assertEquals("job-x", submission.getExternalJobId());
     assertEquals("http://somewhere", submission.getExternalLink());
     assertEquals("RuntimeException", submission.getError().getErrorSummary());

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/repository/repository-postgresql/pom.xml
----------------------------------------------------------------------
diff --git a/repository/repository-postgresql/pom.xml b/repository/repository-postgresql/pom.xml
index e5e5ec8..0ee9081 100644
--- a/repository/repository-postgresql/pom.xml
+++ b/repository/repository-postgresql/pom.xml
@@ -59,9 +59,9 @@ limitations under the License.
     </dependency>
 
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
+      <groupId>org.testng</groupId>
+      <artifactId>testng</artifactId>
+      <version>${testng.version}</version>
     </dependency>
 
     <dependency>

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/repository/repository-postgresql/src/test/java/org/apache/sqoop/repository/postgresql/PostgresqlTestCase.java
----------------------------------------------------------------------
diff --git a/repository/repository-postgresql/src/test/java/org/apache/sqoop/repository/postgresql/PostgresqlTestCase.java b/repository/repository-postgresql/src/test/java/org/apache/sqoop/repository/postgresql/PostgresqlTestCase.java
index 5d80dce..ea199d4 100644
--- a/repository/repository-postgresql/src/test/java/org/apache/sqoop/repository/postgresql/PostgresqlTestCase.java
+++ b/repository/repository-postgresql/src/test/java/org/apache/sqoop/repository/postgresql/PostgresqlTestCase.java
@@ -19,10 +19,10 @@ package org.apache.sqoop.repository.postgresql;
 
 import org.apache.sqoop.common.test.db.DatabaseProvider;
 import org.apache.sqoop.common.test.db.PostgreSQLProvider;
-import org.junit.After;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.BeforeClass;
+import org.testng.SkipException;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 /**
  * Abstract class with convenience methods for testing postgresql repository.
@@ -33,25 +33,25 @@ abstract public class PostgresqlTestCase {
   public static PostgresqlTestUtils utils;
   public PostgresqlRepositoryHandler handler;
 
-  @BeforeClass
+  @Test
   public static void setUpClass() {
     provider = new PostgreSQLProvider();
     utils = new PostgresqlTestUtils(provider);
   }
 
-  @Before
+  @BeforeMethod
   public void setUp() throws Exception {
     try {
       provider.start();
     } catch (RuntimeException e) {
-      Assume.assumeTrue(false);
+      throw new SkipException("Cannot connect to provider.", e);
     }
 
     handler = new PostgresqlRepositoryHandler();
     handler.createOrUpgradeRepository(provider.getConnection());
   }
 
-  @After
+  @AfterMethod
   public void tearDown() throws Exception {
     provider.dropSchema("sqoop");
     provider.stop();

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/repository/repository-postgresql/src/test/java/org/apache/sqoop/repository/postgresql/TestStructure.java
----------------------------------------------------------------------
diff --git a/repository/repository-postgresql/src/test/java/org/apache/sqoop/repository/postgresql/TestStructure.java b/repository/repository-postgresql/src/test/java/org/apache/sqoop/repository/postgresql/TestStructure.java
index 2da19bc..6075de4 100644
--- a/repository/repository-postgresql/src/test/java/org/apache/sqoop/repository/postgresql/TestStructure.java
+++ b/repository/repository-postgresql/src/test/java/org/apache/sqoop/repository/postgresql/TestStructure.java
@@ -17,7 +17,7 @@
  */
 package org.apache.sqoop.repository.postgresql;
 
-import org.junit.Test;
+import org.testng.annotations.Test;
 
 /**
  * Test connector methods on PostgreSQL repository.

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/submission/mapreduce/pom.xml
----------------------------------------------------------------------
diff --git a/submission/mapreduce/pom.xml b/submission/mapreduce/pom.xml
index 7b45492..b0fbb71 100644
--- a/submission/mapreduce/pom.xml
+++ b/submission/mapreduce/pom.xml
@@ -41,8 +41,8 @@ limitations under the License.
     </dependency>
 
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
+      <groupId>org.testng</groupId>
+      <artifactId>testng</artifactId>
       <scope>test</scope>
     </dependency>
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/471e534e/test/pom.xml
----------------------------------------------------------------------
diff --git a/test/pom.xml b/test/pom.xml
index f74ee3c..373b89c 100644
--- a/test/pom.xml
+++ b/test/pom.xml
@@ -31,8 +31,8 @@ limitations under the License.
 
   <dependencies>
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
+      <groupId>org.testng</groupId>
+      <artifactId>testng</artifactId>
     </dependency>
 
     <dependency>


Mime
View raw message