Beispiel #1
0
        /// <exception cref="System.Exception"/>
        public virtual void TestSerializedExceptionDeSer()
        {
            // without cause
            YarnException       yarnEx    = new YarnException("Yarn_Exception");
            SerializedException serEx     = SerializedException.NewInstance(yarnEx);
            Exception           throwable = serEx.DeSerialize();

            NUnit.Framework.Assert.AreEqual(yarnEx.GetType(), throwable.GetType());
            NUnit.Framework.Assert.AreEqual(yarnEx.Message, throwable.Message);
            // with cause
            IOException      ioe = new IOException("Test_IOException");
            RuntimeException runtimeException = new RuntimeException("Test_RuntimeException",
                                                                     ioe);
            YarnException       yarnEx2    = new YarnException("Test_YarnException", runtimeException);
            SerializedException serEx2     = SerializedException.NewInstance(yarnEx2);
            Exception           throwable2 = serEx2.DeSerialize();

            Sharpen.Runtime.PrintStackTrace(throwable2);
            NUnit.Framework.Assert.AreEqual(yarnEx2.GetType(), throwable2.GetType());
            NUnit.Framework.Assert.AreEqual(yarnEx2.Message, throwable2.Message);
            NUnit.Framework.Assert.AreEqual(runtimeException.GetType(), throwable2.InnerException
                                            .GetType());
            NUnit.Framework.Assert.AreEqual(runtimeException.Message, throwable2.InnerException
                                            .Message);
            NUnit.Framework.Assert.AreEqual(ioe.GetType(), throwable2.InnerException.InnerException
                                            .GetType());
            NUnit.Framework.Assert.AreEqual(ioe.Message, throwable2.InnerException.InnerException
                                            .Message);
        }
Beispiel #2
0
        /// <exception cref="System.Exception"/>
        public virtual void TestAMRMClientAsyncException()
        {
            string        exStr         = "TestException";
            YarnException mockException = Org.Mockito.Mockito.Mock <YarnException>();

            Org.Mockito.Mockito.When(mockException.Message).ThenReturn(exStr);
            RunHeartBeatThrowOutException(mockException);
        }