public void SessionCreateOrder() { int rpp = 100; HashSet <Guid> s = new HashSet <Guid>(); for (int page = 1; page <= 10; page++) { List <Guid> sessionList = DataMarshal.GetSessions(page, rpp); Turbine.Data.Session entity = null; DateTime dt = DateTime.Now; foreach (Guid guid in sessionList) { Assert.IsFalse(s.Contains <Guid>(guid)); s.Add(guid); entity = DataMarshal.GetSessionMeta(guid); Debug.WriteLine(entity.Id); // test Create Timestamp Assert.IsTrue(DateTime.Compare(dt, entity.Create) <= 0, "Session '" + guid + "'Out of Order"); dt = entity.Create; } Assert.IsTrue(sessionList.Count() == 100); } }
public Stream GetDescription(string sessionID) { var sessionMeta = DataMarshal.GetSessionMeta(new Guid(sessionID)); Debug.WriteLine("GetDescription: " + sessionMeta); string json = Newtonsoft.Json.JsonConvert.SerializeObject(sessionMeta.Descrption); return(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(json))); }
public Stream GetSession(string sessionID) { int page = QueryParameters.GetPage(1); int rpp = QueryParameters.GetPageSize(1000); Guid session = new Guid(sessionID); bool verbose = QueryParameters.GetVerbose(false); bool meta = QueryParameters.GetMetaData(false); string json = ""; if (meta) { Debug.WriteLine(String.Format("get session {0} metadata", sessionID), this.GetType().Name); var sessionMeta = DataMarshal.GetSessionMeta(session); json = Newtonsoft.Json.JsonConvert.SerializeObject(sessionMeta); return(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(json))); } string simulation = null; Debug.WriteLine(String.Format("get session {0} job resources {1},{2}", sessionID, page, rpp), this.GetType().Name); var jobs = DataMarshal.GetJobs(session, simulation, Guid.Empty, null, page, rpp, verbose); json = Newtonsoft.Json.JsonConvert.SerializeObject(jobs); return(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(json))); }