sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jar...@apache.org
Subject sqoop git commit: SQOOP-2715: Sqoop2: The test case ShowJobInOrderTest always failed
Date Sat, 05 Dec 2015 12:02:57 GMT
Repository: sqoop
Updated Branches:
  refs/heads/sqoop2 e9df0207e -> 1b228f308


SQOOP-2715: Sqoop2: The test case ShowJobInOrderTest always failed

(Colin Ma via Jarek Jarcec Cecho)


Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/1b228f30
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/1b228f30
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/1b228f30

Branch: refs/heads/sqoop2
Commit: 1b228f308c92ee99fb6077b55351d29b90609ef4
Parents: e9df020
Author: Jarek Jarcec Cecho <jarcec@apache.org>
Authored: Sat Dec 5 13:02:24 2015 +0100
Committer: Jarek Jarcec Cecho <jarcec@apache.org>
Committed: Sat Dec 5 13:02:24 2015 +0100

----------------------------------------------------------------------
 .../test/infrastructure/SqoopTestCase.java      | 18 +++++++++++++++
 .../server/InformalObjectNameTest.java          | 10 +++++++++
 .../integration/server/ShowJobInOrderTest.java  | 23 ++++++++++++++------
 .../SubmissionWithDisabledModelObjectsTest.java |  2 ++
 .../sqoop/integration/server/rest/RestTest.java | 11 ++--------
 5 files changed, 48 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/1b228f30/test/src/main/java/org/apache/sqoop/test/infrastructure/SqoopTestCase.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/sqoop/test/infrastructure/SqoopTestCase.java b/test/src/main/java/org/apache/sqoop/test/infrastructure/SqoopTestCase.java
index 4c5d3a8..c1f355f 100644
--- a/test/src/main/java/org/apache/sqoop/test/infrastructure/SqoopTestCase.java
+++ b/test/src/main/java/org/apache/sqoop/test/infrastructure/SqoopTestCase.java
@@ -459,4 +459,22 @@ public class SqoopTestCase implements ITest {
   public void createAndLoadTableShortStories() {
     new ShortStories(getInfrastructureProvider(DatabaseInfrastructureProvider.class).getInstance(),
getTableName()).createTables().loadBasicData();
   }
+
+  /**
+   * Clear the test data for Job.
+   */
+  public void clearJob() {
+    for(MJob job : getClient().getJobs()) {
+      getClient().deleteJob(job.getName());
+    }
+  }
+
+  /**
+   * Clear the test data for Link.
+   */
+  public void clearLink() {
+    for(MLink link : getClient().getLinks()) {
+      getClient().deleteLink(link.getName());
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/1b228f30/test/src/test/java/org/apache/sqoop/integration/server/InformalObjectNameTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/sqoop/integration/server/InformalObjectNameTest.java
b/test/src/test/java/org/apache/sqoop/integration/server/InformalObjectNameTest.java
index 920679f..fe04df7 100644
--- a/test/src/test/java/org/apache/sqoop/integration/server/InformalObjectNameTest.java
+++ b/test/src/test/java/org/apache/sqoop/integration/server/InformalObjectNameTest.java
@@ -30,6 +30,7 @@ import org.apache.sqoop.test.infrastructure.providers.DatabaseInfrastructureProv
 import org.apache.sqoop.test.infrastructure.providers.HadoopInfrastructureProvider;
 import org.apache.sqoop.test.infrastructure.providers.SqoopInfrastructureProvider;
 import org.apache.sqoop.test.utils.ParametrizedUtils;
+import org.testng.annotations.AfterMethod;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Factory;
 import org.testng.annotations.Test;
@@ -146,4 +147,13 @@ public class InformalObjectNameTest extends SqoopTestCase {
       // ignore the exception
     }
   }
+
+  @AfterMethod
+  public void dropTestData() {
+    if (TARGET_LINK.equals(target)) {
+      clearLink();
+    } else if (TARGET_JOB.equals(target)) {
+      clearJob();
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/1b228f30/test/src/test/java/org/apache/sqoop/integration/server/ShowJobInOrderTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/sqoop/integration/server/ShowJobInOrderTest.java
b/test/src/test/java/org/apache/sqoop/integration/server/ShowJobInOrderTest.java
index cbf1e90..298ec09 100644
--- a/test/src/test/java/org/apache/sqoop/integration/server/ShowJobInOrderTest.java
+++ b/test/src/test/java/org/apache/sqoop/integration/server/ShowJobInOrderTest.java
@@ -22,9 +22,10 @@ import org.apache.sqoop.model.MJob;
 import org.apache.sqoop.model.MLink;
 import org.apache.sqoop.test.infrastructure.Infrastructure;
 import org.apache.sqoop.test.infrastructure.SqoopTestCase;
+import org.apache.sqoop.test.infrastructure.providers.DatabaseInfrastructureProvider;
 import org.apache.sqoop.test.infrastructure.providers.HadoopInfrastructureProvider;
 import org.apache.sqoop.test.infrastructure.providers.SqoopInfrastructureProvider;
-import org.apache.sqoop.test.testcases.ConnectorTestCase;
+import org.testng.annotations.AfterMethod;
 import org.testng.annotations.Test;
 
 import java.util.List;
@@ -34,7 +35,7 @@ import static org.testng.Assert.assertEquals;
 /**
  * Ensure that jobs will be shown in order
  */
-@Infrastructure(dependencies = {HadoopInfrastructureProvider.class, SqoopInfrastructureProvider.class})
+@Infrastructure(dependencies = {HadoopInfrastructureProvider.class, SqoopInfrastructureProvider.class,
DatabaseInfrastructureProvider.class})
 public class ShowJobInOrderTest extends SqoopTestCase {
 
   public ShowJobInOrderTest() {
@@ -56,6 +57,7 @@ public class ShowJobInOrderTest extends SqoopTestCase {
 
     // Job creation
     MJob job = getClient().createJob(rdbmsLink.getName(), hdfsLink.getName());
+    job.setName("testJobName1");
 
     // rdms "FROM" config
     fillRdbmsFromConfig(job, "id");
@@ -67,6 +69,7 @@ public class ShowJobInOrderTest extends SqoopTestCase {
 
     // Job creation
     job = getClient().createJob(hdfsLink.getName(), rdbmsLink.getName());
+    job.setName("testJobName2");
 
     // rdms "To" config
     fillRdbmsToConfig(job);
@@ -78,6 +81,7 @@ public class ShowJobInOrderTest extends SqoopTestCase {
 
     // Job creation
     job = getClient().createJob(rdbmsLink.getName(), hdfsLink.getName());
+    job.setName("testJobName3");
 
     // rdms "FROM" config
     fillRdbmsFromConfig(job, "id");
@@ -89,7 +93,7 @@ public class ShowJobInOrderTest extends SqoopTestCase {
 
     // Job creation
     job = getClient().createJob(hdfsLink.getName(), rdbmsLink.getName());
-
+    job.setName("testJobName4");
 
     // hdfs "From" config
     fillHdfsFromConfig(job);
@@ -101,9 +105,14 @@ public class ShowJobInOrderTest extends SqoopTestCase {
 
     List<MJob> jobs = getClient().getJobs();
 
-    assertEquals(1, jobs.get(0).getPersistenceId());
-    assertEquals(2, jobs.get(1).getPersistenceId());
-    assertEquals(3, jobs.get(2).getPersistenceId());
-    assertEquals(4, jobs.get(3).getPersistenceId());
+    assertEquals(jobs.get(0).getName(), "testJobName1");
+    assertEquals(jobs.get(1).getName(), "testJobName2");
+    assertEquals(jobs.get(2).getName(), "testJobName3");
+    assertEquals(jobs.get(3).getName(), "testJobName4");
+  }
+
+  @AfterMethod
+  public void dropTestData() {
+    clearJob();
   }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/1b228f30/test/src/test/java/org/apache/sqoop/integration/server/SubmissionWithDisabledModelObjectsTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/sqoop/integration/server/SubmissionWithDisabledModelObjectsTest.java
b/test/src/test/java/org/apache/sqoop/integration/server/SubmissionWithDisabledModelObjectsTest.java
index 9e682bc..c2709a7 100644
--- a/test/src/test/java/org/apache/sqoop/integration/server/SubmissionWithDisabledModelObjectsTest.java
+++ b/test/src/test/java/org/apache/sqoop/integration/server/SubmissionWithDisabledModelObjectsTest.java
@@ -72,6 +72,8 @@ public class SubmissionWithDisabledModelObjectsTest extends SqoopTestCase
{
   @AfterMethod
   public void tearDownRdbmsTable() {
     dropTable();
+    clearJob();
+    clearLink();
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/sqoop/blob/1b228f30/test/src/test/java/org/apache/sqoop/integration/server/rest/RestTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/sqoop/integration/server/rest/RestTest.java b/test/src/test/java/org/apache/sqoop/integration/server/rest/RestTest.java
index 4ac564c..20f09e8 100644
--- a/test/src/test/java/org/apache/sqoop/integration/server/rest/RestTest.java
+++ b/test/src/test/java/org/apache/sqoop/integration/server/rest/RestTest.java
@@ -20,16 +20,13 @@ package org.apache.sqoop.integration.server.rest;
 import org.apache.log4j.Logger;
 import org.apache.commons.io.IOUtils;
 import org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthenticatedURL;
-import org.apache.sqoop.common.SqoopException;
 import org.apache.sqoop.model.MConfigList;
-import org.apache.sqoop.model.MJob;
 import org.apache.sqoop.model.MLink;
 import org.apache.sqoop.test.infrastructure.Infrastructure;
 import org.apache.sqoop.test.infrastructure.SqoopTestCase;
 import org.apache.sqoop.test.infrastructure.providers.HadoopInfrastructureProvider;
 import org.apache.sqoop.test.infrastructure.providers.SqoopInfrastructureProvider;
 import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 import java.io.DataOutputStream;
@@ -133,12 +130,8 @@ public abstract class RestTest extends SqoopTestCase {
 
   @AfterMethod
   public void dropTestData() {
-    for(MJob job : getClient().getJobs()) {
-      getClient().deleteJob(job.getName());
-    }
-    for(MLink link : getClient().getLinks()) {
-      getClient().deleteLink(link.getName());
-    }
+    clearJob();
+    clearLink();
   }
 
   private TestDescription desc;


Mime
View raw message