Exemplo n.º 1
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            try {
                ConfigFile configFile = new ConfigFile();

                List<ConfigFile> configFiles = new List<ConfigFile>();
                for (int i = 0; i < lstTpks.Items.Count; i++) {
                    configFiles = ParseConfigFiles(lstTpks.Items[i] as ConfigurationObject);
                }
            } catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 2
0
        private List<ConfigFile> ParseTPKConfigFiles(ConfigurationObject configurationObject)
        {
            List<ConfigFile> configFiles = new List<ConfigFile>();
            bool found = false;
            ConfigFile configFileOriginal = SearchForNicknamesTpkOnly(configurationObject, false, out found);
            //here we have the basic config file
            ConfigFile configFileOriginalBase = new ConfigFile(); ;
            if (found) {
                string oldNickname = string.Empty;
                if (!configFileOriginal.availableNickname.isBaseNickname) {
                    oldNickname = configurationObject.nickname;
                    configurationObject.nickname = configFileOriginal.availableNickname.referenceNickname;
                    configFileOriginalBase = SearchForNicknamesTpkOnly(configurationObject, true, out found);
                    configurationObject.nickname = oldNickname;
                }
                //=====>>>  care here we need to keep the basic configurationObject.nickname intact
                configurationObject.nickname = configurationObject.nickname + "_ORA11_MIG";
                bool foundOra11Mig;
                ConfigFile configFileOra11Mig = SearchForNicknamesTpkOnly(configurationObject, false, out foundOra11Mig);
                ConfigFile configFileOra11MigBase = new ConfigFile();
                if (foundOra11Mig) {// check for dump check tpk murex then go to env
                    // case found here we have same reference nicknames ==> no work done on base config file
                    if (!configFileOra11Mig.availableNickname.isBaseNickname && string.Equals(configFileOra11Mig.availableNickname.referenceNickname, configFileOriginal.availableNickname.referenceNickname)) {
                        if (!string.IsNullOrEmpty(configFileOra11Mig.availableNickname.dumpId)) {
                            // we need to replace the dump if the dump was in public config
                            configFileOra11Mig.availableNickname.newXmlRepresentation = configFileOra11Mig.availableNickname.oldXmlRepresentation.Replace(configFileOra11Mig.availableNickname.dumpId, configFileOriginal.availableNickname.dumpId);
                        }
                        //they have different reference nicknames
                    }else if (!configFileOra11Mig.availableNickname.isBaseNickname) {
                        configurationObject.nickname = configFileOra11Mig.availableNickname.referenceNickname;
                        configFileOra11MigBase = SearchForNicknamesTpkOnly(configurationObject, true, out foundOra11Mig);
                        //get dump id and replace it ====> or here we get the databases tag entirely
                        if (configFileOra11MigBase.availableNickname.oldXmlRepresentation.Contains("Dump")) {
                            configFileOra11MigBase.availableNickname.newXmlRepresentation = configFileOra11MigBase.availableNickname.oldXmlRepresentation.Replace(configFileOra11MigBase.availableNickname.dumpId, configFileOriginalBase.availableNickname.dumpId);
                        } else if (configFileOra11Mig.availableNickname.oldXmlRepresentation.Contains("Dump")) {
                        }
                    }
                } else {
                    //create new

                }

                configurationObject.nickname = configurationObject.nickname + "_ORA11";
                bool foundOra11;
                ConfigFile configFileOra11 = SearchForNicknamesTpkOnly(configurationObject, false, out foundOra11);
                ConfigFile configFileOra11Base;
                if (foundOra11) {//test parameters (tpk and env ) and bcps
                    if (!configFileOra11Mig.availableNickname.isBaseNickname) {
                        configurationObject.nickname = configFileOra11.availableNickname.referenceNickname;
                        configFileOra11Base = SearchForNicknamesTpkOnly(configurationObject, true, out foundOra11);
                    }
                } else {
                    //create new

                }

            } else {
                // do nothing coz nickname not found
            }
            return configFiles;
        }
Exemplo n.º 3
0
 private ConfigFile SearchForNicknamesTpkOnly(ConfigurationObject configurationObject, bool searchForBase, out bool found)
 {
     ConfigFile confFile = new ConfigFile();
     found = false;
     confFile = MarshalConfigFile(configurationObject.tpkPublicConfigCheckedOutPath, configurationObject.nickname, searchForBase, out found);
     confFile.filePath = configurationObject.tpkPublicConfigCheckedOutPath;
     confFile.isEnv = false;
     confFile.isPublic = true;
     if (!found) {
         confFile = MarshalConfigFile(configurationObject.tpkMurexConfigCheckedOutPath, configurationObject.nickname, searchForBase, out found);
         confFile.filePath = configurationObject.tpkMurexConfigCheckedOutPath;
         confFile.isEnv = false;
         confFile.isPublic = false;
     }
     return confFile;
 }
Exemplo n.º 4
0
        private ConfigFile MarshalConfigFile(string pathOfConfigFile, string nickname, bool searchForBase, out bool found)
        {
            found = false;
            ConfigFile configFile = new ConfigFile();
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(pathOfConfigFile);
            configFile.availableNickname = new ConfigFileNickname();
            XmlNodeList childrenTests = xmlDoc.DocumentElement.ChildNodes;
            for (int i = 0; i < childrenTests.Count && !found; i++) {

                XDocument xdoc = XDocument.Parse(childrenTests[i].OuterXml);
                string s1 = string.Empty;
                var q1 = from c in xdoc.Descendants("AvailableTest")
                         select new {
                             s1 = (string)c.Element("NickName")
                         };
                if (string.Equals(q1.ElementAt(0).s1, nickname)) {
                    ConfigFileNickname nicknameObject = new ConfigFileNickname();
                    bool isbaseNickname;
                    string referenceNickname;
                    List<string> testParams;
                    string foundNickname;
                    string bcps;
                    string dumpId;
                    GetNicknameObject(nickname, childrenTests[i].ChildNodes, out isbaseNickname, out referenceNickname, out testParams, out bcps, out foundNickname, out dumpId);
                    nicknameObject.isBaseNickname = isbaseNickname;
                    nicknameObject.referenceNickname = referenceNickname;
                    nicknameObject.nickname = foundNickname;
                    nicknameObject.oldXmlRepresentation= childrenTests[i].OuterXml;
                    nicknameObject.bcps = bcps;
                    nicknameObject.testParameters = testParams;
                    nicknameObject.dumpId = dumpId;
                    configFile.availableNickname = nicknameObject;
                    if (searchForBase && isbaseNickname) {
                        found = true;
                    } else if (!searchForBase) {
                        found = true;
                    }
                }
            }
            return configFile;
        }