Exemple #1
0
        public virtual void TestSerializedException()
        {
            SerializedExceptionPBImpl orig = new SerializedExceptionPBImpl();

            orig.Init(new Exception("test exception"));
            YarnProtos.SerializedExceptionProto proto = orig.GetProto();
            SerializedExceptionPBImpl           deser = new SerializedExceptionPBImpl(proto);

            NUnit.Framework.Assert.AreEqual(orig, deser);
            NUnit.Framework.Assert.AreEqual(orig.GetMessage(), deser.GetMessage());
            NUnit.Framework.Assert.AreEqual(orig.GetRemoteTrace(), deser.GetRemoteTrace());
            NUnit.Framework.Assert.AreEqual(orig.GetCause(), deser.GetCause());
        }
Exemple #2
0
        public virtual void TestDeserialize()
        {
            Exception ex = new Exception("test exception");
            SerializedExceptionPBImpl pb = new SerializedExceptionPBImpl();

            try
            {
                pb.DeSerialize();
                NUnit.Framework.Assert.Fail("deSerialze should throw YarnRuntimeException");
            }
            catch (YarnRuntimeException e)
            {
                NUnit.Framework.Assert.AreEqual(typeof(TypeLoadException), e.InnerException.GetType
                                                    ());
            }
            pb.Init(ex);
            NUnit.Framework.Assert.AreEqual(ex.ToString(), pb.DeSerialize().ToString());
        }