/// <summary>Test main method of WebAppProxyServer</summary> /// <exception cref="System.Exception"/> public virtual void TestWebAppProxyServerMainMethod() { WebAppProxyServer mainServer = null; Configuration conf = new YarnConfiguration(); conf.Set(YarnConfiguration.ProxyAddress, "localhost:9099"); try { mainServer = WebAppProxyServer.StartServer(conf); int counter = 20; Uri wrongUrl = new Uri("http://localhost:9099/proxy/app"); HttpURLConnection proxyConn = null; while (counter > 0) { counter--; try { proxyConn = (HttpURLConnection)wrongUrl.OpenConnection(); proxyConn.Connect(); proxyConn.GetResponseCode(); // server started ok counter = 0; } catch (Exception) { Sharpen.Thread.Sleep(100); } } NUnit.Framework.Assert.IsNotNull(proxyConn); // wrong application Id NUnit.Framework.Assert.AreEqual(HttpURLConnection.HttpInternalError, proxyConn.GetResponseCode ()); } finally { if (mainServer != null) { mainServer.Stop(); } } }
public virtual void TearDown() { webAppProxy.Stop(); }