SQOOP-2754: Sqoop2: Fix bug in integration test for Mysql and Postgresql
authorJarek Jarcec Cecho <jarcec@apache.org>
Thu, 24 Dec 2015 08:21:48 +0000 (09:21 +0100)
committerJarek Jarcec Cecho <jarcec@apache.org>
Thu, 24 Dec 2015 08:21:48 +0000 (09:21 +0100)
(Colin Ma via Jarek Jarcec Cecho)

repository/repository-mysql/src/test/java/org/apache/sqoop/integration/repository/mysql/TestJobHandling.java
repository/repository-postgresql/src/test/java/org/apache/sqoop/integration/repository/postgresql/PostgresqlTestCase.java

index 7a87fee..9109212 100644 (file)
@@ -17,6 +17,7 @@
  */
 package org.apache.sqoop.integration.repository.mysql;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -145,9 +146,13 @@ public class TestJobHandling extends MySqlTestCase {
         .findJobsForConnectorUpgrade(
           handler.findConnector("A", provider.getConnection())
             .getPersistenceId(), provider.getConnection());
+    List<String> jobNames = new ArrayList<String>();
+    for (MJob job : list) {
+      jobNames.add(job.getName());
+    }
     assertEquals(2, list.size());
-    assertEquals(JOB_A_NAME, list.get(0).getName());
-    assertEquals(JOB_B_NAME, list.get(1).getName());
+    assertTrue(jobNames.contains(JOB_A_NAME));
+    assertTrue(jobNames.contains(JOB_B_NAME));
   }
 
   @Test
index 2311f8b..4ddfbc3 100644 (file)
@@ -62,7 +62,8 @@ abstract public class PostgresqlTestCase {
   @BeforeMethod(alwaysRun = true)
   public void setUp() throws Exception {
     provider.start();
-
+    // clear the data for sqoop
+    provider.dropSchema("SQOOP");
     handler = new PostgresqlRepositoryHandler();
     handler.createOrUpgradeRepository(provider.getConnection());
   }