public void TestKeepAliveWithTimeout() { // TODORemoting // set keep alive signal on client and server in a way that the server thinks the client has gone away CommonNUnitFunctions.StartOpenPetraServer("-D:Server.ClientKeepAliveTimeoutAfterXSeconds_LAN=10"); try { TPetraConnector.Connect("../../etc/TestClient.config", "<add key=\"ServerObjectKeepAliveIntervalInSeconds\" value=\"20\"/>"); string connectedClientsMessage = CommonNUnitFunctions.OpenPetraServerAdminConsole("ConnectedClients"); StringAssert.Contains("Connected since", connectedClientsMessage, "there should be one client connected"); Thread.Sleep(Convert.ToInt32(TimeSpan.FromSeconds(15.0).TotalMilliseconds)); connectedClientsMessage = CommonNUnitFunctions.OpenPetraServerAdminConsole("ConnectedClients"); StringAssert.Contains("* no connected Clients *", connectedClientsMessage, "there should not be any clients connected anymore after the client got disconnected due to timeout"); } finally { // clean up CommonNUnitFunctions.nant("stopServer", false); } }
public void TestKeepAliveWithoutTimeout() { CommonNUnitFunctions.StartOpenPetraServer("-D:Server.ClientKeepAliveTimeoutAfterXSeconds_LAN=10"); try { // check number of connected clients string connectedClientsMessage = CommonNUnitFunctions.OpenPetraServerAdminConsole("ConnectedClients"); StringAssert.Contains("* no connected Clients *", connectedClientsMessage, "there should not be any clients connected at the moment"); TPetraConnector.Connect("../../etc/TestClient.config", "<add key=\"ServerObjectKeepAliveIntervalInSeconds\" value=\"5\"/>"); connectedClientsMessage = CommonNUnitFunctions.OpenPetraServerAdminConsole("ConnectedClients"); StringAssert.Contains("Connected since", connectedClientsMessage, "there should be one client connected"); Thread.Sleep(Convert.ToInt32(TimeSpan.FromSeconds(15.0).TotalMilliseconds)); connectedClientsMessage = CommonNUnitFunctions.OpenPetraServerAdminConsole("ConnectedClients"); StringAssert.Contains("Connected since", connectedClientsMessage, "the client should still be connected, no timeout"); TPetraConnector.Disconnect(); connectedClientsMessage = CommonNUnitFunctions.OpenPetraServerAdminConsole("ConnectedClients"); StringAssert.Contains("* no connected Clients *", connectedClientsMessage, "there should not be any clients connected anymore"); } finally { // clean up CommonNUnitFunctions.nant("stopServer", false); } }
public void Init() { Catalog.Init(); new TLogging("../../log/test.log"); new TAppSettingsManager("../../etc/TestServer.config"); CommonNUnitFunctions.InitRootPath(); CommonNUnitFunctions.StartOpenPetraServer(); }