From bf5cc533b3259559eb03c3baa947e2e47480cc3d Mon Sep 17 00:00:00 2001 From: Jarek Jarcec Cecho Date: Thu, 24 Dec 2015 09:21:48 +0100 Subject: [PATCH] SQOOP-2754: Sqoop2: Fix bug in integration test for Mysql and Postgresql (Colin Ma via Jarek Jarcec Cecho) --- .../integration/repository/mysql/TestJobHandling.java | 9 +++++++-- .../repository/postgresql/PostgresqlTestCase.java | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/repository/repository-mysql/src/test/java/org/apache/sqoop/integration/repository/mysql/TestJobHandling.java b/repository/repository-mysql/src/test/java/org/apache/sqoop/integration/repository/mysql/TestJobHandling.java index 7a87feec..9109212d 100644 --- a/repository/repository-mysql/src/test/java/org/apache/sqoop/integration/repository/mysql/TestJobHandling.java +++ b/repository/repository-mysql/src/test/java/org/apache/sqoop/integration/repository/mysql/TestJobHandling.java @@ -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 void testFindJobsByConnector() throws Exception { .findJobsForConnectorUpgrade( handler.findConnector("A", provider.getConnection()) .getPersistenceId(), provider.getConnection()); + List jobNames = new ArrayList(); + 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 diff --git a/repository/repository-postgresql/src/test/java/org/apache/sqoop/integration/repository/postgresql/PostgresqlTestCase.java b/repository/repository-postgresql/src/test/java/org/apache/sqoop/integration/repository/postgresql/PostgresqlTestCase.java index 2311f8ba..4ddfbc3f 100644 --- a/repository/repository-postgresql/src/test/java/org/apache/sqoop/integration/repository/postgresql/PostgresqlTestCase.java +++ b/repository/repository-postgresql/src/test/java/org/apache/sqoop/integration/repository/postgresql/PostgresqlTestCase.java @@ -62,7 +62,8 @@ public void setUpClass() { @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()); }