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 05:07:17 UTC
[25/50] [abbrv] git commit: SQOOP-1478: Sqoop2: Migrate remaining
tests from junit 3 to 4
SQOOP-1478: Sqoop2: Migrate remaining tests from junit 3 to 4
Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/97da12aa
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/97da12aa
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/97da12aa
Branch: refs/heads/sqoop2
Commit: 97da12aa5043e1d2f1fcfaf2531670c13aa0c2ae
Parents: 196346d
Author: Chiwan Park <ch...@icloud.com>
Authored: Mon Sep 29 11:04:48 2014 -0700
Committer: Abraham Elmahrek <ab...@elmahrek.com>
Committed: Thu Oct 9 17:59:24 2014 -0700
----------------------------------------------------------------------
.../org/apache/sqoop/common/TestMapContext.java | 3 +-
.../apache/sqoop/json/TestConnectorBean.java | 3 +-
.../apache/sqoop/json/TestDriverConfigBean.java | 2 --
.../java/org/apache/sqoop/json/TestJobBean.java | 2 +-
.../org/apache/sqoop/json/TestLinkBean.java | 2 +-
.../org/apache/sqoop/json/TestSchemaBean.java | 2 --
.../apache/sqoop/json/TestSubmissionBean.java | 30 ++++++++++++++---
.../sqoop/json/TestValidationResultBean.java | 4 +--
.../org/apache/sqoop/model/TestFormUtils.java | 12 +++++--
.../sqoop/model/TestMAccountableEntity.java | 4 +--
.../apache/sqoop/model/TestMBooleanInput.java | 1 -
.../sqoop/model/TestMConnectionForms.java | 4 +--
.../org/apache/sqoop/model/TestMConnector.java | 4 +--
.../org/apache/sqoop/model/TestMEnumInput.java | 4 +--
.../java/org/apache/sqoop/model/TestMForm.java | 3 +-
.../org/apache/sqoop/model/TestMFormList.java | 2 +-
.../apache/sqoop/model/TestMIntegerInput.java | 4 +--
.../java/org/apache/sqoop/model/TestMJob.java | 4 +--
.../org/apache/sqoop/model/TestMJobForms.java | 4 +--
.../java/org/apache/sqoop/model/TestMLink.java | 4 +--
.../org/apache/sqoop/model/TestMMapInput.java | 10 +++---
.../apache/sqoop/model/TestMNamedElement.java | 4 +--
.../sqoop/model/TestMPersistableEntity.java | 3 +-
.../apache/sqoop/model/TestMStringInput.java | 4 +--
.../sqoop/model/TestMValidatedElement.java | 4 +--
.../sqoop/submission/TestSubmissionStatus.java | 10 ++++--
.../submission/counter/TestCounterGroup.java | 2 +-
.../sqoop/submission/counter/TestCounters.java | 2 +-
.../org/apache/sqoop/utils/TestClassUtils.java | 1 -
.../org/apache/sqoop/validation/TestStatus.java | 2 +-
.../apache/sqoop/validation/TestValidation.java | 8 +++--
.../validation/validators/TestContains.java | 2 +-
.../validators/TestNullOrContains.java | 2 +-
.../validation/validators/TestStartsWith.java | 2 +-
.../connector/jdbc/GenericJdbcExecutorTest.java | 12 +++++--
.../sqoop/connector/jdbc/TestExtractor.java | 20 ++++++++----
.../connector/jdbc/TestFromInitializer.java | 24 ++++++++++----
.../apache/sqoop/connector/jdbc/TestLoader.java | 6 ++--
.../sqoop/connector/jdbc/TestPartitioner.java | 25 +++++++++++---
.../sqoop/connector/jdbc/TestToInitializer.java | 26 ++++++++++++---
.../org/apache/sqoop/driver/TestJobManager.java | 14 ++++----
.../org/apache/sqoop/driver/TestJobRequest.java | 6 ++--
.../sqoop/repository/TestJdbcRepository.java | 34 ++++++++++----------
.../java/org/apache/sqoop/job/JobUtils.java | 2 +-
.../org/apache/sqoop/job/TestMapReduce.java | 15 +++++----
.../apache/sqoop/job/io/SqoopWritableTest.java | 10 ++++--
.../java/org/apache/sqoop/job/io/TestData.java | 9 +++---
.../mr/TestSqoopOutputFormatLoadExecutor.java | 2 +-
.../sqoop/repository/derby/DerbyTestCase.java | 16 ++++-----
.../repository/derby/TestConnectorHandling.java | 11 ++++++-
.../derby/TestDriverConfigHandling.java | 11 ++++++-
.../sqoop/repository/derby/TestInputTypes.java | 10 +++++-
.../sqoop/repository/derby/TestInternals.java | 11 ++++++-
.../sqoop/repository/derby/TestJobHandling.java | 14 +++++++-
.../repository/derby/TestLinkHandling.java | 14 +++++++-
.../derby/TestSubmissionHandling.java | 12 ++++++-
56 files changed, 310 insertions(+), 148 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/common/TestMapContext.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/common/TestMapContext.java b/common/src/test/java/org/apache/sqoop/common/TestMapContext.java
index f4718c0..7ce1ccd 100644
--- a/common/src/test/java/org/apache/sqoop/common/TestMapContext.java
+++ b/common/src/test/java/org/apache/sqoop/common/TestMapContext.java
@@ -20,8 +20,7 @@ package org.apache.sqoop.common;
import java.util.HashMap;
import java.util.Map;
-import junit.framework.Assert;
-
+import org.junit.Assert;
import org.junit.Test;
/**
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/json/TestConnectorBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestConnectorBean.java b/common/src/test/java/org/apache/sqoop/json/TestConnectorBean.java
index c3aa84f..fe75ee0 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestConnectorBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestConnectorBean.java
@@ -17,8 +17,6 @@
*/
package org.apache.sqoop.json;
-import static org.junit.Assert.*;
-
import org.apache.sqoop.model.MConnector;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;
@@ -31,6 +29,7 @@ import java.util.Map;
import java.util.ResourceBundle;
import static org.apache.sqoop.json.TestUtil.*;
+import static org.junit.Assert.*;
/**
*
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/json/TestDriverConfigBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestDriverConfigBean.java b/common/src/test/java/org/apache/sqoop/json/TestDriverConfigBean.java
index 4309f10..fcce7b5 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestDriverConfigBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestDriverConfigBean.java
@@ -25,8 +25,6 @@ import org.junit.Test;
import java.util.ResourceBundle;
import static org.apache.sqoop.json.TestUtil.*;
-
-
import static org.junit.Assert.*;
/**
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/json/TestJobBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestJobBean.java b/common/src/test/java/org/apache/sqoop/json/TestJobBean.java
index c6461bf..78a3420 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestJobBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestJobBean.java
@@ -27,8 +27,8 @@ import org.junit.Test;
import java.util.Date;
-import static junit.framework.Assert.assertEquals;
import static org.apache.sqoop.json.TestUtil.getJob;
+import static org.junit.Assert.assertEquals;
/**
*
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/json/TestLinkBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestLinkBean.java b/common/src/test/java/org/apache/sqoop/json/TestLinkBean.java
index 8235275..9ca6b64 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestLinkBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestLinkBean.java
@@ -27,7 +27,7 @@ import org.junit.Test;
import java.util.Date;
-import static junit.framework.Assert.*;
+import static org.junit.Assert.*;
import static org.apache.sqoop.json.TestUtil.*;
/**
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/json/TestSchemaBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestSchemaBean.java b/common/src/test/java/org/apache/sqoop/json/TestSchemaBean.java
index 5daab76..c7a7b2e 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestSchemaBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestSchemaBean.java
@@ -17,13 +17,11 @@
*/
package org.apache.sqoop.json;
-
import org.apache.sqoop.json.util.TestSchemaSerialization;
import org.apache.sqoop.schema.Schema;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;
-
/**
* Run the same tests as TestSchemaSerialization, but using the SchamaBean
* as a means of transfer.
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/json/TestSubmissionBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestSubmissionBean.java b/common/src/test/java/org/apache/sqoop/json/TestSubmissionBean.java
index 518c9cb..e4d50bf 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestSubmissionBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestSubmissionBean.java
@@ -17,7 +17,6 @@
*/
package org.apache.sqoop.json;
-import junit.framework.TestCase;
import org.apache.sqoop.model.MSubmission;
import org.apache.sqoop.schema.Schema;
import org.apache.sqoop.schema.type.Decimal;
@@ -28,16 +27,23 @@ import org.apache.sqoop.submission.counter.CounterGroup;
import org.apache.sqoop.submission.counter.Counters;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;
+import org.junit.Test;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
/**
*
*/
-public class TestSubmissionBean extends TestCase {
+public class TestSubmissionBean {
+
+ private static final double EPSILON = 0.01;
+ @Test
public void testTransferUnknown() {
transfer(MSubmission.UNKNOWN);
@@ -47,6 +53,7 @@ public class TestSubmissionBean extends TestCase {
transfer(submissions);
}
+ @Test
public void testTransferJobId() {
MSubmission source = new MSubmission();
source.setJobId(666);
@@ -69,6 +76,7 @@ public class TestSubmissionBean extends TestCase {
assertEquals(888, targets.get(1).getJobId());
}
+ @Test
public void testTransferCreationUser() {
String username = "admin";
MSubmission source = new MSubmission();
@@ -92,6 +100,7 @@ public class TestSubmissionBean extends TestCase {
assertEquals("userB", targets.get(1).getCreationUser());
}
+ @Test
public void testTransferCreationDate() {
Date date = new Date();
MSubmission source = new MSubmission();
@@ -117,6 +126,7 @@ public class TestSubmissionBean extends TestCase {
assertEquals(datey, targets.get(1).getCreationDate());
}
+ @Test
public void testTransferLastUpdateUser() {
String username = "admin";
MSubmission source = new MSubmission();
@@ -140,6 +150,7 @@ public class TestSubmissionBean extends TestCase {
assertEquals("userB", targets.get(1).getLastUpdateUser());
}
+ @Test
public void testTransferLastUpdateDate() {
Date date = new Date();
MSubmission source = new MSubmission();
@@ -165,6 +176,7 @@ public class TestSubmissionBean extends TestCase {
assertEquals(datey, targets.get(1).getLastUpdateDate());
}
+ @Test
public void testTransferStatus() {
MSubmission source = new MSubmission();
source.setStatus(SubmissionStatus.SUCCEEDED);
@@ -187,6 +199,7 @@ public class TestSubmissionBean extends TestCase {
assertEquals(SubmissionStatus.BOOTING, targets.get(1).getStatus());
}
+ @Test
public void testTransferExternalId() {
MSubmission source = new MSubmission();
source.setExternalId("Job-x");
@@ -209,6 +222,7 @@ public class TestSubmissionBean extends TestCase {
assertEquals("Job-z", targets.get(1).getExternalId());
}
+ @Test
public void testTransferExternalLink() {
MSubmission source = new MSubmission();
source.setExternalLink("http://");
@@ -231,6 +245,7 @@ public class TestSubmissionBean extends TestCase {
assertEquals("http://localhost:8080", targets.get(1).getExternalLink());
}
+ @Test
public void testTransferException() {
MSubmission source = new MSubmission();
source.setExceptionInfo("EndOfTheWorldException");
@@ -253,6 +268,7 @@ public class TestSubmissionBean extends TestCase {
assertEquals("EndOfTheWorldAgainException", targets.get(1).getExceptionInfo());
}
+ @Test
public void testTransferExceptionTrace() {
MSubmission source = new MSubmission();
source.setExceptionStackTrace("void.java(3): line infinity");
@@ -275,12 +291,13 @@ public class TestSubmissionBean extends TestCase {
assertEquals("void.java(5): core dumps in Java", targets.get(1).getExceptionStackTrace());
}
+ @Test
public void testTransferProgress() {
MSubmission source = new MSubmission();
source.setProgress(25.0);
MSubmission target = transfer(source);
- assertEquals(25.0, target.getProgress());
+ assertEquals(25.0, target.getProgress(), EPSILON);
List<MSubmission> sources = new ArrayList<MSubmission>();
MSubmission sourcex = new MSubmission();
@@ -292,11 +309,12 @@ public class TestSubmissionBean extends TestCase {
List<MSubmission> targets = transfer(sources);
assertNotNull(targets.get(0));
- assertEquals(50.0, targets.get(0).getProgress());
+ assertEquals(50.0, targets.get(0).getProgress(), EPSILON);
assertNotNull(targets.get(1));
- assertEquals(99.9, targets.get(1).getProgress());
+ assertEquals(99.9, targets.get(1).getProgress(), EPSILON);
}
+ @Test
public void testTransferCounters() {
Counters counters = new Counters();
counters.addCounterGroup(new CounterGroup("A")
@@ -405,6 +423,7 @@ public class TestSubmissionBean extends TestCase {
assertEquals(222222, counter.getValue());
}
+ @Test
public void testTransferFromSchema() {
MSubmission source = new MSubmission();
source.setFromSchema(getSchema());
@@ -414,6 +433,7 @@ public class TestSubmissionBean extends TestCase {
assertEquals(getSchema(), target);
}
+ @Test
public void testTransferToSchema() {
MSubmission source = new MSubmission();
source.setToSchema(getSchema());
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/json/TestValidationResultBean.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/json/TestValidationResultBean.java b/common/src/test/java/org/apache/sqoop/json/TestValidationResultBean.java
index d9c2043..5c094fb 100644
--- a/common/src/test/java/org/apache/sqoop/json/TestValidationResultBean.java
+++ b/common/src/test/java/org/apache/sqoop/json/TestValidationResultBean.java
@@ -28,8 +28,8 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import static junit.framework.Assert.assertNull;
-import static junit.framework.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/model/TestFormUtils.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestFormUtils.java b/common/src/test/java/org/apache/sqoop/model/TestFormUtils.java
index 9fa2b6b..d2a3476 100644
--- a/common/src/test/java/org/apache/sqoop/model/TestFormUtils.java
+++ b/common/src/test/java/org/apache/sqoop/model/TestFormUtils.java
@@ -17,21 +17,24 @@
*/
package org.apache.sqoop.model;
-import junit.framework.TestCase;
import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.validation.Status;
import org.apache.sqoop.validation.Validation;
+import org.junit.Test;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import static org.junit.Assert.*;
+
/**
* Test form utils
*/
-public class TestFormUtils extends TestCase {
+public class TestFormUtils {
+ @Test
public void testToForms() {
Config config = new Config();
config.aForm.a1 = "value";
@@ -48,6 +51,7 @@ public class TestFormUtils extends TestCase {
assertEquals("value", formsByBoth.get(0).getInputs().get(0).getValue());
}
+ @Test
public void testToFormsMissingAnnotation() {
try {
FormUtils.toForms(ConfigWithout.class);
@@ -91,6 +95,7 @@ public class TestFormUtils extends TestCase {
fail("Correct exception wasn't thrown");
}
+ @Test
public void testFailureOnPrimitiveType() {
PrimitiveConfig config = new PrimitiveConfig();
@@ -102,6 +107,7 @@ public class TestFormUtils extends TestCase {
}
}
+ @Test
public void testFillValues() {
List<MForm> forms = getForms();
@@ -113,6 +119,7 @@ public class TestFormUtils extends TestCase {
assertEquals("value", config.aForm.a1);
}
+ @Test
public void testFillValuesObjectReuse() {
List<MForm> forms = getForms();
@@ -129,6 +136,7 @@ public class TestFormUtils extends TestCase {
assertNull(config.bForm.b2);
}
+ @Test
public void testJson() {
Config config = new Config();
config.aForm.a1 = "A";
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/model/TestMAccountableEntity.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestMAccountableEntity.java b/common/src/test/java/org/apache/sqoop/model/TestMAccountableEntity.java
index d56e165..af0f450 100644
--- a/common/src/test/java/org/apache/sqoop/model/TestMAccountableEntity.java
+++ b/common/src/test/java/org/apache/sqoop/model/TestMAccountableEntity.java
@@ -17,14 +17,14 @@
*/
package org.apache.sqoop.model;
-import static org.junit.Assert.assertEquals;
-
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
/**
* Test class for org.apache.sqoop.model.MAccountableEntity
*/
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/model/TestMBooleanInput.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestMBooleanInput.java b/common/src/test/java/org/apache/sqoop/model/TestMBooleanInput.java
index cf9cf24..433c160 100644
--- a/common/src/test/java/org/apache/sqoop/model/TestMBooleanInput.java
+++ b/common/src/test/java/org/apache/sqoop/model/TestMBooleanInput.java
@@ -19,7 +19,6 @@ package org.apache.sqoop.model;
import org.junit.Test;
-import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/model/TestMConnectionForms.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestMConnectionForms.java b/common/src/test/java/org/apache/sqoop/model/TestMConnectionForms.java
index e2d2717..243fff9 100644
--- a/common/src/test/java/org/apache/sqoop/model/TestMConnectionForms.java
+++ b/common/src/test/java/org/apache/sqoop/model/TestMConnectionForms.java
@@ -17,13 +17,13 @@
*/
package org.apache.sqoop.model;
-import static org.junit.Assert.*;
-
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
+import static org.junit.Assert.*;
+
/**
* Test class for org.apache.sqoop.model.MConnectionForms
*/
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/model/TestMConnector.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestMConnector.java b/common/src/test/java/org/apache/sqoop/model/TestMConnector.java
index 0a5fd90..d8bc94d 100644
--- a/common/src/test/java/org/apache/sqoop/model/TestMConnector.java
+++ b/common/src/test/java/org/apache/sqoop/model/TestMConnector.java
@@ -17,8 +17,6 @@
*/
package org.apache.sqoop.model;
-import static org.junit.Assert.*;
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -26,6 +24,8 @@ import java.util.List;
import org.apache.sqoop.common.Direction;
import org.junit.Test;
+import static org.junit.Assert.*;
+
/**
* Test class for org.apache.sqoop.model.TestMConnector
*/
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/model/TestMEnumInput.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestMEnumInput.java b/common/src/test/java/org/apache/sqoop/model/TestMEnumInput.java
index a25016a..c76d031 100644
--- a/common/src/test/java/org/apache/sqoop/model/TestMEnumInput.java
+++ b/common/src/test/java/org/apache/sqoop/model/TestMEnumInput.java
@@ -17,10 +17,10 @@
*/
package org.apache.sqoop.model;
-import static org.junit.Assert.*;
-
import org.junit.Test;
+import static org.junit.Assert.*;
+
/**
* Test class for org.apache.sqoop.model.MEnumInput
*/
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/model/TestMForm.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestMForm.java b/common/src/test/java/org/apache/sqoop/model/TestMForm.java
index 0bd55d9..536b650 100644
--- a/common/src/test/java/org/apache/sqoop/model/TestMForm.java
+++ b/common/src/test/java/org/apache/sqoop/model/TestMForm.java
@@ -17,12 +17,13 @@
*/
package org.apache.sqoop.model;
-import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
+import static org.junit.Assert.*;
+
/**
* Test class for org.apache.sqoop.model.MForm
*/
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/model/TestMFormList.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestMFormList.java b/common/src/test/java/org/apache/sqoop/model/TestMFormList.java
index c7ee682..b8d3d37 100644
--- a/common/src/test/java/org/apache/sqoop/model/TestMFormList.java
+++ b/common/src/test/java/org/apache/sqoop/model/TestMFormList.java
@@ -23,7 +23,7 @@ import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
-import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertEquals;
/**
*
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/model/TestMIntegerInput.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestMIntegerInput.java b/common/src/test/java/org/apache/sqoop/model/TestMIntegerInput.java
index 1f38e6d..dd9227e 100644
--- a/common/src/test/java/org/apache/sqoop/model/TestMIntegerInput.java
+++ b/common/src/test/java/org/apache/sqoop/model/TestMIntegerInput.java
@@ -17,13 +17,13 @@
*/
package org.apache.sqoop.model;
+import org.junit.Test;
+
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 org.junit.Test;
-
/**
* Test class for org.apache.sqoop.model.MInputInput
*/
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/model/TestMJob.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestMJob.java b/common/src/test/java/org/apache/sqoop/model/TestMJob.java
index 96c316a..8f2943e 100644
--- a/common/src/test/java/org/apache/sqoop/model/TestMJob.java
+++ b/common/src/test/java/org/apache/sqoop/model/TestMJob.java
@@ -17,14 +17,14 @@
*/
package org.apache.sqoop.model;
-import static org.junit.Assert.*;
-
import java.util.ArrayList;
import java.util.List;
import org.apache.sqoop.common.Direction;
import org.junit.Test;
+import static org.junit.Assert.*;
+
/**
* Test class for org.apache.sqoop.model.MJob
*/
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/model/TestMJobForms.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestMJobForms.java b/common/src/test/java/org/apache/sqoop/model/TestMJobForms.java
index 81a8614..e59b282 100644
--- a/common/src/test/java/org/apache/sqoop/model/TestMJobForms.java
+++ b/common/src/test/java/org/apache/sqoop/model/TestMJobForms.java
@@ -17,13 +17,13 @@
*/
package org.apache.sqoop.model;
-import static org.junit.Assert.*;
-
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
+import static org.junit.Assert.*;
+
/**
* Test class for org.apache.sqoop.model.MJobForms
*/
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/model/TestMLink.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestMLink.java b/common/src/test/java/org/apache/sqoop/model/TestMLink.java
index 1be37a1..77fa2a9 100644
--- a/common/src/test/java/org/apache/sqoop/model/TestMLink.java
+++ b/common/src/test/java/org/apache/sqoop/model/TestMLink.java
@@ -17,13 +17,13 @@
*/
package org.apache.sqoop.model;
-import static org.junit.Assert.*;
-
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
+import static org.junit.Assert.*;
+
/**
* Test class for org.apache.sqoop.model.MConnection
*/
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/model/TestMMapInput.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestMMapInput.java b/common/src/test/java/org/apache/sqoop/model/TestMMapInput.java
index 120fb07..fbc08c7 100644
--- a/common/src/test/java/org/apache/sqoop/model/TestMMapInput.java
+++ b/common/src/test/java/org/apache/sqoop/model/TestMMapInput.java
@@ -17,17 +17,17 @@
*/
package org.apache.sqoop.model;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+
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 java.util.HashMap;
-import java.util.Map;
-
-import org.junit.Test;
-
/**
* Test class for org.apache.sqoop.model.MMapInput
*/
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/model/TestMNamedElement.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestMNamedElement.java b/common/src/test/java/org/apache/sqoop/model/TestMNamedElement.java
index f336bab..6610784 100644
--- a/common/src/test/java/org/apache/sqoop/model/TestMNamedElement.java
+++ b/common/src/test/java/org/apache/sqoop/model/TestMNamedElement.java
@@ -17,10 +17,10 @@
*/
package org.apache.sqoop.model;
-import static org.junit.Assert.*;
-
import org.junit.Test;
+import static org.junit.Assert.*;
+
/**
* Test class for org.apache.sqoop.model.MNamedElement
*/
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/model/TestMPersistableEntity.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestMPersistableEntity.java b/common/src/test/java/org/apache/sqoop/model/TestMPersistableEntity.java
index 000c6be..8e1e5bd 100644
--- a/common/src/test/java/org/apache/sqoop/model/TestMPersistableEntity.java
+++ b/common/src/test/java/org/apache/sqoop/model/TestMPersistableEntity.java
@@ -17,9 +17,10 @@
*/
package org.apache.sqoop.model;
-import static org.junit.Assert.*;
import org.junit.Test;
+import static org.junit.Assert.*;
+
public class TestMPersistableEntity {
@Test
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/model/TestMStringInput.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestMStringInput.java b/common/src/test/java/org/apache/sqoop/model/TestMStringInput.java
index 2fe0335..76e625e 100644
--- a/common/src/test/java/org/apache/sqoop/model/TestMStringInput.java
+++ b/common/src/test/java/org/apache/sqoop/model/TestMStringInput.java
@@ -17,10 +17,10 @@
*/
package org.apache.sqoop.model;
-import static org.junit.Assert.*;
-
import org.junit.Test;
+import static org.junit.Assert.*;
+
/**
* Test class for org.apache.sqoop.model.MStringInput
*/
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/model/TestMValidatedElement.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/model/TestMValidatedElement.java b/common/src/test/java/org/apache/sqoop/model/TestMValidatedElement.java
index cf34983..a75a7cd 100644
--- a/common/src/test/java/org/apache/sqoop/model/TestMValidatedElement.java
+++ b/common/src/test/java/org/apache/sqoop/model/TestMValidatedElement.java
@@ -17,12 +17,12 @@
*/
package org.apache.sqoop.model;
-import static org.junit.Assert.*;
-
import org.apache.sqoop.validation.Message;
import org.apache.sqoop.validation.Status;
import org.junit.Test;
+import static org.junit.Assert.*;
+
/**
* Test class for org.apache.sqoop.model.MValidatedElement
*/
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/submission/TestSubmissionStatus.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/submission/TestSubmissionStatus.java b/common/src/test/java/org/apache/sqoop/submission/TestSubmissionStatus.java
index 99f4767..948c0a6 100644
--- a/common/src/test/java/org/apache/sqoop/submission/TestSubmissionStatus.java
+++ b/common/src/test/java/org/apache/sqoop/submission/TestSubmissionStatus.java
@@ -17,19 +17,23 @@
*/
package org.apache.sqoop.submission;
+import org.junit.Test;
+
import java.util.Arrays;
import java.util.List;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
/**
* Test class for org.apache.sqoop.submission.SubmissionStatus
*/
-public class TestSubmissionStatus extends TestCase {
+public class TestSubmissionStatus {
/**
* unfinished() test
*/
+ @Test
public void testUnfinished() {
SubmissionStatus subStatus[] = SubmissionStatus.unfinished();
SubmissionStatus subStatusTest[] = new SubmissionStatus[] {
@@ -43,6 +47,7 @@ public class TestSubmissionStatus extends TestCase {
/**
* isRunning() test
*/
+ @Test
public void testIsRunning() {
assertTrue(SubmissionStatus.RUNNING.isRunning());
assertTrue(SubmissionStatus.BOOTING.isRunning());
@@ -54,6 +59,7 @@ public class TestSubmissionStatus extends TestCase {
/**
* isFailure() test
*/
+ @Test
public void testIsFailure() {
assertTrue(SubmissionStatus.FAILED.isFailure());
assertTrue(SubmissionStatus.UNKNOWN.isFailure());
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/submission/counter/TestCounterGroup.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/submission/counter/TestCounterGroup.java b/common/src/test/java/org/apache/sqoop/submission/counter/TestCounterGroup.java
index 985009a..ae7aaf0 100644
--- a/common/src/test/java/org/apache/sqoop/submission/counter/TestCounterGroup.java
+++ b/common/src/test/java/org/apache/sqoop/submission/counter/TestCounterGroup.java
@@ -17,7 +17,7 @@
*/
package org.apache.sqoop.submission.counter;
-import junit.framework.Assert;
+import org.junit.Assert;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/submission/counter/TestCounters.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/submission/counter/TestCounters.java b/common/src/test/java/org/apache/sqoop/submission/counter/TestCounters.java
index 8f8d617..90a35c3 100644
--- a/common/src/test/java/org/apache/sqoop/submission/counter/TestCounters.java
+++ b/common/src/test/java/org/apache/sqoop/submission/counter/TestCounters.java
@@ -19,7 +19,7 @@ package org.apache.sqoop.submission.counter;
import org.junit.Test;
-import junit.framework.Assert;
+import org.junit.Assert;
/**
* Test Class for org.apache.sqoop.submission.counter.TestCounters
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/utils/TestClassUtils.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/utils/TestClassUtils.java b/common/src/test/java/org/apache/sqoop/utils/TestClassUtils.java
index 16c2015..53ece87 100644
--- a/common/src/test/java/org/apache/sqoop/utils/TestClassUtils.java
+++ b/common/src/test/java/org/apache/sqoop/utils/TestClassUtils.java
@@ -24,7 +24,6 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-
/**
*
*/
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/validation/TestStatus.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/validation/TestStatus.java b/common/src/test/java/org/apache/sqoop/validation/TestStatus.java
index 5b17a4e..99d8076 100644
--- a/common/src/test/java/org/apache/sqoop/validation/TestStatus.java
+++ b/common/src/test/java/org/apache/sqoop/validation/TestStatus.java
@@ -19,7 +19,7 @@ package org.apache.sqoop.validation;
import org.junit.Test;
-import static junit.framework.Assert.*;
+import static org.junit.Assert.*;
/**
*
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/validation/TestValidation.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/validation/TestValidation.java b/common/src/test/java/org/apache/sqoop/validation/TestValidation.java
index bf0ade5..85e9e1c 100644
--- a/common/src/test/java/org/apache/sqoop/validation/TestValidation.java
+++ b/common/src/test/java/org/apache/sqoop/validation/TestValidation.java
@@ -20,20 +20,22 @@ package org.apache.sqoop.validation;
import java.util.HashMap;
import java.util.Map;
-import junit.framework.TestCase;
-
import org.apache.sqoop.common.SqoopException;
import org.apache.sqoop.validation.Validation.FormInput;
import org.apache.sqoop.validation.Validation.Message;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
/**
* Test class for org.apache.sqoop.validation.Validation
*/
-public class TestValidation extends TestCase {
+public class TestValidation {
/**
* Initialization test
*/
+ @Test
public void testInitialization() {
/* Check initialization with class */
Validation validation = new Validation(Class.class);
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/validation/validators/TestContains.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/validation/validators/TestContains.java b/common/src/test/java/org/apache/sqoop/validation/validators/TestContains.java
index b5dce62..e63a69a 100644
--- a/common/src/test/java/org/apache/sqoop/validation/validators/TestContains.java
+++ b/common/src/test/java/org/apache/sqoop/validation/validators/TestContains.java
@@ -20,7 +20,7 @@ package org.apache.sqoop.validation.validators;
import org.apache.sqoop.validation.Status;
import org.junit.Test;
-import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertEquals;
/**
*/
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/validation/validators/TestNullOrContains.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/validation/validators/TestNullOrContains.java b/common/src/test/java/org/apache/sqoop/validation/validators/TestNullOrContains.java
index 4bd1559..88347eb 100644
--- a/common/src/test/java/org/apache/sqoop/validation/validators/TestNullOrContains.java
+++ b/common/src/test/java/org/apache/sqoop/validation/validators/TestNullOrContains.java
@@ -20,7 +20,7 @@ package org.apache.sqoop.validation.validators;
import org.apache.sqoop.validation.Status;
import org.junit.Test;
-import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertEquals;
/**
*/
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/common/src/test/java/org/apache/sqoop/validation/validators/TestStartsWith.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/sqoop/validation/validators/TestStartsWith.java b/common/src/test/java/org/apache/sqoop/validation/validators/TestStartsWith.java
index 92409d9..8c4f9e0 100644
--- a/common/src/test/java/org/apache/sqoop/validation/validators/TestStartsWith.java
+++ b/common/src/test/java/org/apache/sqoop/validation/validators/TestStartsWith.java
@@ -20,7 +20,7 @@ package org.apache.sqoop.validation.validators;
import org.apache.sqoop.validation.Status;
import org.junit.Test;
-import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertEquals;
/**
*/
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/GenericJdbcExecutorTest.java
----------------------------------------------------------------------
diff --git a/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/GenericJdbcExecutorTest.java b/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/GenericJdbcExecutorTest.java
index e10a5b4..1022370 100644
--- a/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/GenericJdbcExecutorTest.java
+++ b/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/GenericJdbcExecutorTest.java
@@ -17,9 +17,12 @@
*/
package org.apache.sqoop.connector.jdbc;
-import junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Test;
-public class GenericJdbcExecutorTest extends TestCase {
+import static org.junit.Assert.assertEquals;
+
+public class GenericJdbcExecutorTest {
private final String table;
private final String emptyTable;
private final GenericJdbcExecutor executor;
@@ -34,7 +37,7 @@ public class GenericJdbcExecutorTest extends TestCase {
GenericJdbcTestConstants.URL, null, null);
}
- @Override
+ @Before
public void setUp() {
if(executor.existTable(emptyTable)) {
executor.executeUpdate("DROP TABLE " + emptyTable);
@@ -56,6 +59,7 @@ public class GenericJdbcExecutorTest extends TestCase {
}
}
+ @Test
@SuppressWarnings("unchecked")
public void testDeleteTableData() throws Exception {
executor.deleteTableData(table);
@@ -63,6 +67,7 @@ public class GenericJdbcExecutorTest extends TestCase {
0, executor.getTableRowCount(table));
}
+ @Test
@SuppressWarnings("unchecked")
public void testMigrateData() throws Exception {
assertEquals("Table " + emptyTable + " is expected to be empty.",
@@ -80,6 +85,7 @@ public class GenericJdbcExecutorTest extends TestCase {
executor.getTableRowCount(emptyTable));
}
+ @Test
@SuppressWarnings("unchecked")
public void testGetTableRowCount() throws Exception {
assertEquals("Table " + table + " is expected to be empty.",
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestExtractor.java
----------------------------------------------------------------------
diff --git a/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestExtractor.java b/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestExtractor.java
index 5f091de..fbdf9c6 100644
--- a/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestExtractor.java
+++ b/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestExtractor.java
@@ -17,8 +17,6 @@
*/
package org.apache.sqoop.connector.jdbc;
-import junit.framework.TestCase;
-
import org.apache.sqoop.common.MutableContext;
import org.apache.sqoop.common.MutableMapContext;
import org.apache.sqoop.connector.jdbc.configuration.LinkConfiguration;
@@ -26,8 +24,14 @@ import org.apache.sqoop.connector.jdbc.configuration.FromJobConfiguration;
import org.apache.sqoop.job.etl.Extractor;
import org.apache.sqoop.job.etl.ExtractorContext;
import org.apache.sqoop.etl.io.DataWriter;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
-public class TestExtractor extends TestCase {
+public class TestExtractor {
private final String tableName;
@@ -36,11 +40,13 @@ public class TestExtractor extends TestCase {
private static final int START = -50;
private static final int NUMBER_OF_ROWS = 101;
+ private static final double EPSILON = 0.01;
+
public TestExtractor() {
tableName = getClass().getSimpleName().toUpperCase();
}
- @Override
+ @Before
public void setUp() {
executor = new GenericJdbcExecutor(GenericJdbcTestConstants.DRIVER,
GenericJdbcTestConstants.URL, null, null);
@@ -59,11 +65,12 @@ public class TestExtractor extends TestCase {
}
}
- @Override
+ @After
public void tearDown() {
executor.close();
}
+ @Test
public void testQuery() throws Exception {
MutableContext context = new MutableMapContext();
@@ -96,6 +103,7 @@ public class TestExtractor extends TestCase {
extractor.extract(extractorContext, connectionConfig, jobConfig, partition);
}
+ @Test
public void testSubquery() throws Exception {
MutableContext context = new MutableMapContext();
@@ -139,7 +147,7 @@ public class TestExtractor extends TestCase {
if (array[i] instanceof Integer) {
assertEquals(indx, ((Integer)array[i]).intValue());
} else if (array[i] instanceof Double) {
- assertEquals((double)indx, ((Double)array[i]).doubleValue());
+ assertEquals((double)indx, ((Double)array[i]).doubleValue(), EPSILON);
} else {
assertEquals(String.valueOf(indx), array[i].toString());
}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestFromInitializer.java
----------------------------------------------------------------------
diff --git a/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestFromInitializer.java b/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestFromInitializer.java
index bf66bb1..54e6acf 100644
--- a/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestFromInitializer.java
+++ b/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestFromInitializer.java
@@ -19,8 +19,6 @@ package org.apache.sqoop.connector.jdbc;
import java.sql.Types;
-import junit.framework.TestCase;
-
import org.apache.sqoop.common.MutableContext;
import org.apache.sqoop.common.MutableMapContext;
import org.apache.sqoop.connector.jdbc.configuration.LinkConfiguration;
@@ -32,8 +30,13 @@ import org.apache.sqoop.schema.Schema;
import org.apache.sqoop.schema.type.FixedPoint;
import org.apache.sqoop.schema.type.FloatingPoint;
import org.apache.sqoop.schema.type.Text;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
-public class TestFromInitializer extends TestCase {
+public class TestFromInitializer {
private final String schemaName;
private final String tableName;
@@ -56,7 +59,7 @@ public class TestFromInitializer extends TestCase {
tableColumns = "ICOL,VCOL";
}
- @Override
+ @Before
public void setUp() {
executor = new GenericJdbcExecutor(GenericJdbcTestConstants.DRIVER,
GenericJdbcTestConstants.URL, null, null);
@@ -105,11 +108,12 @@ public class TestFromInitializer extends TestCase {
;
}
- @Override
+ @After
public void tearDown() {
executor.close();
}
+ @Test
@SuppressWarnings("unchecked")
public void testTableName() throws Exception {
LinkConfiguration connConf = new LinkConfiguration();
@@ -136,6 +140,7 @@ public class TestFromInitializer extends TestCase {
String.valueOf(START+NUMBER_OF_ROWS-1));
}
+ @Test
@SuppressWarnings("unchecked")
public void testTableNameWithTableColumns() throws Exception {
LinkConfiguration connConf = new LinkConfiguration();
@@ -163,6 +168,7 @@ public class TestFromInitializer extends TestCase {
String.valueOf(START+NUMBER_OF_ROWS-1));
}
+ @Test
@SuppressWarnings("unchecked")
public void testTableSql() throws Exception {
LinkConfiguration connConf = new LinkConfiguration();
@@ -190,6 +196,7 @@ public class TestFromInitializer extends TestCase {
String.valueOf((double)(START+NUMBER_OF_ROWS-1)));
}
+ @Test
@SuppressWarnings("unchecked")
public void testTableSqlWithTableColumns() throws Exception {
LinkConfiguration connConf = new LinkConfiguration();
@@ -219,6 +226,7 @@ public class TestFromInitializer extends TestCase {
String.valueOf((double)(START+NUMBER_OF_ROWS-1)));
}
+ @Test
@SuppressWarnings("unchecked")
public void testTableNameWithSchema() throws Exception {
LinkConfiguration connConf = new LinkConfiguration();
@@ -248,6 +256,7 @@ public class TestFromInitializer extends TestCase {
String.valueOf(START+NUMBER_OF_ROWS-1));
}
+ @Test
@SuppressWarnings("unchecked")
public void testTableNameWithTableColumnsWithSchema() throws Exception {
LinkConfiguration connConf = new LinkConfiguration();
@@ -278,6 +287,7 @@ public class TestFromInitializer extends TestCase {
String.valueOf(START+NUMBER_OF_ROWS-1));
}
+ @Test
@SuppressWarnings("unchecked")
public void testTableSqlWithSchema() throws Exception {
LinkConfiguration connConf = new LinkConfiguration();
@@ -308,7 +318,7 @@ public class TestFromInitializer extends TestCase {
String.valueOf((double)(START+NUMBER_OF_ROWS-1)));
}
-
+ @Test
@SuppressWarnings("unchecked")
public void testGetSchemaForTable() throws Exception {
LinkConfiguration connConf = new LinkConfiguration();
@@ -330,6 +340,7 @@ public class TestFromInitializer extends TestCase {
assertEquals(getSchema(jobConf.fromJobConfig.schemaName + "." + tableName), schema);
}
+ @Test
@SuppressWarnings("unchecked")
public void testGetSchemaForSql() throws Exception {
LinkConfiguration connConf = new LinkConfiguration();
@@ -351,6 +362,7 @@ public class TestFromInitializer extends TestCase {
assertEquals(getSchema("Query"), schema);
}
+ @Test
@SuppressWarnings("unchecked")
public void testTableSqlWithTableColumnsWithSchema() throws Exception {
LinkConfiguration connConf = new LinkConfiguration();
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestLoader.java
----------------------------------------------------------------------
diff --git a/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestLoader.java b/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestLoader.java
index c349676..144b92a 100644
--- a/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestLoader.java
+++ b/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestLoader.java
@@ -17,9 +17,6 @@
*/
package org.apache.sqoop.connector.jdbc;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
import java.sql.ResultSet;
import java.util.Arrays;
import java.util.Collection;
@@ -38,6 +35,9 @@ import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
@RunWith(Parameterized.class)
public class TestLoader {
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestPartitioner.java
----------------------------------------------------------------------
diff --git a/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestPartitioner.java b/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestPartitioner.java
index 949877b..ec75e1e 100644
--- a/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestPartitioner.java
+++ b/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestPartitioner.java
@@ -25,8 +25,6 @@ import java.sql.Types;
import java.util.Iterator;
import java.util.List;
-import junit.framework.TestCase;
-
import org.apache.sqoop.common.MutableContext;
import org.apache.sqoop.common.MutableMapContext;
import org.apache.sqoop.connector.jdbc.configuration.LinkConfiguration;
@@ -34,12 +32,17 @@ import org.apache.sqoop.connector.jdbc.configuration.FromJobConfiguration;
import org.apache.sqoop.job.etl.Partition;
import org.apache.sqoop.job.etl.Partitioner;
import org.apache.sqoop.job.etl.PartitionerContext;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
-public class TestPartitioner extends TestCase {
+public class TestPartitioner {
private static final int START = -5;
private static final int NUMBER_OF_ROWS = 11;
+ @Test
public void testIntegerEvenPartition() throws Exception {
MutableContext context = new MutableMapContext();
context.setString(
@@ -71,6 +74,7 @@ public class TestPartitioner extends TestCase {
});
}
+ @Test
public void testIntegerUnevenPartition() throws Exception {
MutableContext context = new MutableMapContext();
context.setString(
@@ -100,6 +104,7 @@ public class TestPartitioner extends TestCase {
});
}
+ @Test
public void testIntegerOverPartition() throws Exception {
MutableContext context = new MutableMapContext();
context.setString(
@@ -136,6 +141,7 @@ public class TestPartitioner extends TestCase {
});
}
+ @Test
public void testFloatingPointEvenPartition() throws Exception {
MutableContext context = new MutableMapContext();
context.setString(
@@ -167,6 +173,7 @@ public class TestPartitioner extends TestCase {
});
}
+ @Test
public void testFloatingPointUnevenPartition() throws Exception {
MutableContext context = new MutableMapContext();
context.setString(
@@ -196,6 +203,7 @@ public class TestPartitioner extends TestCase {
});
}
+ @Test
public void testNumericEvenPartition() throws Exception {
MutableContext context = new MutableMapContext();
context.setString(GenericJdbcConnectorConstants.CONNECTOR_JDBC_PARTITION_COLUMNNAME, "ICOL");
@@ -219,6 +227,7 @@ public class TestPartitioner extends TestCase {
});
}
+ @Test
public void testNumericUnevenPartition() throws Exception {
MutableContext context = new MutableMapContext();
context.setString(GenericJdbcConnectorConstants.CONNECTOR_JDBC_PARTITION_COLUMNNAME, "DCOL");
@@ -240,6 +249,7 @@ public class TestPartitioner extends TestCase {
});
}
+ @Test
public void testNumericSinglePartition() throws Exception {
MutableContext context = new MutableMapContext();
context.setString(GenericJdbcConnectorConstants.CONNECTOR_JDBC_PARTITION_COLUMNNAME, "DCOL");
@@ -259,7 +269,7 @@ public class TestPartitioner extends TestCase {
});
}
-
+ @Test
public void testDatePartition() throws Exception {
MutableContext context = new MutableMapContext();
context.setString(GenericJdbcConnectorConstants.CONNECTOR_JDBC_PARTITION_COLUMNNAME, "DCOL");
@@ -288,6 +298,7 @@ public class TestPartitioner extends TestCase {
}
+ @Test
public void testTimePartition() throws Exception {
MutableContext context = new MutableMapContext();
context.setString(GenericJdbcConnectorConstants
@@ -314,6 +325,7 @@ public class TestPartitioner extends TestCase {
});
}
+ @Test
public void testTimestampPartition() throws Exception {
MutableContext context = new MutableMapContext();
context.setString(GenericJdbcConnectorConstants
@@ -338,6 +350,7 @@ public class TestPartitioner extends TestCase {
});
}
+ @Test
public void testBooleanPartition() throws Exception {
MutableContext context = new MutableMapContext();
context.setString(GenericJdbcConnectorConstants
@@ -361,6 +374,7 @@ public class TestPartitioner extends TestCase {
});
}
+ @Test
public void testVarcharPartition() throws Exception {
MutableContext context = new MutableMapContext();
context.setString(GenericJdbcConnectorConstants
@@ -408,6 +422,7 @@ public class TestPartitioner extends TestCase {
});
}
+ @Test
public void testVarcharPartition2() throws Exception {
MutableContext context = new MutableMapContext();
context.setString(GenericJdbcConnectorConstants
@@ -431,6 +446,7 @@ public class TestPartitioner extends TestCase {
assertTrue(partitions.get(4).toString().contains("Warty Warthog"));
}
+ @Test
public void testVarcharPartitionWithCommonPrefix() throws Exception {
MutableContext context = new MutableMapContext();
context.setString(GenericJdbcConnectorConstants
@@ -460,6 +476,7 @@ public class TestPartitioner extends TestCase {
}
+ @Test
public void testPatitionWithNullValues() throws Exception {
MutableContext context = new MutableMapContext();
context.setString(GenericJdbcConnectorConstants
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestToInitializer.java
----------------------------------------------------------------------
diff --git a/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestToInitializer.java b/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestToInitializer.java
index 00c2aab..a87ce7a 100644
--- a/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestToInitializer.java
+++ b/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestToInitializer.java
@@ -17,7 +17,6 @@
*/
package org.apache.sqoop.connector.jdbc;
-import junit.framework.TestCase;
import org.apache.sqoop.common.MutableContext;
import org.apache.sqoop.common.MutableMapContext;
import org.apache.sqoop.common.SqoopException;
@@ -28,8 +27,15 @@ import org.apache.sqoop.job.etl.InitializerContext;
import org.apache.sqoop.validation.Status;
import org.apache.sqoop.validation.ValidationResult;
import org.apache.sqoop.validation.ValidationRunner;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
-public class TestToInitializer extends TestCase {
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+public class TestToInitializer {
private final String schemaName;
private final String tableName;
private final String schemalessTableName;
@@ -51,7 +57,7 @@ public class TestToInitializer extends TestCase {
tableColumns = "ICOL,VCOL";
}
- @Override
+ @Before
public void setUp() {
executor = new GenericJdbcExecutor(GenericJdbcTestConstants.DRIVER,
GenericJdbcTestConstants.URL, null, null);
@@ -68,11 +74,12 @@ public class TestToInitializer extends TestCase {
}
}
- @Override
+ @After
public void tearDown() {
executor.close();
}
+ @Test
@SuppressWarnings("unchecked")
public void testTableName() throws Exception {
LinkConfiguration connConf = new LinkConfiguration();
@@ -94,6 +101,7 @@ public class TestToInitializer extends TestCase {
verifyResult(context, "INSERT INTO " + fullTableName + " VALUES (?,?,?)");
}
+ @Test
@SuppressWarnings("unchecked")
public void testTableNameWithTableColumns() throws Exception {
LinkConfiguration connConf = new LinkConfiguration();
@@ -116,6 +124,7 @@ public class TestToInitializer extends TestCase {
verifyResult(context, "INSERT INTO " + fullTableName + " (" + tableColumns + ") VALUES (?,?)");
}
+ @Test
@SuppressWarnings("unchecked")
public void testTableSql() throws Exception {
LinkConfiguration connConf = new LinkConfiguration();
@@ -135,6 +144,7 @@ public class TestToInitializer extends TestCase {
verifyResult(context, "INSERT INTO " + executor.delimitIdentifier(schemalessTableName) + " VALUES (?,?,?)");
}
+ @Test
@SuppressWarnings("unchecked")
public void testTableNameWithSchema() throws Exception {
LinkConfiguration connConf = new LinkConfiguration();
@@ -157,6 +167,7 @@ public class TestToInitializer extends TestCase {
verifyResult(context, "INSERT INTO " + fullTableName + " VALUES (?,?,?)");
}
+ @Test
@SuppressWarnings("unchecked")
public void testTableNameWithTableColumnsWithSchema() throws Exception {
LinkConfiguration connConf = new LinkConfiguration();
@@ -180,6 +191,7 @@ public class TestToInitializer extends TestCase {
verifyResult(context, "INSERT INTO " + fullTableName + " (" + tableColumns + ") VALUES (?,?)");
}
+ @Test
@SuppressWarnings("unchecked")
public void testTableSqlWithSchema() throws Exception {
LinkConfiguration connConf = new LinkConfiguration();
@@ -215,6 +227,7 @@ public class TestToInitializer extends TestCase {
"(ICOL INTEGER PRIMARY KEY, DCOL DOUBLE, VCOL VARCHAR(20))");
}
+ @Test
public void testNonExistingStageTable() throws Exception {
LinkConfiguration connConf = new LinkConfiguration();
ToJobConfiguration jobConf = new ToJobConfiguration();
@@ -237,6 +250,7 @@ public class TestToInitializer extends TestCase {
}
}
+ @Test
@SuppressWarnings("unchecked")
public void testNonEmptyStageTable() throws Exception {
LinkConfiguration connConf = new LinkConfiguration();
@@ -264,6 +278,7 @@ public class TestToInitializer extends TestCase {
}
}
+ @Test
public void testClearStageTableValidation() throws Exception {
LinkConfiguration connConf = new LinkConfiguration();
ToJobConfiguration jobConf = new ToJobConfiguration();
@@ -293,6 +308,7 @@ public class TestToInitializer extends TestCase {
"toJobConfig"));
}
+ @Test
public void testStageTableWithoutTable() throws Exception {
LinkConfiguration connConf = new LinkConfiguration();
ToJobConfiguration jobConf = new ToJobConfiguration();
@@ -311,6 +327,7 @@ public class TestToInitializer extends TestCase {
"toJobConfig"));
}
+ @Test
@SuppressWarnings("unchecked")
public void testClearStageTable() throws Exception {
LinkConfiguration connConf = new LinkConfiguration();
@@ -336,6 +353,7 @@ public class TestToInitializer extends TestCase {
executor.getTableRowCount(stageTableName));
}
+ @Test
@SuppressWarnings("unchecked")
public void testStageTable() throws Exception {
LinkConfiguration connConf = new LinkConfiguration();
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/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 80f45e5..aa3af89 100644
--- a/core/src/test/java/org/apache/sqoop/driver/TestJobManager.java
+++ b/core/src/test/java/org/apache/sqoop/driver/TestJobManager.java
@@ -17,13 +17,6 @@
*/
package org.apache.sqoop.driver;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
import java.util.Arrays;
import java.util.List;
@@ -41,6 +34,13 @@ import org.apache.sqoop.request.HttpEventContext;
import org.junit.Before;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
public class TestJobManager {
private JobManager jobManager;
private SqoopConnector sqoopConnectorMock;
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/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 768c978..9eff8a4 100644
--- a/core/src/test/java/org/apache/sqoop/driver/TestJobRequest.java
+++ b/core/src/test/java/org/apache/sqoop/driver/TestJobRequest.java
@@ -17,9 +17,6 @@
*/
package org.apache.sqoop.driver;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
import java.util.Arrays;
import org.apache.sqoop.driver.JobRequest;
@@ -27,6 +24,9 @@ import org.apache.sqoop.utils.ClassUtils;
import org.junit.Before;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
/**
*
*/
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/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 796b021..19b0023 100644
--- a/core/src/test/java/org/apache/sqoop/repository/TestJdbcRepository.java
+++ b/core/src/test/java/org/apache/sqoop/repository/TestJdbcRepository.java
@@ -17,23 +17,6 @@
*/
package org.apache.sqoop.repository;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyLong;
-import static org.mockito.Matchers.anyObject;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.inOrder;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-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 java.sql.Connection;
import java.util.ArrayList;
import java.util.Collections;
@@ -63,6 +46,23 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.InOrder;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyLong;
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.inOrder;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+import static org.mockito.Mockito.when;
+
public class TestJdbcRepository {
private JdbcRepository repoSpy;
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/execution/mapreduce/src/test/java/org/apache/sqoop/job/JobUtils.java
----------------------------------------------------------------------
diff --git a/execution/mapreduce/src/test/java/org/apache/sqoop/job/JobUtils.java b/execution/mapreduce/src/test/java/org/apache/sqoop/job/JobUtils.java
index 09e5ec5..b5435ff 100644
--- a/execution/mapreduce/src/test/java/org/apache/sqoop/job/JobUtils.java
+++ b/execution/mapreduce/src/test/java/org/apache/sqoop/job/JobUtils.java
@@ -19,7 +19,7 @@ package org.apache.sqoop.job;
import java.io.IOException;
-import junit.framework.Assert;
+import org.junit.Assert;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.NullWritable;
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/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 869c727..5662120 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
@@ -23,9 +23,6 @@ import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.InputSplit;
@@ -57,13 +54,17 @@ import org.apache.sqoop.schema.Schema;
import org.apache.sqoop.schema.type.FixedPoint;
import org.apache.sqoop.schema.type.FloatingPoint;
import org.apache.sqoop.schema.type.Text;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
-public class TestMapReduce extends TestCase {
+public class TestMapReduce {
private static final int START_PARTITION = 1;
private static final int NUMBER_OF_PARTITIONS = 9;
private static final int NUMBER_OF_ROWS_PER_PARTITION = 10;
+ @Test
public void testInputFormat() throws Exception {
Configuration conf = new Configuration();
conf.set(JobConstants.JOB_ETL_PARTITIONER, DummyPartitioner.class.getName());
@@ -82,6 +83,7 @@ public class TestMapReduce extends TestCase {
}
}
+ @Test
public void testMapper() throws Exception {
Configuration conf = new Configuration();
conf.set(JobConstants.JOB_ETL_PARTITIONER, DummyPartitioner.class.getName());
@@ -98,6 +100,7 @@ public class TestMapReduce extends TestCase {
DummyOutputFormat.class);
}
+ @Test
public void testOutputFormat() throws Exception {
Configuration conf = new Configuration();
conf.set(JobConstants.JOB_ETL_PARTITIONER, DummyPartitioner.class.getName());
@@ -117,8 +120,8 @@ public class TestMapReduce extends TestCase {
SqoopNullOutputFormat.class);
// Make sure both destroyers get called.
- Assert.assertEquals(1, DummyFromDestroyer.count);
- Assert.assertEquals(1, DummyToDestroyer.count);
+ assertEquals(1, DummyFromDestroyer.count);
+ assertEquals(1, DummyToDestroyer.count);
}
public static class DummyPartition extends Partition {
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/execution/mapreduce/src/test/java/org/apache/sqoop/job/io/SqoopWritableTest.java
----------------------------------------------------------------------
diff --git a/execution/mapreduce/src/test/java/org/apache/sqoop/job/io/SqoopWritableTest.java b/execution/mapreduce/src/test/java/org/apache/sqoop/job/io/SqoopWritableTest.java
index b78b140..f5742a2 100644
--- a/execution/mapreduce/src/test/java/org/apache/sqoop/job/io/SqoopWritableTest.java
+++ b/execution/mapreduce/src/test/java/org/apache/sqoop/job/io/SqoopWritableTest.java
@@ -19,8 +19,6 @@
package org.apache.sqoop.job.io;
import com.google.common.base.Charsets;
-import junit.framework.Assert;
-import junit.framework.TestCase;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -34,17 +32,21 @@ import java.io.InputStream;
import org.apache.hadoop.conf.Configuration;
import org.apache.sqoop.connector.idf.CSVIntermediateDataFormat;
import org.apache.sqoop.job.JobConstants;
+import org.junit.Assert;
+import org.junit.Test;
-public class SqoopWritableTest extends TestCase {
+public class SqoopWritableTest {
private final SqoopWritable writable = new SqoopWritable();
+ @Test
public void testStringInStringOut() {
String testData = "Live Long and prosper";
writable.setString(testData);
Assert.assertEquals(testData,writable.getString());
}
+ @Test
public void testDataWritten() throws IOException {
String testData = "One ring to rule them all";
byte[] testDataBytes = testData.getBytes(Charsets.UTF_8);
@@ -59,6 +61,7 @@ public class SqoopWritableTest extends TestCase {
Assert.assertEquals(testData, readData);
}
+ @Test
public void testDataRead() throws IOException {
String testData = "Brandywine Bridge - 20 miles!";
ByteArrayOutputStream ostream = new ByteArrayOutputStream();
@@ -70,6 +73,7 @@ public class SqoopWritableTest extends TestCase {
Assert.assertEquals(testData, writable.getString());
}
+ @Test
public void testWriteReadUsingStream() throws IOException {
String testData = "You shall not pass";
ByteArrayOutputStream ostream = new ByteArrayOutputStream();
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/execution/mapreduce/src/test/java/org/apache/sqoop/job/io/TestData.java
----------------------------------------------------------------------
diff --git a/execution/mapreduce/src/test/java/org/apache/sqoop/job/io/TestData.java b/execution/mapreduce/src/test/java/org/apache/sqoop/job/io/TestData.java
index 91df426..4e23bcb 100644
--- a/execution/mapreduce/src/test/java/org/apache/sqoop/job/io/TestData.java
+++ b/execution/mapreduce/src/test/java/org/apache/sqoop/job/io/TestData.java
@@ -19,11 +19,10 @@ package org.apache.sqoop.job.io;
import java.util.Arrays;
-import junit.framework.TestCase;
-
+import org.junit.Assert;
import org.junit.Test;
-public class TestData extends TestCase {
+public class TestData {
private static final double TEST_NUMBER = Math.PI + 100;
@Test
@@ -108,10 +107,10 @@ public class TestData extends TestCase {
public static void assertEquals(Object expected, Object actual) {
if (expected instanceof byte[]) {
- assertEquals(Arrays.toString((byte[])expected),
+ Assert.assertEquals(Arrays.toString((byte[])expected),
Arrays.toString((byte[])actual));
} else {
- TestCase.assertEquals(expected, actual);
+ Assert.assertEquals(expected, actual);
}
}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/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 c2ebd7e..1f411d2 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
@@ -18,7 +18,6 @@
*/
package org.apache.sqoop.job.mr;
-import junit.framework.Assert;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.RecordWriter;
@@ -29,6 +28,7 @@ import org.apache.sqoop.job.JobConstants;
import org.apache.sqoop.job.etl.Loader;
import org.apache.sqoop.job.etl.LoaderContext;
import org.apache.sqoop.job.io.SqoopWritable;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/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 998f5b7..4b95687 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
@@ -17,8 +17,6 @@
*/
package org.apache.sqoop.repository.derby;
-import junit.framework.TestCase;
-
import org.apache.sqoop.common.Direction;
import org.apache.sqoop.driver.Driver;
import org.apache.sqoop.model.MLink;
@@ -31,6 +29,8 @@ import org.apache.sqoop.model.MJob;
import org.apache.sqoop.model.MJobForms;
import org.apache.sqoop.model.MMapInput;
import org.apache.sqoop.model.MStringInput;
+import org.junit.After;
+import org.junit.Before;
import java.sql.Connection;
import java.sql.DriverManager;
@@ -43,11 +43,12 @@ import java.util.LinkedList;
import java.util.List;
import static org.apache.sqoop.repository.derby.DerbySchemaQuery.*;
+import static org.junit.Assert.assertEquals;
/**
* Abstract class with convenience methods for testing derby repository.
*/
-abstract public class DerbyTestCase extends TestCase {
+abstract public class DerbyTestCase {
private static int LATEST_SYSTEM_VERSION = 4;
@@ -59,16 +60,14 @@ abstract public class DerbyTestCase extends TestCase {
private Connection connection;
- @Override
+ @Before
public void setUp() throws Exception {
- super.setUp();
-
// Create link to the database
Class.forName(DERBY_DRIVER).newInstance();
connection = DriverManager.getConnection(getStartJdbcUrl());
}
- @Override
+ @After
public void tearDown() throws Exception {
// Close active link
if(connection != null) {
@@ -81,9 +80,6 @@ abstract public class DerbyTestCase extends TestCase {
} catch (SQLException ex) {
// Dropping Derby database leads always to exception
}
-
- // Call parent tear down
- super.tearDown();
}
/**
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/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 8a5823d..15306c2 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,9 +18,15 @@
package org.apache.sqoop.repository.derby;
import org.apache.sqoop.model.MConnector;
+import org.junit.Before;
+import org.junit.Test;
import java.util.List;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
/**
* Test connector methods on Derby repository.
*/
@@ -28,7 +34,7 @@ public class TestConnectorHandling extends DerbyTestCase {
DerbyRepositoryHandler handler;
- @Override
+ @Before
public void setUp() throws Exception {
super.setUp();
@@ -38,6 +44,7 @@ public class TestConnectorHandling extends DerbyTestCase {
createSchema();
}
+ @Test
public void testFindConnector() throws Exception {
// On empty repository, no connectors should be there
assertNull(handler.findConnector("A", getDerbyDatabaseConnection()));
@@ -57,6 +64,7 @@ public class TestConnectorHandling extends DerbyTestCase {
assertEquals(original, connector);
}
+ @Test
public void testFindAllConnectors() throws Exception {
// No connectors in an empty repository, we expect an empty list
assertEquals(handler.findConnectors(getDerbyDatabaseConnection()).size(),0);
@@ -74,6 +82,7 @@ public class TestConnectorHandling extends DerbyTestCase {
}
+ @Test
public void testRegisterConnector() throws Exception {
MConnector connector = getConnector();
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestDriverConfigHandling.java
----------------------------------------------------------------------
diff --git a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestDriverConfigHandling.java b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestDriverConfigHandling.java
index 567dda6..9b18bd3 100644
--- a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestDriverConfigHandling.java
+++ b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestDriverConfigHandling.java
@@ -19,11 +19,17 @@ package org.apache.sqoop.repository.derby;
import org.apache.sqoop.driver.Driver;
import org.apache.sqoop.model.MDriverConfig;
+import org.junit.Before;
+import org.junit.Test;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
/**
* Test driver config methods on Derby repository.
*/
@@ -31,7 +37,7 @@ public class TestDriverConfigHandling extends DerbyTestCase {
DerbyRepositoryHandler handler;
- @Override
+ @Before
public void setUp() throws Exception {
super.setUp();
@@ -41,6 +47,7 @@ public class TestDriverConfigHandling extends DerbyTestCase {
createSchema();
}
+ @Test
public void testFindDriverConfig() throws Exception {
// On empty repository, no driverConfig should be there
assertNull(handler.findDriverConfig(getDerbyDatabaseConnection()));
@@ -57,6 +64,7 @@ public class TestDriverConfigHandling extends DerbyTestCase {
assertEquals(originalDriverConfig, driverConfig);
}
+ @Test
public void testRegisterConnector() throws Exception {
MDriverConfig driverConfig = getDriverConfig();
handler.registerDriverConfig(driverConfig, getDerbyDatabaseConnection());
@@ -106,6 +114,7 @@ public class TestDriverConfigHandling extends DerbyTestCase {
}
}
+ @Test
public void testDriverVersion() throws Exception {
handler.registerDriverConfig(getDriverConfig(), getDerbyDatabaseConnection());
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/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 c4a5829..d744693 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
@@ -29,12 +29,18 @@ import org.apache.sqoop.model.MIntegerInput;
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 java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+
/**
* Test proper support of all available model types.
*/
@@ -42,7 +48,7 @@ public class TestInputTypes extends DerbyTestCase {
DerbyRepositoryHandler handler;
- @Override
+ @Before
public void setUp() throws Exception {
super.setUp();
@@ -56,6 +62,7 @@ public class TestInputTypes extends DerbyTestCase {
* Ensure that metadata with all various data types can be successfully
* serialized into repository and retrieved back.
*/
+ @Test
public void testEntitySerialization() throws Exception {
MConnector connector = getConnector();
@@ -76,6 +83,7 @@ public class TestInputTypes extends DerbyTestCase {
/**
* Test that serializing actual data is not an issue.
*/
+ @Test
public void testEntityDataSerialization() throws Exception {
MConnector connector = getConnector();
MDriverConfig driverConfig = getDriverConfig();
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestInternals.java
----------------------------------------------------------------------
diff --git a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestInternals.java b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestInternals.java
index 37aa8d4..1292168 100644
--- a/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestInternals.java
+++ b/repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestInternals.java
@@ -17,8 +17,14 @@
*/
package org.apache.sqoop.repository.derby;
+import org.junit.Before;
+import org.junit.Test;
+
import java.sql.Connection;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
/**
*
*/
@@ -26,25 +32,28 @@ public class TestInternals extends DerbyTestCase {
DerbyRepositoryHandler handler;
- @Override
+ @Before
public void setUp() throws Exception {
super.setUp();
handler = new TestDerbyRepositoryHandler();
}
+ @Test
public void testSuitableInternals() throws Exception {
assertFalse(handler.haveSuitableInternals(getDerbyDatabaseConnection()));
createSchema(); // Test code is building the structures
assertTrue(handler.haveSuitableInternals(getDerbyDatabaseConnection()));
}
+ @Test
public void testCreateorUpdateInternals() throws Exception {
assertFalse(handler.haveSuitableInternals(getDerbyDatabaseConnection()));
handler.createOrUpdateInternals(getDerbyDatabaseConnection());
assertTrue(handler.haveSuitableInternals(getDerbyDatabaseConnection()));
}
+ @Test
public void testUpgradeVersion2ToVersion4() throws Exception {
createSchema(2);
assertFalse(handler.haveSuitableInternals(getDerbyDatabaseConnection()));
http://git-wip-us.apache.org/repos/asf/sqoop/blob/97da12aa/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 f22c351..47350ea 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
@@ -23,11 +23,15 @@ import org.apache.sqoop.model.MForm;
import org.apache.sqoop.model.MJob;
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 job methods on Derby repository.
*/
@@ -35,7 +39,7 @@ public class TestJobHandling extends DerbyTestCase {
DerbyRepositoryHandler handler;
- @Override
+ @Before
public void setUp() throws Exception {
super.setUp();
@@ -51,6 +55,7 @@ public class TestJobHandling extends DerbyTestCase {
loadLinks();
}
+ @Test
public void testFindJob() throws Exception {
// Let's try to find non existing job
try {
@@ -94,6 +99,7 @@ public class TestJobHandling extends DerbyTestCase {
assertNull(forms.get(1).getInputs().get(1).getValue());
}
+ @Test
public void testFindJobs() throws Exception {
List<MJob> list;
@@ -116,6 +122,7 @@ public class TestJobHandling extends DerbyTestCase {
assertEquals("JD", list.get(3).getName());
}
+ @Test
public void testExistsJob() throws Exception {
// There shouldn't be anything on empty repository
assertFalse(handler.existsJob(1, getDerbyDatabaseConnection()));
@@ -133,6 +140,7 @@ public class TestJobHandling extends DerbyTestCase {
assertFalse(handler.existsJob(5, getDerbyDatabaseConnection()));
}
+ @Test
public void testInUseJob() throws Exception {
loadJobs();
loadSubmissions();
@@ -143,6 +151,7 @@ public class TestJobHandling extends DerbyTestCase {
assertFalse(handler.inUseJob(4, getDerbyDatabaseConnection()));
}
+ @Test
public void testCreateJob() throws Exception {
MJob job = getJob();
@@ -183,6 +192,7 @@ public class TestJobHandling extends DerbyTestCase {
assertCountForTable("SQOOP.SQ_JOB_INPUT", 12);
}
+ @Test
public void testUpdateJob() throws Exception {
loadJobs();
@@ -233,6 +243,7 @@ public class TestJobHandling extends DerbyTestCase {
assertEquals(((Map)forms.get(0).getInputs().get(1).getValue()).size(), 0);
}
+ @Test
public void testEnableAndDisableJob() throws Exception {
loadJobs();
@@ -251,6 +262,7 @@ public class TestJobHandling extends DerbyTestCase {
assertEquals(true, retrieved.getEnabled());
}
+ @Test
public void testDeleteJob() throws Exception {
loadJobs();