public void ToStringSerialisesAllValues() { ReadAuditRequest request = new ReadAuditRequest(); request.Identifier = "identifier"; request.StartRecord = 10; request.NumberOfRecords = 20; request.Filter = AuditFilters.ByProject("testing"); request.ServerName = "serverName"; request.SessionToken = "sessionToken"; request.SourceName = "sourceName"; request.Timestamp = DateTime.Now; string actual = request.ToString(); string expected = string.Format(System.Globalization.CultureInfo.CurrentCulture, "<readAuditMessage xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " + "timestamp=\"{4:yyyy-MM-ddTHH:mm:ss.FFFFFFFzzz}\" identifier=\"{0}\" server=\"{1}\" source=\"{2}\" session=\"{3}\" start=\"{5}\" number=\"{6}\">" + "<filter xsi:type=\"ProjectAuditFilter\" project=\"testing\" />" + "</readAuditMessage>", request.Identifier, request.ServerName, request.SourceName, request.SessionToken, request.Timestamp, request.StartRecord, request.NumberOfRecords); Assert.AreEqual(expected, actual); }
public void GetSetAllPropertiesWorks() { ReadAuditRequest request = new ReadAuditRequest(); request.NumberOfRecords = 12; Assert.AreEqual(12, request.NumberOfRecords, "NumberOfRecords fails the get/set test"); request.StartRecord = 15; Assert.AreEqual(15, request.StartRecord, "StartRecord fails the get/set test"); }
public async override Task <ReadAuditResponse> Read(ReadAuditRequest request, ServerCallContext context) { IDatabase <AuditEntry> database = new MongoDatabase <AuditEntry>(); IRepository <AuditEntry> repository = new AuditRepository(database); var result = await repository.GetByIdAsync(Encoding.UTF8.GetString(request.Audit.Id.ToByteArray())); return(await Task.FromResult(new ReadAuditResponse() { AuditResponse = result })); }
public void ToStringSerialisesDefaultValues() { ReadAuditRequest request = new ReadAuditRequest(); string actual = request.ToString(); string expected = string.Format(System.Globalization.CultureInfo.CurrentCulture, "<readAuditMessage xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " + "timestamp=\"{2:yyyy-MM-ddTHH:mm:ss.FFFFFFFzzz}\" identifier=\"{0}\" source=\"{1}\" />", request.Identifier, request.SourceName, request.Timestamp); Assert.AreEqual(expected, actual); }
/// <summary> /// Reads the specified number of filtered audit events. /// </summary> /// <returns>A list of <see cref="AuditRecord"/>s containing the audit details that match the filter.</returns> public override List <AuditRecord> ReadAuditRecords(int startRecord, int numberOfRecords, AuditFilterBase filter) { ReadAuditRequest request = new ReadAuditRequest(); request.SessionToken = SessionToken; request.ServerName = TargetServer; request.StartRecord = startRecord; request.NumberOfRecords = numberOfRecords; request.Filter = filter; ReadAuditResponse resp = ValidateResponse( connection.SendMessage("ReadAuditRecords", request)) as ReadAuditResponse; return(resp.Records); }
/// <summary> /// Reads the specified number of filtered audit events. /// </summary> /// <param name="request"></param> /// <returns>A list of <see cref="ReadAuditResponse"/>s containing the audit details that match the filter.</returns> public ReadAuditResponse ReadAuditRecords(ReadAuditRequest request) { return(cruiseServer.ReadAuditRecords(request)); }
/// <summary> /// Reads the specified number of filtered audit events. /// </summary> /// <param name="request"></param> /// <returns>A list of <see cref="AuditRecord"/>s containing the audit details that match the filter.</returns> public virtual ReadAuditResponse ReadAuditRecords(ReadAuditRequest request) { return(server.ReadAuditRecords(request)); }