public List<TaiNguyen> getObjectResources() { List<TaiNguyen> tainguyenLst = new List<TaiNguyen>(); tainguyenLst.Add(LoaiTaiLieu_TaiLieu.I); return tainguyenLst; }
private static List<ImagesModel> GetList() { var list = new List<ImagesModel>(); MysqlCon db = new MysqlCon(); MySqlConnection conn = db.connect(); MySqlCommand command = new MySqlCommand("select * from images where isdownload=0;", conn); MySqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { list.Add(new ImagesModel { FileName = reader.GetString("filename"), Url = reader.GetString("img_url"), title = reader.GetString("title"), keyw = reader.GetString("keyw") }); } reader.Close(); db.disconnect(conn); return list; }
public static string[] GetnamespacestoLocalize() { var namespacestoLocalize = new List<string>(); var pathwayDirectory = PathwayPath.GetPathwayDir(); if (pathwayDirectory == null || !Directory.Exists(pathwayDirectory)) return new[] { "SIL.PublishingSolution" }; foreach (var file in Directory.GetFiles(pathwayDirectory, "*.*").Where(f => Regex.IsMatch(f, @"^.+\.(dll|exe)$")) ) { var fileInfo = new FileInfo(file); if ((fileInfo.Name == "PsTool.dll") || (fileInfo.Name.Contains("Convert")) || (fileInfo.Name.Contains("Writer")) || (fileInfo.Name.Contains("Validator"))) { using (var epubinstalleddirectory = File.OpenRead(Common.FromRegistry(fileInfo.FullName))) { var sAssembly = Assembly.LoadFrom(epubinstalleddirectory.Name); foreach ( var stype in sAssembly.GetTypes() .Where(type => type.GetConstructors().Any(s => s.GetParameters().Length == 0))) { if (!namespacestoLocalize.Contains(stype.Namespace)) namespacestoLocalize.Add(stype.Namespace); } } } } return namespacestoLocalize.Distinct().ToArray(); }
private void button5_Click(object sender, EventArgs e) { FileNames.Clear(); sourceFolder = "c:\\temp"; GetFilesFromFolder(sourceFolder); // Get files from Xml List<string> fileNamesXml = new List<string>(); XmlNode returnValue = null; XmlDocument LoadedDoc = new XmlDocument(); LoadedDoc.Load("c:\\FileLibrary.xml"); const string xPath = "//FileLibrary"; XmlElement root = LoadedDoc.DocumentElement; if (root != null) { returnValue = root.SelectSingleNode(xPath); foreach (XmlNode xmlNode in returnValue.ChildNodes) { string path = xmlNode.Attributes.GetNamedItem("Path").Value; fileNamesXml.Add(path); } } //Find missing files in xml foreach (string file in FileNames) { if (!fileNamesXml.Contains(file)) { string newGuid = Guid.NewGuid().ToString(); //Add a File Node XmlNode newNode = LoadedDoc.CreateNode("element", "File", ""); XmlAttribute xmlAttrib = LoadedDoc.CreateAttribute("Path"); xmlAttrib.Value = file; newNode.Attributes.Append(xmlAttrib); xmlAttrib = LoadedDoc.CreateAttribute("ComponentGuid"); xmlAttrib.Value = newGuid; newNode.Attributes.Append(xmlAttrib); root.LastChild.AppendChild(newNode); } } LoadedDoc.Save("c:\\FileLibrary.xml"); }
internal static void twowaysAMI(Ice.Communicator communicator, Test.MyClassPrx p) { { Dictionary<int, int> i = new Dictionary<int, int>(); i[0] = 1; i[1] = 0; AMI_MyClass_opNVI cb = new AMI_MyClass_opNVI(i); p.opNV_async(cb, i); cb.check(); } { Dictionary<string, string> i = new Dictionary<string, string>(); i["a"] = "b"; i["b"] = "a"; AMI_MyClass_opNRI cb = new AMI_MyClass_opNRI(i); p.opNR_async(cb, i); cb.check(); } { Dictionary<string, Dictionary<int, int>> i = new Dictionary<string, Dictionary<int, int>>(); Dictionary<int, int> id = new Dictionary<int, int>(); id[0] = 1; id[1] = 0; i["a"] = id; i["b"] = id; AMI_MyClass_opNDVI cb = new AMI_MyClass_opNDVI(i); p.opNDV_async(cb, i); cb.check(); } { Dictionary<string, Dictionary<string, string>> i = new Dictionary<string, Dictionary<string, string>>(); Dictionary<string, string> id = new Dictionary<string, string>(); id["a"] = "b"; id["b"] = "a"; i["a"] = id; i["b"] = id; AMI_MyClass_opNDRI cb = new AMI_MyClass_opNDRI(i); p.opNDR_async(cb, i); cb.check(); } { OV i = new OV(); i[0] = 1; i[1] = 0; AMI_MyClass_opOVI cb = new AMI_MyClass_opOVI(i); p.opOV_async(cb, i); cb.check(); } { OR i = new OR(); i["a"] = "b"; i["b"] = "a"; AMI_MyClass_opORI cb = new AMI_MyClass_opORI(i); p.opOR_async(cb, i); cb.check(); } { ODV i = new ODV(); OV id = new OV(); id[0] = 1; id[1] = 0; i["a"] = id; i["b"] = id; AMI_MyClass_opODVI cb = new AMI_MyClass_opODVI(i); p.opODV_async(cb, i); cb.check(); } { ODR i = new ODR(); OR id = new OR(); id["a"] = "b"; id["b"] = "a"; i["a"] = id; i["b"] = id; AMI_MyClass_opODRI cb = new AMI_MyClass_opODRI(i); p.opODR_async(cb, i); cb.check(); } { Dictionary<string, ODV> i = new Dictionary<string, ODV>(); OV iid = new OV(); iid[0] = 1; iid[1] = 0; ODV id = new ODV(); id["a"] = iid; id["b"] = iid; i["a"] = id; i["b"] = id; AMI_MyClass_opNODVI cb = new AMI_MyClass_opNODVI(i); p.opNODV_async(cb, i); cb.check(); } { Dictionary<string, ODR> i = new Dictionary<string, ODR>(); OR iid = new OR(); iid["a"] = "b"; iid["b"] = "a"; ODR id = new ODR(); id["a"] = iid; id["b"] = iid; i["a"] = id; i["b"] = id; AMI_MyClass_opNODRI cb = new AMI_MyClass_opNODRI(i); p.opNODR_async(cb, i); cb.check(); } { ONDV i = new ONDV(); Dictionary<int, int> iid = new Dictionary<int, int>(); iid[0] = 1; iid[1] = 0; Dictionary<string, Dictionary<int, int>> id = new Dictionary<string, Dictionary<int, int>>(); id["a"] = iid; id["b"] = iid; i["a"] = id; i["b"] = id; AMI_MyClass_opONDVI cb = new AMI_MyClass_opONDVI(i); p.opONDV_async(cb, i); cb.check(); } { ONDR i = new ONDR(); Dictionary<string, string> iid = new Dictionary<string, string>(); iid["a"] = "b"; iid["b"] = "a"; Dictionary<string, Dictionary<string, string>> id = new Dictionary<string, Dictionary<string, string>>(); id["a"] = iid; id["b"] = iid; i["a"] = id; i["b"] = id; AMI_MyClass_opONDRI cb = new AMI_MyClass_opONDRI(i); p.opONDR_async(cb, i); cb.check(); } { int[] ii = new int[] { 1, 2 }; Dictionary<string, int[]> i = new Dictionary<string, int[]>(); i["a"] = ii; i["b"] = ii; AMI_MyClass_opNDAISI cb = new AMI_MyClass_opNDAISI(i); p.opNDAIS_async(cb, i); cb.check(); } { CIS ii = new CIS(); ii.Add(1); ii.Add(2); Dictionary<string, CIS> i = new Dictionary<string, CIS>(); i["a"] = ii; i["b"] = ii; AMI_MyClass_opNDCISI cb = new AMI_MyClass_opNDCISI(i); p.opNDCIS_async(cb, i); cb.check(); } { List<int> ii = new List<int>(); ii.Add(1); ii.Add(2); Dictionary<string, List<int>> i = new Dictionary<string, List<int>>(); i["a"] = ii; i["b"] = ii; AMI_MyClass_opNDGISI cb = new AMI_MyClass_opNDGISI(i); p.opNDGIS_async(cb, i); cb.check(); } { string[] ii = new string[] { "a", "b" }; Dictionary<string, string[]> i = new Dictionary<string, string[]>(); i["a"] = ii; i["b"] = ii; AMI_MyClass_opNDASSI cb = new AMI_MyClass_opNDASSI(i); p.opNDASS_async(cb, i); cb.check(); } { CSS ii = new CSS(); ii.Add("a"); ii.Add("b"); Dictionary<string, CSS> i = new Dictionary<string, CSS>(); i["a"] = ii; i["b"] = ii; AMI_MyClass_opNDCSSI cb = new AMI_MyClass_opNDCSSI(i); p.opNDCSS_async(cb, i); cb.check(); } { List<string> ii = new List<string>(); ii.Add("a"); ii.Add("b"); Dictionary<string, List<string>> i = new Dictionary<string, List<string>>(); i["a"] = ii; i["b"] = ii; AMI_MyClass_opNDGSSI cb = new AMI_MyClass_opNDGSSI(i); p.opNDGSS_async(cb, i); cb.check(); } { int[] ii = new int[] { 1, 2 }; ODAIS i = new ODAIS(); i["a"] = ii; i["b"] = ii; AMI_MyClass_opODAISI cb = new AMI_MyClass_opODAISI(i); p.opODAIS_async(cb, i); cb.check(); } { CIS ii = new CIS(); ii.Add(1); ii.Add(2); ODCIS i = new ODCIS(); i["a"] = ii; i["b"] = ii; AMI_MyClass_opODCISI cb = new AMI_MyClass_opODCISI(i); p.opODCIS_async(cb, i); cb.check(); } { List<int> ii = new List<int>(); ii.Add(1); ii.Add(2); ODGIS i = new ODGIS(); i["a"] = ii; i["b"] = ii; AMI_MyClass_opODGISI cb = new AMI_MyClass_opODGISI(i); p.opODGIS_async(cb, i); cb.check(); } { string[] ii = new string[] { "a", "b" }; ODASS i = new ODASS(); i["a"] = ii; i["b"] = ii; AMI_MyClass_opODASSI cb = new AMI_MyClass_opODASSI(i); p.opODASS_async(cb, i); cb.check(); } { CSS ii = new CSS(); ii.Add("a"); ii.Add("b"); ODCSS i = new ODCSS(); i["a"] = ii; i["b"] = ii; AMI_MyClass_opODCSSI cb = new AMI_MyClass_opODCSSI(i); p.opODCSS_async(cb, i); cb.check(); } { List<string> ii = new List<string>(); ii.Add("a"); ii.Add("b"); ODGSS i = new ODGSS(); i["a"] = ii; i["b"] = ii; AMI_MyClass_opODGSSI cb = new AMI_MyClass_opODGSSI(i); p.opODGSS_async(cb, i); cb.check(); } }
/// <summary> /// The first two calls handle the error redirect from MyMav asking for cookies. The rest basically emulate the post requests /// from MyMav and you can use FireBug in FireFox to analyze any of MyMavs request and see how these are put together. One thing to note /// is that the ICIS code is the most important part as it is how the MyMav ties your session together /// </summary> public void Execute() { string errorPage = "https://sis-cs-prod.uta.edu/psc/ACSPRD/EMPLOYEE/PSFT_ACS/c/COMMUNITY_ACCESS.CLASS_SEARCH.GBL?&"; request = (HttpWebRequest)WebRequest.Create(errorPage); request.CookieContainer = cc; request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2"; response = (HttpWebResponse)request.GetResponse(); string searchPage = "https://sis-cs-prod.uta.edu/psc/ACSPRD/EMPLOYEE/PSFT_ACS/c/COMMUNITY_ACCESS.CLASS_SEARCH.GBL?&"; request = (HttpWebRequest)WebRequest.Create(searchPage); request.CookieContainer = cc; request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2"; response = (HttpWebResponse)request.GetResponse(); using (StreamReader sr = new StreamReader(response.GetResponseStream())) { html = sr.ReadToEnd(); } var document = new HtmlDocument(); document.LoadHtml(html); var getSemesterList = "https://sis-cs-prod.uta.edu/psc/ACSPRD/EMPLOYEE/PSFT_ACS/c/COMMUNITY_ACCESS.CLASS_SEARCH.GBL"; var getSemesterListParameters = new Dictionary<string, string>() { {"CLASS_SRCH_WRK2_STRM$273$", document.GetElementbyId("CLASS_SRCH_WRK2_STRM$273$").InnerText}, {"FacetPath", document.GetElementbyId("FacetPath") != null ? document.GetElementbyId("FacetPath").GetAttributeValue("value","") : "None"}, {"ICAJAX","1"}, {"ACAPPCLSDATA",document.GetElementbyId("ICAPPCLSDATA") != null ? document.GetElementbyId("ICAPPCLSDATA").GetAttributeValue("value","") : ""}, {"ICAction", "CLASS_SRCH_WRK2_STRM$273$$prompt"}, {"ICActionPrompt", document.GetElementbyId("ICActionPrompt") != null ? document.GetElementbyId("ICActionPrompt").GetAttributeValue("value","") : "false"}, {"ICAddCount", document.GetElementbyId("ICAddCount") != null ? document.GetElementbyId("ICAddCount").GetAttributeValue("value","") : ""}, {"ICChanged", document.GetElementbyId("ICChanged") != null ? document.GetElementbyId("ICChanged").GetAttributeValue("value","") : "-1"}, {"ICElementNum", document.GetElementbyId("ICElementNum") != null ? document.GetElementbyId("ICElementNum").GetAttributeValue("value","") : "0"}, {"ICFind", document.GetElementbyId("ICFind") != null ? document.GetElementbyId("ICFind").GetAttributeValue("value","") : ""}, {"ICFocus", ""}, {"ICNAVTYPEDROPDOWN", "0"}, {"ICResubmit", document.GetElementbyId("ICResubmit")!= null ? document.GetElementbyId("ICResubmit").GetAttributeValue("value","") : "0"}, {"ICSID", document.GetElementbyId("ICSID") != null ? document.GetElementbyId("ICSID").GetAttributeValue("value","") : ""}, {"ICSaveWarningFilter",document.GetElementbyId("ICSaveWarningFilter") != null ? document.GetElementbyId("ICSaveWarningFilter").GetAttributeValue("value","") : "0"}, {"ICStateNum",document.GetElementbyId("ICStateNum") != null ? document.GetElementbyId("ICStateNum").GetAttributeValue("value","") : ""}, {"ICType", document.GetElementbyId("ICType") != null ? document.GetElementbyId("ICType").GetAttributeValue("value","") : "Panel"}, {"ICXPos", document.GetElementbyId("ICXPos") != null ? document.GetElementbyId("ICXPos").GetAttributeValue("value","") : "0"}, {"ICYPos", document.GetElementbyId("ICYPos") != null ? document.GetElementbyId("ICYPos").GetAttributeValue("value","") : "0"}, {"ResponseToDiffFrame", document.GetElementbyId("ResponsetoDiffFrame") != null ? document.GetElementbyId("ResponsetoDiffFrame").GetAttributeValue("value","") : "-1"}, {"TargetFrameName",document.GetElementbyId("TargetFrameName") != null ? document.GetElementbyId("TargetFrameName").GetAttributeValue("value","") : "None"}, }; foreach (var key in getSemesterListParameters.Keys) { sb.Append(key + "=" + getSemesterListParameters[key] + "&"); } sb.Remove(sb.Length - 1, 1); request = (HttpWebRequest)WebRequest.Create(getSemesterList); request.Method = WebRequestMethods.Http.Post; request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2"; request.AllowWriteStreamBuffering = true; request.ProtocolVersion = HttpVersion.Version11; request.AllowAutoRedirect = true; request.ContentType = "application/x-www-form-urlencoded"; request.CookieContainer = cc; byteArray = Encoding.ASCII.GetBytes(sb.ToString()); request.ContentLength = byteArray.Length; requestStream = request.GetRequestStream(); requestStream.Write(byteArray, 0, byteArray.Length); requestStream.Close(); response = (HttpWebResponse)request.GetResponse(); html = ""; using (StreamReader sr = new StreamReader(response.GetResponseStream())) { html = sr.ReadToEnd(); var tempy = html; } document.LoadHtml(html); var semesterNodes = new List<string>(); HtmlNode node = document.GetElementbyId("SEARCH_RESULT1"); int i = 1; while (node != null) { semesterNodes.Add(node.InnerText); node = document.GetElementbyId("RESULT0$" + i); i++; } node = document.GetElementbyId("SEARCH_RESULTLAST"); if (node != null) semesterNodes.Add(node.InnerText); if(!semesterNodes.Any()) { getSemesterList = "https://sis-cs-prod.uta.edu/psc/ACSPRD/EMPLOYEE/PSFT_ACS/c/COMMUNITY_ACCESS.CLASS_SEARCH.GBL"; getSemesterListParameters = new Dictionary<string, string>() { {"CLASS_SRCH_WRK2_STRM$273$", document.GetElementbyId("CLASS_SRCH_WRK2_STRM$273$").InnerText}, {"FacetPath", document.GetElementbyId("FacetPath") != null ? document.GetElementbyId("FacetPath").GetAttributeValue("value","") : "None"}, {"ICAJAX","1"}, {"ACAPPCLSDATA",document.GetElementbyId("ICAPPCLSDATA") != null ? document.GetElementbyId("ICAPPCLSDATA").GetAttributeValue("value","") : ""}, {"ICAction", "CLASS_SRCH_WRK2_STRM$273$$prompt"}, {"ICActionPrompt", document.GetElementbyId("ICActionPrompt") != null ? document.GetElementbyId("ICActionPrompt").GetAttributeValue("value","") : "false"}, {"ICAddCount", document.GetElementbyId("ICAddCount") != null ? document.GetElementbyId("ICAddCount").GetAttributeValue("value","") : ""}, {"ICChanged", document.GetElementbyId("ICChanged") != null ? document.GetElementbyId("ICChanged").GetAttributeValue("value","") : "-1"}, {"ICElementNum", document.GetElementbyId("ICElementNum") != null ? document.GetElementbyId("ICElementNum").GetAttributeValue("value","") : "0"}, {"ICFind", document.GetElementbyId("ICFind") != null ? document.GetElementbyId("ICFind").GetAttributeValue("value","") : ""}, {"ICFocus", ""}, {"ICNAVTYPEDROPDOWN", "0"}, {"ICResubmit", document.GetElementbyId("ICResubmit")!= null ? document.GetElementbyId("ICResubmit").GetAttributeValue("value","") : "0"}, {"ICSID", document.GetElementbyId("ICSID") != null ? document.GetElementbyId("ICSID").GetAttributeValue("value","") : ""}, {"ICSaveWarningFilter",document.GetElementbyId("ICSaveWarningFilter") != null ? document.GetElementbyId("ICSaveWarningFilter").GetAttributeValue("value","") : "0"}, {"ICStateNum",document.GetElementbyId("ICStateNum") != null ? document.GetElementbyId("ICStateNum").GetAttributeValue("value","") : ""}, {"ICType", document.GetElementbyId("ICType") != null ? document.GetElementbyId("ICType").GetAttributeValue("value","") : "Panel"}, {"ICXPos", document.GetElementbyId("ICXPos") != null ? document.GetElementbyId("ICXPos").GetAttributeValue("value","") : "0"}, {"ICYPos", document.GetElementbyId("ICYPos") != null ? document.GetElementbyId("ICYPos").GetAttributeValue("value","") : "0"}, {"ResponseToDiffFrame", document.GetElementbyId("ResponsetoDiffFrame") != null ? document.GetElementbyId("ResponsetoDiffFrame").GetAttributeValue("value","") : "-1"}, {"TargetFrameName",document.GetElementbyId("TargetFrameName") != null ? document.GetElementbyId("TargetFrameName").GetAttributeValue("value","") : "None"}, }; foreach (var key in getSemesterListParameters.Keys) { sb.Append(key + "=" + getSemesterListParameters[key] + "&"); } sb.Remove(sb.Length - 1, 1); request = (HttpWebRequest)WebRequest.Create(getSemesterList); request.Method = WebRequestMethods.Http.Post; request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2"; request.AllowWriteStreamBuffering = true; request.ProtocolVersion = HttpVersion.Version11; request.AllowAutoRedirect = true; request.ContentType = "application/x-www-form-urlencoded"; request.CookieContainer = cc; byteArray = Encoding.ASCII.GetBytes(sb.ToString()); request.ContentLength = byteArray.Length; requestStream = request.GetRequestStream(); requestStream.Write(byteArray, 0, byteArray.Length); requestStream.Close(); response = (HttpWebResponse)request.GetResponse(); html = ""; using (StreamReader sr = new StreamReader(response.GetResponseStream())) { html = sr.ReadToEnd(); var tempy = html; } document.LoadHtml(html); semesterNodes = new List<string>(); node = document.GetElementbyId("SEARCH_RESULT1"); i = 1; while (node != null) { semesterNodes.Add(node.InnerText); node = document.GetElementbyId("RESULT0$" + i); i++; } node = document.GetElementbyId("SEARCH_RESULTLAST"); if (node != null) semesterNodes.Add(node.InnerText); } //var semesterNodes = new List<string>() //{ // "2158", // "2155", // "2152", // "2145", //}; var setSemester = "https://sis-cs-prod.uta.edu/psc/ACSPRD/EMPLOYEE/PSFT_ACS/c/COMMUNITY_ACCESS.CLASS_SEARCH.GBL"; var setSemesterParameters = new Dictionary<string, string>() { {"FacetPath", document.GetElementbyId("FacetPath") != null ? document.GetElementbyId("FacetPath").GetAttributeValue("value","") : "None"}, {"ICAJAX","1"}, {"ACAPPCLSDATA",document.GetElementbyId("ICAPPCLSDATA") != null ? document.GetElementbyId("ICAPPCLSDATA").GetAttributeValue("value","") : ""}, {"ICAction", "#ICRow" + semesterNodes.IndexOf(semester)}, {"ICActionPrompt", document.GetElementbyId("ICActionPrompt") != null ? document.GetElementbyId("ICActionPrompt").GetAttributeValue("value","") : "false"}, {"ICAddCount", document.GetElementbyId("ICAddCount") != null ? document.GetElementbyId("ICAddCount").GetAttributeValue("value","") : ""}, {"ICChanged", document.GetElementbyId("ICChanged") != null ? document.GetElementbyId("ICChanged").GetAttributeValue("value","") : "-1"}, {"ICElementNum", document.GetElementbyId("ICElementNum") != null ? document.GetElementbyId("ICElementNum").GetAttributeValue("value","") : "0"}, {"ICFind", document.GetElementbyId("ICFind") != null ? document.GetElementbyId("ICFind").GetAttributeValue("value","") : ""}, {"ICFocus", ""}, {"ICNAVTYPEDROPDOWN", "0"}, {"ICResubmit", document.GetElementbyId("ICResubmit")!= null ? document.GetElementbyId("ICResubmit").GetAttributeValue("value","") : "0"}, {"ICSID", document.GetElementbyId("ICSID") != null ? document.GetElementbyId("ICSID").GetAttributeValue("value","") : ""}, {"ICSaveWarningFilter",document.GetElementbyId("ICSaveWarningFilter") != null ? document.GetElementbyId("ICSaveWarningFilter").GetAttributeValue("value","") : "0"}, {"ICStateNum",document.GetElementbyId("ICStateNum") != null ? document.GetElementbyId("ICStateNum").GetAttributeValue("value","") : ""}, {"ICType", document.GetElementbyId("ICType") != null ? document.GetElementbyId("ICType").GetAttributeValue("value","") : "Panel"}, {"ICXPos", document.GetElementbyId("ICXPos") != null ? document.GetElementbyId("ICXPos").GetAttributeValue("value","") : "0"}, {"ICYPos", document.GetElementbyId("ICYPos") != null ? document.GetElementbyId("ICYPos").GetAttributeValue("value","") : "0"}, {"ResponseToDiffFrame", document.GetElementbyId("ResponsetoDiffFrame") != null ? document.GetElementbyId("ResponsetoDiffFrame").GetAttributeValue("value","") : "-1"}, {"TargetFrameName",document.GetElementbyId("TargetFrameName") != null ? document.GetElementbyId("TargetFrameName").GetAttributeValue("value","") : "None"}, }; sb.Clear(); foreach (var key in setSemesterParameters.Keys) { sb.Append(key + "=" + setSemesterParameters[key] + "&"); } sb.Remove(sb.Length - 1, 1); request = (HttpWebRequest)WebRequest.Create(setSemester); request.Method = WebRequestMethods.Http.Post; request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2"; request.AllowWriteStreamBuffering = true; request.ProtocolVersion = HttpVersion.Version11; request.AllowAutoRedirect = true; request.ContentType = "application/x-www-form-urlencoded"; request.CookieContainer = cc; byteArray = Encoding.ASCII.GetBytes(sb.ToString()); request.ContentLength = byteArray.Length; requestStream = request.GetRequestStream(); requestStream.Write(byteArray, 0, byteArray.Length); requestStream.Close(); response = (HttpWebResponse)request.GetResponse(); html = ""; using (StreamReader sr = new StreamReader(response.GetResponseStream())) { html = sr.ReadToEnd(); var tempy = html; } document.LoadHtml(html); var setDepartment = "https://sis-cs-prod.uta.edu/psc/ACSPRD/EMPLOYEE/PSFT_ACS/c/COMMUNITY_ACCESS.CLASS_SEARCH.GBL"; var setDepartmentParameters = new Dictionary<string, string>() { {"FacetPath", document.GetElementbyId("FacetPath") != null ? document.GetElementbyId("FacetPath").GetAttributeValue("value","") : "None"}, {"ICAJAX","1"}, {"ACAPPCLSDATA",document.GetElementbyId("ICAPPCLSDATA") != null ? document.GetElementbyId("ICAPPCLSDATA").GetAttributeValue("value","") : ""}, {"ICAction", "SSR_CLSRCH_WRK_SUBJECT$0"}, {"ICActionPrompt", document.GetElementbyId("ICActionPrompt") != null ? document.GetElementbyId("ICActionPrompt").GetAttributeValue("value","") : "false"}, {"ICAddCount", document.GetElementbyId("ICAddCount") != null ? document.GetElementbyId("ICAddCount").GetAttributeValue("value","") : ""}, {"ICChanged", document.GetElementbyId("ICChanged") != null ? document.GetElementbyId("ICChanged").GetAttributeValue("value","") : "-1"}, {"ICElementNum", document.GetElementbyId("ICElementNum") != null ? document.GetElementbyId("ICElementNum").GetAttributeValue("value","") : "0"}, {"ICFind", document.GetElementbyId("ICFind") != null ? document.GetElementbyId("ICFind").GetAttributeValue("value","") : ""}, {"ICFocus", "SSR_CLSRCH_WRK_SSR_EXACT_MATCH1$1"}, {"ICNAVTYPEDROPDOWN", "0"}, {"ICResubmit", document.GetElementbyId("ICResubmit")!= null ? document.GetElementbyId("ICResubmit").GetAttributeValue("value","") : "0"}, {"ICSID", document.GetElementbyId("ICSID") != null ? document.GetElementbyId("ICSID").GetAttributeValue("value","") : ""}, {"ICSaveWarningFilter",document.GetElementbyId("ICSaveWarningFilter") != null ? document.GetElementbyId("ICSaveWarningFilter").GetAttributeValue("value","") : "0"}, {"ICStateNum",document.GetElementbyId("ICStateNum") != null ? document.GetElementbyId("ICStateNum").GetAttributeValue("value","") : ""}, {"ICType", document.GetElementbyId("ICType") != null ? document.GetElementbyId("ICType").GetAttributeValue("value","") : "Panel"}, {"ICXPos", document.GetElementbyId("ICXPos") != null ? document.GetElementbyId("ICXPos").GetAttributeValue("value","") : "0"}, {"ICYPos", document.GetElementbyId("ICYPos") != null ? document.GetElementbyId("ICYPos").GetAttributeValue("value","") : "0"}, {"ResponseToDiffFrame", document.GetElementbyId("ResponsetoDiffFrame") != null ? document.GetElementbyId("ResponsetoDiffFrame").GetAttributeValue("value","") : "-1"}, {"SSR_CLSRCH_WRK_SUBJECT$0", department}, {"TargetFrameName",document.GetElementbyId("TargetFrameName") != null ? document.GetElementbyId("TargetFrameName").GetAttributeValue("value","") : "None"}, }; foreach (var key in setDepartmentParameters.Keys) { sb.Append(key + "=" + setDepartmentParameters[key] + "&"); } sb.Remove(sb.Length - 1, 1); request = (HttpWebRequest)WebRequest.Create(setDepartment); request.Method = WebRequestMethods.Http.Post; request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2"; request.AllowWriteStreamBuffering = true; request.ProtocolVersion = HttpVersion.Version11; request.AllowAutoRedirect = true; request.ContentType = "application/x-www-form-urlencoded"; request.CookieContainer = cc; byteArray = Encoding.ASCII.GetBytes(sb.ToString()); request.ContentLength = byteArray.Length; requestStream = request.GetRequestStream(); requestStream.Write(byteArray, 0, byteArray.Length); requestStream.Close(); response = (HttpWebResponse)request.GetResponse(); html = ""; using (StreamReader sr = new StreamReader(response.GetResponseStream())) { html = sr.ReadToEnd(); var tempy = html; } document.LoadHtml(html); var searchClass = "https://sis-cs-prod.uta.edu/psc/ACSPRD/EMPLOYEE/PSFT_ACS/c/COMMUNITY_ACCESS.CLASS_SEARCH.GBL"; var searchClassParameters = new Dictionary<string, string>() { {"FacetPath", document.GetElementbyId("FacetPath") != null ? document.GetElementbyId("FacetPath").GetAttributeValue("value","") : "None"}, {"ICAJAX","1"}, {"ACAPPCLSDATA",document.GetElementbyId("ICAPPCLSDATA") != null ? document.GetElementbyId("ICAPPCLSDATA").GetAttributeValue("value","") : ""}, {"ICAction", "CLASS_SRCH_WRK2_SSR_PB_CLASS_SRCH"}, {"ICActionPrompt", document.GetElementbyId("ICActionPrompt") != null ? document.GetElementbyId("ICActionPrompt").GetAttributeValue("value","") : "false"}, {"ICAddCount", document.GetElementbyId("ICAddCount") != null ? document.GetElementbyId("ICAddCount").GetAttributeValue("value","") : ""}, {"ICChanged", document.GetElementbyId("ICChanged") != null ? document.GetElementbyId("ICChanged").GetAttributeValue("value","") : "-1"}, {"ICElementNum", document.GetElementbyId("ICElementNum") != null ? document.GetElementbyId("ICElementNum").GetAttributeValue("value","") : "0"}, {"ICFind", document.GetElementbyId("ICFind") != null ? document.GetElementbyId("ICFind").GetAttributeValue("value","") : ""}, {"ICFocus", ""}, {"ICNAVTYPEDROPDOWN", "0"}, {"ICResubmit", document.GetElementbyId("ICResubmit")!= null ? document.GetElementbyId("ICResubmit").GetAttributeValue("value","") : "0"}, {"ICSID", document.GetElementbyId("ICSID") != null ? document.GetElementbyId("ICSID").GetAttributeValue("value","") : ""}, {"ICSaveWarningFilter",document.GetElementbyId("ICSaveWarningFilter") != null ? document.GetElementbyId("ICSaveWarningFilter").GetAttributeValue("value","") : "0"}, {"ICStateNum",document.GetElementbyId("ICStateNum") != null ? document.GetElementbyId("ICStateNum").GetAttributeValue("value","") : ""}, {"ICType", document.GetElementbyId("ICType") != null ? document.GetElementbyId("ICType").GetAttributeValue("value","") : "Panel"}, {"ICXPos", document.GetElementbyId("ICXPos") != null ? document.GetElementbyId("ICXPos").GetAttributeValue("value","") : "0"}, {"ICYPos", document.GetElementbyId("ICYPos") != null ? document.GetElementbyId("ICYPos").GetAttributeValue("value","") : "0"}, {"ResponseToDiffFrame", document.GetElementbyId("ResponsetoDiffFrame") != null ? document.GetElementbyId("ResponsetoDiffFrame").GetAttributeValue("value","") : "-1"}, {"SSR_CLSRCH_WRK_CATALOG_NBR$1", courseNumber}, {"SSR_CLSRCH_WRK_SSR_EXACT_MATCH1$1", "E"}, {"SSR_CLSRCH_WRK_SSR_OPEN_ONLY$chk$3", "N"}, {"TargetFrameName",document.GetElementbyId("TargetFrameName") != null ? document.GetElementbyId("TargetFrameName").GetAttributeValue("value","") : "None"}, }; sb.Clear(); foreach (var key in searchClassParameters.Keys) { sb.Append(key + "=" + searchClassParameters[key] + "&"); } sb.Remove(sb.Length - 1, 1); request = (HttpWebRequest)WebRequest.Create(searchClass); request.Method = WebRequestMethods.Http.Post; request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2"; request.AllowWriteStreamBuffering = true; request.ProtocolVersion = HttpVersion.Version11; request.AllowAutoRedirect = true; request.ContentType = "application/x-www-form-urlencoded"; request.CookieContainer = cc; byteArray = Encoding.ASCII.GetBytes(sb.ToString()); request.ContentLength = byteArray.Length; requestStream = request.GetRequestStream(); requestStream.Write(byteArray, 0, byteArray.Length); requestStream.Close(); response = (HttpWebResponse)request.GetResponse(); html = ""; using (StreamReader sr = new StreamReader(response.GetResponseStream())) { html = sr.ReadToEnd(); var tempy = html; } document.LoadHtml(html); i = 0; HtmlNode classNumber; //className = doc.GetElementbyId("win0divSSR_CLSRSLT_WRK_GROUPBOX2GP$0").InnerText.Replace(" ", ""); while ((classNumber = document.GetElementbyId("MTG_CLASS_NBR$" + i)) != null) { var classes = classNumber.Ancestors(); //var classy = classes.Where(x => x["id"].Value.ToLower().Contains("ACE_$ICField$48$$".ToLower())); var statusTag = document.GetElementbyId("win0divDERIVED_CLSRCH_SSR_STATUS_LONG$" + i); var statusImg = statusTag.ChildNodes.FirstOrDefault().ChildNodes.FirstOrDefault(x => x.Name.ToLower() == "img"); var course = document.GetElementbyId("win0divSSR_CLSRSLT_WRK_GROUPBOX2GP$" + i); if (course != null) { var courseText = course.InnerText.Replace(" &", "").Trim(" ".ToCharArray()); courseName = courseText.Split('-')[1].Trim(); } var scheduleClass = new UTAClass() { CourseNumber = classNumber.InnerText, Section = document.GetElementbyId("MTG_CLASSNAME$" + i).InnerText.Split('-')[0], Room = document.GetElementbyId("MTG_ROOM$" + i).InnerText.Replace(" ", ""), Instructor = document.GetElementbyId("MTG_INSTR$" + i).InnerText, Status = statusImg.Attributes.FirstOrDefault(x => x.Name.ToLower() == "alt").Value, }; var timeData = document.GetElementbyId("MTG_DAYTIME$" + i).InnerText.Split(' '); for (int j = 0; j < scheduleClass.MeetingDays.Count; j++) { if (!timeData[0].Contains(scheduleClass.MeetingDays.ElementAt(j))) { scheduleClass.MeetingDays.RemoveAt(j); } } if (timeData[0] == "TBA") scheduleClass.MeetingTime = timeData[0]; else scheduleClass.MeetingTime = timeData[1] + "-" + timeData[3]; finalClasses.Add(scheduleClass); i++; } }
internal static void twoways(Ice.Communicator communicator, Test.MyClassPrx p) { { Dictionary<int, int> i = new Dictionary<int, int>(); i[0] = 1; i[1] = 0; Dictionary<int, int> o; Dictionary<int, int> r; r = p.opNV(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Dictionary<string, string> i = new Dictionary<string, string>(); i["a"] = "b"; i["b"] = "a"; Dictionary<string, string> o; Dictionary<string, string> r; r = p.opNR(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Dictionary<string, Dictionary<int, int>> i = new Dictionary<string, Dictionary<int, int>>(); Dictionary<int, int> id = new Dictionary<int, int>(); id[0] = 1; id[1] = 0; i["a"] = id; i["b"] = id; Dictionary<string, Dictionary<int, int>> o; Dictionary<string, Dictionary<int, int>> r; r = p.opNDV(i, out o); foreach(string key in i.Keys) { test(Ice.CollectionComparer.Equals(i[key], o[key])); test(Ice.CollectionComparer.Equals(i[key], r[key])); } } { Dictionary<string, Dictionary<string, string>> i = new Dictionary<string, Dictionary<string, string>>(); Dictionary<string, string> id = new Dictionary<string, string>(); id["a"] = "b"; id["b"] = "a"; i["a"] = id; i["b"] = id; Dictionary<string, Dictionary<string, string>> o; Dictionary<string, Dictionary<string, string>> r; r = p.opNDR(i, out o); foreach(string key in i.Keys) { test(Ice.CollectionComparer.Equals(i[key], o[key])); test(Ice.CollectionComparer.Equals(i[key], r[key])); } } { OV i = new OV(); i[0] = 1; i[1] = 0; OV o; OV r; r = p.opOV(i, out o); test(OV.Equals(i, o)); test(OV.Equals(i, r)); } { OR i = new OR(); i["a"] = "b"; i["b"] = "a"; OR o; OR r; r = p.opOR(i, out o); test(OR.Equals(i, o)); test(OR.Equals(i, r)); } { ODV i = new ODV(); OV id = new OV(); id[0] = 1; id[1] = 0; i["a"] = id; i["b"] = id; ODV o; ODV r; r = p.opODV(i, out o); test(ODV.Equals(i, o)); test(ODV.Equals(i, r)); } { ODR i = new ODR(); OR id = new OR(); id["a"] = "b"; id["b"] = "a"; i["a"] = id; i["b"] = id; ODR o; ODR r; r = p.opODR(i, out o); test(ODR.Equals(i, o)); test(ODR.Equals(i, r)); } { Dictionary<string, ODV> i = new Dictionary<string, ODV>(); OV iid = new OV(); iid[0] = 1; iid[1] = 0; ODV id = new ODV(); id["a"] = iid; id["b"] = iid; i["a"] = id; i["b"] = id; Dictionary<string, ODV> o; Dictionary<string, ODV> r; r = p.opNODV(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Dictionary<string, ODR> i = new Dictionary<string, ODR>(); OR iid = new OR(); iid["a"] = "b"; iid["a"] = "b"; ODR id = new ODR(); id["a"] = iid; id["b"] = iid; i["a"] = id; i["b"] = id; Dictionary<string, ODR> o; Dictionary<string, ODR> r; r = p.opNODR(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { ONDV i = new ONDV(); Dictionary<int, int> iid = new Dictionary<int, int>(); iid[0] = 1; iid[1] = 0; Dictionary<string, Dictionary<int, int>> id = new Dictionary<string, Dictionary<int, int>>(); id["a"] = iid; id["b"] = iid; i["a"] = id; i["b"] = id; ONDV o; ONDV r; r = p.opONDV(i, out o); foreach(string key in i.Keys) { foreach(string s in i[key].Keys) { test(Ice.CollectionComparer.Equals(i[key][s], o[key][s])); test(Ice.CollectionComparer.Equals(i[key][s], r[key][s])); } } } { ONDR i = new ONDR(); Dictionary<string, string> iid = new Dictionary<string, string>(); iid["a"] = "b"; iid["b"] = "a"; Dictionary<string, Dictionary<string, string>> id = new Dictionary<string, Dictionary<string, string>>(); id["a"] = iid; id["b"] = iid; i["a"] = id; i["b"] = id; ONDR o; ONDR r; r = p.opONDR(i, out o); foreach(string key in i.Keys) { foreach(string s in i[key].Keys) { test(Ice.CollectionComparer.Equals(i[key][s], o[key][s])); test(Ice.CollectionComparer.Equals(i[key][s], r[key][s])); } } } { int[] ii = new int[] { 1, 2 }; Dictionary<string, int[]> i = new Dictionary<string, int[]>(); i["a"] = ii; i["b"] = ii; Dictionary<string, int[]> o; Dictionary<string, int[]> r; r = p.opNDAIS(i, out o); foreach(string key in i.Keys) { test(Ice.CollectionComparer.Equals(i[key], o[key])); test(Ice.CollectionComparer.Equals(i[key], r[key])); } } { CIS ii = new CIS(); ii.Add(1); ii.Add(2); Dictionary<string, CIS> i = new Dictionary<string, CIS>(); i["a"] = ii; i["b"] = ii; Dictionary<string, CIS> o; Dictionary<string, CIS> r; r = p.opNDCIS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { List<int> ii = new List<int>(); ii.Add(1); ii.Add(2); Dictionary<string, List<int>> i = new Dictionary<string, List<int>>(); i["a"] = ii; i["b"] = ii; Dictionary<string, List<int>> o; Dictionary<string, List<int>> r; r = p.opNDGIS(i, out o); foreach(string key in i.Keys) { test(Ice.CollectionComparer.Equals(i[key], o[key])); test(Ice.CollectionComparer.Equals(i[key], r[key])); } } { string[] ii = new string[] { "a", "b" }; Dictionary<string, string[]> i = new Dictionary<string, string[]>(); i["a"] = ii; i["b"] = ii; Dictionary<string, string[]> o; Dictionary<string, string[]> r; r = p.opNDASS(i, out o); foreach(string key in i.Keys) { test(Ice.CollectionComparer.Equals(i[key], o[key])); test(Ice.CollectionComparer.Equals(i[key], r[key])); } } { CSS ii = new CSS(); ii.Add("a"); ii.Add("b"); Dictionary<string, CSS> i = new Dictionary<string, CSS>(); i["a"] = ii; i["b"] = ii; Dictionary<string, CSS> o; Dictionary<string, CSS> r; r = p.opNDCSS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { List<string> ii = new List<string>(); ii.Add("a"); ii.Add("b"); Dictionary<string, List<string>> i = new Dictionary<string, List<string>>(); i["a"] = ii; i["b"] = ii; Dictionary<string, List<string>> o; Dictionary<string, List<string>> r; r = p.opNDGSS(i, out o); foreach(string key in i.Keys) { test(Ice.CollectionComparer.Equals(i[key], o[key])); test(Ice.CollectionComparer.Equals(i[key], r[key])); } } { int[] ii = new int[] { 1, 2 }; ODAIS i = new ODAIS(); i["a"] = ii; i["b"] = ii; ODAIS o; ODAIS r; r = p.opODAIS(i, out o); foreach(string key in i.Keys) { test(Ice.CollectionComparer.Equals(i[key], o[key])); test(Ice.CollectionComparer.Equals(i[key], r[key])); } } { CIS ii = new CIS(); ii.Add(1); ii.Add(2); ODCIS i = new ODCIS(); i["a"] = ii; i["b"] = ii; ODCIS o; ODCIS r; r = p.opODCIS(i, out o); foreach(string key in i.Keys) { test(Ice.CollectionComparer.Equals(i[key], o[key])); test(Ice.CollectionComparer.Equals(i[key], r[key])); } } { List<int> ii = new List<int>(); ii.Add(1); ii.Add(2); ODGIS i = new ODGIS(); i["a"] = ii; i["b"] = ii; ODGIS o; ODGIS r; r = p.opODGIS(i, out o); foreach(string key in i.Keys) { test(Ice.CollectionComparer.Equals(i[key], o[key])); test(Ice.CollectionComparer.Equals(i[key], r[key])); } } { string[] ii = new string[] { "a", "b" }; ODASS i = new ODASS(); i["a"] = ii; i["b"] = ii; ODASS o; ODASS r; r = p.opODASS(i, out o); foreach(string key in i.Keys) { test(Ice.CollectionComparer.Equals(i[key], o[key])); test(Ice.CollectionComparer.Equals(i[key], r[key])); } } { CSS ii = new CSS(); ii.Add("a"); ii.Add("b"); ODCSS i = new ODCSS(); i["a"] = ii; i["b"] = ii; ODCSS o; ODCSS r; r = p.opODCSS(i, out o); foreach(string key in i.Keys) { test(Ice.CollectionComparer.Equals(i[key], o[key])); test(Ice.CollectionComparer.Equals(i[key], r[key])); } } { List<string> ii = new List<string>(); ii.Add("a"); ii.Add("b"); ODGSS i = new ODGSS(); i["a"] = ii; i["b"] = ii; ODGSS o; ODGSS r; r = p.opODGSS(i, out o); foreach(string key in i.Keys) { test(Ice.CollectionComparer.Equals(i[key], o[key])); test(Ice.CollectionComparer.Equals(i[key], r[key])); } } }
public static void allTests(Ice.Communicator communicator, int num) { List<ControllerPrx> proxies = new List<ControllerPrx>(); List<ControllerPrx> indirectProxies = new List<ControllerPrx>(); for(int i = 0; i < num; ++i) { string id = "controller" + i; proxies.Add(ControllerPrxHelper.uncheckedCast(communicator.stringToProxy(id))); indirectProxies.Add(ControllerPrxHelper.uncheckedCast(communicator.stringToProxy(id + "@control" + i))); } Console.Out.Write("testing indirect proxies... "); Console.Out.Flush(); { foreach(ControllerPrx prx in indirectProxies) { prx.ice_ping(); } } Console.Out.WriteLine("ok"); Console.Out.Write("testing well-known proxies... "); Console.Out.Flush(); { foreach(ControllerPrx prx in proxies) { prx.ice_ping(); } } Console.Out.WriteLine("ok"); Console.Out.Write("testing object adapter registration... "); Console.Out.Flush(); { try { communicator.stringToProxy("object @ oa1").ice_ping(); } catch(Ice.NoEndpointException) { } proxies[0].activateObjectAdapter("oa", "oa1", ""); try { communicator.stringToProxy("object @ oa1").ice_ping(); } catch(Ice.ObjectNotExistException) { } proxies[0].deactivateObjectAdapter("oa"); try { communicator.stringToProxy("object @ oa1").ice_ping(); } catch(Ice.NoEndpointException) { } } Console.Out.WriteLine("ok"); Console.Out.Write("testing object adapter migration..."); Console.Out.Flush(); { proxies[0].activateObjectAdapter("oa", "oa1", ""); proxies[0].addObject("oa", "object"); communicator.stringToProxy("object @ oa1").ice_ping(); proxies[0].removeObject("oa", "object"); proxies[0].deactivateObjectAdapter("oa"); proxies[1].activateObjectAdapter("oa", "oa1", ""); proxies[1].addObject("oa", "object"); communicator.stringToProxy("object @ oa1").ice_ping(); proxies[1].removeObject("oa", "object"); proxies[1].deactivateObjectAdapter("oa"); } Console.Out.WriteLine("ok"); Console.Out.Write("testing object migration..."); Console.Out.Flush(); { proxies[0].activateObjectAdapter("oa", "oa1", ""); proxies[1].activateObjectAdapter("oa", "oa2", ""); proxies[0].addObject("oa", "object"); communicator.stringToProxy("object @ oa1").ice_ping(); communicator.stringToProxy("object").ice_ping(); proxies[0].removeObject("oa", "object"); proxies[1].addObject("oa", "object"); communicator.stringToProxy("object @ oa2").ice_ping(); communicator.stringToProxy("object").ice_ping(); proxies[1].removeObject("oa", "object"); try { communicator.stringToProxy("object @ oa1").ice_ping(); } catch(Ice.ObjectNotExistException) { } try { communicator.stringToProxy("object @ oa2").ice_ping(); } catch(Ice.ObjectNotExistException) { } proxies[0].deactivateObjectAdapter("oa"); proxies[1].deactivateObjectAdapter("oa"); } Console.Out.WriteLine("ok"); Console.Out.Write("testing replica groups..."); Console.Out.Flush(); { proxies[0].activateObjectAdapter("oa", "oa1", "rg"); proxies[1].activateObjectAdapter("oa", "oa2", "rg"); proxies[2].activateObjectAdapter("oa", "oa3", "rg"); proxies[0].addObject("oa", "object"); proxies[1].addObject("oa", "object"); proxies[2].addObject("oa", "object"); communicator.stringToProxy("object @ oa1").ice_ping(); communicator.stringToProxy("object @ oa2").ice_ping(); communicator.stringToProxy("object @ oa3").ice_ping(); communicator.stringToProxy("object @ rg").ice_ping(); List<string> adapterIds = new List<string>(); adapterIds.Add("oa1"); adapterIds.Add("oa2"); adapterIds.Add("oa3"); TestIntfPrx intf = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("object")); intf = (TestIntfPrx)intf.ice_connectionCached(false).ice_locatorCacheTimeout(0); while(adapterIds.Count > 0) { adapterIds.Remove(intf.getAdapterId()); } while(true) { adapterIds.Add("oa1"); adapterIds.Add("oa2"); adapterIds.Add("oa3"); intf = TestIntfPrxHelper.uncheckedCast( communicator.stringToProxy("object @ rg").ice_connectionCached(false)); int nRetry = 100; while(adapterIds.Count > 0 && --nRetry > 0) { adapterIds.Remove(intf.getAdapterId()); } if(nRetry > 0) { break; } // The previous locator lookup probably didn't return all the replicas... try again. communicator.stringToProxy("object @ rg").ice_locatorCacheTimeout(0).ice_ping(); } proxies[0].deactivateObjectAdapter("oa"); proxies[1].deactivateObjectAdapter("oa"); test(TestIntfPrxHelper.uncheckedCast( communicator.stringToProxy("object @ rg")).getAdapterId().Equals("oa3")); proxies[2].deactivateObjectAdapter("oa"); proxies[0].activateObjectAdapter("oa", "oa1", "rg"); proxies[0].addObject("oa", "object"); test(TestIntfPrxHelper.uncheckedCast( communicator.stringToProxy("object @ rg")).getAdapterId().Equals("oa1")); proxies[0].deactivateObjectAdapter("oa"); } Console.Out.WriteLine("ok"); Console.Out.Write("shutting down... "); Console.Out.Flush(); foreach(ControllerPrx prx in proxies) { prx.shutdown(); } Console.Out.WriteLine("ok"); }
public static string GetFontList(string xhtmlFileNameWithPath, string projectInputType, string finalOutput) { if (Path.GetFileName(xhtmlFileNameWithPath).IndexOf("Preserve") == 0) { xhtmlFileNameWithPath = xhtmlFileNameWithPath.Replace(Path.GetFileName(xhtmlFileNameWithPath), Path.GetFileName(xhtmlFileNameWithPath).Replace( "Preserve", "")); } string fontList = string.Empty; if (finalOutput == ".epub") { List<string> langCodeList = new List<string>(); string[] epubFile = Directory.GetFiles(Path.GetDirectoryName(xhtmlFileNameWithPath), "*.epub"); string epubFileName = epubFile[0]; string extractFolder = Common.PathCombine(Path.GetDirectoryName(epubFileName), "Test"); if (File.Exists(epubFileName)) { ZipUtil.UnZipFiles(epubFileName, extractFolder, "", false); if (Directory.Exists(Common.PathCombine(extractFolder, "OEBPS"))) { string[] ttfFiles = Directory.GetFiles(Common.PathCombine(extractFolder, "OEBPS"), "*.ttf"); if (ttfFiles.Length > 0) { for (int i = 0; i < ttfFiles.Length; i++) { string filename = Path.GetFileNameWithoutExtension(ttfFiles[i]); if (filename.IndexOf('-') > 0) { filename = filename.Substring(0, filename.IndexOf('-')); } if (!langCodeList.Contains(filename)) { langCodeList.Add(filename); fontList = fontList + filename; if (i < ttfFiles.Length - 1) { fontList = fontList + ";"; } } } } } } if (Directory.Exists(extractFolder)) { DirectoryInfo di = new DirectoryInfo(extractFolder); Common.CleanDirectory(di); } } else { List<string> langCodeList = new List<string>(); XmlDocument xDoc = Common.DeclareXMLDocument(true); XmlNamespaceManager namespaceManager = new XmlNamespaceManager(xDoc.NameTable); namespaceManager.AddNamespace("xhtml", "http://www.w3.org/1999/xhtml"); xDoc.Load(xhtmlFileNameWithPath); XmlNodeList fontNodeList = xDoc.GetElementsByTagName("meta"); for (int i = 0; i < fontNodeList.Count; i++) { if (fontNodeList[i].Attributes["scheme"] == null) continue; string langScheme = fontNodeList[i].Attributes["scheme"].Value; string langContent = fontNodeList[i].Attributes["content"].Value; if (langScheme.ToLower().IndexOf("language to font") != 0) continue; if (!langCodeList.Contains(langContent)) { langCodeList.Add(langContent); fontList = fontList + langContent; if (i < fontNodeList.Count - 1) { fontList = fontList + ";"; } } } } return fontList; }
/// <summary> /// The first two calls handle the error redirect from MyMav asking for cookies. The rest basically emulate the post requests /// from MyMav and you can use FireBug in FireFox to analyze any of MyMavs request and see how these are put together. One thing to note /// is that the ICIS code is the most important part as it is how the MyMav ties your session together /// </summary> public void Execute() { string errorPage = "https://sis-cs-prod.uta.edu/psc/ACSPRD/EMPLOYEE/PSFT_ACS/c/COMMUNITY_ACCESS.CLASS_SEARCH.GBL?&"; request = (HttpWebRequest)WebRequest.Create(errorPage); request.CookieContainer = cc; request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2"; try { response = (HttpWebResponse)request.GetResponse(); } catch (Exception ex) { System.Threading.Thread.Sleep(10000); response = (HttpWebResponse)request.GetResponse(); } string searchPage = "https://sis-cs-prod.uta.edu/psc/ACSPRD/EMPLOYEE/PSFT_ACS/c/COMMUNITY_ACCESS.CLASS_SEARCH.GBL?&"; request = (HttpWebRequest)WebRequest.Create(searchPage); request.CookieContainer = cc; request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2"; try { response = (HttpWebResponse)request.GetResponse(); } catch (Exception ex) { System.Threading.Thread.Sleep(10000); response = (HttpWebResponse)request.GetResponse(); } using (StreamReader sr = new StreamReader(response.GetResponseStream())) { html = sr.ReadToEnd(); } var document = new HtmlDocument(); document.LoadHtml(html); while (html.Contains("An error has occurred")) { request = (HttpWebRequest)WebRequest.Create(searchPage); request.CookieContainer = cc; request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2"; try { response = (HttpWebResponse)request.GetResponse(); } catch (Exception ex) { System.Threading.Thread.Sleep(10000); response = (HttpWebResponse)request.GetResponse(); } using (StreamReader sr = new StreamReader(response.GetResponseStream())) { html = sr.ReadToEnd(); } } document.LoadHtml(html); var getSemesterList = "https://sis-cs-prod.uta.edu/psc/ACSPRD/EMPLOYEE/PSFT_ACS/c/COMMUNITY_ACCESS.CLASS_SEARCH.GBL"; var getSemesterListParameters = new Dictionary<string, string>() { {"CLASS_SRCH_WRK2_STRM$273$", document.GetElementbyId("CLASS_SRCH_WRK2_STRM$273$").InnerText}, {"FacetPath", document.GetElementbyId("FacetPath") != null ? document.GetElementbyId("FacetPath").GetAttributeValue("value","") : "None"}, {"ICAJAX","1"}, {"ACAPPCLSDATA",document.GetElementbyId("ICAPPCLSDATA") != null ? document.GetElementbyId("ICAPPCLSDATA").GetAttributeValue("value","") : ""}, {"ICAction", "CLASS_SRCH_WRK2_STRM$273$$prompt"}, {"ICActionPrompt", document.GetElementbyId("ICActionPrompt") != null ? document.GetElementbyId("ICActionPrompt").GetAttributeValue("value","") : "false"}, {"ICAddCount", document.GetElementbyId("ICAddCount") != null ? document.GetElementbyId("ICAddCount").GetAttributeValue("value","") : ""}, {"ICChanged", document.GetElementbyId("ICChanged") != null ? document.GetElementbyId("ICChanged").GetAttributeValue("value","") : "-1"}, {"ICElementNum", document.GetElementbyId("ICElementNum") != null ? document.GetElementbyId("ICElementNum").GetAttributeValue("value","") : "0"}, {"ICFind", document.GetElementbyId("ICFind") != null ? document.GetElementbyId("ICFind").GetAttributeValue("value","") : ""}, {"ICFocus", ""}, {"ICNAVTYPEDROPDOWN", "0"}, {"ICResubmit", document.GetElementbyId("ICResubmit")!= null ? document.GetElementbyId("ICResubmit").GetAttributeValue("value","") : "0"}, {"ICSID", document.GetElementbyId("ICSID") != null ? document.GetElementbyId("ICSID").GetAttributeValue("value","") : ""}, {"ICSaveWarningFilter",document.GetElementbyId("ICSaveWarningFilter") != null ? document.GetElementbyId("ICSaveWarningFilter").GetAttributeValue("value","") : "0"}, {"ICStateNum",document.GetElementbyId("ICStateNum") != null ? document.GetElementbyId("ICStateNum").GetAttributeValue("value","") : ""}, {"ICType", document.GetElementbyId("ICType") != null ? document.GetElementbyId("ICType").GetAttributeValue("value","") : "Panel"}, {"ICXPos", document.GetElementbyId("ICXPos") != null ? document.GetElementbyId("ICXPos").GetAttributeValue("value","") : "0"}, {"ICYPos", document.GetElementbyId("ICYPos") != null ? document.GetElementbyId("ICYPos").GetAttributeValue("value","") : "0"}, {"ResponseToDiffFrame", document.GetElementbyId("ResponsetoDiffFrame") != null ? document.GetElementbyId("ResponsetoDiffFrame").GetAttributeValue("value","") : "-1"}, {"TargetFrameName",document.GetElementbyId("TargetFrameName") != null ? document.GetElementbyId("TargetFrameName").GetAttributeValue("value","") : "None"}, }; foreach (var key in getSemesterListParameters.Keys) { sb.Append(key + "=" + getSemesterListParameters[key] + "&"); } sb.Remove(sb.Length - 1, 1); request = (HttpWebRequest)WebRequest.Create(getSemesterList); request.Method = WebRequestMethods.Http.Post; request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2"; request.AllowWriteStreamBuffering = true; request.ProtocolVersion = HttpVersion.Version11; request.AllowAutoRedirect = true; request.ContentType = "application/x-www-form-urlencoded"; request.CookieContainer = cc; byteArray = Encoding.ASCII.GetBytes(sb.ToString()); request.ContentLength = byteArray.Length; requestStream = request.GetRequestStream(); requestStream.Write(byteArray, 0, byteArray.Length); requestStream.Close(); try { response = (HttpWebResponse)request.GetResponse(); } catch (Exception ex) { System.Threading.Thread.Sleep(10000); response = (HttpWebResponse)request.GetResponse(); } html = ""; using (StreamReader sr = new StreamReader(response.GetResponseStream())) { html = sr.ReadToEnd(); var tempy = html; } document.LoadHtml(html); var semesterNodes = new List<string>(); HtmlNode node = document.GetElementbyId("SEARCH_RESULT1"); int i = 1; while (node != null) { semesterNodes.Add(node.InnerText); node = document.GetElementbyId("RESULT0$" + i); i++; } node = document.GetElementbyId("SEARCH_RESULTLAST"); if (node != null) semesterNodes.Add(node.InnerText); if (!semesterNodes.Any()) { getSemesterList = "https://sis-cs-prod.uta.edu/psc/ACSPRD/EMPLOYEE/PSFT_ACS/c/COMMUNITY_ACCESS.CLASS_SEARCH.GBL"; getSemesterListParameters = new Dictionary<string, string>() { {"CLASS_SRCH_WRK2_STRM$273$", document.GetElementbyId("CLASS_SRCH_WRK2_STRM$273$").InnerText}, {"FacetPath", document.GetElementbyId("FacetPath") != null ? document.GetElementbyId("FacetPath").GetAttributeValue("value","") : "None"}, {"ICAJAX","1"}, {"ACAPPCLSDATA",document.GetElementbyId("ICAPPCLSDATA") != null ? document.GetElementbyId("ICAPPCLSDATA").GetAttributeValue("value","") : ""}, {"ICAction", "CLASS_SRCH_WRK2_STRM$273$$prompt"}, {"ICActionPrompt", document.GetElementbyId("ICActionPrompt") != null ? document.GetElementbyId("ICActionPrompt").GetAttributeValue("value","") : "false"}, {"ICAddCount", document.GetElementbyId("ICAddCount") != null ? document.GetElementbyId("ICAddCount").GetAttributeValue("value","") : ""}, {"ICChanged", document.GetElementbyId("ICChanged") != null ? document.GetElementbyId("ICChanged").GetAttributeValue("value","") : "-1"}, {"ICElementNum", document.GetElementbyId("ICElementNum") != null ? document.GetElementbyId("ICElementNum").GetAttributeValue("value","") : "0"}, {"ICFind", document.GetElementbyId("ICFind") != null ? document.GetElementbyId("ICFind").GetAttributeValue("value","") : ""}, {"ICFocus", ""}, {"ICNAVTYPEDROPDOWN", "0"}, {"ICResubmit", document.GetElementbyId("ICResubmit")!= null ? document.GetElementbyId("ICResubmit").GetAttributeValue("value","") : "0"}, {"ICSID", document.GetElementbyId("ICSID") != null ? document.GetElementbyId("ICSID").GetAttributeValue("value","") : ""}, {"ICSaveWarningFilter",document.GetElementbyId("ICSaveWarningFilter") != null ? document.GetElementbyId("ICSaveWarningFilter").GetAttributeValue("value","") : "0"}, {"ICStateNum",document.GetElementbyId("ICStateNum") != null ? document.GetElementbyId("ICStateNum").GetAttributeValue("value","") : ""}, {"ICType", document.GetElementbyId("ICType") != null ? document.GetElementbyId("ICType").GetAttributeValue("value","") : "Panel"}, {"ICXPos", document.GetElementbyId("ICXPos") != null ? document.GetElementbyId("ICXPos").GetAttributeValue("value","") : "0"}, {"ICYPos", document.GetElementbyId("ICYPos") != null ? document.GetElementbyId("ICYPos").GetAttributeValue("value","") : "0"}, {"ResponseToDiffFrame", document.GetElementbyId("ResponsetoDiffFrame") != null ? document.GetElementbyId("ResponsetoDiffFrame").GetAttributeValue("value","") : "-1"}, {"TargetFrameName",document.GetElementbyId("TargetFrameName") != null ? document.GetElementbyId("TargetFrameName").GetAttributeValue("value","") : "None"}, }; foreach (var key in getSemesterListParameters.Keys) { sb.Append(key + "=" + getSemesterListParameters[key] + "&"); } sb.Remove(sb.Length - 1, 1); request = (HttpWebRequest)WebRequest.Create(getSemesterList); request.Method = WebRequestMethods.Http.Post; request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2"; request.AllowWriteStreamBuffering = true; request.ProtocolVersion = HttpVersion.Version11; request.AllowAutoRedirect = true; request.ContentType = "application/x-www-form-urlencoded"; request.CookieContainer = cc; byteArray = Encoding.ASCII.GetBytes(sb.ToString()); request.ContentLength = byteArray.Length; requestStream = request.GetRequestStream(); requestStream.Write(byteArray, 0, byteArray.Length); requestStream.Close(); try { response = (HttpWebResponse)request.GetResponse(); } catch (Exception ex) { System.Threading.Thread.Sleep(10000); response = (HttpWebResponse)request.GetResponse(); } html = ""; using (StreamReader sr = new StreamReader(response.GetResponseStream())) { html = sr.ReadToEnd(); var tempy = html; } document.LoadHtml(html); semesterNodes = new List<string>(); node = document.GetElementbyId("SEARCH_RESULT1"); i = 1; while (node != null) { semesterNodes.Add(node.InnerText); node = document.GetElementbyId("RESULT0$" + i); i++; } node = document.GetElementbyId("SEARCH_RESULTLAST"); if (node != null) semesterNodes.Add(node.InnerText); } //var semesterNodes = new List<string>() //{ // "2158", // "2155", // "2152", // "2145", //}; var setSemester = "https://sis-cs-prod.uta.edu/psc/ACSPRD/EMPLOYEE/PSFT_ACS/c/COMMUNITY_ACCESS.CLASS_SEARCH.GBL"; var setSemesterParameters = new Dictionary<string, string>() { {"FacetPath", document.GetElementbyId("FacetPath") != null ? document.GetElementbyId("FacetPath").GetAttributeValue("value","") : "None"}, {"ICAJAX","1"}, {"ACAPPCLSDATA",document.GetElementbyId("ICAPPCLSDATA") != null ? document.GetElementbyId("ICAPPCLSDATA").GetAttributeValue("value","") : ""}, {"ICAction", "#ICRow" + semesterNodes.IndexOf(semester.SemesterNumber)}, {"ICActionPrompt", document.GetElementbyId("ICActionPrompt") != null ? document.GetElementbyId("ICActionPrompt").GetAttributeValue("value","") : "false"}, {"ICAddCount", document.GetElementbyId("ICAddCount") != null ? document.GetElementbyId("ICAddCount").GetAttributeValue("value","") : ""}, {"ICChanged", document.GetElementbyId("ICChanged") != null ? document.GetElementbyId("ICChanged").GetAttributeValue("value","") : "-1"}, {"ICElementNum", document.GetElementbyId("ICElementNum") != null ? document.GetElementbyId("ICElementNum").GetAttributeValue("value","") : "0"}, {"ICFind", document.GetElementbyId("ICFind") != null ? document.GetElementbyId("ICFind").GetAttributeValue("value","") : ""}, {"ICFocus", ""}, {"ICNAVTYPEDROPDOWN", "0"}, {"ICResubmit", document.GetElementbyId("ICResubmit")!= null ? document.GetElementbyId("ICResubmit").GetAttributeValue("value","") : "0"}, {"ICSID", document.GetElementbyId("ICSID") != null ? document.GetElementbyId("ICSID").GetAttributeValue("value","") : ""}, {"ICSaveWarningFilter",document.GetElementbyId("ICSaveWarningFilter") != null ? document.GetElementbyId("ICSaveWarningFilter").GetAttributeValue("value","") : "0"}, {"ICStateNum",document.GetElementbyId("ICStateNum") != null ? document.GetElementbyId("ICStateNum").GetAttributeValue("value","") : ""}, {"ICType", document.GetElementbyId("ICType") != null ? document.GetElementbyId("ICType").GetAttributeValue("value","") : "Panel"}, {"ICXPos", document.GetElementbyId("ICXPos") != null ? document.GetElementbyId("ICXPos").GetAttributeValue("value","") : "0"}, {"ICYPos", document.GetElementbyId("ICYPos") != null ? document.GetElementbyId("ICYPos").GetAttributeValue("value","") : "0"}, {"ResponseToDiffFrame", document.GetElementbyId("ResponsetoDiffFrame") != null ? document.GetElementbyId("ResponsetoDiffFrame").GetAttributeValue("value","") : "-1"}, {"TargetFrameName",document.GetElementbyId("TargetFrameName") != null ? document.GetElementbyId("TargetFrameName").GetAttributeValue("value","") : "None"}, }; sb.Clear(); foreach (var key in setSemesterParameters.Keys) { sb.Append(key + "=" + setSemesterParameters[key] + "&"); } sb.Remove(sb.Length - 1, 1); request = (HttpWebRequest)WebRequest.Create(setSemester); request.Method = WebRequestMethods.Http.Post; request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2"; request.AllowWriteStreamBuffering = true; request.ProtocolVersion = HttpVersion.Version11; request.AllowAutoRedirect = true; request.ContentType = "application/x-www-form-urlencoded"; request.CookieContainer = cc; byteArray = Encoding.ASCII.GetBytes(sb.ToString()); request.ContentLength = byteArray.Length; requestStream = request.GetRequestStream(); requestStream.Write(byteArray, 0, byteArray.Length); requestStream.Close(); try { response = (HttpWebResponse)request.GetResponse(); } catch (Exception ex) { System.Threading.Thread.Sleep(5000); response = (HttpWebResponse)request.GetResponse(); } html = ""; using (StreamReader sr = new StreamReader(response.GetResponseStream())) { html = sr.ReadToEnd(); var tempy = html; } document.LoadHtml(html); var setDepartment = "https://sis-cs-prod.uta.edu/psc/ACSPRD/EMPLOYEE/PSFT_ACS/c/COMMUNITY_ACCESS.CLASS_SEARCH.GBL"; var setDepartmentParameters = new Dictionary<string, string>() { {"FacetPath", document.GetElementbyId("FacetPath") != null ? document.GetElementbyId("FacetPath").GetAttributeValue("value","") : "None"}, {"ICAJAX","1"}, {"ACAPPCLSDATA",document.GetElementbyId("ICAPPCLSDATA") != null ? document.GetElementbyId("ICAPPCLSDATA").GetAttributeValue("value","") : ""}, {"ICAction", "SSR_CLSRCH_WRK_SUBJECT$0"}, {"ICActionPrompt", document.GetElementbyId("ICActionPrompt") != null ? document.GetElementbyId("ICActionPrompt").GetAttributeValue("value","") : "false"}, {"ICAddCount", document.GetElementbyId("ICAddCount") != null ? document.GetElementbyId("ICAddCount").GetAttributeValue("value","") : ""}, {"ICChanged", document.GetElementbyId("ICChanged") != null ? document.GetElementbyId("ICChanged").GetAttributeValue("value","") : "-1"}, {"ICElementNum", document.GetElementbyId("ICElementNum") != null ? document.GetElementbyId("ICElementNum").GetAttributeValue("value","") : "0"}, {"ICFind", document.GetElementbyId("ICFind") != null ? document.GetElementbyId("ICFind").GetAttributeValue("value","") : ""}, {"ICFocus", "SSR_CLSRCH_WRK_SSR_EXACT_MATCH1$1"}, {"ICNAVTYPEDROPDOWN", "0"}, {"ICResubmit", document.GetElementbyId("ICResubmit")!= null ? document.GetElementbyId("ICResubmit").GetAttributeValue("value","") : "0"}, {"ICSID", document.GetElementbyId("ICSID") != null ? document.GetElementbyId("ICSID").GetAttributeValue("value","") : ""}, {"ICSaveWarningFilter",document.GetElementbyId("ICSaveWarningFilter") != null ? document.GetElementbyId("ICSaveWarningFilter").GetAttributeValue("value","") : "0"}, {"ICStateNum",document.GetElementbyId("ICStateNum") != null ? document.GetElementbyId("ICStateNum").GetAttributeValue("value","") : ""}, {"ICType", document.GetElementbyId("ICType") != null ? document.GetElementbyId("ICType").GetAttributeValue("value","") : "Panel"}, {"ICXPos", document.GetElementbyId("ICXPos") != null ? document.GetElementbyId("ICXPos").GetAttributeValue("value","") : "0"}, {"ICYPos", document.GetElementbyId("ICYPos") != null ? document.GetElementbyId("ICYPos").GetAttributeValue("value","") : "0"}, {"ResponseToDiffFrame", document.GetElementbyId("ResponsetoDiffFrame") != null ? document.GetElementbyId("ResponsetoDiffFrame").GetAttributeValue("value","") : "-1"}, {"SSR_CLSRCH_WRK_SUBJECT$0", department}, {"TargetFrameName",document.GetElementbyId("TargetFrameName") != null ? document.GetElementbyId("TargetFrameName").GetAttributeValue("value","") : "None"}, }; foreach (var key in setDepartmentParameters.Keys) { sb.Append(key + "=" + setDepartmentParameters[key] + "&"); } sb.Remove(sb.Length - 1, 1); request = (HttpWebRequest)WebRequest.Create(setDepartment); request.Method = WebRequestMethods.Http.Post; request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2"; request.AllowWriteStreamBuffering = true; request.ProtocolVersion = HttpVersion.Version11; request.AllowAutoRedirect = true; request.ContentType = "application/x-www-form-urlencoded"; request.CookieContainer = cc; byteArray = Encoding.ASCII.GetBytes(sb.ToString()); request.ContentLength = byteArray.Length; requestStream = request.GetRequestStream(); requestStream.Write(byteArray, 0, byteArray.Length); requestStream.Close(); try { response = (HttpWebResponse)request.GetResponse(); } catch (Exception ex) { System.Threading.Thread.Sleep(10000); response = (HttpWebResponse)request.GetResponse(); } html = ""; using (StreamReader sr = new StreamReader(response.GetResponseStream())) { html = sr.ReadToEnd(); var tempy = html; } document.LoadHtml(html); var searchClass = "https://sis-cs-prod.uta.edu/psc/ACSPRD/EMPLOYEE/PSFT_ACS/c/COMMUNITY_ACCESS.CLASS_SEARCH.GBL"; var searchClassParameters = new Dictionary<string, string>() { {"FacetPath", document.GetElementbyId("FacetPath") != null ? document.GetElementbyId("FacetPath").GetAttributeValue("value","") : "None"}, {"ICAJAX","1"}, {"ACAPPCLSDATA",document.GetElementbyId("ICAPPCLSDATA") != null ? document.GetElementbyId("ICAPPCLSDATA").GetAttributeValue("value","") : ""}, {"ICAction", "CLASS_SRCH_WRK2_SSR_PB_CLASS_SRCH"}, {"ICActionPrompt", document.GetElementbyId("ICActionPrompt") != null ? document.GetElementbyId("ICActionPrompt").GetAttributeValue("value","") : "false"}, {"ICAddCount", document.GetElementbyId("ICAddCount") != null ? document.GetElementbyId("ICAddCount").GetAttributeValue("value","") : ""}, {"ICChanged", document.GetElementbyId("ICChanged") != null ? document.GetElementbyId("ICChanged").GetAttributeValue("value","") : "-1"}, {"ICElementNum", document.GetElementbyId("ICElementNum") != null ? document.GetElementbyId("ICElementNum").GetAttributeValue("value","") : "0"}, {"ICFind", document.GetElementbyId("ICFind") != null ? document.GetElementbyId("ICFind").GetAttributeValue("value","") : ""}, {"ICFocus", ""}, {"ICNAVTYPEDROPDOWN", "0"}, {"ICResubmit", document.GetElementbyId("ICResubmit")!= null ? document.GetElementbyId("ICResubmit").GetAttributeValue("value","") : "0"}, {"ICSID", document.GetElementbyId("ICSID") != null ? document.GetElementbyId("ICSID").GetAttributeValue("value","") : ""}, {"ICSaveWarningFilter",document.GetElementbyId("ICSaveWarningFilter") != null ? document.GetElementbyId("ICSaveWarningFilter").GetAttributeValue("value","") : "0"}, {"ICStateNum",document.GetElementbyId("ICStateNum") != null ? document.GetElementbyId("ICStateNum").GetAttributeValue("value","") : ""}, {"ICType", document.GetElementbyId("ICType") != null ? document.GetElementbyId("ICType").GetAttributeValue("value","") : "Panel"}, {"ICXPos", document.GetElementbyId("ICXPos") != null ? document.GetElementbyId("ICXPos").GetAttributeValue("value","") : "0"}, {"ICYPos", document.GetElementbyId("ICYPos") != null ? document.GetElementbyId("ICYPos").GetAttributeValue("value","") : "0"}, {"ResponseToDiffFrame", document.GetElementbyId("ResponsetoDiffFrame") != null ? document.GetElementbyId("ResponsetoDiffFrame").GetAttributeValue("value","") : "-1"}, {"SSR_CLSRCH_WRK_CATALOG_NBR$1", "0"}, {"SSR_CLSRCH_WRK_SSR_EXACT_MATCH1$1", "G"}, {"SSR_CLSRCH_WRK_SSR_OPEN_ONLY$chk$3", "N"}, {"TargetFrameName",document.GetElementbyId("TargetFrameName") != null ? document.GetElementbyId("TargetFrameName").GetAttributeValue("value","") : "None"}, }; sb.Clear(); foreach (var key in searchClassParameters.Keys) { sb.Append(key + "=" + searchClassParameters[key] + "&"); } sb.Remove(sb.Length - 1, 1); request = (HttpWebRequest)WebRequest.Create(searchClass); request.Method = WebRequestMethods.Http.Post; request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2"; request.AllowWriteStreamBuffering = true; request.ProtocolVersion = HttpVersion.Version11; request.AllowAutoRedirect = true; request.ContentType = "application/x-www-form-urlencoded"; request.CookieContainer = cc; byteArray = Encoding.ASCII.GetBytes(sb.ToString()); request.ContentLength = byteArray.Length; requestStream = request.GetRequestStream(); requestStream.Write(byteArray, 0, byteArray.Length); requestStream.Close(); try { response = (HttpWebResponse)request.GetResponse(); } catch (Exception ex) { System.Threading.Thread.Sleep(5000); response = (HttpWebResponse)request.GetResponse(); } html = ""; using (StreamReader sr = new StreamReader(response.GetResponseStream())) { try { html = sr.ReadToEnd(); } catch (Exception ex) { System.Threading.Thread.Sleep(10000); response = (HttpWebResponse)request.GetResponse(); var sit = new StreamReader(response.GetResponseStream()); html = sit.ReadToEnd(); } } document.LoadHtml(html); i = 0; HtmlNode course; while ((course = document.GetElementbyId("win0divSSR_CLSRSLT_WRK_GROUPBOX2GP$" + i)) != null) { var courseText = course.InnerText.Replace(" &", "").Trim(" ".ToCharArray()); //var courseNumber = Regex.Match(courseText, @"^\d+$").ToString(); var courseNumber = courseText.Split(' ')[1]; //var courseName = Regex.Match(courseText, @"- .*?").ToString(); var courseName = courseText.Split('-')[1].Trim(); var courseToBeAdded = new CatalogedCourse() { CourseName = courseName, CourseNumber = courseNumber, DepartmentId = departmentId, }; CatalogedCourse catalogCourse = connection.Query<CatalogedCourse>("select * from CatalogedCourse where DepartmentId='" + departmentId + "' and CourseNumber='" + courseNumber + "'").FirstOrDefault(); if (catalogCourse == null) connection.Query<int>("insert CatalogedCourse (DepartmentId, CourseNumber, CourseName) values (@DepartmentId, @CourseNumber, @CourseName); select cast(scope_identity() as int)", courseToBeAdded).First(); i++; } Debug.WriteLine(semester.SemesterNumber + " - " + department); }
internal static void twoways(Ice.Communicator communicator, Test.MyClassPrx p) { { Dictionary<int, int> i = new Dictionary<int, int>(); i[0] = 1; i[1] = 0; Dictionary<int, int> o; Dictionary<int, int> r; r = p.opNV(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Dictionary<string, string> i = new Dictionary<string, string>(); i["a"] = "b"; i["b"] = "a"; Dictionary<string, string> o; Dictionary<string, string> r; r = p.opNR(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Dictionary<string, Dictionary<int, int>> i = new Dictionary<string, Dictionary<int, int>>(); Dictionary<int, int> id = new Dictionary<int, int>(); id[0] = 1; id[1] = 0; i["a"] = id; i["b"] = id; Dictionary<string, Dictionary<int, int>> o; Dictionary<string, Dictionary<int, int>> r; r = p.opNDV(i, out o); foreach(string key in i.Keys) { test(Ice.CollectionComparer.Equals(i[key], o[key])); test(Ice.CollectionComparer.Equals(i[key], r[key])); } } { Dictionary<string, Dictionary<string, string>> i = new Dictionary<string, Dictionary<string, string>>(); Dictionary<string, string> id = new Dictionary<string, string>(); id["a"] = "b"; id["b"] = "a"; i["a"] = id; i["b"] = id; Dictionary<string, Dictionary<string, string>> o; Dictionary<string, Dictionary<string, string>> r; r = p.opNDR(i, out o); foreach(string key in i.Keys) { test(Ice.CollectionComparer.Equals(i[key], o[key])); test(Ice.CollectionComparer.Equals(i[key], r[key])); } } { int[] ii = new int[] { 1, 2 }; Dictionary<string, int[]> i = new Dictionary<string, int[]>(); i["a"] = ii; i["b"] = ii; Dictionary<string, int[]> o; Dictionary<string, int[]> r; r = p.opNDAIS(i, out o); foreach(string key in i.Keys) { test(Ice.CollectionComparer.Equals(i[key], o[key])); test(Ice.CollectionComparer.Equals(i[key], r[key])); } } { List<int> ii = new List<int>(); ii.Add(1); ii.Add(2); Dictionary<string, List<int>> i = new Dictionary<string, List<int>>(); i["a"] = ii; i["b"] = ii; Dictionary<string, List<int>> o; Dictionary<string, List<int>> r; r = p.opNDGIS(i, out o); foreach(string key in i.Keys) { test(Ice.CollectionComparer.Equals(i[key], o[key])); test(Ice.CollectionComparer.Equals(i[key], r[key])); } } { string[] ii = new string[] { "a", "b" }; Dictionary<string, string[]> i = new Dictionary<string, string[]>(); i["a"] = ii; i["b"] = ii; Dictionary<string, string[]> o; Dictionary<string, string[]> r; r = p.opNDASS(i, out o); foreach(string key in i.Keys) { test(Ice.CollectionComparer.Equals(i[key], o[key])); test(Ice.CollectionComparer.Equals(i[key], r[key])); } } { List<string> ii = new List<string>(); ii.Add("a"); ii.Add("b"); Dictionary<string, List<string>> i = new Dictionary<string, List<string>>(); i["a"] = ii; i["b"] = ii; Dictionary<string, List<string>> o; Dictionary<string, List<string>> r; r = p.opNDGSS(i, out o); foreach(string key in i.Keys) { test(Ice.CollectionComparer.Equals(i[key], o[key])); test(Ice.CollectionComparer.Equals(i[key], r[key])); } } }
/// <summary> /// Accepts the data in comma delimited strings and exectues HttpRequests in parallel to get the data from MyMav. /// Returns the current status (Open, Closed, Waitlisted) to via JSON. /// </summary> /// <param name="semester"></param> /// <param name="departments"></param> /// <param name="classNumbers"></param> /// <returns></returns> public JsonResult ValidateCourses(string semester = "2152", string departments = "CSE", string classNumbers = "21931") { try { Stopwatch watch = new Stopwatch(); watch.Start(); var semesterList = semester.Split(','); var classNumberList = classNumbers.Split(','); var departmentList = departments.Split(','); var searchResults = new List<ValidateCourses>(); for (int i = 0; i < semesterList.Count(); i++) { searchResults.Add(new ValidateCourses(semesterList[i], departmentList[i], classNumberList[i])); } Parallel.ForEach(searchResults, x => x.Execute()); var results = new List<UTASearchResult>(); foreach (var result in searchResults) { results.Add(new UTASearchResult() { CourseId = result.number, Department = result.department, CourseName = result.courseName, Semester = result.semester, CourseResults = result.finalClasses }); } watch.Stop(); return Json(new { Success = true, Results = results, TimeTaken = watch.Elapsed.TotalSeconds, }, JsonRequestBehavior.AllowGet); } catch(Exception ex) { return Json(new { Success = false, Message = ex.InnerException, }, JsonRequestBehavior.AllowGet); } }
/// <summary> /// Gets the full course info from MyMav and returns it via JSON. Accepts comma delimited strings. /// </summary> /// <param name="semester"></param> /// <param name="department"></param> /// <param name="courseNumber"></param> /// <returns></returns> public JsonResult GetCourseInfo(string semester = "2152,2152,2152,2152", string department = "CSE,MATH,MATH,KORE", string courseNumber = "3302,1301,1302,1441") { try { Stopwatch watch = new Stopwatch(); watch.Start(); var semesterList = semester.Split(','); var departmentList = department.Split(','); var courseList = courseNumber.Split(','); var searchResults = new List<DownloadCourseData>(); for (int i = 0; i < semesterList.Count(); i++) { searchResults.Add(new DownloadCourseData(semesterList[i], departmentList[i], courseList[i])); } Parallel.ForEach(searchResults, x => x.Execute()); var results = new List<UTASearchResult>(); foreach (var result in searchResults) { results.Add(new UTASearchResult() { CourseId = result.courseNumber, CourseName = result.courseName, Department = result.department, Semester = result.semester, CourseResults = result.finalClasses }); } watch.Stop(); return Json(new { Success = true, Results = results, TimeTaken = watch.Elapsed.TotalSeconds, }, JsonRequestBehavior.AllowGet); } catch (Exception ex) { return Json(new { Success = false, Message = ex.InnerException, }, JsonRequestBehavior.AllowGet); } }
internal static void twowaysAMI(Ice.Communicator communicator, Test.MyClassPrx p) { { Dictionary<int, int> i = new Dictionary<int, int>(); i[0] = 1; i[1] = 0; Callback cb = new Callback(); p.begin_opNV(i, null, cb.opNVI, i); cb.check(); } { Dictionary<string, string> i = new Dictionary<string, string>(); i["a"] = "b"; i["b"] = "a"; Callback cb = new Callback(); p.begin_opNR(i, null, cb.opNRI, i); cb.check(); } { Dictionary<string, Dictionary<int, int>> i = new Dictionary<string, Dictionary<int, int>>(); Dictionary<int, int> id = new Dictionary<int, int>(); id[0] = 1; id[1] = 0; i["a"] = id; i["b"] = id; Callback cb = new Callback(); p.begin_opNDV(i, null, cb.opNDVI, i); cb.check(); } { Dictionary<string, Dictionary<string, string>> i = new Dictionary<string, Dictionary<string, string>>(); Dictionary<string, string> id = new Dictionary<string, string>(); id["a"] = "b"; id["b"] = "a"; i["a"] = id; i["b"] = id; Callback cb = new Callback(); p.begin_opNDR(i, null, cb.opNDRI, i); cb.check(); } { int[] ii = new int[] { 1, 2 }; Dictionary<string, int[]> i = new Dictionary<string, int[]>(); i["a"] = ii; i["b"] = ii; Callback cb = new Callback(); p.begin_opNDAIS(i, null, cb.opNDAISI, i); cb.check(); } { List<int> ii = new List<int>(); ii.Add(1); ii.Add(2); Dictionary<string, List<int>> i = new Dictionary<string, List<int>>(); i["a"] = ii; i["b"] = ii; Callback cb = new Callback(); p.begin_opNDGIS(i, null, cb.opNDGISI, i); cb.check(); } { string[] ii = new string[] { "a", "b" }; Dictionary<string, string[]> i = new Dictionary<string, string[]>(); i["a"] = ii; i["b"] = ii; Callback cb = new Callback(); p.begin_opNDASS(i, null, cb.opNDASSI, i); cb.check(); } { List<string> ii = new List<string>(); ii.Add("a"); ii.Add("b"); Dictionary<string, List<string>> i = new Dictionary<string, List<string>>(); i["a"] = ii; i["b"] = ii; Callback cb = new Callback(); p.begin_opNDGSS(i, null, cb.opNDGSSI, i); cb.check(); } }
public static string GetLanguageCode(string xhtmlFileNameWithPath, string projectInputType, bool vernagular) { string languageCode = string.Empty; if (File.Exists(xhtmlFileNameWithPath)) { if (Path.GetFileName(xhtmlFileNameWithPath).IndexOf("Preserve") == 0) { xhtmlFileNameWithPath = xhtmlFileNameWithPath.Replace(Path.GetFileName(xhtmlFileNameWithPath), Path.GetFileName(xhtmlFileNameWithPath) .Replace( "Preserve", "")); } List<string> langCodeList = new List<string>(); XmlDocument xDoc = Common.DeclareXMLDocument(true); XmlNamespaceManager namespaceManager = new XmlNamespaceManager(xDoc.NameTable); namespaceManager.AddNamespace("x", "http://www.w3.org/1999/xhtml"); xDoc.Load(xhtmlFileNameWithPath); XmlNode node; var vernacularLang = string.Empty; if (vernagular) { node = xDoc.SelectSingleNode("//*[@class='headword']/@*[local-name()='lang']"); if (node != null) { vernacularLang = node.InnerText; } else { node = xDoc.SelectSingleNode("//*[@class='headref']/@*[local-name()='lang']"); if (node != null) { vernacularLang = node.InnerText; } else { node = xDoc.SelectSingleNode("//*[@class='Paragraph']//@*[local-name()='lang']"); if (node != null) { vernacularLang = node.InnerText; } } } } XmlNodeList fontList = xDoc.GetElementsByTagName("meta"); for (int i = 0; i < fontList.Count; i++) { string langName = fontList[i].Attributes["name"].Value; string langContent = fontList[i].Attributes["content"].Value; if (langName.ToLower() == "dc.language") { if (vernagular) { if (langContent.Length < vernacularLang.Length || langContent.Substring(0, vernacularLang.Length) != vernacularLang) { continue; } if (langContent.Length >= vernacularLang.Length && langContent.Substring(vernacularLang.Length, 1) != ":") { continue; } } if (!langCodeList.Contains(langContent)) { langCodeList.Add(langContent); languageCode = languageCode + langContent; if (i < fontList.Count - 1) { languageCode = languageCode + ";"; } } } } } else { languageCode = "eng"; } return languageCode; }
public static List<string> GetInputBooks(string xhtmlFileNameWithPath) { List<string> books = new List<string>(); if (Path.GetFileName(xhtmlFileNameWithPath).IndexOf("Preserve") == 0) { xhtmlFileNameWithPath = xhtmlFileNameWithPath.Replace(Path.GetFileName(xhtmlFileNameWithPath), Path.GetFileName(xhtmlFileNameWithPath).Replace( "Preserve", "")); } XmlDocument xDoc = Common.DeclareXMLDocument(true); XmlNamespaceManager namespaceManager = new XmlNamespaceManager(xDoc.NameTable); namespaceManager.AddNamespace("xhtml", "http://www.w3.org/1999/xhtml"); xDoc.Load(xhtmlFileNameWithPath); string xPath = "//xhtml:span[@class='scrBookCode']|//span[@class='scrBookCode']"; XmlNodeList bookList = xDoc.SelectNodes(xPath, namespaceManager); if (bookList != null && bookList.Count > 0) { foreach (XmlNode book in bookList) { books.Add(book.InnerText); } } return books; }
public static Test.BackgroundPrx allTests(Ice.Communicator communicator) { string sref = "background:default -p 12010"; Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); BackgroundPrx background = BackgroundPrxHelper.uncheckedCast(obj); sref = "backgroundController:tcp -p 12011"; obj = communicator.stringToProxy(sref); test(obj != null); BackgroundControllerPrx backgroundController = BackgroundControllerPrxHelper.uncheckedCast(obj); Configuration configuration = Configuration.getInstance(); Console.Write("testing connect... "); Console.Out.Flush(); { connectTests(configuration, background); } Console.Out.WriteLine("ok"); Console.Write("testing initialization... "); Console.Out.Flush(); { initializeTests(configuration, background, backgroundController); } Console.Out.WriteLine("ok"); Console.Write("testing connection validation... "); Console.Out.Flush(); { validationTests(configuration, background, backgroundController); } Console.Out.WriteLine("ok"); Console.Write("testing read/write... "); Console.Out.Flush(); { readWriteTests(configuration, background, backgroundController); } Console.Out.WriteLine("ok"); Console.Write("testing locator... "); Console.Out.Flush(); { Ice.LocatorPrx locator; obj = communicator.stringToProxy("locator:default -p 12010").ice_invocationTimeout(250); locator = Ice.LocatorPrxHelper.uncheckedCast(obj); obj = communicator.stringToProxy("background@Test").ice_locator(locator).ice_oneway(); backgroundController.pauseCall("findAdapterById"); try { obj.ice_ping(); test(false); } catch(Ice.TimeoutException) { } backgroundController.resumeCall("findAdapterById"); obj = communicator.stringToProxy("locator:default -p 12010"); locator = Ice.LocatorPrxHelper.uncheckedCast(obj); obj = obj.ice_locator(locator); obj.ice_ping(); obj = communicator.stringToProxy("background@Test").ice_locator(locator); BackgroundPrx bg = BackgroundPrxHelper.uncheckedCast(obj); backgroundController.pauseCall("findAdapterById"); Ice.AsyncResult r1 = bg.begin_op(); Ice.AsyncResult r2 = bg.begin_op(); test(!r1.IsCompleted); test(!r2.IsCompleted); backgroundController.resumeCall("findAdapterById"); bg.end_op(r1); bg.end_op(r2); test(r1.IsCompleted); test(r2.IsCompleted); } Console.Out.WriteLine("ok"); Console.Write("testing router... "); Console.Out.Flush(); { Ice.RouterPrx router; obj = communicator.stringToProxy("router:default -p 12010").ice_invocationTimeout(250); router = Ice.RouterPrxHelper.uncheckedCast(obj); obj = communicator.stringToProxy("background@Test").ice_router(router).ice_oneway(); backgroundController.pauseCall("getClientProxy"); try { obj.ice_ping(); test(false); } catch(Ice.TimeoutException) { } backgroundController.resumeCall("getClientProxy"); obj = communicator.stringToProxy("router:default -p 12010"); router = Ice.RouterPrxHelper.uncheckedCast(obj); obj = communicator.stringToProxy("background@Test").ice_router(router); BackgroundPrx bg = BackgroundPrxHelper.uncheckedCast(obj); test(bg.ice_getRouter() != null); backgroundController.pauseCall("getClientProxy"); Ice.AsyncResult r1 = bg.begin_op(); Ice.AsyncResult r2 = bg.begin_op(); test(!r1.IsCompleted); test(!r2.IsCompleted); backgroundController.resumeCall("getClientProxy"); bg.end_op(r1); bg.end_op(r2); test(r1.IsCompleted); test(r2.IsCompleted); } Console.Out.WriteLine("ok"); bool ws = communicator.getProperties().getProperty("Ice.Default.Protocol").Equals("test-ws"); bool wss = communicator.getProperties().getProperty("Ice.Default.Protocol").Equals("test-wss"); if(!ws && !wss) { Console.Write("testing buffered transport... "); Console.Out.Flush(); configuration.buffered(true); backgroundController.buffered(true); background.begin_op(); background.ice_getCachedConnection().close(true); background.begin_op(); OpAMICallback cb = new OpAMICallback(); List<Ice.AsyncResult> results = new List<Ice.AsyncResult>(); for(int i = 0; i < 10000; ++i) { Ice.AsyncResult r = background.begin_op().whenCompleted(cb.responseNoOp, cb.noException); results.Add(r); if(i % 50 == 0) { backgroundController.holdAdapter(); backgroundController.resumeAdapter(); } if(i % 100 == 0) { r.waitForCompleted(); } } foreach(Ice.AsyncResult r in results) { r.waitForCompleted(); } Console.Out.WriteLine("ok"); } return background; }
/// <summary> /// Returns language Script(font-name) used in dictionary /// </summary> /// <returns></returns> public static string GetLanguageScriptList(string xhtmlFileNameWithPath, string projectInputType) { if (Path.GetFileName(xhtmlFileNameWithPath).IndexOf("Preserve") == 0) { xhtmlFileNameWithPath = xhtmlFileNameWithPath.Replace(Path.GetFileName(xhtmlFileNameWithPath), Path.GetFileName(xhtmlFileNameWithPath).Replace( "Preserve", "")); } string languageCode = string.Empty; if (projectInputType.ToLower() == "dictionary") { List<string> langCodeList = new List<string>(); XmlDocument xDoc = Common.DeclareXMLDocument(true); XmlNamespaceManager namespaceManager = new XmlNamespaceManager(xDoc.NameTable); namespaceManager.AddNamespace("xhtml", "http://www.w3.org/1999/xhtml"); xDoc.Load(xhtmlFileNameWithPath); XmlNodeList fontList = xDoc.GetElementsByTagName("meta"); for (int i = 0; i < fontList.Count; i++) { string langName = fontList[i].Attributes["name"].Value; string langContent = fontList[i].Attributes["content"].Value; if (langName.ToLower().IndexOf("dc.language") != 0) continue; if (langContent.IndexOf(':') > 0 && langContent.IndexOf('-') > 0) { if (!langCodeList.Contains(langContent)) { langCodeList.Add(langContent); languageCode = languageCode + langContent; if (i < fontList.Count) { languageCode = languageCode + ","; } } } } } else { languageCode = Common.ParaTextEthnologueCodeName(); if (languageCode.Length > 0 && languageCode.IndexOf('-') > 0) { string[] val = languageCode.Split('-'); languageCode = val[1]; } } return languageCode; }
public static void allTests(Ice.Communicator communicator) { string @ref = "communicator:default -p 12010"; RemoteCommunicatorPrx com = RemoteCommunicatorPrxHelper.uncheckedCast(communicator.stringToProxy(@ref)); List<TestCase> tests = new List<TestCase>(); tests.Add(new InvocationHeartbeatTest(com)); tests.Add(new InvocationHeartbeatOnHoldTest(com)); tests.Add(new InvocationNoHeartbeatTest(com)); tests.Add(new InvocationHeartbeatCloseOnIdleTest(com)); tests.Add(new CloseOnIdleTest(com)); tests.Add(new CloseOnInvocationTest(com)); tests.Add(new CloseOnIdleAndInvocationTest(com)); tests.Add(new ForcefulCloseOnIdleAndInvocationTest(com)); tests.Add(new HeartbeatOnIdleTest(com)); tests.Add(new HeartbeatAlwaysTest(com)); tests.Add(new SetACMTest(com)); foreach(TestCase test in tests) { test.init(); } foreach(TestCase test in tests) { test.start(); } foreach(TestCase test in tests) { test.join(); } foreach(TestCase test in tests) { test.destroy(); } Console.Out.Write("shutting down... "); Console.Out.Flush(); com.shutdown(); Console.WriteLine("ok"); }
public static void allTests(Ice.Communicator communicator, bool collocated) { string sref = "test:default -p 12010"; Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); Test.TestIntfPrx p = Test.TestIntfPrxHelper.uncheckedCast(obj); sref = "testController:default -p 12011"; obj = communicator.stringToProxy(sref); test(obj != null); Test.TestIntfControllerPrx testController = Test.TestIntfControllerPrxHelper.uncheckedCast(obj); Write("testing begin/end invocation... "); Flush(); { Ice.AsyncResult result; Dictionary<string, string> ctx = new Dictionary<string, string>(); result = p.begin_ice_isA("::Test::TestIntf"); test(p.end_ice_isA(result)); result = p.begin_ice_isA("::Test::TestIntf", ctx); test(p.end_ice_isA(result)); result = p.begin_ice_ping(); p.end_ice_ping(result); result = p.begin_ice_ping(ctx); p.end_ice_ping(result); result = p.begin_ice_id(); test(p.end_ice_id(result).Equals("::Test::TestIntf")); result = p.begin_ice_id(ctx); test(p.end_ice_id(result).Equals("::Test::TestIntf")); result = p.begin_ice_ids(); test(p.end_ice_ids(result).Length == 2); result = p.begin_ice_ids(ctx); test(p.end_ice_ids(result).Length == 2); if(!collocated) { result = p.begin_ice_getConnection(); test(p.end_ice_getConnection(result) != null); } result = p.begin_op(); p.end_op(result); result = p.begin_op(ctx); p.end_op(result); result = p.begin_opWithResult(); test(p.end_opWithResult(result) == 15); result = p.begin_opWithResult(ctx); test(p.end_opWithResult(result) == 15); result = p.begin_opWithUE(); try { p.end_opWithUE(result); test(false); } catch(Test.TestIntfException) { } result = p.begin_opWithUE(ctx); try { p.end_opWithUE(result); test(false); } catch(Test.TestIntfException) { } } WriteLine("ok"); Write("testing async callback... "); Flush(); { AsyncCallback cb = new AsyncCallback(); Dictionary<string, string> ctx = new Dictionary<string, string>(); Cookie cookie = new Cookie(5); AsyncCallback cbWC = new AsyncCallback(cookie); p.begin_ice_isA("::Test::TestIntf", cb.isA, null); cb.check(); p.begin_ice_isA("::Test::TestIntf", cbWC.isA, cookie); cbWC.check(); p.begin_ice_isA("::Test::TestIntf", ctx, cb.isA, null); cb.check(); p.begin_ice_isA("::Test::TestIntf", ctx, cbWC.isA, cookie); cbWC.check(); p.begin_ice_ping(cb.ping, null); cb.check(); p.begin_ice_ping(cbWC.ping, cookie); cbWC.check(); p.begin_ice_ping(ctx, cb.ping, null); cb.check(); p.begin_ice_ping(ctx, cbWC.ping, cookie); cbWC.check(); p.begin_ice_id(cb.id, null); cb.check(); p.begin_ice_id(cbWC.id, cookie); cbWC.check(); p.begin_ice_id(ctx, cb.id, null); cb.check(); p.begin_ice_id(ctx, cbWC.id, cookie); cbWC.check(); p.begin_ice_ids(cb.ids, null); cb.check(); p.begin_ice_ids(cbWC.ids, cookie); cbWC.check(); p.begin_ice_ids(ctx, cb.ids, null); cb.check(); p.begin_ice_ids(ctx, cbWC.ids, cookie); cbWC.check(); if(!collocated) { p.begin_ice_getConnection(cb.connection, null); cb.check(); p.begin_ice_getConnection(cbWC.connection, cookie); cbWC.check(); } p.begin_op(cb.op, null); cb.check(); p.begin_op(cbWC.op, cookie); cbWC.check(); p.begin_op(ctx, cb.op, null); cb.check(); p.begin_op(ctx, cbWC.op, cookie); cbWC.check(); p.begin_opWithResult(cb.opWithResult, null); cb.check(); p.begin_opWithResult(cbWC.opWithResult, cookie); cbWC.check(); p.begin_opWithResult(ctx, cb.opWithResult, null); cb.check(); p.begin_opWithResult(ctx, cbWC.opWithResult, cookie); cbWC.check(); p.begin_opWithUE(cb.opWithUE, null); cb.check(); p.begin_opWithUE(cbWC.opWithUE, cookie); cbWC.check(); p.begin_opWithUE(ctx, cb.opWithUE, null); cb.check(); p.begin_opWithUE(ctx, cbWC.opWithUE, cookie); cbWC.check(); } WriteLine("ok"); Write("testing response callback... "); Flush(); { ResponseCallback cb = new ResponseCallback(); Dictionary<string, string> ctx = new Dictionary<string, string>(); p.begin_ice_isA("::Test::TestIntf").whenCompleted(cb.isA, null); cb.check(); p.begin_ice_isA("::Test::TestIntf", ctx).whenCompleted(cb.isA, null); cb.check(); p.begin_ice_ping().whenCompleted(cb.ping, null); cb.check(); p.begin_ice_ping(ctx).whenCompleted(cb.ping, null); cb.check(); p.begin_ice_id().whenCompleted(cb.id, null); cb.check(); p.begin_ice_id(ctx).whenCompleted(cb.id, null); cb.check(); p.begin_ice_ids().whenCompleted(cb.ids, null); cb.check(); p.begin_ice_ids(ctx).whenCompleted(cb.ids, null); cb.check(); if(!collocated) { p.begin_ice_getConnection().whenCompleted(cb.connection, null); cb.check(); } p.begin_op().whenCompleted(cb.op, null); cb.check(); p.begin_op(ctx).whenCompleted(cb.op, null); cb.check(); p.begin_opWithResult().whenCompleted(cb.opWithResult, null); cb.check(); p.begin_opWithResult(ctx).whenCompleted(cb.opWithResult, null); cb.check(); p.begin_opWithUE().whenCompleted(cb.op, cb.opWithUE); cb.check(); p.begin_opWithUE(ctx).whenCompleted(cb.op, cb.opWithUE); cb.check(); } WriteLine("ok"); Write("testing lambda callback... "); Flush(); { ResponseCallback cb = new ResponseCallback(); Dictionary<string, string> ctx = new Dictionary<string, string>(); p.begin_ice_isA("::Test::TestIntf").whenCompleted( (bool r) => { cb.isA(r); }, null); cb.check(); p.begin_ice_isA("::Test::TestIntf", ctx).whenCompleted( (bool r) => { cb.isA(r); }, null); cb.check(); p.begin_ice_ping().whenCompleted( () => { cb.ping(); }, null); cb.check(); p.begin_ice_ping(ctx).whenCompleted( () => { cb.ping(); }, null); cb.check(); p.begin_ice_id().whenCompleted( (string id) => { cb.id(id); }, null); cb.check(); p.begin_ice_id(ctx).whenCompleted( (string id) => { cb.id(id); }, null); cb.check(); p.begin_ice_ids().whenCompleted( (string[] ids) => { cb.ids(ids); }, null); cb.check(); p.begin_ice_ids(ctx).whenCompleted( (string[] ids) => { cb.ids(ids); }, null); cb.check(); if(!collocated) { p.begin_ice_getConnection().whenCompleted( (Ice.Connection conn) => { cb.connection(conn); }, null); cb.check(); } p.begin_op().whenCompleted( () => { cb.op(); }, null); cb.check(); p.begin_op(ctx).whenCompleted( () => { cb.op(); }, null); cb.check(); p.begin_opWithResult().whenCompleted( (int r) => { cb.opWithResult(r); }, null); cb.check(); p.begin_opWithResult(ctx).whenCompleted( (int r) => { cb.opWithResult(r); }, null); cb.check(); p.begin_opWithUE().whenCompleted( () => { cb.op(); }, (Ice.Exception ex) => { cb.opWithUE(ex); }); cb.check(); p.begin_opWithUE(ctx).whenCompleted( () => { cb.op(); }, (Ice.Exception ex) => { cb.opWithUE(ex); }); cb.check(); } WriteLine("ok"); Write("testing local exceptions... "); Flush(); { Test.TestIntfPrx indirect = Test.TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); Ice.AsyncResult r; r = indirect.begin_op(); try { indirect.end_op(r); test(false); } catch(Ice.NoEndpointException) { } try { r = ((Test.TestIntfPrx)p.ice_oneway()).begin_opWithResult(); test(false); } catch(System.ArgumentException) { } // // Check that CommunicatorDestroyedException is raised directly. // if(p.ice_getConnection() != null) { Ice.InitializationData initData = new Ice.InitializationData(); initData.properties = communicator.getProperties().ice_clone_(); Ice.Communicator ic = Ice.Util.initialize(initData); Ice.ObjectPrx o = ic.stringToProxy(p.ToString()); Test.TestIntfPrx p2 = Test.TestIntfPrxHelper.checkedCast(o); ic.destroy(); try { p2.begin_op(); test(false); } catch(Ice.CommunicatorDestroyedException) { // Expected. } } } WriteLine("ok"); Write("testing local exceptions with async callback... "); Flush(); { Test.TestIntfPrx i = Test.TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); AsyncCallback cb = new AsyncCallback(); Cookie cookie = new Cookie(5); AsyncCallback cbWC = new AsyncCallback(cookie); i.begin_ice_isA("::Test::TestIntf", cb.isAEx, null); cb.check(); i.begin_ice_isA("::Test::TestIntf", cbWC.isAEx, cookie); cbWC.check(); i.begin_ice_ping(cb.pingEx, null); cb.check(); i.begin_ice_ping(cbWC.pingEx, cookie); cbWC.check(); i.begin_ice_id(cb.idEx, null); cb.check(); i.begin_ice_id(cbWC.idEx, cookie); cbWC.check(); i.begin_ice_ids(cb.idsEx, null); cb.check(); i.begin_ice_ids(cbWC.idsEx, cookie); cbWC.check(); if(!collocated) { i.begin_ice_getConnection(cb.connectionEx, null); cb.check(); i.begin_ice_getConnection(cbWC.connectionEx, cookie); cbWC.check(); } i.begin_op(cb.opEx, null); cb.check(); i.begin_op(cbWC.opEx, cookie); cbWC.check(); } WriteLine("ok"); Write("testing local exceptions with response callback... "); Flush(); { Test.TestIntfPrx i = Test.TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); ExceptionCallback cb = new ExceptionCallback(); i.begin_ice_isA("::Test::TestIntf").whenCompleted(cb.isA, cb.ex); cb.check(); i.begin_ice_ping().whenCompleted(cb.ping, cb.ex); cb.check(); i.begin_ice_id().whenCompleted(cb.id, cb.ex); cb.check(); i.begin_ice_ids().whenCompleted(cb.ids, cb.ex); cb.check(); if(!collocated) { i.begin_ice_getConnection().whenCompleted(cb.connection, cb.ex); cb.check(); } i.begin_op().whenCompleted(cb.op, cb.ex); cb.check(); } WriteLine("ok"); Write("testing local exceptions with lambda callback... "); Flush(); { Test.TestIntfPrx i = Test.TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); ExceptionCallback cb = new ExceptionCallback(); i.begin_ice_isA("::Test::TestIntf").whenCompleted( (bool r) => { cb.isA(r); }, (Ice.Exception ex) => { cb.ex(ex); }); cb.check(); i.begin_ice_ping().whenCompleted( () => { cb.ping(); }, (Ice.Exception ex) => { cb.ex(ex); }); cb.check(); i.begin_ice_id().whenCompleted( (string id) => { cb.id(id); }, (Ice.Exception ex) => { cb.ex(ex); }); cb.check(); i.begin_ice_ids().whenCompleted( (string[] ids) => { cb.ids(ids); }, (Ice.Exception ex) => { cb.ex(ex); }); cb.check(); if(!collocated) { i.begin_ice_getConnection().whenCompleted( (Ice.Connection conn) => { cb.connection(conn); }, (Ice.Exception ex) => { cb.ex(ex); }); cb.check(); } i.begin_op().whenCompleted( () => { cb.op(); }, (Ice.Exception ex) => { cb.ex(ex); }); cb.check(); } WriteLine("ok"); Write("testing exception callback... "); Flush(); { Test.TestIntfPrx i = Test.TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); ExceptionCallback cb = new ExceptionCallback(); i.begin_ice_isA("::Test::TestIntf").whenCompleted(cb.ex); cb.check(); i.begin_op().whenCompleted(cb.ex); cb.check(); i.begin_opWithResult().whenCompleted(cb.ex); cb.check(); i.begin_opWithUE().whenCompleted(cb.ex); cb.check(); // Ensures no exception is called when response is received p.begin_ice_isA("::Test::TestIntf").whenCompleted(cb.noEx); p.begin_op().whenCompleted(cb.noEx); p.begin_opWithResult().whenCompleted(cb.noEx); // If response is a user exception, it should be received. p.begin_opWithUE().whenCompleted(cb.opWithUE); cb.check(); } WriteLine("ok"); Write("testing lambda exception callback... "); Flush(); { Test.TestIntfPrx i = Test.TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); ExceptionCallback cb = new ExceptionCallback(); i.begin_ice_isA("::Test::TestIntf").whenCompleted( (Ice.Exception ex) => { cb.ex(ex); }); cb.check(); i.begin_op().whenCompleted( (Ice.Exception ex) => { cb.ex(ex); }); cb.check(); i.begin_opWithResult().whenCompleted( (Ice.Exception ex) => { cb.ex(ex); }); cb.check(); i.begin_opWithUE().whenCompleted( (Ice.Exception ex) => { cb.ex(ex); }); cb.check(); // Ensures no exception is called when response is received p.begin_ice_isA("::Test::TestIntf").whenCompleted( (Ice.Exception ex) => { cb.noEx(ex); }); p.begin_op().whenCompleted( (Ice.Exception ex) => { cb.noEx(ex); }); p.begin_opWithResult().whenCompleted( (Ice.Exception ex) => { cb.noEx(ex); }); // If response is a user exception, it should be received. p.begin_opWithUE().whenCompleted( (Ice.Exception ex) => { cb.opWithUE(ex); }); cb.check(); } WriteLine("ok"); Write("testing sent callback... "); Flush(); { SentCallback cb = new SentCallback(); p.begin_ice_isA("").whenCompleted(cb.isA, cb.ex).whenSent(cb.sent); cb.check(); p.begin_ice_ping().whenCompleted(cb.ping, cb.ex).whenSent(cb.sent); cb.check(); p.begin_ice_id().whenCompleted(cb.id, cb.ex).whenSent(cb.sent); cb.check(); p.begin_ice_ids().whenCompleted(cb.ids, cb.ex).whenSent(cb.sent); cb.check(); p.begin_op().whenCompleted(cb.op, cb.ex).whenSent(cb.sent); cb.check(); p.begin_op(cb.opAsync, null).whenSent(cb.sentAsync); cb.check(); p.begin_op().whenCompleted(cb.ex).whenSent(cb.sent); cb.check(); List<SentCallback> cbs = new List<SentCallback>(); byte[] seq = new byte[10024]; (new System.Random()).NextBytes(seq); testController.holdAdapter(); try { Ice.AsyncResult r; do { SentCallback cb2 = new SentCallback(); r = p.begin_opWithPayload(seq).whenCompleted(cb2.ex).whenSent(cb2.sent); cbs.Add(cb2); } while(r.sentSynchronously()); } finally { testController.resumeAdapter(); } foreach(SentCallback cb3 in cbs) { cb3.check(); } } WriteLine("ok"); Write("testing lambda sent callback... "); Flush(); { SentCallback cb = new SentCallback(); p.begin_ice_isA("").whenCompleted( (bool r) => { cb.isA(r); }, (Ice.Exception ex) => { cb.ex(ex); } ).whenSent( (bool sentSynchronously) => { cb.sent(sentSynchronously); }); cb.check(); p.begin_ice_ping().whenCompleted( () => { cb.ping(); }, (Ice.Exception ex) => { cb.ex(ex); } ).whenSent( (bool sentSynchronously) => { cb.sent(sentSynchronously); }); cb.check(); p.begin_ice_id().whenCompleted( (string id) => { cb.id(id); }, (Ice.Exception ex) => { cb.ex(ex); } ).whenSent( (bool sentSynchronously) => { cb.sent(sentSynchronously); }); cb.check(); p.begin_ice_ids().whenCompleted( (string[] ids) => { cb.ids(ids); }, (Ice.Exception ex) => { cb.ex(ex); } ).whenSent( (bool sentSynchronously) => { cb.sent(sentSynchronously); }); cb.check(); p.begin_op().whenCompleted( () => { cb.op(); }, (Ice.Exception ex) => { cb.ex(ex); } ).whenSent( (bool sentSynchronously) => { cb.sent(sentSynchronously); }); cb.check(); p.begin_op(cb.opAsync, null).whenSent( (Ice.AsyncResult r) => { cb.sentAsync(r); }); cb.check(); p.begin_op().whenCompleted( (Ice.Exception ex) => { cb.ex(ex); } ).whenSent( (bool sentSynchronously) => { cb.sent(sentSynchronously); }); cb.check(); List<SentCallback> cbs = new List<SentCallback>(); byte[] seq = new byte[10024]; (new System.Random()).NextBytes(seq); testController.holdAdapter(); try { Ice.AsyncResult r; do { SentCallback cb2 = new SentCallback(); r = p.begin_opWithPayload(seq).whenCompleted( (Ice.Exception ex) => { cb2.ex(ex); } ).whenSent( (bool sentSynchronously) => { cb2.sent(sentSynchronously); }); cbs.Add(cb2); } while(r.sentSynchronously()); } finally { testController.resumeAdapter(); } foreach(SentCallback cb3 in cbs) { cb3.check(); } } WriteLine("ok"); Write("testing illegal arguments... "); Flush(); { Ice.AsyncResult result; result = p.begin_op(); p.end_op(result); try { p.end_op(result); test(false); } catch(System.ArgumentException) { } result = p.begin_op(); try { p.end_opWithResult(result); test(false); } catch(System.ArgumentException) { } try { p.end_op(null); test(false); } catch(System.ArgumentException) { } } WriteLine("ok"); Write("testing unexpected exceptions from callback... "); Flush(); { Test.TestIntfPrx q = Test.TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); ThrowType[] throwEx = new ThrowType[]{ ThrowType.LocalException, ThrowType.UserException, ThrowType.OtherException }; for(int i = 0; i < 3; ++i) { Thrower cb = new Thrower(throwEx[i]); p.begin_op(cb.opAsync, null); cb.check(); p.begin_op().whenCompleted(cb.op, null); cb.check(); q.begin_op().whenCompleted(cb.op, cb.ex); cb.check(); p.begin_op().whenCompleted(cb.noOp, cb.ex).whenSent(cb.sent); cb.check(); q.begin_op().whenCompleted(cb.ex); cb.check(); } } WriteLine("ok"); Write("testing unexpected exceptions from callback with lambda... "); Flush(); { Test.TestIntfPrx q = Test.TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); ThrowType[] throwEx = new ThrowType[]{ ThrowType.LocalException, ThrowType.UserException, ThrowType.OtherException }; for(int i = 0; i < 3; ++i) { Thrower cb = new Thrower(throwEx[i]); p.begin_op().whenCompleted( () => { cb.op(); }, null); cb.check(); q.begin_op().whenCompleted( () => { cb.op(); }, (Ice.Exception ex) => { cb.ex(ex); }); cb.check(); p.begin_op().whenCompleted( () => { cb.noOp(); }, (Ice.Exception ex) => { cb.ex(ex); } ).whenSent( (bool sentSynchronously) => { cb.sent(sentSynchronously); }); cb.check(); q.begin_op().whenCompleted( (Ice.Exception ex) => { cb.ex(ex); }); cb.check(); } } WriteLine("ok"); Write("testing batch requests with proxy... "); Flush(); { test(p.ice_batchOneway().begin_ice_flushBatchRequests().sentSynchronously()); Cookie cookie = new Cookie(5); { // // AsyncResult. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); b1.opBatch(); b1.opBatch(); FlushCallback cb = new FlushCallback(cookie); Ice.AsyncResult r = b1.begin_ice_flushBatchRequests(cb.completedAsync, cookie); r.whenSent(cb.sentAsync); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(2)); } if(p.ice_getConnection() != null) { // // AsyncResult exception. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); b1.opBatch(); b1.ice_getConnection().close(false); FlushCallback cb = new FlushCallback(cookie); Ice.AsyncResult r = b1.begin_ice_flushBatchRequests(cb.completedAsync, cookie); r.whenSent(cb.sentAsync); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(1)); } { // // Type-safe. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); b1.opBatch(); b1.opBatch(); FlushCallback cb = new FlushCallback(); Ice.AsyncResult r = b1.begin_ice_flushBatchRequests(); r.whenCompleted(cb.exception); r.whenSent(cb.sent); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(2)); } if(p.ice_getConnection() != null) { // // Type-safe exception. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); b1.opBatch(); b1.ice_getConnection().close(false); FlushCallback cb = new FlushCallback(); Ice.AsyncResult r = b1.begin_ice_flushBatchRequests(); r.whenCompleted(cb.exception); r.whenSent(cb.sent); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(1)); } } WriteLine("ok"); Write("testing batch requests with proxy and lambda... "); Flush(); { test(p.ice_batchOneway().begin_ice_flushBatchRequests().sentSynchronously()); Cookie cookie = new Cookie(5); { // // AsyncResult. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); b1.opBatch(); b1.opBatch(); FlushCallback cb = new FlushCallback(cookie); Ice.AsyncResult r = b1.begin_ice_flushBatchRequests( (Ice.AsyncResult result) => { cb.completedAsync(result); }, cookie); r.whenSent( (Ice.AsyncResult result) => { cb.sentAsync(result); }); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(2)); FlushCallback cb2 = new FlushCallback(cookie); Ice.AsyncResult r2 = b1.begin_ice_flushBatchRequests( (Ice.AsyncResult result) => { cb2.completedAsync(result); }, cookie); r2.whenSent( (Ice.AsyncResult result) => { cb2.sentAsync(result); }); cb2.check(); test(r2.isSent()); test(r2.IsCompleted); } if(p.ice_getConnection() != null) { // // AsyncResult exception. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); b1.opBatch(); b1.ice_getConnection().close(false); FlushCallback cb = new FlushCallback(cookie); Ice.AsyncResult r = b1.begin_ice_flushBatchRequests( (Ice.AsyncResult result) => { cb.completedAsync(result); }, cookie); r.whenSent( (Ice.AsyncResult result) => { cb.sentAsync(result); }); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(1)); } { // // Type-safe. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); b1.opBatch(); b1.opBatch(); FlushCallback cb = new FlushCallback(); Ice.AsyncResult r = b1.begin_ice_flushBatchRequests(); r.whenCompleted( (Ice.Exception ex) => { cb.exception(ex); }); r.whenSent( (bool sentSynchronously) => { cb.sent(sentSynchronously); }); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(2)); } if(p.ice_getConnection() != null) { // // Type-safe exception. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); b1.opBatch(); b1.ice_getConnection().close(false); FlushCallback cb = new FlushCallback(); Ice.AsyncResult r = b1.begin_ice_flushBatchRequests(); r.whenCompleted( (Ice.Exception ex) => { cb.exception(ex); }); r.whenSent( (bool sentSynchronously) => { cb.sent(sentSynchronously); }); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(1)); } } WriteLine("ok"); if(p.ice_getConnection() != null) { Write("testing batch requests with connection... "); Flush(); { Cookie cookie = new Cookie(5); { // // AsyncResult. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy( p.ice_getIdentity()).ice_batchOneway()); b1.opBatch(); b1.opBatch(); FlushCallback cb = new FlushCallback(cookie); Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(cb.completedAsync, cookie); r.whenSent(cb.sentAsync); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(2)); } { // // AsyncResult exception. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy( p.ice_getIdentity()).ice_batchOneway()); b1.opBatch(); b1.ice_getConnection().close(false); FlushExCallback cb = new FlushExCallback(cookie); Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(cb.completedAsync, cookie); r.whenSent(cb.sentAsync); cb.check(); test(!r.isSent()); test(r.IsCompleted); test(p.opBatchCount() == 0); } { // // Type-safe. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy( p.ice_getIdentity()).ice_batchOneway()); b1.opBatch(); b1.opBatch(); FlushCallback cb = new FlushCallback(); Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(); r.whenCompleted(cb.exception); r.whenSent(cb.sent); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(2)); } { // // Type-safe exception. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy( p.ice_getIdentity()).ice_batchOneway()); b1.opBatch(); b1.ice_getConnection().close(false); FlushExCallback cb = new FlushExCallback(); Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(); r.whenCompleted(cb.exception); r.whenSent(cb.sent); cb.check(); test(!r.isSent()); test(r.IsCompleted); test(p.opBatchCount() == 0); } } WriteLine("ok"); } if(p.ice_getConnection() != null) { Write("testing batch requests with connection and lambda... "); Flush(); { Cookie cookie = new Cookie(5); { // // AsyncResult. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy( p.ice_getIdentity()).ice_batchOneway()); b1.opBatch(); b1.opBatch(); FlushCallback cb = new FlushCallback(cookie); Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests( (Ice.AsyncResult result) => { cb.completedAsync(result); }, cookie); r.whenSent( (Ice.AsyncResult result) => { cb.sentAsync(result); }); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(2)); } { // // AsyncResult exception. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy( p.ice_getIdentity()).ice_batchOneway()); b1.opBatch(); b1.ice_getConnection().close(false); FlushExCallback cb = new FlushExCallback(cookie); Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests( (Ice.AsyncResult result) => { cb.completedAsync(result); }, cookie); r.whenSent( (Ice.AsyncResult result) => { cb.sentAsync(result); }); cb.check(); test(!r.isSent()); test(r.IsCompleted); test(p.opBatchCount() == 0); } { // // Type-safe. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy( p.ice_getIdentity()).ice_batchOneway()); b1.opBatch(); b1.opBatch(); FlushCallback cb = new FlushCallback(); Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(); r.whenCompleted( (Ice.Exception ex) => { cb.exception(ex); }); r.whenSent( (bool sentSynchronously) => { cb.sent(sentSynchronously); }); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(2)); } { // // Type-safe exception. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy( p.ice_getIdentity()).ice_batchOneway()); b1.opBatch(); b1.ice_getConnection().close(false); FlushExCallback cb = new FlushExCallback(); Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(); r.whenCompleted( (Ice.Exception ex) => { cb.exception(ex); }); r.whenSent( (bool sentSynchronously) => { cb.sent(sentSynchronously); }); cb.check(); test(!r.isSent()); test(r.IsCompleted); test(p.opBatchCount() == 0); } } WriteLine("ok"); Write("testing batch requests with communicator... "); Flush(); { Cookie cookie = new Cookie(5); { // // AsyncResult - 1 connection. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy( p.ice_getIdentity()).ice_batchOneway()); b1.opBatch(); b1.opBatch(); FlushCallback cb = new FlushCallback(cookie); Ice.AsyncResult r = communicator.begin_flushBatchRequests(cb.completedAsync, cookie); r.whenSent(cb.sentAsync); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(2)); } { // // AsyncResult exception - 1 connection. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy( p.ice_getIdentity()).ice_batchOneway()); b1.opBatch(); b1.ice_getConnection().close(false); FlushCallback cb = new FlushCallback(cookie); Ice.AsyncResult r = communicator.begin_flushBatchRequests(cb.completedAsync, cookie); r.whenSent(cb.sentAsync); cb.check(); test(r.isSent()); // Exceptions are ignored! test(r.IsCompleted); test(p.opBatchCount() == 0); } { // // AsyncResult - 2 connections. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy( p.ice_getIdentity()).ice_batchOneway()); TestIntfPrx b2 = TestIntfPrxHelper.uncheckedCast( p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway()); b2.ice_getConnection(); // Ensure connection is established. b1.opBatch(); b1.opBatch(); b2.opBatch(); b2.opBatch(); FlushCallback cb = new FlushCallback(cookie); Ice.AsyncResult r = communicator.begin_flushBatchRequests(cb.completedAsync, cookie); r.whenSent(cb.sentAsync); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(4)); } { // // AsyncResult exception - 2 connections - 1 failure. // // All connections should be flushed even if there are failures on some connections. // Exceptions should not be reported. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy( p.ice_getIdentity()).ice_batchOneway()); TestIntfPrx b2 = TestIntfPrxHelper.uncheckedCast( p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway()); b2.ice_getConnection(); // Ensure connection is established. b1.opBatch(); b2.opBatch(); b1.ice_getConnection().close(false); FlushCallback cb = new FlushCallback(cookie); Ice.AsyncResult r = communicator.begin_flushBatchRequests(cb.completedAsync, cookie); r.whenSent(cb.sentAsync); cb.check(); test(r.isSent()); // Exceptions are ignored! test(r.IsCompleted); test(p.waitForBatch(1)); } { // // AsyncResult exception - 2 connections - 2 failures. // // The sent callback should be invoked even if all connections fail. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy( p.ice_getIdentity()).ice_batchOneway()); TestIntfPrx b2 = TestIntfPrxHelper.uncheckedCast( p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway()); b2.ice_getConnection(); // Ensure connection is established. b1.opBatch(); b2.opBatch(); b1.ice_getConnection().close(false); b2.ice_getConnection().close(false); FlushCallback cb = new FlushCallback(cookie); Ice.AsyncResult r = communicator.begin_flushBatchRequests(cb.completedAsync, cookie); r.whenSent(cb.sentAsync); cb.check(); test(r.isSent()); // Exceptions are ignored! test(r.IsCompleted); test(p.opBatchCount() == 0); } { // // Type-safe - 1 connection. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy( p.ice_getIdentity()).ice_batchOneway()); b1.opBatch(); b1.opBatch(); FlushCallback cb = new FlushCallback(); Ice.AsyncResult r = communicator.begin_flushBatchRequests(); r.whenCompleted(cb.exception); r.whenSent(cb.sent); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(2)); } { // // Type-safe exception - 1 connection. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy( p.ice_getIdentity()).ice_batchOneway()); b1.opBatch(); b1.ice_getConnection().close(false); FlushCallback cb = new FlushCallback(); Ice.AsyncResult r = communicator.begin_flushBatchRequests(); r.whenCompleted(cb.exception); r.whenSent(cb.sent); cb.check(); test(r.isSent()); // Exceptions are ignored! test(r.IsCompleted); test(p.opBatchCount() == 0); } { // // 2 connections. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy( p.ice_getIdentity()).ice_batchOneway()); TestIntfPrx b2 = TestIntfPrxHelper.uncheckedCast( p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway()); b2.ice_getConnection(); // Ensure connection is established. b1.opBatch(); b1.opBatch(); b2.opBatch(); b2.opBatch(); FlushCallback cb = new FlushCallback(); Ice.AsyncResult r = communicator.begin_flushBatchRequests(); r.whenCompleted(cb.exception); r.whenSent(cb.sent); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(4)); } { // // Exception - 2 connections - 1 failure. // // All connections should be flushed even if there are failures on some connections. // Exceptions should not be reported. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy( p.ice_getIdentity()).ice_batchOneway()); TestIntfPrx b2 = TestIntfPrxHelper.uncheckedCast( p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway()); b2.ice_getConnection(); // Ensure connection is established. b1.opBatch(); b2.opBatch(); b1.ice_getConnection().close(false); FlushCallback cb = new FlushCallback(); Ice.AsyncResult r = communicator.begin_flushBatchRequests(); r.whenCompleted(cb.exception); r.whenSent(cb.sent); cb.check(); test(r.isSent()); // Exceptions are ignored! test(r.IsCompleted); test(p.waitForBatch(1)); } { // // Exception - 2 connections - 2 failures. // // The sent callback should be invoked even if all connections fail. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy( p.ice_getIdentity()).ice_batchOneway()); TestIntfPrx b2 = TestIntfPrxHelper.uncheckedCast( p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway()); b2.ice_getConnection(); // Ensure connection is established. b1.opBatch(); b2.opBatch(); b1.ice_getConnection().close(false); b2.ice_getConnection().close(false); FlushCallback cb = new FlushCallback(); Ice.AsyncResult r = communicator.begin_flushBatchRequests(); r.whenCompleted(cb.exception); r.whenSent(cb.sent); cb.check(); test(r.isSent()); // Exceptions are ignored! test(r.IsCompleted); test(p.opBatchCount() == 0); } } WriteLine("ok"); Write("testing batch requests with communicator with lambda... "); Flush(); { Cookie cookie = new Cookie(5); { // // AsyncResult - 1 connection. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy( p.ice_getIdentity()).ice_batchOneway()); b1.opBatch(); b1.opBatch(); FlushCallback cb = new FlushCallback(cookie); Ice.AsyncResult r = communicator.begin_flushBatchRequests( (Ice.AsyncResult result) => { cb.completedAsync(result); }, cookie); r.whenSent( (Ice.AsyncResult result) => { cb.sentAsync(result); }); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(2)); } { // // AsyncResult exception - 1 connection. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy( p.ice_getIdentity()).ice_batchOneway()); b1.opBatch(); b1.ice_getConnection().close(false); FlushCallback cb = new FlushCallback(cookie); Ice.AsyncResult r = communicator.begin_flushBatchRequests( (Ice.AsyncResult result) => { cb.completedAsync(result); }, cookie); r.whenSent( (Ice.AsyncResult result) => { cb.sentAsync(result); }); cb.check(); test(r.isSent()); // Exceptions are ignored! test(r.IsCompleted); test(p.opBatchCount() == 0); } { // // AsyncResult - 2 connections. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy( p.ice_getIdentity()).ice_batchOneway()); TestIntfPrx b2 = TestIntfPrxHelper.uncheckedCast( p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway()); b2.ice_getConnection(); // Ensure connection is established. b1.opBatch(); b1.opBatch(); b2.opBatch(); b2.opBatch(); FlushCallback cb = new FlushCallback(cookie); Ice.AsyncResult r = communicator.begin_flushBatchRequests( (Ice.AsyncResult result) => { cb.completedAsync(result); }, cookie); r.whenSent( (Ice.AsyncResult result) => { cb.sentAsync(result); }); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(4)); } { // // AsyncResult exception - 2 connections - 1 failure. // // All connections should be flushed even if there are failures on some connections. // Exceptions should not be reported. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy( p.ice_getIdentity()).ice_batchOneway()); TestIntfPrx b2 = TestIntfPrxHelper.uncheckedCast( p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway()); b2.ice_getConnection(); // Ensure connection is established. b1.opBatch(); b2.opBatch(); b1.ice_getConnection().close(false); FlushCallback cb = new FlushCallback(cookie); Ice.AsyncResult r = communicator.begin_flushBatchRequests( (Ice.AsyncResult result) => { cb.completedAsync(result); }, cookie); r.whenSent( (Ice.AsyncResult result) => { cb.sentAsync(result); }); cb.check(); test(r.isSent()); // Exceptions are ignored! test(r.IsCompleted); test(p.waitForBatch(1)); } { // // AsyncResult exception - 2 connections - 2 failures. // // The sent callback should be invoked even if all connections fail. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy( p.ice_getIdentity()).ice_batchOneway()); TestIntfPrx b2 = TestIntfPrxHelper.uncheckedCast( p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway()); b2.ice_getConnection(); // Ensure connection is established. b1.opBatch(); b2.opBatch(); b1.ice_getConnection().close(false); b2.ice_getConnection().close(false); FlushCallback cb = new FlushCallback(cookie); Ice.AsyncResult r = communicator.begin_flushBatchRequests( (Ice.AsyncResult result) => { cb.completedAsync(result); }, cookie); r.whenSent( (Ice.AsyncResult result) => { cb.sentAsync(result); }); cb.check(); test(r.isSent()); // Exceptions are ignored! test(r.IsCompleted); test(p.opBatchCount() == 0); } { // // Type-safe - 1 connection. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy( p.ice_getIdentity()).ice_batchOneway()); b1.opBatch(); b1.opBatch(); FlushCallback cb = new FlushCallback(); Ice.AsyncResult r = communicator.begin_flushBatchRequests(); r.whenCompleted( (Ice.Exception ex) => { cb.exception(ex); }); r.whenSent( (bool sentSynchronously) => { cb.sent(sentSynchronously); }); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(2)); } { // // Type-safe exception - 1 connection. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy( p.ice_getIdentity()).ice_batchOneway()); b1.opBatch(); b1.ice_getConnection().close(false); FlushCallback cb = new FlushCallback(); Ice.AsyncResult r = communicator.begin_flushBatchRequests(); r.whenCompleted( (Ice.Exception ex) => { cb.exception(ex); }); r.whenSent( (bool sentSynchronously) => { cb.sent(sentSynchronously); }); cb.check(); test(r.isSent()); // Exceptions are ignored! test(r.IsCompleted); test(p.opBatchCount() == 0); } { // // 2 connections. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast( p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway()); TestIntfPrx b2 = TestIntfPrxHelper.uncheckedCast( p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway()); b2.ice_getConnection(); // Ensure connection is established. b1.opBatch(); b1.opBatch(); b2.opBatch(); b2.opBatch(); FlushCallback cb = new FlushCallback(); Ice.AsyncResult r = communicator.begin_flushBatchRequests(); r.whenCompleted( (Ice.Exception ex) => { cb.exception(ex); }); r.whenSent( (bool sentSynchronously) => { cb.sent(sentSynchronously); }); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(4)); } { // // Exception - 2 connections - 1 failure. // // All connections should be flushed even if there are failures on some connections. // Exceptions should not be reported. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast( p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway()); TestIntfPrx b2 = TestIntfPrxHelper.uncheckedCast( p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway()); b2.ice_getConnection(); // Ensure connection is established. b1.opBatch(); b2.opBatch(); b1.ice_getConnection().close(false); FlushCallback cb = new FlushCallback(); Ice.AsyncResult r = communicator.begin_flushBatchRequests(); r.whenCompleted( (Ice.Exception ex) => { cb.exception(ex); }); r.whenSent( (bool sentSynchronously) => { cb.sent(sentSynchronously); }); cb.check(); test(r.isSent()); // Exceptions are ignored! test(r.IsCompleted); test(p.waitForBatch(1)); } { // // Exception - 2 connections - 2 failures. // // The sent callback should be invoked even if all connections fail. // test(p.opBatchCount() == 0); TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast( p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway()); TestIntfPrx b2 = TestIntfPrxHelper.uncheckedCast( p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway()); b2.ice_getConnection(); // Ensure connection is established. b1.opBatch(); b2.opBatch(); b1.ice_getConnection().close(false); b2.ice_getConnection().close(false); FlushCallback cb = new FlushCallback(); Ice.AsyncResult r = communicator.begin_flushBatchRequests(); r.whenCompleted( (Ice.Exception ex) => { cb.exception(ex); }); r.whenSent( (bool sentSynchronously) => { cb.sent(sentSynchronously); }); cb.check(); test(r.isSent()); // Exceptions are ignored! test(r.IsCompleted); test(p.opBatchCount() == 0); } } WriteLine("ok"); } Write("testing AsyncResult operations... "); Flush(); { { testController.holdAdapter(); Ice.AsyncResult r1; Ice.AsyncResult r2; try { r1 = p.begin_op(); byte[] seq = new byte[10024]; (new System.Random()).NextBytes(seq); while((r2 = p.begin_opWithPayload(seq)).sentSynchronously()); if(p.ice_getConnection() != null) { test(r1.sentSynchronously() && r1.isSent() && !r1.isCompleted_() || !r1.sentSynchronously() && !r1.isCompleted_()); test(!r2.sentSynchronously() && !r2.isCompleted_()); test(!r1.IsCompleted && !r1.CompletedSynchronously); test(!r2.IsCompleted && !r2.CompletedSynchronously); } } finally { testController.resumeAdapter(); } WaitHandle w1 = r1.AsyncWaitHandle; WaitHandle w2 = r2.AsyncWaitHandle; r1.waitForSent(); test(r1.isSent()); r2.waitForSent(); test(r2.isSent()); r1.waitForCompleted(); test(r1.isCompleted_()); w1.WaitOne(); r2.waitForCompleted(); test(r2.isCompleted_()); w2.WaitOne(); test(r1.getOperation().Equals("op")); test(r2.getOperation().Equals("opWithPayload")); } { Ice.AsyncResult r; // // Twoway // r = p.begin_ice_ping(); test(r.getOperation().Equals("ice_ping")); test(r.getConnection() == null); // Expected test(r.getCommunicator() == communicator); test(r.getProxy() == p); p.end_ice_ping(r); Test.TestIntfPrx p2; // // Oneway // p2 = p.ice_oneway() as Test.TestIntfPrx; r = p2.begin_ice_ping(); test(r.getOperation().Equals("ice_ping")); test(r.getConnection() == null); // Expected test(r.getCommunicator() == communicator); test(r.getProxy() == p2); // // Batch request via proxy // p2 = p.ice_batchOneway() as Test.TestIntfPrx; p2.ice_ping(); r = p2.begin_ice_flushBatchRequests(); test(r.getConnection() == null); // Expected test(r.getCommunicator() == communicator); test(r.getProxy() == p2); p2.end_ice_flushBatchRequests(r); if(p.ice_getConnection() != null) { // // Batch request via connection // Ice.Connection con = p.ice_getConnection(); p2 = p.ice_batchOneway() as Test.TestIntfPrx; p2.ice_ping(); r = con.begin_flushBatchRequests(); test(r.getConnection() == con); test(r.getCommunicator() == communicator); test(r.getProxy() == null); // Expected con.end_flushBatchRequests(r); // // Batch request via communicator // p2 = p.ice_batchOneway() as Test.TestIntfPrx; p2.ice_ping(); r = communicator.begin_flushBatchRequests(); test(r.getConnection() == null); // Expected test(r.getCommunicator() == communicator); test(r.getProxy() == null); // Expected communicator.end_flushBatchRequests(r); } } if(p.ice_getConnection() != null) { Ice.AsyncResult r1 = null; Ice.AsyncResult r2 = null; testController.holdAdapter(); try { Ice.AsyncResult r = null; byte[] seq = new byte[10024]; for(int i = 0; i < 200; ++i) // 2MB { r = p.begin_opWithPayload(seq); } test(!r.isSent()); r1 = p.begin_ice_ping(); r2 = p.begin_ice_id(); r1.cancel(); r2.cancel(); try { p.end_ice_ping(r1); test(false); } catch(Ice.InvocationCanceledException) { } try { p.end_ice_id(r2); test(false); } catch(Ice.InvocationCanceledException) { } } finally { testController.resumeAdapter(); p.ice_ping(); test(!r1.isSent() && r1.isCompleted_()); test(!r2.isSent() && r2.isCompleted_()); } testController.holdAdapter(); try { r1 = p.begin_op(); r2 = p.begin_ice_id(); r1.waitForSent(); r2.waitForSent(); r1.cancel(); r2.cancel(); try { p.end_op(r1); test(false); } catch(Ice.InvocationCanceledException) { } try { p.end_ice_id(r2); test(false); } catch(Ice.InvocationCanceledException) { } } finally { testController.resumeAdapter(); } } } WriteLine("ok"); if(p.ice_getConnection() != null) { Write("testing close connection with sending queue... "); Flush(); { byte[] seq = new byte[1024 * 10]; // // Send multiple opWithPayload, followed by a close and followed by multiple opWithPaylod. // The goal is to make sure that none of the opWithPayload fail even if the server closes // the connection gracefully in between. // int maxQueue = 2; bool done = false; while(!done && maxQueue < 50) { done = true; p.ice_ping(); List<Ice.AsyncResult> results = new List<Ice.AsyncResult>(); for(int i = 0; i < maxQueue; ++i) { results.Add(p.begin_opWithPayload(seq)); } if(!p.begin_close(false).isSent()) { for(int i = 0; i < maxQueue; i++) { Ice.AsyncResult r = p.begin_opWithPayload(seq); results.Add(r); if(r.isSent()) { done = false; maxQueue *= 2; break; } } } else { maxQueue *= 2; done = false; } foreach(Ice.AsyncResult q in results) { q.waitForCompleted(); try { q.throwLocalException(); } catch(Ice.LocalException) { test(false); } } } } WriteLine("ok"); } p.shutdown(); }
public static void allTests(Ice.Communicator communicator) { string sref = "test:default -p 12010"; Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); Test.TestIntfPrx p = Test.TestIntfPrxHelper.uncheckedCast(obj); sref = "testController:tcp -p 12011"; obj = communicator.stringToProxy(sref); test(obj != null); Test.TestIntfControllerPrx testController = Test.TestIntfControllerPrxHelper.uncheckedCast(obj); Console.Out.Write("testing begin/end invocation... "); Console.Out.Flush(); { Ice.AsyncResult result; Dictionary<string, string> ctx = new Dictionary<string, string>(); result = p.begin_ice_isA("::Test::TestIntf"); test(p.end_ice_isA(result)); result = p.begin_ice_isA("::Test::TestIntf", ctx); test(p.end_ice_isA(result)); result = p.begin_ice_ping(); p.end_ice_ping(result); result = p.begin_ice_ping(ctx); p.end_ice_ping(result); result = p.begin_ice_id(); test(p.end_ice_id(result).Equals("::Test::TestIntf")); result = p.begin_ice_id(ctx); test(p.end_ice_id(result).Equals("::Test::TestIntf")); result = p.begin_ice_ids(); test(p.end_ice_ids(result).Length == 2); result = p.begin_ice_ids(ctx); test(p.end_ice_ids(result).Length == 2); result = p.begin_op(); p.end_op(result); result = p.begin_op(ctx); p.end_op(result); result = p.begin_opWithResult(); test(p.end_opWithResult(result) == 15); result = p.begin_opWithResult(ctx); test(p.end_opWithResult(result) == 15); result = p.begin_opWithUE(); try { p.end_opWithUE(result); test(false); } catch(Test.TestIntfException) { } result = p.begin_opWithUE(ctx); try { p.end_opWithUE(result); test(false); } catch(Test.TestIntfException) { } } Console.Out.WriteLine("ok"); Console.Out.Write("testing async callback... "); Console.Out.Flush(); { AsyncCallback cb = new AsyncCallback(); Dictionary<string, string> ctx = new Dictionary<string, string>(); Cookie cookie = new Cookie(5); AsyncCallback cbWC = new AsyncCallback(cookie); p.begin_ice_isA("::Test::TestIntf", cb.isA, null); cb.check(); p.begin_ice_isA("::Test::TestIntf", cbWC.isA, cookie); cbWC.check(); p.begin_ice_isA("::Test::TestIntf", ctx, cb.isA, null); cb.check(); p.begin_ice_isA("::Test::TestIntf", ctx, cbWC.isA, cookie); cbWC.check(); p.begin_ice_ping(cb.ping, null); cb.check(); p.begin_ice_ping(cbWC.ping, cookie); cbWC.check(); p.begin_ice_ping(ctx, cb.ping, null); cb.check(); p.begin_ice_ping(ctx, cbWC.ping, cookie); cbWC.check(); p.begin_ice_id(cb.id, null); cb.check(); p.begin_ice_id(cbWC.id, cookie); cbWC.check(); p.begin_ice_id(ctx, cb.id, null); cb.check(); p.begin_ice_id(ctx, cbWC.id, cookie); cbWC.check(); p.begin_ice_ids(cb.ids, null); cb.check(); p.begin_ice_ids(cbWC.ids, cookie); cbWC.check(); p.begin_ice_ids(ctx, cb.ids, null); cb.check(); p.begin_ice_ids(ctx, cbWC.ids, cookie); cbWC.check(); p.begin_op(cb.op, null); cb.check(); p.begin_op(cbWC.op, cookie); cbWC.check(); p.begin_op(ctx, cb.op, null); cb.check(); p.begin_op(ctx, cbWC.op, cookie); cbWC.check(); p.begin_opWithResult(cb.opWithResult, null); cb.check(); p.begin_opWithResult(cbWC.opWithResult, cookie); cbWC.check(); p.begin_opWithResult(ctx, cb.opWithResult, null); cb.check(); p.begin_opWithResult(ctx, cbWC.opWithResult, cookie); cbWC.check(); p.begin_opWithUE(cb.opWithUE, null); cb.check(); p.begin_opWithUE(cbWC.opWithUE, cookie); cbWC.check(); p.begin_opWithUE(ctx, cb.opWithUE, null); cb.check(); p.begin_opWithUE(ctx, cbWC.opWithUE, cookie); cbWC.check(); } Console.Out.WriteLine("ok"); Console.Out.Write("testing response callback... "); Console.Out.Flush(); { ResponseCallback cb = new ResponseCallback(); Dictionary<string, string> ctx = new Dictionary<string, string>(); p.begin_ice_isA("::Test::TestIntf").whenCompleted(cb.isA, null); cb.check(); p.begin_ice_isA("::Test::TestIntf", ctx).whenCompleted(cb.isA, null); cb.check(); p.begin_ice_ping().whenCompleted(cb.ping, null); cb.check(); p.begin_ice_ping(ctx).whenCompleted(cb.ping, null); cb.check(); p.begin_ice_id().whenCompleted(cb.id, null); cb.check(); p.begin_ice_id(ctx).whenCompleted(cb.id, null); cb.check(); p.begin_ice_ids().whenCompleted(cb.ids, null); cb.check(); p.begin_ice_ids(ctx).whenCompleted(cb.ids, null); cb.check(); p.begin_op().whenCompleted(cb.op, null); cb.check(); p.begin_op(ctx).whenCompleted(cb.op, null); cb.check(); p.begin_opWithResult().whenCompleted(cb.opWithResult, null); cb.check(); p.begin_opWithResult(ctx).whenCompleted(cb.opWithResult, null); cb.check(); p.begin_opWithUE().whenCompleted(cb.op, cb.opWithUE); cb.check(); p.begin_opWithUE(ctx).whenCompleted(cb.op, cb.opWithUE); cb.check(); } Console.Out.WriteLine("ok"); Console.Out.Write("testing local exceptions... "); Console.Out.Flush(); { Test.TestIntfPrx indirect = Test.TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); Ice.AsyncResult r; r = indirect.begin_op(); try { indirect.end_op(r); test(false); } catch(Ice.NoEndpointException) { } try { r = ((Test.TestIntfPrx)p.ice_oneway()).begin_opWithResult(); test(false); } catch(System.ArgumentException) { } // // Check that CommunicatorDestroyedException is raised directly. // Ice.InitializationData initData = new Ice.InitializationData(); initData.properties = communicator.getProperties().ice_clone_(); Ice.Communicator ic = Ice.Util.initialize(initData); Ice.ObjectPrx o = ic.stringToProxy(p.ToString()); Test.TestIntfPrx p2 = Test.TestIntfPrxHelper.checkedCast(o); ic.destroy(); try { p2.begin_op(); test(false); } catch(Ice.CommunicatorDestroyedException) { // Expected. } } Console.Out.WriteLine("ok"); Console.Out.Write("testing local exceptions with async callback... "); Console.Out.Flush(); { Test.TestIntfPrx i = Test.TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); AsyncCallback cb = new AsyncCallback(); Cookie cookie = new Cookie(5); AsyncCallback cbWC = new AsyncCallback(cookie); i.begin_ice_isA("::Test::TestIntf", cb.isAEx, null); cb.check(); i.begin_ice_isA("::Test::TestIntf", cbWC.isAEx, cookie); cbWC.check(); i.begin_ice_ping(cb.pingEx, null); cb.check(); i.begin_ice_ping(cbWC.pingEx, cookie); cbWC.check(); i.begin_ice_id(cb.idEx, null); cb.check(); i.begin_ice_id(cbWC.idEx, cookie); cbWC.check(); i.begin_ice_ids(cb.idsEx, null); cb.check(); i.begin_ice_ids(cbWC.idsEx, cookie); cbWC.check(); i.begin_op(cb.opEx, null); cb.check(); i.begin_op(cbWC.opEx, cookie); cbWC.check(); } Console.Out.WriteLine("ok"); Console.Out.Write("testing local exceptions with response callback... "); Console.Out.Flush(); { Test.TestIntfPrx i = Test.TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); ExceptionCallback cb = new ExceptionCallback(); i.begin_ice_isA("::Test::TestIntf").whenCompleted(cb.isA, cb.ex); cb.check(); i.begin_ice_ping().whenCompleted(cb.ping, cb.ex); cb.check(); i.begin_ice_id().whenCompleted(cb.id, cb.ex); cb.check(); i.begin_ice_ids().whenCompleted(cb.ids, cb.ex); cb.check(); i.begin_op().whenCompleted(cb.op, cb.ex); cb.check(); } Console.Out.WriteLine("ok"); Console.Out.Write("testing exception callback... "); Console.Out.Flush(); { Test.TestIntfPrx i = Test.TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); ExceptionCallback cb = new ExceptionCallback(); i.begin_ice_isA("::Test::TestIntf").whenCompleted(cb.ex); cb.check(); i.begin_op().whenCompleted(cb.ex); cb.check(); i.begin_opWithResult().whenCompleted(cb.ex); cb.check(); i.begin_opWithUE().whenCompleted(cb.ex); cb.check(); // Ensures no exception is called when response is received p.begin_ice_isA("::Test::TestIntf").whenCompleted(cb.noEx); p.begin_op().whenCompleted(cb.noEx); p.begin_opWithResult().whenCompleted(cb.noEx); // If response is a user exception, it should be received. p.begin_opWithUE().whenCompleted(cb.opWithUE); cb.check(); } Console.Out.WriteLine("ok"); Console.Out.Write("testing sent callback... "); Console.Out.Flush(); { SentCallback cb = new SentCallback(); p.begin_ice_isA("").whenCompleted(cb.isA, cb.ex).whenSent(cb.sent); cb.check(); p.begin_ice_ping().whenCompleted(cb.ping, cb.ex).whenSent(cb.sent); cb.check(); p.begin_ice_id().whenCompleted(cb.id, cb.ex).whenSent(cb.sent); cb.check(); p.begin_ice_ids().whenCompleted(cb.ids, cb.ex).whenSent(cb.sent); cb.check(); p.begin_op().whenCompleted(cb.op, cb.ex).whenSent(cb.sent); cb.check(); p.begin_op(cb.opAsync, null).whenSent((Ice.AsyncCallback)cb.sentAsync); cb.check(); p.begin_op().whenCompleted(cb.ex).whenSent(cb.sent); cb.check(); List<SentCallback> cbs = new List<SentCallback>(); byte[] seq = new byte[10024]; (new System.Random()).NextBytes(seq); testController.holdAdapter(); try { Ice.AsyncResult r; do { SentCallback cb2 = new SentCallback(); r = p.begin_opWithPayload(seq).whenCompleted(cb2.ex).whenSent(cb2.sent); cbs.Add(cb2); } while(r.sentSynchronously()); } finally { testController.resumeAdapter(); } foreach(SentCallback cb3 in cbs) { cb3.check(); } } Console.Out.WriteLine("ok"); Console.Out.Write("testing illegal arguments... "); Console.Out.Flush(); { Ice.AsyncResult result; result = p.begin_op(); p.end_op(result); try { p.end_op(result); test(false); } catch(System.ArgumentException) { } result = p.begin_op(); try { p.end_opWithResult(result); test(false); } catch(System.ArgumentException) { } try { p.end_op(null); test(false); } catch(System.ArgumentException) { } } Console.Out.WriteLine("ok"); Console.Out.Write("testing unexpected exceptions from callback... "); Console.Out.Flush(); { Test.TestIntfPrx q = Test.TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); ThrowType[] throwEx = new ThrowType[]{ ThrowType.LocalException, ThrowType.UserException, ThrowType.OtherException }; for(int i = 0; i < 3; ++i) { Thrower cb = new Thrower(throwEx[i]); p.begin_op(cb.opAsync, null); cb.check(); p.begin_op().whenCompleted(cb.op, null); cb.check(); q.begin_op().whenCompleted(cb.op, cb.ex); cb.check(); p.begin_op().whenCompleted(cb.noOp, cb.ex).whenSent(cb.sent); cb.check(); q.begin_op().whenCompleted(cb.ex); cb.check(); } } Console.Out.WriteLine("ok"); Console.Out.Write("testing batch requests with proxy... "); Console.Out.Flush(); { Cookie cookie = new Cookie(5); { // // AsyncResult. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); b1.opBatch(); b1.opBatch(); FlushCallback cb = new FlushCallback(cookie); Ice.AsyncResult r = b1.begin_ice_flushBatchRequests(cb.completedAsync, cookie); r.whenSent((Ice.AsyncCallback)cb.sentAsync); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(2)); } { // // AsyncResult exception. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); b1.opBatch(); b1.ice_getConnection().close(false); FlushExCallback cb = new FlushExCallback(cookie); Ice.AsyncResult r = b1.begin_ice_flushBatchRequests(cb.completedAsync, cookie); r.whenSent((Ice.AsyncCallback)cb.sentAsync); cb.check(); test(!r.isSent()); test(r.IsCompleted); test(p.opBatchCount() == 0); } { // // Type-safe. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); b1.opBatch(); b1.opBatch(); FlushCallback cb = new FlushCallback(); Ice.AsyncResult r = b1.begin_ice_flushBatchRequests(); r.whenCompleted(cb.exception); r.whenSent((Ice.SentCallback)cb.sent); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(2)); } { // // Type-safe exception. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); b1.opBatch(); b1.ice_getConnection().close(false); FlushExCallback cb = new FlushExCallback(); Ice.AsyncResult r = b1.begin_ice_flushBatchRequests(); r.whenCompleted(cb.exception); r.whenSent((Ice.SentCallback)cb.sent); cb.check(); test(!r.isSent()); test(r.IsCompleted); test(p.opBatchCount() == 0); } } Console.Out.WriteLine("ok"); Console.Out.Write("testing batch requests with connection... "); Console.Out.Flush(); { Cookie cookie = new Cookie(5); { // // AsyncResult. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); b1.opBatch(); b1.opBatch(); FlushCallback cb = new FlushCallback(cookie); Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(cb.completedAsync, cookie); r.whenSent((Ice.AsyncCallback)cb.sentAsync); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(2)); } { // // AsyncResult exception. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); b1.opBatch(); b1.ice_getConnection().close(false); FlushExCallback cb = new FlushExCallback(cookie); Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(cb.completedAsync, cookie); r.whenSent((Ice.AsyncCallback)cb.sentAsync); cb.check(); test(!r.isSent()); test(r.IsCompleted); test(p.opBatchCount() == 0); } { // // Type-safe. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); b1.opBatch(); b1.opBatch(); FlushCallback cb = new FlushCallback(); Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(); r.whenCompleted(cb.exception); r.whenSent((Ice.SentCallback)cb.sent); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(2)); } { // // Type-safe exception. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); b1.opBatch(); b1.ice_getConnection().close(false); FlushExCallback cb = new FlushExCallback(); Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(); r.whenCompleted(cb.exception); r.whenSent((Ice.SentCallback)cb.sent); cb.check(); test(!r.isSent()); test(r.IsCompleted); test(p.opBatchCount() == 0); } } Console.Out.WriteLine("ok"); Console.Out.Write("testing batch requests with communicator... "); Console.Out.Flush(); { Cookie cookie = new Cookie(5); { // // AsyncResult - 1 connection. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); b1.opBatch(); b1.opBatch(); FlushCallback cb = new FlushCallback(cookie); Ice.AsyncResult r = communicator.begin_flushBatchRequests(cb.completedAsync, cookie); r.whenSent((Ice.AsyncCallback)cb.sentAsync); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(2)); } { // // AsyncResult exception - 1 connection. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); b1.opBatch(); b1.ice_getConnection().close(false); FlushCallback cb = new FlushCallback(cookie); Ice.AsyncResult r = communicator.begin_flushBatchRequests(cb.completedAsync, cookie); r.whenSent((Ice.AsyncCallback)cb.sentAsync); cb.check(); test(r.isSent()); // Exceptions are ignored! test(r.IsCompleted); test(p.opBatchCount() == 0); } { // // AsyncResult - 2 connections. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); TestIntfPrx b2 = (TestIntfPrx)p.ice_connectionId("2").ice_batchOneway(); b2.ice_getConnection(); // Ensure connection is established. b1.opBatch(); b1.opBatch(); b2.opBatch(); b2.opBatch(); FlushCallback cb = new FlushCallback(cookie); Ice.AsyncResult r = communicator.begin_flushBatchRequests(cb.completedAsync, cookie); r.whenSent((Ice.AsyncCallback)cb.sentAsync); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(4)); } { // // AsyncResult exception - 2 connections - 1 failure. // // All connections should be flushed even if there are failures on some connections. // Exceptions should not be reported. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); TestIntfPrx b2 = (TestIntfPrx)p.ice_connectionId("2").ice_batchOneway(); b2.ice_getConnection(); // Ensure connection is established. b1.opBatch(); b2.opBatch(); b1.ice_getConnection().close(false); FlushCallback cb = new FlushCallback(cookie); Ice.AsyncResult r = communicator.begin_flushBatchRequests(cb.completedAsync, cookie); r.whenSent((Ice.AsyncCallback)cb.sentAsync); cb.check(); test(r.isSent()); // Exceptions are ignored! test(r.IsCompleted); test(p.waitForBatch(1)); } { // // AsyncResult exception - 2 connections - 2 failures. // // The sent callback should be invoked even if all connections fail. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); TestIntfPrx b2 = (TestIntfPrx)p.ice_connectionId("2").ice_batchOneway(); b2.ice_getConnection(); // Ensure connection is established. b1.opBatch(); b2.opBatch(); b1.ice_getConnection().close(false); b2.ice_getConnection().close(false); FlushCallback cb = new FlushCallback(cookie); Ice.AsyncResult r = communicator.begin_flushBatchRequests(cb.completedAsync, cookie); r.whenSent((Ice.AsyncCallback)cb.sentAsync); cb.check(); test(r.isSent()); // Exceptions are ignored! test(r.IsCompleted); test(p.opBatchCount() == 0); } { // // Type-safe - 1 connection. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); b1.opBatch(); b1.opBatch(); FlushCallback cb = new FlushCallback(); Ice.AsyncResult r = communicator.begin_flushBatchRequests(); r.whenCompleted(cb.exception); r.whenSent((Ice.SentCallback)cb.sent); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(2)); } { // // Type-safe exception - 1 connection. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); b1.opBatch(); b1.ice_getConnection().close(false); FlushCallback cb = new FlushCallback(); Ice.AsyncResult r = communicator.begin_flushBatchRequests(); r.whenCompleted(cb.exception); r.whenSent((Ice.SentCallback)cb.sent); cb.check(); test(r.isSent()); // Exceptions are ignored! test(r.IsCompleted); test(p.opBatchCount() == 0); } { // // 2 connections. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); TestIntfPrx b2 = (TestIntfPrx)p.ice_connectionId("2").ice_batchOneway(); b2.ice_getConnection(); // Ensure connection is established. b1.opBatch(); b1.opBatch(); b2.opBatch(); b2.opBatch(); FlushCallback cb = new FlushCallback(); Ice.AsyncResult r = communicator.begin_flushBatchRequests(); r.whenCompleted(cb.exception); r.whenSent((Ice.SentCallback)cb.sent); cb.check(); test(r.isSent()); test(r.IsCompleted); test(p.waitForBatch(4)); } { // // Exception - 2 connections - 1 failure. // // All connections should be flushed even if there are failures on some connections. // Exceptions should not be reported. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); TestIntfPrx b2 = (TestIntfPrx)p.ice_connectionId("2").ice_batchOneway(); b2.ice_getConnection(); // Ensure connection is established. b1.opBatch(); b2.opBatch(); b1.ice_getConnection().close(false); FlushCallback cb = new FlushCallback(); Ice.AsyncResult r = communicator.begin_flushBatchRequests(); r.whenCompleted(cb.exception); r.whenSent((Ice.SentCallback)cb.sent); cb.check(); test(r.isSent()); // Exceptions are ignored! test(r.IsCompleted); test(p.waitForBatch(1)); } { // // Exception - 2 connections - 2 failures. // // The sent callback should be invoked even if all connections fail. // test(p.opBatchCount() == 0); TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway(); TestIntfPrx b2 = (TestIntfPrx)p.ice_connectionId("2").ice_batchOneway(); b2.ice_getConnection(); // Ensure connection is established. b1.opBatch(); b2.opBatch(); b1.ice_getConnection().close(false); b2.ice_getConnection().close(false); FlushCallback cb = new FlushCallback(); Ice.AsyncResult r = communicator.begin_flushBatchRequests(); r.whenCompleted(cb.exception); r.whenSent((Ice.SentCallback)cb.sent); cb.check(); test(r.isSent()); // Exceptions are ignored! test(r.IsCompleted); test(p.opBatchCount() == 0); } } Console.Out.WriteLine("ok"); Console.Out.Write("testing AsyncResult operations... "); Console.Out.Flush(); { testController.holdAdapter(); Ice.AsyncResult r1; Ice.AsyncResult r2; try { r1 = p.begin_op(); byte[] seq = new byte[10024]; (new System.Random()).NextBytes(seq); while((r2 = p.begin_opWithPayload(seq)).sentSynchronously()); test(r1.sentSynchronously() && r1.isSent() && !r1.isCompleted_() || !r1.sentSynchronously() && !r1.isCompleted_()); test(!r2.sentSynchronously() && !r2.isCompleted_()); test(!r1.IsCompleted && !r1.CompletedSynchronously); test(!r2.IsCompleted && !r2.CompletedSynchronously); } finally { testController.resumeAdapter(); } WaitHandle w1 = r1.AsyncWaitHandle; WaitHandle w2 = r2.AsyncWaitHandle; r1.waitForSent(); test(r1.isSent()); r2.waitForSent(); test(r2.isSent()); r1.waitForCompleted(); test(r1.isCompleted_()); w1.WaitOne(); r2.waitForCompleted(); test(r2.isCompleted_()); w2.WaitOne(); test(r1.getOperation().Equals("op")); test(r2.getOperation().Equals("opWithPayload")); } Console.Out.WriteLine("ok"); p.shutdown(); }
public static void allTests(Ice.Communicator communicator) { string @ref = "communicator:default -p 12010"; RemoteCommunicatorPrx com = RemoteCommunicatorPrxHelper.uncheckedCast(communicator.stringToProxy(@ref)); System.Random rand = new System.Random(unchecked((int)System.DateTime.Now.Ticks)); Console.Out.Write("testing binding with single endpoint... "); Console.Out.Flush(); { RemoteObjectAdapterPrx adapter = com.createObjectAdapter("Adapter", "default"); TestIntfPrx test1 = adapter.getTestIntf(); TestIntfPrx test2 = adapter.getTestIntf(); test(test1.ice_getConnection() == test2.ice_getConnection()); test1.ice_ping(); test2.ice_ping(); com.deactivateObjectAdapter(adapter); TestIntfPrx test3 = TestIntfPrxHelper.uncheckedCast(test1); test(test3.ice_getConnection() == test1.ice_getConnection()); test(test3.ice_getConnection() == test2.ice_getConnection()); try { test3.ice_ping(); test(false); } catch(Ice.ConnectionRefusedException) { } } Console.Out.WriteLine("ok"); Console.Out.Write("testing binding with multiple endpoints... "); Console.Out.Flush(); { ArrayList adapters = new ArrayList(); adapters.Add(com.createObjectAdapter("Adapter11", "default")); adapters.Add(com.createObjectAdapter("Adapter12", "default")); adapters.Add(com.createObjectAdapter("Adapter13", "default")); // // Ensure that when a connection is opened it's reused for new // proxies and that all endpoints are eventually tried. // List<string> names = new List<string>(); names.Add("Adapter11"); names.Add("Adapter12"); names.Add("Adapter13"); while(names.Count > 0) { ArrayList adpts = new ArrayList(adapters); TestIntfPrx test1 = createTestIntfPrx(adpts); shuffle(ref adpts); TestIntfPrx test2 = createTestIntfPrx(adpts); shuffle(ref adpts); TestIntfPrx test3 = createTestIntfPrx(adpts); test1.ice_ping(); test(test1.ice_getConnection() == test2.ice_getConnection()); test(test2.ice_getConnection() == test3.ice_getConnection()); names.Remove(test1.getAdapterName()); test1.ice_getConnection().close(false); } // // Ensure that the proxy correctly caches the connection (we // always send the request over the same connection.) // { foreach(RemoteObjectAdapterPrx adpt in adapters) { adpt.getTestIntf().ice_ping(); } TestIntfPrx t = createTestIntfPrx(adapters); string name = t.getAdapterName(); int nRetry = 10; int i; for(i = 0; i < nRetry && t.getAdapterName().Equals(name); i++); test(i == nRetry); foreach(RemoteObjectAdapterPrx adpt in adapters) { adpt.getTestIntf().ice_getConnection().close(false); } } // // Deactivate an adapter and ensure that we can still // establish the connection to the remaining adapters. // com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[0]); names.Add("Adapter12"); names.Add("Adapter13"); while(names.Count > 0) { ArrayList adpts = new ArrayList(adapters); TestIntfPrx test1 = createTestIntfPrx(adpts); shuffle(ref adpts); TestIntfPrx test2 = createTestIntfPrx(adpts); shuffle(ref adpts); TestIntfPrx test3 = createTestIntfPrx(adpts); test(test1.ice_getConnection() == test2.ice_getConnection()); test(test2.ice_getConnection() == test3.ice_getConnection()); names.Remove(test1.getAdapterName()); test1.ice_getConnection().close(false); } // // Deactivate an adapter and ensure that we can still // establish the connection to the remaining adapter. // com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]); TestIntfPrx obj = createTestIntfPrx(adapters); test(obj.getAdapterName().Equals("Adapter12")); deactivate(com, adapters); } Console.Out.WriteLine("ok"); Console.Out.Write("testing binding with multiple random endpoints... "); Console.Out.Flush(); { RemoteObjectAdapterPrx[] adapters = new RemoteObjectAdapterPrx[5]; adapters[0] = com.createObjectAdapter("AdapterRandom11", "default"); adapters[1] = com.createObjectAdapter("AdapterRandom12", "default"); adapters[2] = com.createObjectAdapter("AdapterRandom13", "default"); adapters[3] = com.createObjectAdapter("AdapterRandom14", "default"); adapters[4] = com.createObjectAdapter("AdapterRandom15", "default"); int count; if(IceInternal.AssemblyUtil.platform_ == IceInternal.AssemblyUtil.Platform.Windows) { count = 20; } else { count = 60; } int adapterCount = adapters.Length; while(--count > 0) { TestIntfPrx[] proxies; if(IceInternal.AssemblyUtil.platform_ == IceInternal.AssemblyUtil.Platform.Windows) { if(count == 10) { com.deactivateObjectAdapter(adapters[4]); --adapterCount; } proxies = new TestIntfPrx[10]; } else { if(count < 60 && count % 10 == 0) { com.deactivateObjectAdapter(adapters[count / 10 - 1]); --adapterCount; } proxies = new TestIntfPrx[40]; } int i; for(i = 0; i < proxies.Length; ++i) { RemoteObjectAdapterPrx[] adpts = new RemoteObjectAdapterPrx[rand.Next(adapters.Length)]; if(adpts.Length == 0) { adpts = new RemoteObjectAdapterPrx[1]; } for(int j = 0; j < adpts.Length; ++j) { adpts[j] = adapters[rand.Next(adapters.Length)]; } proxies[i] = createTestIntfPrx(new ArrayList(adpts)); } for(i = 0; i < proxies.Length; i++) { proxies[i].begin_getAdapterName(); } for(i = 0; i < proxies.Length; i++) { try { proxies[i].ice_ping(); } catch(Ice.LocalException) { } } ArrayList connections = new ArrayList(); for(i = 0; i < proxies.Length; i++) { if(proxies[i].ice_getCachedConnection() != null) { if(!connections.Contains(proxies[i].ice_getCachedConnection())) { connections.Add(proxies[i].ice_getCachedConnection()); } } } test(connections.Count <= adapterCount); foreach(RemoteObjectAdapterPrx a in adapters) { try { a.getTestIntf().ice_getConnection().close(false); } catch(Ice.LocalException) { // Expected if adapter is down. } } } } Console.Out.WriteLine("ok"); Console.Out.Write("testing binding with multiple endpoints and AMI... "); Console.Out.Flush(); { ArrayList adapters = new ArrayList(); adapters.Add(com.createObjectAdapter("AdapterAMI11", "default")); adapters.Add(com.createObjectAdapter("AdapterAMI12", "default")); adapters.Add(com.createObjectAdapter("AdapterAMI13", "default")); // // Ensure that when a connection is opened it's reused for new // proxies and that all endpoints are eventually tried. // List<string> names = new List<string>(); names.Add("AdapterAMI11"); names.Add("AdapterAMI12"); names.Add("AdapterAMI13"); while(names.Count > 0) { ArrayList adpts = new ArrayList(adapters); TestIntfPrx test1 = createTestIntfPrx(adpts); shuffle(ref adpts); TestIntfPrx test2 = createTestIntfPrx(adpts); shuffle(ref adpts); TestIntfPrx test3 = createTestIntfPrx(adpts); test1.ice_ping(); test(test1.ice_getConnection() == test2.ice_getConnection()); test(test2.ice_getConnection() == test3.ice_getConnection()); names.Remove(getAdapterNameWithAMI(test1)); test1.ice_getConnection().close(false); } // // Ensure that the proxy correctly caches the connection (we // always send the request over the same connection.) // { foreach(RemoteObjectAdapterPrx adpt in adapters) { adpt.getTestIntf().ice_ping(); } TestIntfPrx t = createTestIntfPrx(adapters); string name = getAdapterNameWithAMI(t); int nRetry = 10; int i; for(i = 0; i < nRetry && getAdapterNameWithAMI(t).Equals(name); i++); test(i == nRetry); foreach(RemoteObjectAdapterPrx adpt in adapters) { adpt.getTestIntf().ice_getConnection().close(false); } } // // Deactivate an adapter and ensure that we can still // establish the connection to the remaining adapters. // com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[0]); names.Add("AdapterAMI12"); names.Add("AdapterAMI13"); while(names.Count > 0) { ArrayList adpts = new ArrayList(adapters); TestIntfPrx test1 = createTestIntfPrx(adpts); shuffle(ref adpts); TestIntfPrx test2 = createTestIntfPrx(adpts); shuffle(ref adpts); TestIntfPrx test3 = createTestIntfPrx(adpts); test(test1.ice_getConnection() == test2.ice_getConnection()); test(test2.ice_getConnection() == test3.ice_getConnection()); names.Remove(getAdapterNameWithAMI(test1)); test1.ice_getConnection().close(false); } // // Deactivate an adapter and ensure that we can still // establish the connection to the remaining adapter. // com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]); TestIntfPrx obj = createTestIntfPrx(adapters); test(getAdapterNameWithAMI(obj).Equals("AdapterAMI12")); deactivate(com, adapters); } Console.Out.WriteLine("ok"); Console.Out.Write("testing random endpoint selection... "); Console.Out.Flush(); { ArrayList adapters = new ArrayList(); adapters.Add(com.createObjectAdapter("Adapter21", "default")); adapters.Add(com.createObjectAdapter("Adapter22", "default")); adapters.Add(com.createObjectAdapter("Adapter23", "default")); TestIntfPrx obj = createTestIntfPrx(adapters); test(obj.ice_getEndpointSelection() == Ice.EndpointSelectionType.Random); List<string> names = new List<string>(); names.Add("Adapter21"); names.Add("Adapter22"); names.Add("Adapter23"); while(names.Count > 0) { names.Remove(obj.getAdapterName()); obj.ice_getConnection().close(false); } obj = TestIntfPrxHelper.uncheckedCast(obj.ice_endpointSelection(Ice.EndpointSelectionType.Random)); test(obj.ice_getEndpointSelection() == Ice.EndpointSelectionType.Random); names.Add("Adapter21"); names.Add("Adapter22"); names.Add("Adapter23"); while(names.Count > 0) { names.Remove(obj.getAdapterName()); obj.ice_getConnection().close(false); } deactivate(com, adapters); } Console.Out.WriteLine("ok"); Console.Out.Write("testing ordered endpoint selection... "); Console.Out.Flush(); { ArrayList adapters = new ArrayList(); adapters.Add(com.createObjectAdapter("Adapter31", "default")); adapters.Add(com.createObjectAdapter("Adapter32", "default")); adapters.Add(com.createObjectAdapter("Adapter33", "default")); TestIntfPrx obj = createTestIntfPrx(adapters); obj = TestIntfPrxHelper.uncheckedCast(obj.ice_endpointSelection(Ice.EndpointSelectionType.Ordered)); test(obj.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered); int nRetry = 3; int i; // // Ensure that endpoints are tried in order by deactiving the adapters // one after the other. // for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter31"); i++); test(i == nRetry); com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[0]); for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter32"); i++); test(i == nRetry); com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[1]); for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter33"); i++); test(i == nRetry); com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]); try { obj.getAdapterName(); } catch(Ice.ConnectionRefusedException) { } Ice.Endpoint[] endpoints = obj.ice_getEndpoints(); adapters.Clear(); // // Now, re-activate the adapters with the same endpoints in the opposite // order. // adapters.Add(com.createObjectAdapter("Adapter36", endpoints[2].ToString())); for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter36"); i++); test(i == nRetry); obj.ice_getConnection().close(false); adapters.Add(com.createObjectAdapter("Adapter35", endpoints[1].ToString())); for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter35"); i++); test(i == nRetry); obj.ice_getConnection().close(false); adapters.Add(com.createObjectAdapter("Adapter34", endpoints[0].ToString())); for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter34"); i++); test(i == nRetry); deactivate(com, adapters); } Console.Out.WriteLine("ok"); Console.Out.Write("testing per request binding with single endpoint... "); Console.Out.Flush(); { RemoteObjectAdapterPrx adapter = com.createObjectAdapter("Adapter41", "default"); TestIntfPrx test1 = TestIntfPrxHelper.uncheckedCast(adapter.getTestIntf().ice_connectionCached(false)); TestIntfPrx test2 = TestIntfPrxHelper.uncheckedCast(adapter.getTestIntf().ice_connectionCached(false)); test(!test1.ice_isConnectionCached()); test(!test2.ice_isConnectionCached()); test(test1.ice_getConnection() == test2.ice_getConnection()); test1.ice_ping(); com.deactivateObjectAdapter(adapter); TestIntfPrx test3 = TestIntfPrxHelper.uncheckedCast(test1); try { test(test3.ice_getConnection() == test1.ice_getConnection()); test(false); } catch(Ice.ConnectionRefusedException) { } } Console.Out.WriteLine("ok"); Console.Out.Write("testing per request binding with multiple endpoints... "); Console.Out.Flush(); { ArrayList adapters = new ArrayList(); adapters.Add(com.createObjectAdapter("Adapter51", "default")); adapters.Add(com.createObjectAdapter("Adapter52", "default")); adapters.Add(com.createObjectAdapter("Adapter53", "default")); TestIntfPrx obj = TestIntfPrxHelper.uncheckedCast(createTestIntfPrx(adapters).ice_connectionCached(false)); test(!obj.ice_isConnectionCached()); List<string> names = new List<string>(); names.Add("Adapter51"); names.Add("Adapter52"); names.Add("Adapter53"); while(names.Count > 0) { names.Remove(obj.getAdapterName()); } com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[0]); names.Add("Adapter52"); names.Add("Adapter53"); while(names.Count > 0) { names.Remove(obj.getAdapterName()); } com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]); test(obj.getAdapterName().Equals("Adapter52")); deactivate(com, adapters); } Console.Out.WriteLine("ok"); Console.Out.Write("testing per request binding with multiple endpoints and AMI... "); Console.Out.Flush(); { ArrayList adapters = new ArrayList(); adapters.Add(com.createObjectAdapter("AdapterAMI51", "default")); adapters.Add(com.createObjectAdapter("AdapterAMI52", "default")); adapters.Add(com.createObjectAdapter("AdapterAMI53", "default")); TestIntfPrx obj = TestIntfPrxHelper.uncheckedCast(createTestIntfPrx(adapters).ice_connectionCached(false)); test(!obj.ice_isConnectionCached()); List<string> names = new List<string>(); names.Add("AdapterAMI51"); names.Add("AdapterAMI52"); names.Add("AdapterAMI53"); while(names.Count > 0) { names.Remove(getAdapterNameWithAMI(obj)); } com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[0]); names.Add("AdapterAMI52"); names.Add("AdapterAMI53"); while(names.Count > 0) { names.Remove(getAdapterNameWithAMI(obj)); } com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]); test(getAdapterNameWithAMI(obj).Equals("AdapterAMI52")); deactivate(com, adapters); } Console.Out.WriteLine("ok"); Console.Out.Write("testing per request binding and ordered endpoint selection... "); Console.Out.Flush(); { ArrayList adapters = new ArrayList(); adapters.Add(com.createObjectAdapter("Adapter61", "default")); adapters.Add(com.createObjectAdapter("Adapter62", "default")); adapters.Add(com.createObjectAdapter("Adapter63", "default")); TestIntfPrx obj = createTestIntfPrx(adapters); obj = TestIntfPrxHelper.uncheckedCast(obj.ice_endpointSelection(Ice.EndpointSelectionType.Ordered)); test(obj.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered); obj = TestIntfPrxHelper.uncheckedCast(obj.ice_connectionCached(false)); test(!obj.ice_isConnectionCached()); int nRetry = 3; int i; // // Ensure that endpoints are tried in order by deactiving the adapters // one after the other. // for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter61"); i++); test(i == nRetry); com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[0]); for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter62"); i++); test(i == nRetry); com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[1]); for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter63"); i++); test(i == nRetry); com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]); try { obj.getAdapterName(); } catch(Ice.ConnectionRefusedException) { } Ice.Endpoint[] endpoints = obj.ice_getEndpoints(); adapters.Clear(); // // Now, re-activate the adapters with the same endpoints in the opposite // order. // adapters.Add(com.createObjectAdapter("Adapter66", endpoints[2].ToString())); for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter66"); i++); test(i == nRetry); adapters.Add(com.createObjectAdapter("Adapter65", endpoints[1].ToString())); for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter65"); i++); test(i == nRetry); adapters.Add(com.createObjectAdapter("Adapter64", endpoints[0].ToString())); for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter64"); i++); test(i == nRetry); deactivate(com, adapters); } Console.Out.WriteLine("ok"); Console.Out.Write("testing per request binding and ordered endpoint selection and AMI... "); Console.Out.Flush(); { ArrayList adapters = new ArrayList(); adapters.Add(com.createObjectAdapter("AdapterAMI61", "default")); adapters.Add(com.createObjectAdapter("AdapterAMI62", "default")); adapters.Add(com.createObjectAdapter("AdapterAMI63", "default")); TestIntfPrx obj = createTestIntfPrx(adapters); obj = TestIntfPrxHelper.uncheckedCast(obj.ice_endpointSelection(Ice.EndpointSelectionType.Ordered)); test(obj.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered); obj = TestIntfPrxHelper.uncheckedCast(obj.ice_connectionCached(false)); test(!obj.ice_isConnectionCached()); int nRetry = 3; int i; // // Ensure that endpoints are tried in order by deactiving the adapters // one after the other. // for(i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI61"); i++); test(i == nRetry); com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[0]); for(i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI62"); i++); test(i == nRetry); com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[1]); for(i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI63"); i++); test(i == nRetry); com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]); try { obj.getAdapterName(); } catch(Ice.ConnectionRefusedException) { } Ice.Endpoint[] endpoints = obj.ice_getEndpoints(); adapters.Clear(); // // Now, re-activate the adapters with the same endpoints in the opposite // order. // adapters.Add(com.createObjectAdapter("AdapterAMI66", endpoints[2].ToString())); for(i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI66"); i++); test(i == nRetry); adapters.Add(com.createObjectAdapter("AdapterAMI65", endpoints[1].ToString())); for(i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI65"); i++); test(i == nRetry); adapters.Add(com.createObjectAdapter("AdapterAMI64", endpoints[0].ToString())); for(i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI64"); i++); test(i == nRetry); deactivate(com, adapters); } Console.Out.WriteLine("ok"); Console.Out.Write("testing endpoint mode filtering... "); Console.Out.Flush(); { ArrayList adapters = new ArrayList(); adapters.Add(com.createObjectAdapter("Adapter71", "default")); adapters.Add(com.createObjectAdapter("Adapter72", "udp")); TestIntfPrx obj = createTestIntfPrx(adapters); test(obj.getAdapterName().Equals("Adapter71")); TestIntfPrx testUDP = TestIntfPrxHelper.uncheckedCast(obj.ice_datagram()); test(obj.ice_getConnection() != testUDP.ice_getConnection()); try { testUDP.getAdapterName(); } catch(Ice.TwowayOnlyException) { } } Console.Out.WriteLine("ok"); if(communicator.getProperties().getProperty("Ice.Plugin.IceSSL").Length > 0) { Console.Out.Write("testing unsecure vs. secure endpoints... "); Console.Out.Flush(); { ArrayList adapters = new ArrayList(); adapters.Add(com.createObjectAdapter("Adapter81", "ssl")); adapters.Add(com.createObjectAdapter("Adapter82", "tcp")); TestIntfPrx obj = createTestIntfPrx(adapters); int i; for(i = 0; i < 5; i++) { test(obj.getAdapterName().Equals("Adapter82")); obj.ice_getConnection().close(false); } TestIntfPrx testSecure = TestIntfPrxHelper.uncheckedCast(obj.ice_secure(true)); test(testSecure.ice_isSecure()); testSecure = TestIntfPrxHelper.uncheckedCast(obj.ice_secure(false)); test(!testSecure.ice_isSecure()); testSecure = TestIntfPrxHelper.uncheckedCast(obj.ice_secure(true)); test(testSecure.ice_isSecure()); test(obj.ice_getConnection() != testSecure.ice_getConnection()); com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[1]); for(i = 0; i < 5; i++) { test(obj.getAdapterName().Equals("Adapter81")); obj.ice_getConnection().close(false); } com.createObjectAdapter("Adapter83", (obj.ice_getEndpoints()[1]).ToString()); // Reactive tcp OA. for(i = 0; i < 5; i++) { test(obj.getAdapterName().Equals("Adapter83")); obj.ice_getConnection().close(false); } com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[0]); try { testSecure.ice_ping(); test(false); } catch(Ice.ConnectionRefusedException) { } deactivate(com, adapters); } Console.Out.WriteLine("ok"); } com.shutdown(); }
public static void allTests(Ice.Communicator communicator) #endif { ServerManagerPrx manager = ServerManagerPrxHelper.checkedCast( communicator.stringToProxy("ServerManager :default -p 12010")); test(manager != null); TestLocatorPrx locator = TestLocatorPrxHelper.uncheckedCast(communicator.getDefaultLocator()); test(locator != null); TestLocatorRegistryPrx registry = TestLocatorRegistryPrxHelper.checkedCast(locator.getRegistry()); test(registry != null); Write("testing stringToProxy... "); Flush(); Ice.ObjectPrx @base = communicator.stringToProxy("test @ TestAdapter"); Ice.ObjectPrx base2 = communicator.stringToProxy("test @ TestAdapter"); Ice.ObjectPrx base3 = communicator.stringToProxy("test"); Ice.ObjectPrx base4 = communicator.stringToProxy("ServerManager"); Ice.ObjectPrx base5 = communicator.stringToProxy("test2"); Ice.ObjectPrx base6 = communicator.stringToProxy("test @ ReplicatedAdapter"); WriteLine("ok"); Write("testing ice_locator and ice_getLocator... "); test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), communicator.getDefaultLocator()) == 0); Ice.LocatorPrx anotherLocator = Ice.LocatorPrxHelper.uncheckedCast(communicator.stringToProxy("anotherLocator")); @base = @base.ice_locator(anotherLocator); test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), anotherLocator) == 0); communicator.setDefaultLocator(null); @base = communicator.stringToProxy("test @ TestAdapter"); test(@base.ice_getLocator() == null); @base = @base.ice_locator(anotherLocator); test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), anotherLocator) == 0); communicator.setDefaultLocator(locator); @base = communicator.stringToProxy("test @ TestAdapter"); test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), communicator.getDefaultLocator()) == 0); // // We also test ice_router/ice_getRouter (perhaps we should add a // test/Ice/router test?) // test(@base.ice_getRouter() == null); Ice.RouterPrx anotherRouter = Ice.RouterPrxHelper.uncheckedCast(communicator.stringToProxy("anotherRouter")); @base = @base.ice_router(anotherRouter); test(Ice.Util.proxyIdentityCompare(@base.ice_getRouter(), anotherRouter) == 0); Ice.RouterPrx router = Ice.RouterPrxHelper.uncheckedCast(communicator.stringToProxy("dummyrouter")); communicator.setDefaultRouter(router); @base = communicator.stringToProxy("test @ TestAdapter"); test(Ice.Util.proxyIdentityCompare(@base.ice_getRouter(), communicator.getDefaultRouter()) == 0); communicator.setDefaultRouter(null); @base = communicator.stringToProxy("test @ TestAdapter"); test(@base.ice_getRouter() == null); WriteLine("ok"); Write("starting server... "); Flush(); manager.startServer(); WriteLine("ok"); Write("testing checked cast... "); Flush(); TestIntfPrx obj = TestIntfPrxHelper.checkedCast(@base); test(obj != null); TestIntfPrx obj2 = TestIntfPrxHelper.checkedCast(base2); test(obj2 != null); TestIntfPrx obj3 = TestIntfPrxHelper.checkedCast(base3); test(obj3 != null); ServerManagerPrx obj4 = ServerManagerPrxHelper.checkedCast(base4); test(obj4 != null); TestIntfPrx obj5 = TestIntfPrxHelper.checkedCast(base5); test(obj5 != null); TestIntfPrx obj6 = TestIntfPrxHelper.checkedCast(base6); test(obj6 != null); WriteLine("ok"); Write("testing id@AdapterId indirect proxy... "); Flush(); obj.shutdown(); manager.startServer(); try { obj2.ice_ping(); } catch(Ice.LocalException) { test(false); } WriteLine("ok"); Write("testing id@ReplicaGroupId indirect proxy... "); Flush(); obj.shutdown(); manager.startServer(); try { obj6.ice_ping(); } catch(Ice.LocalException) { test(false); } WriteLine("ok"); Write("testing identity indirect proxy... "); Flush(); obj.shutdown(); manager.startServer(); try { obj3.ice_ping(); } catch(Ice.LocalException) { test(false); } try { obj2.ice_ping(); } catch(Ice.LocalException) { test(false); } obj.shutdown(); manager.startServer(); try { obj2.ice_ping(); } catch(Ice.LocalException) { test(false); } try { obj3.ice_ping(); } catch(Ice.LocalException) { test(false); } obj.shutdown(); manager.startServer(); try { obj2.ice_ping(); } catch(Ice.LocalException) { test(false); } obj.shutdown(); manager.startServer(); try { obj3.ice_ping(); } catch(Ice.LocalException) { test(false); } obj.shutdown(); manager.startServer(); try { obj5 = TestIntfPrxHelper.checkedCast(base5); obj5.ice_ping(); } catch(Ice.LocalException) { test(false); } WriteLine("ok"); Write("testing proxy with unknown identity... "); Flush(); try { @base = communicator.stringToProxy("unknown/unknown"); @base.ice_ping(); test(false); } catch(Ice.NotRegisteredException ex) { test(ex.kindOfObject.Equals("object")); test(ex.id.Equals("unknown/unknown")); } WriteLine("ok"); Write("testing proxy with unknown adapter... "); Flush(); try { @base = communicator.stringToProxy("test @ TestAdapterUnknown"); @base.ice_ping(); test(false); } catch(Ice.NotRegisteredException ex) { test(ex.kindOfObject.Equals("object adapter")); test(ex.id.Equals("TestAdapterUnknown")); } WriteLine("ok"); Write("testing locator cache timeout... "); Flush(); int count = locator.getRequestCount(); communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache. test(++count == locator.getRequestCount()); communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache. test(++count == locator.getRequestCount()); communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout. test(count == locator.getRequestCount()); System.Threading.Thread.Sleep(1200); // 1200ms communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout. test(++count == locator.getRequestCount()); communicator.stringToProxy("test").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache. count += 2; test(count == locator.getRequestCount()); communicator.stringToProxy("test").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout test(count == locator.getRequestCount()); System.Threading.Thread.Sleep(1200); // 1200ms communicator.stringToProxy("test").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout count += 2; test(count == locator.getRequestCount()); communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(-1).ice_ping(); test(count == locator.getRequestCount()); communicator.stringToProxy("test").ice_locatorCacheTimeout(-1).ice_ping(); test(count == locator.getRequestCount()); communicator.stringToProxy("test@TestAdapter").ice_ping(); test(count == locator.getRequestCount()); communicator.stringToProxy("test").ice_ping(); test(count == locator.getRequestCount()); test(communicator.stringToProxy("test").ice_locatorCacheTimeout(99).ice_getLocatorCacheTimeout() == 99); WriteLine("ok"); Write("testing proxy from server... "); Flush(); obj = TestIntfPrxHelper.checkedCast(communicator.stringToProxy("test@TestAdapter")); HelloPrx hello = obj.getHello(); test(hello.ice_getAdapterId().Equals("TestAdapter")); hello.sayHello(); hello = obj.getReplicatedHello(); test(hello.ice_getAdapterId().Equals("ReplicatedAdapter")); hello.sayHello(); WriteLine("ok"); Write("testing locator request queuing... "); Flush(); hello = (HelloPrx)obj.getReplicatedHello().ice_locatorCacheTimeout(0).ice_connectionCached(false); count = locator.getRequestCount(); hello.ice_ping(); test(++count == locator.getRequestCount()); List<Ice.AsyncResult<Test.Callback_Hello_sayHello> > results = new List<Ice.AsyncResult<Test.Callback_Hello_sayHello> >(); for(int i = 0; i < 1000; i++) { Ice.AsyncResult<Test.Callback_Hello_sayHello> result = hello.begin_sayHello(). whenCompleted( () => { }, (Ice.Exception ex) => { test(false); }); results.Add(result); } foreach(Ice.AsyncResult<Test.Callback_Hello_sayHello> result in results) { result.waitForCompleted(); } results.Clear(); test(locator.getRequestCount() > count && locator.getRequestCount() < count + 999); if(locator.getRequestCount() > count + 800) { Write("queuing = " + (locator.getRequestCount() - count)); } count = locator.getRequestCount(); hello = (HelloPrx)hello.ice_adapterId("unknown"); for(int i = 0; i < 1000; i++) { Ice.AsyncResult<Test.Callback_Hello_sayHello> result = hello.begin_sayHello(). whenCompleted( () => { test(false); }, (Ice.Exception ex) => { test(ex is Ice.NotRegisteredException); }); results.Add(result); } foreach(Ice.AsyncResult<Test.Callback_Hello_sayHello> result in results) { result.waitForCompleted(); } results.Clear(); // XXX: // Take into account the retries. test(locator.getRequestCount() > count && locator.getRequestCount() < count + 1999); if(locator.getRequestCount() > count + 800) { Write("queuing = " + (locator.getRequestCount() - count)); } WriteLine("ok"); Write("testing adapter locator cache... "); Flush(); try { communicator.stringToProxy("test@TestAdapter3").ice_ping(); test(false); } catch(Ice.NotRegisteredException ex) { test(ex.kindOfObject == "object adapter"); test(ex.id.Equals("TestAdapter3")); } registry.setAdapterDirectProxy("TestAdapter3", locator.findAdapterById("TestAdapter")); try { communicator.stringToProxy("test@TestAdapter3").ice_ping(); registry.setAdapterDirectProxy("TestAdapter3", communicator.stringToProxy("dummy:tcp")); communicator.stringToProxy("test@TestAdapter3").ice_ping(); } catch(Ice.LocalException) { test(false); } try { communicator.stringToProxy("test@TestAdapter3").ice_locatorCacheTimeout(0).ice_ping(); test(false); } catch(Ice.LocalException) { } try { communicator.stringToProxy("test@TestAdapter3").ice_ping(); test(false); } catch(Ice.LocalException) { } registry.setAdapterDirectProxy("TestAdapter3", locator.findAdapterById("TestAdapter")); try { communicator.stringToProxy("test@TestAdapter3").ice_ping(); } catch(Ice.LocalException) { test(false); } WriteLine("ok"); Write("testing well-known object locator cache... "); Flush(); registry.addObject(communicator.stringToProxy("test3@TestUnknown")); try { communicator.stringToProxy("test3").ice_ping(); test(false); } catch(Ice.NotRegisteredException ex) { test(ex.kindOfObject == "object adapter"); test(ex.id.Equals("TestUnknown")); } registry.addObject(communicator.stringToProxy("test3@TestAdapter4")); // Update registry.setAdapterDirectProxy("TestAdapter4", communicator.stringToProxy("dummy:tcp")); try { communicator.stringToProxy("test3").ice_ping(); test(false); } catch(Ice.LocalException) { } registry.setAdapterDirectProxy("TestAdapter4", locator.findAdapterById("TestAdapter")); try { communicator.stringToProxy("test3").ice_ping(); } catch(Ice.LocalException) { test(false); } registry.setAdapterDirectProxy("TestAdapter4", communicator.stringToProxy("dummy:tcp")); try { communicator.stringToProxy("test3").ice_ping(); } catch(Ice.LocalException) { test(false); } try { communicator.stringToProxy("test@TestAdapter4").ice_locatorCacheTimeout(0).ice_ping(); test(false); } catch(Ice.LocalException) { } try { communicator.stringToProxy("test@TestAdapter4").ice_ping(); test(false); } catch(Ice.LocalException) { } try { communicator.stringToProxy("test3").ice_ping(); test(false); } catch(Ice.LocalException) { } registry.addObject(communicator.stringToProxy("test3@TestAdapter")); try { communicator.stringToProxy("test3").ice_ping(); } catch(Ice.LocalException) { test(false); } registry.addObject(communicator.stringToProxy("test4")); try { communicator.stringToProxy("test4").ice_ping(); test(false); } catch(Ice.NoEndpointException) { } WriteLine("ok"); Write("testing locator cache background updates... "); Flush(); { Ice.InitializationData initData = new Ice.InitializationData(); initData.properties = communicator.getProperties().ice_clone_(); initData.properties.setProperty("Ice.BackgroundLocatorCacheUpdates", "1"); Ice.Communicator ic = Ice.Util.initialize(initData); registry.setAdapterDirectProxy("TestAdapter5", locator.findAdapterById("TestAdapter")); registry.addObject(communicator.stringToProxy("test3@TestAdapter")); count = locator.getRequestCount(); ic.stringToProxy("test@TestAdapter5").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache. ic.stringToProxy("test3").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache. count += 3; test(count == locator.getRequestCount()); registry.setAdapterDirectProxy("TestAdapter5", null); registry.addObject(communicator.stringToProxy("test3:tcp")); ic.stringToProxy("test@TestAdapter5").ice_locatorCacheTimeout(10).ice_ping(); // 10s timeout. ic.stringToProxy("test3").ice_locatorCacheTimeout(10).ice_ping(); // 10s timeout. test(count == locator.getRequestCount()); System.Threading.Thread.Sleep(1200); // The following request should trigger the background // updates but still use the cached endpoints and // therefore succeed. ic.stringToProxy("test@TestAdapter5").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout. ic.stringToProxy("test3").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout. try { while(true) { ic.stringToProxy("test@TestAdapter5").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout. System.Threading.Thread.Sleep(10); } } catch(Ice.LocalException) { // Expected to fail once they endpoints have been updated in the background. } try { while(true) { ic.stringToProxy("test3").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout. System.Threading.Thread.Sleep(10); } } catch(Ice.LocalException) { // Expected to fail once they endpoints have been updated in the background. } ic.destroy(); } WriteLine("ok"); Write("testing proxy from server after shutdown... "); Flush(); hello = obj.getReplicatedHello(); obj.shutdown(); manager.startServer(); hello.sayHello(); WriteLine("ok"); Write("testing object migration... "); Flush(); hello = HelloPrxHelper.checkedCast(communicator.stringToProxy("hello")); obj.migrateHello(); hello.ice_getConnection().close(false); hello.sayHello(); obj.migrateHello(); hello.sayHello(); obj.migrateHello(); hello.sayHello(); WriteLine("ok"); Write("testing locator encoding resolution... "); Flush(); hello = HelloPrxHelper.checkedCast(communicator.stringToProxy("hello")); count = locator.getRequestCount(); communicator.stringToProxy("test@TestAdapter").ice_encodingVersion(Ice.Util.Encoding_1_1).ice_ping(); test(count == locator.getRequestCount()); communicator.stringToProxy("test@TestAdapter10").ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping(); test(++count == locator.getRequestCount()); communicator.stringToProxy("test -e 1.0@TestAdapter10-2").ice_ping(); test(++count == locator.getRequestCount()); WriteLine("ok"); Write("shutdown server... "); Flush(); obj.shutdown(); WriteLine("ok"); Write("testing whether server is gone... "); Flush(); try { obj2.ice_ping(); test(false); } catch(Ice.LocalException) { } try { obj3.ice_ping(); test(false); } catch(Ice.LocalException) { } try { obj5.ice_ping(); test(false); } catch(Ice.LocalException) { } WriteLine("ok"); #if !SILVERLIGHT Write("testing indirect proxies to collocated objects... "); Flush(); // // Set up test for calling a collocated object through an // indirect, adapterless reference. // Ice.Properties properties = communicator.getProperties(); properties.setProperty("Ice.PrintAdapterReady", "0"); Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("Hello", "default"); adapter.setLocator(locator); Ice.Identity id = new Ice.Identity(); id.name = Guid.NewGuid().ToString(); registry.addObject(adapter.add(new HelloI(), id)); adapter.activate(); HelloPrx helloPrx = HelloPrxHelper.checkedCast( communicator.stringToProxy("\"" + communicator.identityToString(id) + "\"")); test(helloPrx.ice_getConnection() == null); adapter.deactivate(); WriteLine("ok"); Write("shutdown server manager... "); Flush(); manager.shutdown(); WriteLine("ok"); #else manager.shutdown(); #endif }
internal static void twoways(Ice.Communicator communicator, Test.MyClassPrx p) { { byte[] i = new byte[_length]; for(int c = 0; c < _length; ++c) { i[c] = (byte)c; } byte[] o; byte[] r; r = p.opAByteS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { List<byte> i = new List<byte>(_length); for(int c = 0; c < _length; ++c) { i.Add((byte)c); } List<byte> o; List<byte> r; r = p.opLByteS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { LinkedList<byte> i = new LinkedList<byte>(); for(int c = 0; c < _length; ++c) { i.AddLast((byte)c); } LinkedList<byte> o; LinkedList<byte> r; r = p.opKByteS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Queue<byte> i = new Queue<byte>(); for(int c = 0; c < _length; ++c) { i.Enqueue((byte)c); } Queue<byte> o; Queue<byte> r; r = p.opQByteS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Stack<byte> i = new Stack<byte>(); for(int c = 0; c < _length; ++c) { i.Push((byte)c); } Stack<byte> o; Stack<byte> r; r = p.opSByteS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { CByteS i = new CByteS(_length); for(int c = 0; c < _length; ++c) { i.Add((byte)c); } CByteS o; CByteS r; r = p.opCByteS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { bool[] i = new bool[_length]; for(int c = 0; c < _length; ++c) { i[c] = c % 1 == 1; } bool[] o; bool[] r; r = p.opABoolS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { List<bool> i = new List<bool>(_length); for(int c = 0; c < _length; ++c) { i.Add(c % 1 == 1); } List<bool> o; List<bool> r; r = p.opLBoolS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { LinkedList<bool> i = new LinkedList<bool>(); for(int c = 0; c < _length; ++c) { i.AddLast(c % 1 == 1); } LinkedList<bool> o; LinkedList<bool> r; r = p.opKBoolS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Queue<bool> i = new Queue<bool>(); for(int c = 0; c < _length; ++c) { i.Enqueue(c % 1 == 1); } Queue<bool> o; Queue<bool> r; r = p.opQBoolS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Stack<bool> i = new Stack<bool>(); for(int c = 0; c < _length; ++c) { i.Push(c % 1 == 1); } Stack<bool> o; Stack<bool> r; r = p.opSBoolS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { CBoolS i = new CBoolS(_length); for(int c = 0; c < _length; ++c) { i.Add(c % 1 == 1); } CBoolS o; CBoolS r; r = p.opCBoolS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { short[] i = new short[_length]; for(int c = 0; c < _length; ++c) { i[c] = (short)c; } short[] o; short[] r; { r = p.opAShortS(i, out o); } test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { List<short> i = new List<short>(_length); for(int c = 0; c < _length; ++c) { i.Add((short)c); } List<short> o; List<short> r; r = p.opLShortS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { LinkedList<short> i = new LinkedList<short>(); for(int c = 0; c < _length; ++c) { i.AddLast((short)c); } LinkedList<short> o; LinkedList<short> r; r = p.opKShortS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Queue<short> i = new Queue<short>(); for(int c = 0; c < _length; ++c) { i.Enqueue((short)c); } Queue<short> o; Queue<short> r; r = p.opQShortS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Stack<short> i = new Stack<short>(); for(int c = 0; c < _length; ++c) { i.Push((short)c); } Stack<short> o; Stack<short> r; r = p.opSShortS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { CShortS i = new CShortS(_length); for(int c = 0; c < _length; ++c) { i.Add((short)c); } CShortS o; CShortS r; r = p.opCShortS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { int[] i = new int[_length]; for(int c = 0; c < _length; ++c) { i[c] = (int)c; } int[] o; int[] r; r = p.opAIntS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { List<int> i = new List<int>(_length); for(int c = 0; c < _length; ++c) { i.Add((int)c); } List<int> o; List<int> r; r = p.opLIntS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { LinkedList<int> i = new LinkedList<int>(); for(int c = 0; c < _length; ++c) { i.AddLast((int)c); } LinkedList<int> o; LinkedList<int> r; r = p.opKIntS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Queue<int> i = new Queue<int>(); for(int c = 0; c < _length; ++c) { i.Enqueue((int)c); } Queue<int> o; Queue<int> r; r = p.opQIntS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Stack<int> i = new Stack<int>(); for(int c = 0; c < _length; ++c) { i.Push((int)c); } Stack<int> o; Stack<int> r; r = p.opSIntS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { CIntS i = new CIntS(_length); for(int c = 0; c < _length; ++c) { i.Add((int)c); } CIntS o; CIntS r; r = p.opCIntS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { long[] i = new long[_length]; for(int c = 0; c < _length; ++c) { i[c] = (long)c; } long[] o; long[] r; r = p.opALongS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { List<long> i = new List<long>(_length); for(int c = 0; c < _length; ++c) { i.Add((long)c); } List<long> o; List<long> r; r = p.opLLongS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { LinkedList<long> i = new LinkedList<long>(); for(int c = 0; c < _length; ++c) { i.AddLast((long)c); } LinkedList<long> o; LinkedList<long> r; r = p.opKLongS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Queue<long> i = new Queue<long>(); for(int c = 0; c < _length; ++c) { i.Enqueue((long)c); } Queue<long> o; Queue<long> r; r = p.opQLongS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Stack<long> i = new Stack<long>(); for(int c = 0; c < _length; ++c) { i.Push((long)c); } Stack<long> o; Stack<long> r; r = p.opSLongS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { CLongS i = new CLongS(_length); for(int c = 0; c < _length; ++c) { i.Add((long)c); } CLongS o; CLongS r; r = p.opCLongS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { float[] i = new float[_length]; for(int c = 0; c < _length; ++c) { i[c] = (float)c; } float[] o; float[] r; r = p.opAFloatS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { List<float> i = new List<float>(_length); for(int c = 0; c < _length; ++c) { i.Add((float)c); } List<float> o; List<float> r; r = p.opLFloatS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { LinkedList<float> i = new LinkedList<float>(); for(int c = 0; c < _length; ++c) { i.AddLast((float)c); } LinkedList<float> o; LinkedList<float> r; r = p.opKFloatS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Queue<float> i = new Queue<float>(); for(int c = 0; c < _length; ++c) { i.Enqueue((float)c); } Queue<float> o; Queue<float> r; r = p.opQFloatS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Stack<float> i = new Stack<float>(); for(int c = 0; c < _length; ++c) { i.Push((float)c); } Stack<float> o; Stack<float> r; r = p.opSFloatS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { CFloatS i = new CFloatS(_length); for(int c = 0; c < _length; ++c) { i.Add((float)c); } CFloatS o; CFloatS r; r = p.opCFloatS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { double[] i = new double[_length]; for(int c = 0; c < _length; ++c) { i[c] = (double)c; } double[] o; double[] r; r = p.opADoubleS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { List<double> i = new List<double>(_length); for(int c = 0; c < _length; ++c) { i.Add((double)c); } List<double> o; List<double> r; r = p.opLDoubleS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { LinkedList<double> i = new LinkedList<double>(); for(int c = 0; c < _length; ++c) { i.AddLast((double)c); } LinkedList<double> o; LinkedList<double> r; r = p.opKDoubleS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Queue<double> i = new Queue<double>(); for(int c = 0; c < _length; ++c) { i.Enqueue((double)c); } Queue<double> o; Queue<double> r; r = p.opQDoubleS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Stack<double> i = new Stack<double>(); for(int c = 0; c < _length; ++c) { i.Push((double)c); } Stack<double> o; Stack<double> r; r = p.opSDoubleS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { CDoubleS i = new CDoubleS(_length); for(int c = 0; c < _length; ++c) { i.Add((double)c); } CDoubleS o; CDoubleS r; r = p.opCDoubleS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { string[] i = new string[_length]; for(int c = 0; c < _length; ++c) { i[c] = c.ToString(); } string[] o; string[] r; r = p.opAStringS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { List<string> i = new List<string>(_length); for(int c = 0; c < _length; ++c) { i.Add(c.ToString()); } List<string> o; List<string> r; r = p.opLStringS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { LinkedList<string> i = new LinkedList<string>(); for(int c = 0; c < _length; ++c) { i.AddLast(c.ToString()); } LinkedList<string> o; LinkedList<string> r; r = p.opKStringS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Queue<string> i = new Queue<string>(); for(int c = 0; c < _length; ++c) { i.Enqueue(c.ToString()); } Queue<string> o; Queue<string> r; r = p.opQStringS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Stack<string> i = new Stack<string>(); for(int c = 0; c < _length; ++c) { i.Push(c.ToString()); } Stack<string> o; Stack<string> r; r = p.opSStringS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { CStringS i = new CStringS(_length); for(int c = 0; c < _length; ++c) { i.Add(c.ToString()); } CStringS o; CStringS r; r = p.opCStringS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Ice.Object[] i = new CV[_length]; for(int c = 0; c < _length; ++c) { i[c] = new CV(c); } Ice.Object[] o; Ice.Object[] r; r = p.opAObjectS(i, out o); System.Collections.IEnumerator eo = o.GetEnumerator(); System.Collections.IEnumerator er = r.GetEnumerator(); foreach(CV obj in i) { eo.MoveNext(); er.MoveNext(); test(obj.i == ((CV)eo.Current).i); test(obj.i == ((CV)er.Current).i); } } { List<Ice.Object> i = new List<Ice.Object>(_length); for(int c = 0; c < _length; ++c) { i.Add(new CV(c)); } List<Ice.Object> o; List<Ice.Object> r; r = p.opLObjectS(i, out o); IEnumerator<Ice.Object> eo = o.GetEnumerator(); IEnumerator<Ice.Object> er = r.GetEnumerator(); foreach(CV obj in i) { eo.MoveNext(); er.MoveNext(); test(obj.i == ((CV)eo.Current).i); test(obj.i == ((CV)er.Current).i); } } { CObjectS i = new CObjectS(_length); for(int c = 0; c < _length; ++c) { i.Add(new CV(c)); } CObjectS o; CObjectS r; r = p.opCObjectS(i, out o); IEnumerator<Ice.Object> eo = (IEnumerator<Ice.Object>)o.GetEnumerator(); IEnumerator<Ice.Object> er = (IEnumerator<Ice.Object>)r.GetEnumerator(); foreach(CV obj in i) { eo.MoveNext(); er.MoveNext(); test(obj.i == ((CV)eo.Current).i); test(obj.i == ((CV)er.Current).i); } } { Ice.ObjectPrx[] i = new Ice.ObjectPrx[_length]; for(int c = 0; c < _length; ++c) { i[c] = communicator.stringToProxy(c.ToString()); } Ice.ObjectPrx[] o; Ice.ObjectPrx[] r; r = p.opAObjectPrxS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { List<Ice.ObjectPrx> i = new List<Ice.ObjectPrx>(_length); for(int c = 0; c < _length; ++c) { i.Add(communicator.stringToProxy(c.ToString())); } List<Ice.ObjectPrx> o; List<Ice.ObjectPrx> r; r = p.opLObjectPrxS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { LinkedList<Ice.ObjectPrx> i = new LinkedList<Ice.ObjectPrx>(); for(int c = 0; c < _length; ++c) { i.AddLast(communicator.stringToProxy(c.ToString())); } LinkedList<Ice.ObjectPrx> o; LinkedList<Ice.ObjectPrx> r; r = p.opKObjectPrxS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Queue<Ice.ObjectPrx> i = new Queue<Ice.ObjectPrx>(); for(int c = 0; c < _length; ++c) { i.Enqueue(communicator.stringToProxy(c.ToString())); } Queue<Ice.ObjectPrx> o; Queue<Ice.ObjectPrx> r; r = p.opQObjectPrxS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Stack<Ice.ObjectPrx> i = new Stack<Ice.ObjectPrx>(); for(int c = 0; c < _length; ++c) { i.Push(communicator.stringToProxy(c.ToString())); } Stack<Ice.ObjectPrx> o; Stack<Ice.ObjectPrx> r; r = p.opSObjectPrxS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { CObjectPrxS i = new CObjectPrxS(_length); for(int c = 0; c < _length; ++c) { i.Add(communicator.stringToProxy(c.ToString())); } CObjectPrxS o; CObjectPrxS r; r = p.opCObjectPrxS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { S[] i = new S[_length]; for(int c = 0; c < _length; ++c) { i[c].i = c; } S[] o; S[] r; r = p.opAStructS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { List<S> i = new List<S>(_length); for(int c = 0; c < _length; ++c) { i.Add(new S(c)); } List<S> o; List<S> r; r = p.opLStructS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { LinkedList<S> i = new LinkedList<S>(); for(int c = 0; c < _length; ++c) { i.AddLast(new S(c)); } LinkedList<S> o; LinkedList<S> r; r = p.opKStructS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Queue<S> i = new Queue<S>(); for(int c = 0; c < _length; ++c) { i.Enqueue(new S(c)); } Queue<S> o; Queue<S> r; r = p.opQStructS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Stack<S> i = new Stack<S>(); for(int c = 0; c < _length; ++c) { i.Push(new S(c)); } Stack<S> o; Stack<S> r; r = p.opSStructS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { CStructS i = new CStructS(_length); for(int c = 0; c < _length; ++c) { i.Add(new S(c)); } CStructS o; CStructS r; r = p.opCStructS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { SD[] i = new SD[_length]; for(int c = 0; c < _length; ++c) { i[c] = new SD(c); } SD[] o; SD[] r; r = p.opAStructSD(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { List<SD> i = new List<SD>(_length); for(int c = 0; c < _length; ++c) { i.Add(new SD(c)); } List<SD> o; List<SD> r; r = p.opLStructSD(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { LinkedList<SD> i = new LinkedList<SD>(); for(int c = 0; c < _length; ++c) { i.AddLast(new SD(c)); } LinkedList<SD> o; LinkedList<SD> r; r = p.opKStructSD(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Queue<SD> i = new Queue<SD>(); for(int c = 0; c < _length; ++c) { i.Enqueue(new SD(c)); } Queue<SD> o; Queue<SD> r; r = p.opQStructSD(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Stack<SD> i = new Stack<SD>(); for(int c = 0; c < _length; ++c) { i.Push(new SD(c)); } Stack<SD> o; Stack<SD> r; r = p.opSStructSD(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { CStructSD i = new CStructSD(_length); for(int c = 0; c < _length; ++c) { i.Add(new SD(c)); } CStructSD o; CStructSD r; r = p.opCStructSD(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { CV[] i = new CV[_length]; for(int c = 0; c < _length; ++c) { i[c] = new CV(c); } CV[] o; CV[] r; r = p.opACVS(i, out o); System.Collections.IEnumerator eo = o.GetEnumerator(); System.Collections.IEnumerator er = r.GetEnumerator(); foreach(CV obj in i) { eo.MoveNext(); er.MoveNext(); test(obj.i == ((CV)eo.Current).i); test(obj.i == ((CV)er.Current).i); } } { List<CV> i = new List<CV>(_length); for(int c = 0; c < _length; ++c) { i.Add(new CV(c)); } List<CV> o; List<CV> r; r = p.opLCVS(i, out o); IEnumerator<CV> eo = o.GetEnumerator(); IEnumerator<CV> er = r.GetEnumerator(); foreach(CV obj in i) { eo.MoveNext(); er.MoveNext(); test(obj.i == eo.Current.i); test(obj.i == er.Current.i); } } { CCVS i = new CCVS(_length); for(int c = 0; c < _length; ++c) { i.Add(new CV(c)); } CCVS o; CCVS r; r = p.opCCVS(i, out o); IEnumerator<CV> eo = (IEnumerator<CV>)o.GetEnumerator(); IEnumerator<CV> er = (IEnumerator<CV>)r.GetEnumerator(); foreach(CV obj in i) { eo.MoveNext(); er.MoveNext(); test(obj.i == eo.Current.i); test(obj.i == er.Current.i); } } { CR[] i = new CR[_length]; for(int c = 0; c < _length; ++c) { i[c] = new CR(new CV(c)); } CR[] o; CR[] r; r = p.opACRS(i, out o); System.Collections.IEnumerator eo = o.GetEnumerator(); System.Collections.IEnumerator er = r.GetEnumerator(); foreach(CR obj in i) { eo.MoveNext(); er.MoveNext(); test(obj.v.i == ((CR)eo.Current).v.i); test(obj.v.i == ((CR)er.Current).v.i); } } { List<CR> i = new List<CR>(_length); for(int c = 0; c < _length; ++c) { i.Add(new CR(new CV(c))); } List<CR> o; List<CR> r; r = p.opLCRS(i, out o); IEnumerator<CR> eo = o.GetEnumerator(); IEnumerator<CR> er = r.GetEnumerator(); foreach(CR obj in i) { eo.MoveNext(); er.MoveNext(); test(obj.v.i == eo.Current.v.i); test(obj.v.i == er.Current.v.i); } } { CCRS i = new CCRS(_length); for(int c = 0; c < _length; ++c) { i.Add(new CR(new CV(c))); } CCRS o; CCRS r; r = p.opCCRS(i, out o); IEnumerator<CR> eo = (IEnumerator<CR>)o.GetEnumerator(); IEnumerator<CR> er = (IEnumerator<CR>)r.GetEnumerator(); foreach(CR obj in i) { eo.MoveNext(); er.MoveNext(); test(obj.v.i == eo.Current.v.i); test(obj.v.i == er.Current.v.i); } } { En[] i = new En[_length]; for(int c = 0; c < _length; ++c) { i[c] = (En)(c % 3); } En[] o; En[] r; r = p.opAEnS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { List<En> i = new List<En>(_length); for(int c = 0; c < _length; ++c) { i.Add((En)(c % 3)); } List<En> o; List<En> r; r = p.opLEnS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { LinkedList<En> i = new LinkedList<En>(); for(int c = 0; c < _length; ++c) { i.AddLast((En)(c % 3)); } LinkedList<En> o; LinkedList<En> r; r = p.opKEnS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Queue<En> i = new Queue<En>(); for(int c = 0; c < _length; ++c) { i.Enqueue((En)(c % 3)); } Queue<En> o; Queue<En> r; r = p.opQEnS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Stack<En> i = new Stack<En>(); for(int c = 0; c < _length; ++c) { i.Push((En)(c % 3)); } Stack<En> o; Stack<En> r; r = p.opSEnS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { CEnS i = new CEnS(_length); for(int c = 0; c < _length; ++c) { i.Add((En)(c % 3)); } CEnS o; CEnS r; r = p.opCEnS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { CVPrx[] i = new CVPrx[_length]; for(int c = 0; c < _length; ++c) { i[c] = CVPrxHelper.uncheckedCast(communicator.stringToProxy(c.ToString())); } CVPrx[] o; CVPrx[] r; r = p.opACVPrxS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { List<CVPrx> i = new List<CVPrx>(_length); for(int c = 0; c < _length; ++c) { i.Add(CVPrxHelper.uncheckedCast(communicator.stringToProxy(c.ToString()))); } List<CVPrx> o; List<CVPrx> r; r = p.opLCVPrxS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { LinkedList<CVPrx> i = new LinkedList<CVPrx>(); for(int c = 0; c < _length; ++c) { i.AddLast(CVPrxHelper.uncheckedCast(communicator.stringToProxy(c.ToString()))); } LinkedList<CVPrx> o; LinkedList<CVPrx> r; r = p.opKCVPrxS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Queue<CVPrx> i = new Queue<CVPrx>(); for(int c = 0; c < _length; ++c) { i.Enqueue(CVPrxHelper.uncheckedCast(communicator.stringToProxy(c.ToString()))); } Queue<CVPrx> o; Queue<CVPrx> r; r = p.opQCVPrxS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Stack<CVPrx> i = new Stack<CVPrx>(); for(int c = 0; c < _length; ++c) { i.Push(CVPrxHelper.uncheckedCast(communicator.stringToProxy(c.ToString()))); } Stack<CVPrx> o; Stack<CVPrx> r; r = p.opSCVPrxS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { CCVPrxS i = new CCVPrxS(_length); for(int c = 0; c < _length; ++c) { i.Add(CVPrxHelper.uncheckedCast(communicator.stringToProxy(c.ToString()))); } CCVPrxS o; CCVPrxS r; r = p.opCCVPrxS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Custom<int> i = new Custom<int>(); for(int c = 0; c < _length; ++c) { i.Add(c); } Custom<int> o; Custom<int> r; r = p.opCustomIntS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Custom<CV> i = new Custom<CV>(); for(int c = 0; c < _length; ++c) { i.Add(new CV(c)); } i.Add(null); Custom<CV> o; Custom<CV> r; r = p.opCustomCVS(i, out o); IEnumerator<CV> eo = (IEnumerator<CV>)o.GetEnumerator(); IEnumerator<CV> er = (IEnumerator<CV>)r.GetEnumerator(); foreach(CV obj in i) { eo.MoveNext(); er.MoveNext(); if(obj == null) { test(eo.Current == null); test(er.Current == null); } else { test(obj.i == eo.Current.i); test(obj.i == er.Current.i); } } } { Custom<Custom<int>> i = new Custom<Custom<int>>(); for(int c = 0; c < _length; ++c) { Custom<int> inner = new Custom<int>(); for(int j = 0; j < c; ++j) { inner.Add(j); } i.Add(inner); } Custom<Custom<int>> o; Custom<Custom<int>> r; r = p.opCustomIntSS(i, out o); test(Ice.CollectionComparer.Equals(i, o)); test(Ice.CollectionComparer.Equals(i, r)); } { Custom<Custom<CV>> i = new Custom<Custom<CV>>(); for(int c = 0; c < _length; ++c) { Custom<CV> inner = new Custom<CV>(); for(int j = 0; j < c; ++j) { inner.Add(new CV(j)); } i.Add(inner); } Custom<Custom<CV>> o; Custom<Custom<CV>> r; r = p.opCustomCVSS(i, out o); IEnumerator<Custom<CV>> eo = (IEnumerator<Custom<CV>>)o.GetEnumerator(); IEnumerator<Custom<CV>> er = (IEnumerator<Custom<CV>>)r.GetEnumerator(); foreach(Custom<CV> s in i) { eo.MoveNext(); er.MoveNext(); IEnumerator<CV> io = (IEnumerator<CV>)eo.Current.GetEnumerator(); IEnumerator<CV> ir = (IEnumerator<CV>)er.Current.GetEnumerator(); foreach(CV obj in s) { io.MoveNext(); ir.MoveNext(); if(obj == null) { test(io.Current == null); test(ir.Current == null); } else { test(obj.i == io.Current.i); test(obj.i == ir.Current.i); } } } } #if !COMPACT && !SILVERLIGHT { Serialize.Small i = null; Serialize.Small o; Serialize.Small r; r = p.opSerialSmallCSharp(i, out o); test(o == null); test(r == null); } { Serialize.Small i = new Serialize.Small(); i.i = 99; Serialize.Small o; Serialize.Small r; try { r = p.opSerialSmallCSharp(i, out o); test(o.i == 99); test(r.i == 99); } catch(Ice.OperationNotExistException) { // OK, talking to non-C# server. } } { Serialize.Large i = new Serialize.Large(); i.d1 = 1.0; i.d2 = 2.0; i.d3 = 3.0; i.d4 = 4.0; i.d5 = 5.0; i.d6 = 6.0; i.d7 = 7.0; i.d8 = 8.0; i.d9 = 9.0; i.d10 = 10.0; Serialize.Large o; Serialize.Large r; try { r = p.opSerialLargeCSharp(i, out o); test(o.d1 == 1.0); test(o.d2 == 2.0); test(o.d3 == 3.0); test(o.d4 == 4.0); test(o.d5 == 5.0); test(o.d6 == 6.0); test(o.d7 == 7.0); test(o.d8 == 8.0); test(o.d9 == 9.0); test(o.d10 == 10.0); test(r.d1 == 1.0); test(r.d2 == 2.0); test(r.d3 == 3.0); test(r.d4 == 4.0); test(r.d5 == 5.0); test(r.d6 == 6.0); test(r.d7 == 7.0); test(r.d8 == 8.0); test(r.d9 == 9.0); test(r.d10 == 10.0); } catch(Ice.OperationNotExistException) { // OK, talking to non-C# server. } } { Serialize.Struct i = new Serialize.Struct(); i.o = null; i.o2 = i; i.s = null; i.s2 = "Hello"; Serialize.Struct o; Serialize.Struct r; try { r = p.opSerialStructCSharp(i, out o); test(o.o == null); test(o.o2 != null); test(((Serialize.Struct)(o.o2)).o == null); test(((Serialize.Struct)(o.o2)).o2 == o.o2); test(o.s == null); test(o.s2.Equals("Hello")); test(r.o == null); test(r.o2 != null); test(((Serialize.Struct)(r.o2)).o == null); test(((Serialize.Struct)(r.o2)).o2 == r.o2); test(r.s == null); test(r.s2.Equals("Hello")); } catch(Ice.OperationNotExistException) { // OK, talking to non-C# server. } } #endif }
public static void MigrateCustomSheet(string userSheet, string updatedSheet) { List<string> mediaType = new List<string>(); mediaType.Add("paper"); mediaType.Add("mobile"); mediaType.Add("web"); mediaType.Add("others"); XmlDocument userSettings = new XmlDocument(); XmlDocument installerSettings = new XmlDocument(); string backUpFileName = "backUp_" + DateTime.Now.ToString("MM-dd-yyyy") + ".xml"; string backUpFilePath = Common.PathCombine(Path.GetDirectoryName(userSheet), backUpFileName); File.Copy(userSheet, backUpFilePath, true); if (File.Exists(userSheet)) File.Delete(userSheet); File.Copy(updatedSheet, userSheet, true); userSettings.Load(backUpFilePath); installerSettings.Load(userSheet); foreach (string media in mediaType) { string xPathUser = @"//stylePick/styles/" + media + "/style[@type='Custom']"; XmlNodeList nodeList = userSettings.SelectNodes(xPathUser); string xPathInstaller = @"//stylePick/styles/" + media; XmlNode nodeInst = installerSettings.SelectSingleNode(xPathInstaller); XmlNodeList nodeInstList = installerSettings.SelectNodes(xPathUser); if (nodeList != null) foreach (XmlNode backupNode in nodeList) { bool isExist = false; string oldNodeName = backupNode.Attributes["name"].Value; if (nodeInstList != null) foreach (XmlNode newNode in nodeInstList) { string newNodeName = newNode.Attributes["name"].Value; if (newNodeName == oldNodeName) { isExist = true; break; } } if (!isExist) { XmlDocumentFragment docFrag = installerSettings.CreateDocumentFragment(); docFrag.InnerXml = backupNode.OuterXml; nodeInst.AppendChild(docFrag); } } } installerSettings.Save(userSheet); }
internal static void twowaysAMI(Ice.Communicator communicator, Test.MyClassPrx p) { { byte[] i = new byte[_length]; for(int c = 0; c < _length; ++c) { i[c] = (byte)c; } AMI_MyClass_opAByteSI cb = new AMI_MyClass_opAByteSI(i); p.opAByteS_async(cb, i); cb.check(); } { List<byte> i = new List<byte>(); for(int c = 0; c < _length; ++c) { i.Add((byte)c); } AMI_MyClass_opLByteSI cb = new AMI_MyClass_opLByteSI(i); p.opLByteS_async(cb, i); cb.check(); } { LinkedList<byte> i = new LinkedList<byte>(); for(int c = 0; c < _length; ++c) { i.AddLast((byte)c); } AMI_MyClass_opKByteSI cb = new AMI_MyClass_opKByteSI(i); p.opKByteS_async(cb, i); cb.check(); } { Queue<byte> i = new Queue<byte>(); for(int c = 0; c < _length; ++c) { i.Enqueue((byte)c); } AMI_MyClass_opQByteSI cb = new AMI_MyClass_opQByteSI(i); p.opQByteS_async(cb, i); cb.check(); } { Stack<byte> i = new Stack<byte>(); for(int c = 0; c < _length; ++c) { i.Push((byte)c); } AMI_MyClass_opSByteSI cb = new AMI_MyClass_opSByteSI(i); p.opSByteS_async(cb, i); cb.check(); } { CByteS i = new CByteS(); for(int c = 0; c < _length; ++c) { i.Add((byte)c); } AMI_MyClass_opCByteSI cb = new AMI_MyClass_opCByteSI(i); p.opCByteS_async(cb, i); cb.check(); } { bool[] i = new bool[_length]; for(int c = 0; c < _length; ++c) { i[c] = c % 1 == 1; } AMI_MyClass_opABoolSI cb = new AMI_MyClass_opABoolSI(i); p.opABoolS_async(cb, i); cb.check(); } { List<bool> i = new List<bool>(); for(int c = 0; c < _length; ++c) { i.Add(c % 1 == 1); } AMI_MyClass_opLBoolSI cb = new AMI_MyClass_opLBoolSI(i); p.opLBoolS_async(cb, i); cb.check(); } { LinkedList<bool> i = new LinkedList<bool>(); for(int c = 0; c < _length; ++c) { i.AddLast(c % 1 == 1); } AMI_MyClass_opKBoolSI cb = new AMI_MyClass_opKBoolSI(i); p.opKBoolS_async(cb, i); cb.check(); } { Queue<bool> i = new Queue<bool>(); for(int c = 0; c < _length; ++c) { i.Enqueue(c % 1 == 1); } AMI_MyClass_opQBoolSI cb = new AMI_MyClass_opQBoolSI(i); p.opQBoolS_async(cb, i); cb.check(); } { Stack<bool> i = new Stack<bool>(); for(int c = 0; c < _length; ++c) { i.Push(c % 1 == 1); } AMI_MyClass_opSBoolSI cb = new AMI_MyClass_opSBoolSI(i); p.opSBoolS_async(cb, i); cb.check(); } { CBoolS i = new CBoolS(); for(int c = 0; c < _length; ++c) { i.Add(c % 1 == 1); } AMI_MyClass_opCBoolSI cb = new AMI_MyClass_opCBoolSI(i); p.opCBoolS_async(cb, i); cb.check(); } { short[] i = new short[_length]; for(int c = 0; c < _length; ++c) { i[c] = (short)c; } AMI_MyClass_opAShortSI cb = new AMI_MyClass_opAShortSI(i); p.opAShortS_async(cb, i); cb.check(); } { List<short> i = new List<short>(); for(int c = 0; c < _length; ++c) { i.Add((short)c); } AMI_MyClass_opLShortSI cb = new AMI_MyClass_opLShortSI(i); p.opLShortS_async(cb, i); cb.check(); } { LinkedList<short> i = new LinkedList<short>(); for(int c = 0; c < _length; ++c) { i.AddLast((short)c); } AMI_MyClass_opKShortSI cb = new AMI_MyClass_opKShortSI(i); p.opKShortS_async(cb, i); cb.check(); } { Queue<short> i = new Queue<short>(); for(int c = 0; c < _length; ++c) { i.Enqueue((short)c); } AMI_MyClass_opQShortSI cb = new AMI_MyClass_opQShortSI(i); p.opQShortS_async(cb, i); cb.check(); } { Stack<short> i = new Stack<short>(); for(int c = 0; c < _length; ++c) { i.Push((short)c); } AMI_MyClass_opSShortSI cb = new AMI_MyClass_opSShortSI(i); p.opSShortS_async(cb, i); cb.check(); } { CShortS i = new CShortS(); for(int c = 0; c < _length; ++c) { i.Add((short)c); } AMI_MyClass_opCShortSI cb = new AMI_MyClass_opCShortSI(i); p.opCShortS_async(cb, i); cb.check(); } { int[] i = new int[_length]; for(int c = 0; c < _length; ++c) { i[c] = (int)c; } AMI_MyClass_opAIntSI cb = new AMI_MyClass_opAIntSI(i); p.opAIntS_async(cb, i); cb.check(); } { List<int> i = new List<int>(); for(int c = 0; c < _length; ++c) { i.Add((int)c); } AMI_MyClass_opLIntSI cb = new AMI_MyClass_opLIntSI(i); p.opLIntS_async(cb, i); cb.check(); } { LinkedList<int> i = new LinkedList<int>(); for(int c = 0; c < _length; ++c) { i.AddLast((int)c); } AMI_MyClass_opKIntSI cb = new AMI_MyClass_opKIntSI(i); p.opKIntS_async(cb, i); cb.check(); } { Queue<int> i = new Queue<int>(); for(int c = 0; c < _length; ++c) { i.Enqueue((int)c); } AMI_MyClass_opQIntSI cb = new AMI_MyClass_opQIntSI(i); p.opQIntS_async(cb, i); cb.check(); } { Stack<int> i = new Stack<int>(); for(int c = 0; c < _length; ++c) { i.Push((int)c); } AMI_MyClass_opSIntSI cb = new AMI_MyClass_opSIntSI(i); p.opSIntS_async(cb, i); cb.check(); } { CIntS i = new CIntS(); for(int c = 0; c < _length; ++c) { i.Add((int)c); } AMI_MyClass_opCIntSI cb = new AMI_MyClass_opCIntSI(i); p.opCIntS_async(cb, i); cb.check(); } { long[] i = new long[_length]; for(int c = 0; c < _length; ++c) { i[c] = (long)c; } AMI_MyClass_opALongSI cb = new AMI_MyClass_opALongSI(i); p.opALongS_async(cb, i); cb.check(); } { List<long> i = new List<long>(); for(int c = 0; c < _length; ++c) { i.Add((long)c); } AMI_MyClass_opLLongSI cb = new AMI_MyClass_opLLongSI(i); p.opLLongS_async(cb, i); cb.check(); } { LinkedList<long> i = new LinkedList<long>(); for(int c = 0; c < _length; ++c) { i.AddLast((long)c); } AMI_MyClass_opKLongSI cb = new AMI_MyClass_opKLongSI(i); p.opKLongS_async(cb, i); cb.check(); } { Queue<long> i = new Queue<long>(); for(int c = 0; c < _length; ++c) { i.Enqueue((long)c); } AMI_MyClass_opQLongSI cb = new AMI_MyClass_opQLongSI(i); p.opQLongS_async(cb, i); cb.check(); } { Stack<long> i = new Stack<long>(); for(int c = 0; c < _length; ++c) { i.Push((long)c); } AMI_MyClass_opSLongSI cb = new AMI_MyClass_opSLongSI(i); p.opSLongS_async(cb, i); cb.check(); } { CLongS i = new CLongS(); for(int c = 0; c < _length; ++c) { i.Add((long)c); } AMI_MyClass_opCLongSI cb = new AMI_MyClass_opCLongSI(i); p.opCLongS_async(cb, i); cb.check(); } { float[] i = new float[_length]; for(int c = 0; c < _length; ++c) { i[c] = (float)c; } AMI_MyClass_opAFloatSI cb = new AMI_MyClass_opAFloatSI(i); p.opAFloatS_async(cb, i); cb.check(); } { List<float> i = new List<float>(); for(int c = 0; c < _length; ++c) { i.Add((float)c); } AMI_MyClass_opLFloatSI cb = new AMI_MyClass_opLFloatSI(i); p.opLFloatS_async(cb, i); cb.check(); } { LinkedList<float> i = new LinkedList<float>(); for(int c = 0; c < _length; ++c) { i.AddLast((float)c); } AMI_MyClass_opKFloatSI cb = new AMI_MyClass_opKFloatSI(i); p.opKFloatS_async(cb, i); cb.check(); } { Queue<float> i = new Queue<float>(); for(int c = 0; c < _length; ++c) { i.Enqueue((float)c); } AMI_MyClass_opQFloatSI cb = new AMI_MyClass_opQFloatSI(i); p.opQFloatS_async(cb, i); cb.check(); } { Stack<float> i = new Stack<float>(); for(int c = 0; c < _length; ++c) { i.Push((float)c); } AMI_MyClass_opSFloatSI cb = new AMI_MyClass_opSFloatSI(i); p.opSFloatS_async(cb, i); cb.check(); } { CFloatS i = new CFloatS(); for(int c = 0; c < _length; ++c) { i.Add((float)c); } AMI_MyClass_opCFloatSI cb = new AMI_MyClass_opCFloatSI(i); p.opCFloatS_async(cb, i); cb.check(); } { double[] i = new double[_length]; for(int c = 0; c < _length; ++c) { i[c] = (double)c; } AMI_MyClass_opADoubleSI cb = new AMI_MyClass_opADoubleSI(i); p.opADoubleS_async(cb, i); cb.check(); } { List<double> i = new List<double>(); for(int c = 0; c < _length; ++c) { i.Add((double)c); } AMI_MyClass_opLDoubleSI cb = new AMI_MyClass_opLDoubleSI(i); p.opLDoubleS_async(cb, i); cb.check(); } { LinkedList<double> i = new LinkedList<double>(); for(int c = 0; c < _length; ++c) { i.AddLast((double)c); } AMI_MyClass_opKDoubleSI cb = new AMI_MyClass_opKDoubleSI(i); p.opKDoubleS_async(cb, i); cb.check(); } { Queue<double> i = new Queue<double>(); for(int c = 0; c < _length; ++c) { i.Enqueue((double)c); } AMI_MyClass_opQDoubleSI cb = new AMI_MyClass_opQDoubleSI(i); p.opQDoubleS_async(cb, i); cb.check(); } { Stack<double> i = new Stack<double>(); for(int c = 0; c < _length; ++c) { i.Push((double)c); } AMI_MyClass_opSDoubleSI cb = new AMI_MyClass_opSDoubleSI(i); p.opSDoubleS_async(cb, i); cb.check(); } { CDoubleS i = new CDoubleS(); for(int c = 0; c < _length; ++c) { i.Add((double)c); } AMI_MyClass_opCDoubleSI cb = new AMI_MyClass_opCDoubleSI(i); p.opCDoubleS_async(cb, i); cb.check(); } { string[] i = new string[_length]; for(int c = 0; c < _length; ++c) { i[c] = c.ToString(); } AMI_MyClass_opAStringSI cb = new AMI_MyClass_opAStringSI(i); p.opAStringS_async(cb, i); cb.check(); } { List<string> i = new List<string>(); for(int c = 0; c < _length; ++c) { i.Add(c.ToString()); } AMI_MyClass_opLStringSI cb = new AMI_MyClass_opLStringSI(i); p.opLStringS_async(cb, i); cb.check(); } { LinkedList<string> i = new LinkedList<string>(); for(int c = 0; c < _length; ++c) { i.AddLast(c.ToString()); } AMI_MyClass_opKStringSI cb = new AMI_MyClass_opKStringSI(i); p.opKStringS_async(cb, i); cb.check(); } { Queue<string> i = new Queue<string>(); for(int c = 0; c < _length; ++c) { i.Enqueue(c.ToString()); } AMI_MyClass_opQStringSI cb = new AMI_MyClass_opQStringSI(i); p.opQStringS_async(cb, i); cb.check(); } { Stack<string> i = new Stack<string>(); for(int c = 0; c < _length; ++c) { i.Push(c.ToString()); } AMI_MyClass_opSStringSI cb = new AMI_MyClass_opSStringSI(i); p.opSStringS_async(cb, i); cb.check(); } { CStringS i = new CStringS(); for(int c = 0; c < _length; ++c) { i.Add(c.ToString()); } AMI_MyClass_opCStringSI cb = new AMI_MyClass_opCStringSI(i); p.opCStringS_async(cb, i); cb.check(); } { Ice.Object[] i = new Ice.Object[_length]; for(int c = 0; c < _length; ++c) { i[c] = new CV(c); } AMI_MyClass_opAObjectSI cb = new AMI_MyClass_opAObjectSI(i); p.opAObjectS_async(cb, i); cb.check(); } { List<Ice.Object> i = new List<Ice.Object>(); for(int c = 0; c < _length; ++c) { i.Add(new CV(c)); } AMI_MyClass_opLObjectSI cb = new AMI_MyClass_opLObjectSI(i); p.opLObjectS_async(cb, i); cb.check(); } { CObjectS i = new CObjectS(); for(int c = 0; c < _length; ++c) { i.Add(new CV(c)); } AMI_MyClass_opCObjectSI cb = new AMI_MyClass_opCObjectSI(i); p.opCObjectS_async(cb, i); cb.check(); } { Ice.ObjectPrx[] i = new Ice.ObjectPrx[_length]; for(int c = 0; c < _length; ++c) { i[c] = communicator.stringToProxy(c.ToString()); } AMI_MyClass_opAObjectPrxSI cb = new AMI_MyClass_opAObjectPrxSI(i); p.opAObjectPrxS_async(cb, i); cb.check(); } { List<Ice.ObjectPrx> i = new List<Ice.ObjectPrx>(); for(int c = 0; c < _length; ++c) { i.Add(communicator.stringToProxy(c.ToString())); } AMI_MyClass_opLObjectPrxSI cb = new AMI_MyClass_opLObjectPrxSI(i); p.opLObjectPrxS_async(cb, i); cb.check(); } { LinkedList<Ice.ObjectPrx> i = new LinkedList<Ice.ObjectPrx>(); for(int c = 0; c < _length; ++c) { i.AddLast(communicator.stringToProxy(c.ToString())); } AMI_MyClass_opKObjectPrxSI cb = new AMI_MyClass_opKObjectPrxSI(i); p.opKObjectPrxS_async(cb, i); cb.check(); } { Queue<Ice.ObjectPrx> i = new Queue<Ice.ObjectPrx>(); for(int c = 0; c < _length; ++c) { i.Enqueue(communicator.stringToProxy(c.ToString())); } AMI_MyClass_opQObjectPrxSI cb = new AMI_MyClass_opQObjectPrxSI(i); p.opQObjectPrxS_async(cb, i); cb.check(); } { Stack<Ice.ObjectPrx> i = new Stack<Ice.ObjectPrx>(); for(int c = 0; c < _length; ++c) { i.Push(communicator.stringToProxy(c.ToString())); } AMI_MyClass_opSObjectPrxSI cb = new AMI_MyClass_opSObjectPrxSI(i); p.opSObjectPrxS_async(cb, i); cb.check(); } { CObjectPrxS i = new CObjectPrxS(); for(int c = 0; c < _length; ++c) { i.Add(communicator.stringToProxy(c.ToString())); } AMI_MyClass_opCObjectPrxSI cb = new AMI_MyClass_opCObjectPrxSI(i); p.opCObjectPrxS_async(cb, i); cb.check(); } { S[] i = new S[_length]; for(int c = 0; c < _length; ++c) { i[c].i = c; } AMI_MyClass_opAStructSI cb = new AMI_MyClass_opAStructSI(i); p.opAStructS_async(cb, i); cb.check(); } { List<S> i = new List<S>(); for(int c = 0; c < _length; ++c) { i.Add(new S(c)); } AMI_MyClass_opLStructSI cb = new AMI_MyClass_opLStructSI(i); p.opLStructS_async(cb, i); cb.check(); } { LinkedList<S> i = new LinkedList<S>(); for(int c = 0; c < _length; ++c) { i.AddLast(new S(c)); } AMI_MyClass_opKStructSI cb = new AMI_MyClass_opKStructSI(i); p.opKStructS_async(cb, i); cb.check(); } { Queue<S> i = new Queue<S>(); for(int c = 0; c < _length; ++c) { i.Enqueue(new S(c)); } AMI_MyClass_opQStructSI cb = new AMI_MyClass_opQStructSI(i); p.opQStructS_async(cb, i); cb.check(); } { Stack<S> i = new Stack<S>(); for(int c = 0; c < _length; ++c) { i.Push(new S(c)); } AMI_MyClass_opSStructSI cb = new AMI_MyClass_opSStructSI(i); p.opSStructS_async(cb, i); cb.check(); } { CStructS i = new CStructS(); for(int c = 0; c < _length; ++c) { i.Add(new S(c)); } AMI_MyClass_opCStructSI cb = new AMI_MyClass_opCStructSI(i); p.opCStructS_async(cb, i); cb.check(); } { SD[] i = new SD[_length]; for(int c = 0; c < _length; ++c) { i[c] = new SD(c); } AMI_MyClass_opAStructSDI cb = new AMI_MyClass_opAStructSDI(i); p.opAStructSD_async(cb, i); cb.check(); } { List<SD> i = new List<SD>(); for(int c = 0; c < _length; ++c) { i.Add(new SD(c)); } AMI_MyClass_opLStructSDI cb = new AMI_MyClass_opLStructSDI(i); p.opLStructSD_async(cb, i); cb.check(); } { LinkedList<SD> i = new LinkedList<SD>(); for(int c = 0; c < _length; ++c) { i.AddLast(new SD(c)); } AMI_MyClass_opKStructSDI cb = new AMI_MyClass_opKStructSDI(i); p.opKStructSD_async(cb, i); cb.check(); } { Queue<SD> i = new Queue<SD>(); for(int c = 0; c < _length; ++c) { i.Enqueue(new SD(c)); } AMI_MyClass_opQStructSDI cb = new AMI_MyClass_opQStructSDI(i); p.opQStructSD_async(cb, i); cb.check(); } { Stack<SD> i = new Stack<SD>(); for(int c = 0; c < _length; ++c) { i.Push(new SD(c)); } AMI_MyClass_opSStructSDI cb = new AMI_MyClass_opSStructSDI(i); p.opSStructSD_async(cb, i); cb.check(); } { CStructSD i = new CStructSD(); for(int c = 0; c < _length; ++c) { i.Add(new SD(c)); } AMI_MyClass_opCStructSDI cb = new AMI_MyClass_opCStructSDI(i); p.opCStructSD_async(cb, i); cb.check(); } { CV[] i = new CV[_length]; for(int c = 0; c < _length; ++c) { i[c] = new CV(c); } AMI_MyClass_opACVSI cb = new AMI_MyClass_opACVSI(i); p.opACVS_async(cb, i); cb.check(); } { List<CV> i = new List<CV>(); for(int c = 0; c < _length; ++c) { i.Add(new CV(c)); } AMI_MyClass_opLCVSI cb = new AMI_MyClass_opLCVSI(i); p.opLCVS_async(cb, i); cb.check(); } { CCVS i = new CCVS(); for(int c = 0; c < _length; ++c) { i.Add(new CV(c)); } AMI_MyClass_opCCVSI cb = new AMI_MyClass_opCCVSI(i); p.opCCVS_async(cb, i); cb.check(); } { CVPrx[] i = new CVPrx[_length]; for(int c = 0; c < _length; ++c) { i[c] = CVPrxHelper.uncheckedCast(communicator.stringToProxy(c.ToString())); } AMI_MyClass_opACVPrxSI cb = new AMI_MyClass_opACVPrxSI(i); p.opACVPrxS_async(cb, i); cb.check(); } { List<CVPrx> i = new List<CVPrx>(); for(int c = 0; c < _length; ++c) { i.Add(CVPrxHelper.uncheckedCast(communicator.stringToProxy(c.ToString()))); } AMI_MyClass_opLCVPrxSI cb = new AMI_MyClass_opLCVPrxSI(i); p.opLCVPrxS_async(cb, i); cb.check(); } { LinkedList<CVPrx> i = new LinkedList<CVPrx>(); for(int c = 0; c < _length; ++c) { i.AddLast(CVPrxHelper.uncheckedCast(communicator.stringToProxy(c.ToString()))); } AMI_MyClass_opKCVPrxSI cb = new AMI_MyClass_opKCVPrxSI(i); p.opKCVPrxS_async(cb, i); cb.check(); } { Queue<CVPrx> i = new Queue<CVPrx>(); for(int c = 0; c < _length; ++c) { i.Enqueue(CVPrxHelper.uncheckedCast(communicator.stringToProxy(c.ToString()))); } AMI_MyClass_opQCVPrxSI cb = new AMI_MyClass_opQCVPrxSI(i); p.opQCVPrxS_async(cb, i); cb.check(); } { Stack<CVPrx> i = new Stack<CVPrx>(); for(int c = 0; c < _length; ++c) { i.Push(CVPrxHelper.uncheckedCast(communicator.stringToProxy(c.ToString()))); } AMI_MyClass_opSCVPrxSI cb = new AMI_MyClass_opSCVPrxSI(i); p.opSCVPrxS_async(cb, i); cb.check(); } { CCVPrxS i = new CCVPrxS(); for(int c = 0; c < _length; ++c) { i.Add(CVPrxHelper.uncheckedCast(communicator.stringToProxy(c.ToString()))); } AMI_MyClass_opCCVPrxSI cb = new AMI_MyClass_opCCVPrxSI(i); p.opCCVPrxS_async(cb, i); cb.check(); } { CR[] i = new CR[_length]; for(int c = 0; c < _length; ++c) { i[c] = new CR(new CV(c)); } AMI_MyClass_opACRSI cb = new AMI_MyClass_opACRSI(i); p.opACRS_async(cb, i); cb.check(); } { List<CR> i = new List<CR>(); for(int c = 0; c < _length; ++c) { i.Add(new CR(new CV(c))); } AMI_MyClass_opLCRSI cb = new AMI_MyClass_opLCRSI(i); p.opLCRS_async(cb, i); cb.check(); } { CCRS i = new CCRS(); for(int c = 0; c < _length; ++c) { i.Add(new CR(new CV(c))); } AMI_MyClass_opCCRSI cb = new AMI_MyClass_opCCRSI(i); p.opCCRS_async(cb, i); cb.check(); } { En[] i = new En[_length]; for(int c = 0; c < _length; ++c) { i[c] = (En)(c % 3); } AMI_MyClass_opAEnSI cb = new AMI_MyClass_opAEnSI(i); p.opAEnS_async(cb, i); cb.check(); } { List<En> i = new List<En>(); for(int c = 0; c < _length; ++c) { i.Add((En)(c % 3)); } AMI_MyClass_opLEnSI cb = new AMI_MyClass_opLEnSI(i); p.opLEnS_async(cb, i); cb.check(); } { LinkedList<En> i = new LinkedList<En>(); for(int c = 0; c < _length; ++c) { i.AddLast((En)(c % 3)); } AMI_MyClass_opKEnSI cb = new AMI_MyClass_opKEnSI(i); p.opKEnS_async(cb, i); cb.check(); } { Queue<En> i = new Queue<En>(); for(int c = 0; c < _length; ++c) { i.Enqueue((En)(c % 3)); } AMI_MyClass_opQEnSI cb = new AMI_MyClass_opQEnSI(i); p.opQEnS_async(cb, i); cb.check(); } { Stack<En> i = new Stack<En>(); for(int c = 0; c < _length; ++c) { i.Push((En)(c % 3)); } AMI_MyClass_opSEnSI cb = new AMI_MyClass_opSEnSI(i); p.opSEnS_async(cb, i); cb.check(); } { CEnS i = new CEnS(); for(int c = 0; c < _length; ++c) { i.Add((En)(c % 3)); } AMI_MyClass_opCEnSI cb = new AMI_MyClass_opCEnSI(i); p.opCEnS_async(cb, i); cb.check(); } { Custom<int> i = new Custom<int>(); for(int c = 0; c < _length; ++c) { i.Add(c); } AMI_MyClass_opCustomIntSI cb = new AMI_MyClass_opCustomIntSI(i); p.opCustomIntS_async(cb, i); cb.check(); } { Custom<CV> i = new Custom<CV>(); for(int c = 0; c < _length; ++c) { i.Add(new CV(c)); } AMI_MyClass_opCustomCVSI cb = new AMI_MyClass_opCustomCVSI(i); p.opCustomCVS_async(cb, i); cb.check(); } { Custom<Custom<int>> i = new Custom<Custom<int>>(); for(int c = 0; c < _length; ++c) { Custom<int> inner = new Custom<int>(); for(int j = 0; j < c; ++j) { inner.Add(j); } i.Add(inner); } AMI_MyClass_opCustomIntSSI cb = new AMI_MyClass_opCustomIntSSI(i); p.opCustomIntSS_async(cb, i); cb.check(); } { Custom<Custom<CV>> i = new Custom<Custom<CV>>(); for(int c = 0; c < _length; ++c) { Custom<CV> inner = new Custom<CV>(); for(int j = 0; j < c; ++j) { inner.Add(new CV(j)); } i.Add(inner); } AMI_MyClass_opCustomCVSSI cb = new AMI_MyClass_opCustomCVSSI(i); p.opCustomCVSS_async(cb, i); cb.check(); } #if !COMPACT && !SILVERLIGHT { Serialize.Small i = null; AMI_MyClass_opSerialSmallCSharpNull cb = new AMI_MyClass_opSerialSmallCSharpNull(); p.opSerialSmallCSharp_async(cb, i); cb.check(); } { Serialize.Small i = new Serialize.Small(); i.i = 99; AMI_MyClass_opSerialSmallCSharp cb = new AMI_MyClass_opSerialSmallCSharp(); p.opSerialSmallCSharp_async(cb, i); cb.check(); } { Serialize.Large i = new Serialize.Large(); i.d1 = 1.0; i.d2 = 2.0; i.d3 = 3.0; i.d4 = 4.0; i.d5 = 5.0; i.d6 = 6.0; i.d7 = 7.0; i.d8 = 8.0; i.d9 = 9.0; i.d10 = 10.0; AMI_MyClass_opSerialLargeCSharp cb = new AMI_MyClass_opSerialLargeCSharp(); p.opSerialLargeCSharp_async(cb, i); cb.check(); } { Serialize.Struct i = new Serialize.Struct(); i.o = null; i.o2 = i; i.s = null; i.s2 = "Hello"; AMI_MyClass_opSerialStructCSharp cb = new AMI_MyClass_opSerialStructCSharp(); p.opSerialStructCSharp_async(cb, i); cb.check(); } #endif }
public static string HandleSpaceinLinuxPath(string filePath) { var name = new List<string>(); string[] ss = filePath.Split('/'); foreach (string variable in ss) { if (variable.IndexOf(' ') > 0) { name.Add(variable); } } if (name.Count > 0) { foreach (var variable in name) { filePath = filePath.Replace(variable, "'" + variable + "'"); } } return filePath; }