зеркало из https://github.com/github/sqoop.git
SQOOP-1478: Sqoop2: Migrate remaining tests from junit 3 to 4
This commit is contained in:
Родитель
196346d5cc
Коммит
97da12aa50
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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.*;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -25,8 +25,6 @@ import org.junit.Test;
|
|||
import java.util.ResourceBundle;
|
||||
|
||||
import static org.apache.sqoop.json.TestUtil.*;
|
||||
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -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.*;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
package org.apache.sqoop.submission.counter;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import org.junit.Assert;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -24,7 +24,6 @@ import static org.junit.Assert.assertEquals;
|
|||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.sqoop.validation;
|
|||
|
||||
import org.junit.Test;
|
||||
|
||||
import static junit.framework.Assert.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
|
|
@ -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.",
|
||||
|
|
|
@ -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;
|
||||
|
||||
public class TestExtractor extends TestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
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());
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
public class TestFromInitializer extends TestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
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();
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
public class TestPartitioner extends TestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
public class TestMapReduce extends TestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
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 {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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()));
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче