Esempio n. 1
0
        public void Init()
        {
            new TLogging("TestCommonControls.log");

            TPetraConnector.Connect("../../etc/TestClient.config");
            FLedgerNumber = Convert.ToInt32(TAppSettingsManager.GetValue("LedgerNumber"));
        }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// test for gift batch import
        /// </summary>
        public override void Setup()
        {
            new TLogging("../../log/TestClient.log");

            TPetraConnector.Connect("../../etc/TestClient.config");
            FLedgerNumber = Convert.ToInt32(TAppSettingsManager.GetValue("LedgerNumber", "43"));
        }
Esempio n. 4
0
        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);
            }
        }
Esempio n. 5
0
        public void TestAuthentication()
        {
            // read original config file for client
            StreamReader sr     = new StreamReader("../../etc/TestClient.config");
            string       config = sr.ReadToEnd();

            sr.Close();
            string tempConfigFile = Path.GetTempFileName();

            // Testing successful login
            Assert.AreEqual(eLoginEnum.eLoginSucceeded, TPetraConnector.Connect("../../etc/TestClient.config", false), "should connect fine");
            TPetraConnector.Disconnect();

            // pass invalid password
            StreamWriter sw = new StreamWriter(tempConfigFile);

            sw.Write(config.Replace("key=\"AutoLoginPasswd\" value=\"demo\"",
                                    "key=\"AutoLoginPasswd\" value=\"demoFalse\""));
            sw.Close();

            Assert.AreEqual(eLoginEnum.eLoginAuthenticationFailed, TPetraConnector.Connect(tempConfigFile, false), "should fail on wrong password");

            // pass invalid user
            sw = new StreamWriter(tempConfigFile);
            sw.Write(config.Replace("key=\"AutoLogin\" value=\"demo\"",
                                    "key=\"AutoLogin\" value=\"demoNonExisting\""));
            sw.Close();
            Assert.AreEqual(eLoginEnum.eLoginAuthenticationFailed, TPetraConnector.Connect(tempConfigFile, false), "should fail on wrong user");

            // clean up
            File.Delete(tempConfigFile);
        }
Esempio n. 6
0
        /// <summary>
        /// clean up, disconnect from OpenPetra server
        /// </summary>
        public override void TearDown()
        {
            if (!FConnectedToServer)
            {
                return;
            }

            TPetraConnector.Disconnect();
        }
Esempio n. 7
0
 /// <summary>
 /// start the gui program
 /// </summary>
 public override void Setup()
 {
     // Before Execution of any Test we should do something like
     // nant stopPetraServer
     // nant ResetDatabase
     // nant startPetraServer
     // this may take some time ....
     new TLogging("../../log/TestClient.log");
     TPetraConnector.Connect("../../etc/TestClient.config");
     FLedgerNumber = Convert.ToInt32(TAppSettingsManager.GetValue("LedgerNumber"));
 }
Esempio n. 8
0
        /// <summary>
        /// clean up, disconnect from OpenPetra server
        /// </summary>
        public override void TearDown()
        {
            if (!FConnectedToServer)
            {
                return;
            }

            FMainDS.DeleteAllRows();
            FMainDS.SaveChanges();

            TPetraConnector.Disconnect();
        }
Esempio n. 9
0
        public void TestVersionMismatch()
        {
            StreamReader     sr = new StreamReader("../../delivery/bin/version.txt");
            string           strServerVersion = sr.ReadLine();
            TFileVersionInfo ServerVersion    = new TFileVersionInfo(strServerVersion);

            sr.Close();

            Assert.AreEqual(eLoginEnum.eLoginSucceeded, TPetraConnector.Connect(
                                "../../etc/TestClient.config", false), "connecting with the same version number");
            TPetraConnector.Disconnect();

            TFileVersionInfo.FManualApplicationVersion =
                new TFileVersionInfo(new Version(ServerVersion.FileMajorPart, ServerVersion.FileMinorPart, ServerVersion.FileBuildPart,
                                                 ServerVersion.FilePrivatePart + 1));
            Assert.AreEqual(eLoginEnum.eLoginVersionMismatch, TPetraConnector.Connect(
                                "../../etc/TestClient.config", false), "client is too new, only change in private part");

            int FileMajorPart   = ServerVersion.FileMajorPart;
            int FileMinorPart   = ServerVersion.FileMinorPart;
            int FileBuildPart   = ServerVersion.FileBuildPart - 1;
            int FilePrivatePart = ServerVersion.FilePrivatePart;

            if (FileBuildPart < 0)
            {
                FileMinorPart -= 1;
                FileBuildPart  = 0;
            }
            else if (FileMinorPart < 0)
            {
                FileMajorPart -= 1;
                FileMinorPart  = 0;
            }

            TFileVersionInfo.FManualApplicationVersion =
                new TFileVersionInfo(new Version(FileMajorPart, FileMinorPart, FileBuildPart,
                                                 FilePrivatePart));
            Assert.AreEqual(eLoginEnum.eLoginVersionMismatch, TPetraConnector.Connect("../../etc/TestClient.config", false), "client is too old");

            TFileVersionInfo.FManualApplicationVersion =
                new TFileVersionInfo(new Version(ServerVersion.FileMajorPart, ServerVersion.FileMinorPart, ServerVersion.FileBuildPart + 1,
                                                 ServerVersion.FilePrivatePart));
            Assert.AreEqual(eLoginEnum.eLoginVersionMismatch, TPetraConnector.Connect("../../etc/TestClient.config", false), "client is too new");

            TFileVersionInfo.FManualApplicationVersion = new TFileVersionInfo(new Version());
            Assert.AreEqual(eLoginEnum.eLoginVersionMismatch, TPetraConnector.Connect(
                                "../../etc/TestClient.config", false), "version 0.0.0.0 should not be accepted");

            // reset values
            TFileVersionInfo.FManualApplicationVersion = ServerVersion;
        }
Esempio n. 10
0
        public void Init()
        {
            new TLogging("test.log");

            // TODO: what about different cultures?
            OrigCulture = new CultureInfo("en-GB", false);
            Thread.CurrentThread.CurrentCulture = OrigCulture;
            TPetraConnector.Connect("../../etc/TestClient.config");
            FCalculator    = new TRptCalculator();
            PathToTestData = TAppSettingsManager.GetValue("Testing.Path") + "/lib/Reporting/TestData/".Replace("/",
                                                                                                               System.IO.Path.DirectorySeparatorChar.ToString());
            PathToSettingsData = TAppSettingsManager.GetValue("Reporting.PathReportSettings") + "/".Replace("/",
                                                                                                            System.IO.Path.DirectorySeparatorChar.ToString());
        }
Esempio n. 11
0
        /// <summary>
        /// Set up test for corporate exchange rate screen
        /// </summary>
        public override void Setup()
        {
            new TLogging("../../log/TestClient.log");

            FConnectedToServer = false;
            try
            {
                TPetraConnector.Connect("../../etc/TestClient.config");
                FConnectedToServer = true;
            }
            catch (Exception Exc)
            {
                Assert.Fail("Failed to connect to the Petra Server.  Have you forgotten to launch the Server Console? Exception: \r\n" + Exc.ToString());
            }
        }
Esempio n. 12
0
        /// <summary>
        /// start the gui program
        /// </summary>
        public override void Setup()
        {
            // Before Execution of any Test we should do something like
            // nant stopPetraServer
            // nant ResetDatabase
            // nant startPetraServer
            // this may take some time ....
            new TLogging("../../log/TestClient_MainNavigationTest.log");

            // clear the log file
            using (FileStream stream = new FileStream("TestClient_MainNavigationTest.log", FileMode.Create))
                using (TextWriter writer = new StreamWriter(stream))
                {
                    writer.WriteLine("");
                }

            FConnectedToServer = false;
            try
            {
                TPetraConnector.Connect("../../etc/TestClient.config");
                FConnectedToServer = true;
            }
            catch (Exception)
            {
                Assert.Fail("Failed to connect to the Petra Server.  Have you forgotten to launch the Server Console");
            }

            TLstTasks.Init(UserInfo.GUserInfo.UserID, TFrmMainWindowNew.HasAccessPermission);

            // load the UINavigation file (csharp\ICT\Petra\Definitions\UINavigation.yml)
            TLogging.Log("loading " + TAppSettingsManager.GetValue("UINavigation.File"));
            XmlNode MainMenuNode = TFrmMainWindowNew.BuildNavigationXml(false);

            // saving a xml file for better understanding how to use the XPath commands
            //StreamWriter sw = new StreamWriter(TAppSettingsManager.GetValue("UINavigation.File") + ".xml");
            //sw.WriteLine(TXMLParser.XmlToStringIndented(MainMenuNode.OwnerDocument));
            //sw.Close();

            FNavigator = MainMenuNode.OwnerDocument.CreateNavigator();

            TLogging.Log("Test Setup finished..." + Environment.NewLine);
        }
 public void Dispose()
 {
     TPetraConnector.Disconnect();
 }
Esempio n. 14
0
 /// <summary>
 /// clean up, disconnect from OpenPetra server
 /// </summary>
 public override void TearDown()
 {
     TPetraConnector.Disconnect();
 }
Esempio n. 15
0
 public void TearDown()
 {
     TPetraConnector.Disconnect();
 }