Example #1
0
        public override void Execute()
        {
            #region Setup and display Variables

            //Vars
            String        sConfig  = Config.SITE_SRC_LOGIN.ToString(); // get Inputs
            InputVars     myVars   = new InputVars();
            Mod_SetupVars dispVars = new Mod_SetupVars();
            dispVars.Setup(sConfig, ref myVars);


            #endregion

            #region Unpublish and Restore
            if (myVars.restore)
            {
                if (String.IsNullOrEmpty(myVars.sQLServerName) || String.IsNullOrEmpty(myVars.databaseName) || string.IsNullOrEmpty(myVars.backupLocation))
                {
                    throw new Exception("Not enough inputs to attempt Restore");
                }

                if (!File.Exists(myVars.backupLocation.ToString()))
                {
                    Console.WriteLine("Backup file not found!  " + myVars.backupLocation.ToString());
                    throw new Exception("Backup File not found!");
                }
                Mod_RestoreDB restore = new Mod_RestoreDB();
                restore.ResetSite(myVars);
            }
            #endregion
        }
        public virtual void ResetSite(InputVars myVars)
        {
            Console.WriteLine("- UnPublish Customizations");

            using (TestExecution.CreateTestCaseGroup("UnPublish Customizations"))
            {
                string           dir   = Directory.GetCurrentDirectory();
                CustomizationMgr myMgr = new CustomizationMgr();
                myMgr.OpenScreen();
                myMgr.ActionUndoPublish();
            }

            using (TestExecution.CreateTestCaseGroup("Restore fresh database"))
            {
                Console.WriteLine("- Restore SQL DB");
                DatabaseOperations db = new DatabaseOperations();
                db.RestoreDB(myVars.sQLServerName, myVars.databaseName, myVars.backupLocation);
            }

            using (TestExecution.CreateTestStepGroup("Sign in"))
            {
                Console.WriteLine("Logging into " + Config.SITE_DST_URL);
                Browser.StartingUrl = Config.SITE_DST_URL;
                PxLogin LoginPage = new PxLogin();

                String login    = Config.SITE_DST_LOGIN;
                String company  = "";
                int    location = login.IndexOf("@");
                if (location > 0)
                {
                    company = login.Substring(location + 1);
                    login   = login.Substring(0, location);
                }

                LoginPage.Username.Type(login);
                LoginPage.Password.Type(Config.SITE_DST_PASSWORD);
                if (company != "")
                {
                    LoginPage.CompanyId.SelectValue(company);
                }
                LoginPage.SignIn.Click();
                Console.WriteLine("You have successfully logged into Acumatica.");
            }
        }
Example #3
0
        public virtual void Setup(String Config, ref InputVars myVars)
        {
            string[] Creds = Config.Split(';');
            myVars.buildName = Creds[0] != null ? Creds[0].Trim() : "";
            myVars.userName  = Creds[1] != null ? Creds[1].Trim() : "";
            myVars.password  = Creds[2] != null ? Creds[2].Trim() : "";
            myVars.uRL       = Creds[3] != null ? Creds[3].Trim() : "";

            myVars.restore = Creds[4] != null?Convert.ToBoolean(Creds[4].ToString()) : false;

            myVars.sQLServerName  = Creds[5] != null ? Creds[5].Trim() : "";
            myVars.databaseName   = Creds[6] != null ? Creds[6].Trim() : "";
            myVars.backupLocation = Creds[7] != null ? Creds[7].Trim() : "";

            myVars.regresionSetups = Creds[8] != null?Convert.ToBoolean(Creds[8].ToString()) : false;

            myVars.publish = Creds[9] != null?Convert.ToBoolean(Creds[9].ToString()) : false;

            myVars.testXrefs = Creds[10] != null?Convert.ToBoolean(Creds[10].ToString()) : false;

            myVars.testCustomer = Creds[11] != null?Convert.ToBoolean(Creds[11].ToString()) : false;

            myVars.shipmentType = Creds[12] != null ? Creds[12].Trim() : "";
            myVars.printLabels  = Creds[13] != null?Convert.ToBoolean(Creds[13].ToString()) : false;

            myVars.processShipments = Creds[14] != null?Convert.ToBoolean(Creds[14].ToString()) : false;

            myVars.testVendor = Creds[15] != null?Convert.ToBoolean(Creds[15].ToString()) : false;

            Console.WriteLine("-------------");
            Console.WriteLine(" Test Inputs");
            string[] varNames = myVars.varNames.Split(';');
            int      count    = 0;

            foreach (string var in varNames)
            {
                Console.WriteLine(var + " : " + Creds[count].Trim());
                count++;
            }
            Console.WriteLine("-------------");
        }
Example #4
0
 // the splicer assumes that this is the first method in
 // the class
 public ClassMethod(Application app)
 {
     application = app;
     nextBlock = Blocks.Enter;
     handlerBlock = Blocks.None;
     locals = new LocalVars(this);
     inputs = new InputVars(this);
     outputs = new OutputVars(this);
 }