/// <exception cref="System.Exception"/> public virtual void TestPreVersion21CompatibilityEmptyTuple() { Writable[] manyWrits = new Writable[0]; TestTupleWritable.PreVersion21TupleWritable oldTuple = new TestTupleWritable.PreVersion21TupleWritable (manyWrits); // don't set any values written ByteArrayOutputStream @out = new ByteArrayOutputStream(); oldTuple.Write(new DataOutputStream(@out)); ByteArrayInputStream @in = new ByteArrayInputStream(@out.ToByteArray()); TupleWritable dTuple = new TupleWritable(); dTuple.ReadFields(new DataInputStream(@in)); NUnit.Framework.Assert.IsTrue("Tuple writable is unable to read pre-0.21 versions of TupleWritable" , oldTuple.IsCompatible(dTuple)); NUnit.Framework.Assert.AreEqual("All tuple data has not been read from the stream" , -1, @in.Read()); }
/// <summary>Tests compatibility with pre-0.21 versions of TupleWritable</summary> /// <exception cref="System.Exception"/> public virtual void TestPreVersion21Compatibility() { Writable[] manyWrits = MakeRandomWritables(64); TestTupleWritable.PreVersion21TupleWritable oldTuple = new TestTupleWritable.PreVersion21TupleWritable (manyWrits); for (int i = 0; i < manyWrits.Length; i++) { if (i % 3 == 0) { oldTuple.SetWritten(i); } } ByteArrayOutputStream @out = new ByteArrayOutputStream(); oldTuple.Write(new DataOutputStream(@out)); ByteArrayInputStream @in = new ByteArrayInputStream(@out.ToByteArray()); TupleWritable dTuple = new TupleWritable(); dTuple.ReadFields(new DataInputStream(@in)); NUnit.Framework.Assert.IsTrue("Tuple writable is unable to read pre-0.21 versions of TupleWritable" , oldTuple.IsCompatible(dTuple)); NUnit.Framework.Assert.AreEqual("All tuple data has not been read from the stream" , -1, @in.Read()); }