|
@@ -26,6 +26,8 @@ import java.io.IOException;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Random;
|
|
|
|
|
|
+import junit.framework.TestCase;
|
|
|
+
|
|
|
import org.apache.hadoop.io.BooleanWritable;
|
|
|
import org.apache.hadoop.io.BytesWritable;
|
|
|
import org.apache.hadoop.io.FloatWritable;
|
|
@@ -34,12 +36,8 @@ import org.apache.hadoop.io.LongWritable;
|
|
|
import org.apache.hadoop.io.Text;
|
|
|
import org.apache.hadoop.io.Writable;
|
|
|
import org.apache.hadoop.io.WritableUtils;
|
|
|
-import org.junit.Test;
|
|
|
-import static org.junit.Assert.assertTrue;
|
|
|
-import static org.junit.Assert.assertEquals;
|
|
|
-import static org.junit.Assert.assertFalse;
|
|
|
|
|
|
-public class TestTupleWritable {
|
|
|
+public class TestTupleWritable extends TestCase {
|
|
|
|
|
|
private TupleWritable makeTuple(Writable[] writs) {
|
|
|
Writable[] sub1 = { writs[1], writs[2] };
|
|
@@ -102,7 +100,6 @@ public class TestTupleWritable {
|
|
|
return i;
|
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
public void testIterable() throws Exception {
|
|
|
Random r = new Random();
|
|
|
Writable[] writs = {
|
|
@@ -124,7 +121,6 @@ public class TestTupleWritable {
|
|
|
verifIter(writs, t, 0);
|
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
public void testNestedIterable() throws Exception {
|
|
|
Random r = new Random();
|
|
|
Writable[] writs = {
|
|
@@ -143,7 +139,6 @@ public class TestTupleWritable {
|
|
|
assertTrue("Bad count", writs.length == verifIter(writs, sTuple, 0));
|
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
public void testWritable() throws Exception {
|
|
|
Random r = new Random();
|
|
|
Writable[] writs = {
|
|
@@ -167,7 +162,6 @@ public class TestTupleWritable {
|
|
|
assertTrue("Failed to write/read tuple", sTuple.equals(dTuple));
|
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
public void testWideWritable() throws Exception {
|
|
|
Writable[] manyWrits = makeRandomWritables(131);
|
|
|
|
|
@@ -186,8 +180,7 @@ public class TestTupleWritable {
|
|
|
assertTrue("Failed to write/read tuple", sTuple.equals(dTuple));
|
|
|
assertEquals("All tuple data has not been read from the stream",-1,in.read());
|
|
|
}
|
|
|
-
|
|
|
- @Test
|
|
|
+
|
|
|
public void testWideWritable2() throws Exception {
|
|
|
Writable[] manyWrits = makeRandomWritables(71);
|
|
|
|
|
@@ -209,7 +202,6 @@ public class TestTupleWritable {
|
|
|
* Tests a tuple writable with more than 64 values and the values set written
|
|
|
* spread far apart.
|
|
|
*/
|
|
|
- @Test
|
|
|
public void testSparseWideWritable() throws Exception {
|
|
|
Writable[] manyWrits = makeRandomWritables(131);
|
|
|
|
|
@@ -228,7 +220,7 @@ public class TestTupleWritable {
|
|
|
assertTrue("Failed to write/read tuple", sTuple.equals(dTuple));
|
|
|
assertEquals("All tuple data has not been read from the stream",-1,in.read());
|
|
|
}
|
|
|
- @Test
|
|
|
+
|
|
|
public void testWideTuple() throws Exception {
|
|
|
Text emptyText = new Text("Should be empty");
|
|
|
Writable[] values = new Writable[64];
|
|
@@ -248,7 +240,7 @@ public class TestTupleWritable {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- @Test
|
|
|
+
|
|
|
public void testWideTuple2() throws Exception {
|
|
|
Text emptyText = new Text("Should be empty");
|
|
|
Writable[] values = new Writable[64];
|
|
@@ -272,7 +264,6 @@ public class TestTupleWritable {
|
|
|
/**
|
|
|
* Tests that we can write more than 64 values.
|
|
|
*/
|
|
|
- @Test
|
|
|
public void testWideTupleBoundary() throws Exception {
|
|
|
Text emptyText = new Text("Should not be set written");
|
|
|
Writable[] values = new Writable[65];
|
|
@@ -296,7 +287,6 @@ public class TestTupleWritable {
|
|
|
/**
|
|
|
* Tests compatibility with pre-0.21 versions of TupleWritable
|
|
|
*/
|
|
|
- @Test
|
|
|
public void testPreVersion21Compatibility() throws Exception {
|
|
|
Writable[] manyWrits = makeRandomWritables(64);
|
|
|
PreVersion21TupleWritable oldTuple = new PreVersion21TupleWritable(manyWrits);
|
|
@@ -314,7 +304,7 @@ public class TestTupleWritable {
|
|
|
assertTrue("Tuple writable is unable to read pre-0.21 versions of TupleWritable", oldTuple.isCompatible(dTuple));
|
|
|
assertEquals("All tuple data has not been read from the stream",-1,in.read());
|
|
|
}
|
|
|
- @Test
|
|
|
+
|
|
|
public void testPreVersion21CompatibilityEmptyTuple() throws Exception {
|
|
|
Writable[] manyWrits = new Writable[0];
|
|
|
PreVersion21TupleWritable oldTuple = new PreVersion21TupleWritable(manyWrits);
|