You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sqoop.apache.org by ab...@apache.org on 2014/10/10 04:51:59 UTC

[30/52] [abbrv] SQOOP-1478: Sqoop2: Migrate remaining tests from junit 3 to 4

http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/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 7378eda..8dd1ce2 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
@@ -22,11 +22,15 @@ import org.apache.sqoop.model.MLink;
 import org.apache.sqoop.model.MForm;
 import org.apache.sqoop.model.MMapInput;
 import org.apache.sqoop.model.MStringInput;
+import org.junit.Before;
+import org.junit.Test;
 
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import static org.junit.Assert.*;
+
 /**
  * Test link methods on Derby repository.
  */
@@ -34,7 +38,7 @@ public class TestLinkHandling extends DerbyTestCase {
 
   DerbyRepositoryHandler handler;
 
-  @Override
+  @Before
   public void setUp() throws Exception {
     super.setUp();
 
@@ -47,6 +51,7 @@ public class TestLinkHandling extends DerbyTestCase {
     loadConnectorAndDriverConfig();
   }
 
+  @Test
   public void testFindLink() throws Exception {
     // Let's try to find non existing link
     try {
@@ -81,6 +86,7 @@ public class TestLinkHandling extends DerbyTestCase {
     assertNull(forms.get(1).getInputs().get(1).getValue());
   }
 
+  @Test
   public void testFindLinks() throws Exception {
     List<MLink> list;
 
@@ -98,6 +104,7 @@ public class TestLinkHandling extends DerbyTestCase {
     assertEquals("CB", list.get(1).getName());
   }
 
+  @Test
   public void testExistsLink() throws Exception {
     // There shouldn't be anything on empty repository
     assertFalse(handler.existsLink(1, getDerbyDatabaseConnection()));
@@ -111,6 +118,7 @@ public class TestLinkHandling extends DerbyTestCase {
     assertFalse(handler.existsLink(3, getDerbyDatabaseConnection()));
   }
 
+  @Test
   public void testCreateLink() throws Exception {
     MLink link = getLink();
 
@@ -150,6 +158,7 @@ public class TestLinkHandling extends DerbyTestCase {
     assertCountForTable("SQOOP.SQ_CONNECTION_INPUT", 8);
   }
 
+  @Test
   public void testInUseLink() throws Exception {
     loadLinks();
 
@@ -160,6 +169,7 @@ public class TestLinkHandling extends DerbyTestCase {
     assertTrue(handler.inUseLink(1, getDerbyDatabaseConnection()));
   }
 
+  @Test
   public void testUpdateLink() throws Exception {
     loadLinks();
 
@@ -205,6 +215,7 @@ public class TestLinkHandling extends DerbyTestCase {
     assertEquals(((Map)forms.get(1).getInputs().get(1).getValue()).size(), 0);
   }
 
+  @Test
   public void testEnableAndDisableLink() throws Exception {
     loadLinks();
 
@@ -223,6 +234,7 @@ public class TestLinkHandling extends DerbyTestCase {
     assertEquals(true, retrieved.getEnabled());
   }
 
+  @Test
   public void testDeleteLink() throws Exception {
     loadLinks();
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/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 38a995f..cf0944d 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,11 +22,15 @@ 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 java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
+import static org.junit.Assert.*;
+
 /**
  *
  */
@@ -34,7 +38,7 @@ public class TestSubmissionHandling extends DerbyTestCase {
 
   DerbyRepositoryHandler handler;
 
-  @Override
+  @Before
   public void setUp() throws Exception {
     super.setUp();
 
@@ -53,6 +57,7 @@ public class TestSubmissionHandling extends DerbyTestCase {
     loadJobs();
   }
 
+  @Test
   public void testFindSubmissionsUnfinished() throws Exception {
     List<MSubmission> submissions;
 
@@ -67,6 +72,7 @@ public class TestSubmissionHandling extends DerbyTestCase {
     assertEquals(2, submissions.size());
   }
 
+  @Test
   public void testExistsSubmission() throws Exception {
     // There shouldn't be anything on empty repository
     assertFalse(handler.existsSubmission(1, getDerbyDatabaseConnection()));
@@ -86,6 +92,7 @@ public class TestSubmissionHandling extends DerbyTestCase {
     assertFalse(handler.existsSubmission(6, getDerbyDatabaseConnection()));
   }
 
+  @Test
   public void testCreateSubmission() throws Exception {
     Date creationDate = new Date();
     Date updateDate = new Date();
@@ -168,6 +175,7 @@ public class TestSubmissionHandling extends DerbyTestCase {
     assertCountForTable("SQOOP.SQ_SUBMISSION", 2);
   }
 
+  @Test
   public void testUpdateConnection() throws Exception {
     loadSubmissions();
 
@@ -186,6 +194,7 @@ public class TestSubmissionHandling extends DerbyTestCase {
     assertEquals(1, submissions.size());
   }
 
+  @Test
   public void testPurgeSubmissions() throws Exception {
     loadSubmissions();
     List<MSubmission> submissions;
@@ -226,6 +235,7 @@ public class TestSubmissionHandling extends DerbyTestCase {
    *
    * @throws Exception
    */
+  @Test
   public void testDeleteJobs() throws Exception {
     loadSubmissions();
     assertCountForTable("SQOOP.SQ_SUBMISSION", 5);