@Test public void saveAuditWithLocationAndTrackingChanges() throws Exception { AsyncTaskAuditEventWriter writer = new AsyncTaskAuditEventWriter(auditFile, true, true, false, false); writer.writeEvents(getSampleAuditEventsWithLocationsAndTrackingChanges()); String expectedAuditContent = FileUtils.readFileToString(auditFile); String expectedData = "event,node,start,end,latitude,longitude,accuracy,old-value,new-value\n" + "form start,,1548106927319,,,,,,\n" + "location tracking enabled,,548108908250,,,,,,\n" + "location permissions granted,,548108908255,,,,,,\n" + "location providers enabled,,548108908259,,,,,,\n" + "question,/data/q1,1548106927323,1548106930112,54.4112062,18.5896652,30.716999053955078,Old value,New Value\n" + "add repeat,/data/g1[1],1548106930118,1548106931611,54.4112062,18.5896652,30.716999053955078,,\n" + "end screen,,1548106949448,1548106953601,54.4112062,18.5896652,30.716999053955078,,\n" + "form save,,1548106953600,,54.4112062,18.5896652,30.716999053955078,,\n" + "form exit,,1548106953601,,54.4112062,18.5896652,30.716999053955078,,\n" + "form finalize,,1548106953601,,54.4112062,18.5896652,30.716999053955078,,\n"; assertEquals(expectedData, expectedAuditContent); }
@Override public void writeEvents(List<AuditEvent> auditEvents) { AuditEvent[] auditEventArray = auditEvents.toArray(new AuditEvent[0]); saveTask = new AuditEventSaveTask(file, isLocationEnabled, isTrackingChangesEnabled, isUserRequired, isTrackChangesReasonEnabled).execute(auditEventArray); }
AsyncTaskAuditEventWriter implements AuditEventLogger.AuditEventWriter { @Override public void writeEvents(List<AuditEvent> auditEvents) { AuditEvent[] auditEventArray = auditEvents.toArray(new AuditEvent[0]); saveTask = new AuditEventSaveTask(file, isLocationEnabled, isTrackingChangesEnabled, isUserRequired, isTrackChangesReasonEnabled).execute(auditEventArray); } }
AsyncTaskAuditEventWriter implements AuditEventLogger.AuditEventWriter { @Override public void writeEvents(List<AuditEvent> auditEvents) { AuditEvent[] auditEventArray = auditEvents.toArray(new AuditEvent[0]); saveTask = new AuditEventSaveTask(file, isLocationEnabled, isTrackingChangesEnabled, isUserRequired, isTrackChangesReasonEnabled).execute(auditEventArray); } AsyncTaskAuditEventWriter(@NonNull File file, boolean isLocationEnabled, boolean isTrackingChangesEnabled, boolean isUserRequired, boolean isTrackChangesReasonEnabled); }
AsyncTaskAuditEventWriter implements AuditEventLogger.AuditEventWriter { @Override public void writeEvents(List<AuditEvent> auditEvents) { AuditEvent[] auditEventArray = auditEvents.toArray(new AuditEvent[0]); saveTask = new AuditEventSaveTask(file, isLocationEnabled, isTrackingChangesEnabled, isUserRequired, isTrackChangesReasonEnabled).execute(auditEventArray); } AsyncTaskAuditEventWriter(@NonNull File file, boolean isLocationEnabled, boolean isTrackingChangesEnabled, boolean isUserRequired, boolean isTrackChangesReasonEnabled); @Override void writeEvents(List<AuditEvent> auditEvents); @Override boolean isWriting(); }
AsyncTaskAuditEventWriter implements AuditEventLogger.AuditEventWriter { @Override public void writeEvents(List<AuditEvent> auditEvents) { AuditEvent[] auditEventArray = auditEvents.toArray(new AuditEvent[0]); saveTask = new AuditEventSaveTask(file, isLocationEnabled, isTrackingChangesEnabled, isUserRequired, isTrackChangesReasonEnabled).execute(auditEventArray); } AsyncTaskAuditEventWriter(@NonNull File file, boolean isLocationEnabled, boolean isTrackingChangesEnabled, boolean isUserRequired, boolean isTrackChangesReasonEnabled); @Override void writeEvents(List<AuditEvent> auditEvents); @Override boolean isWriting();  }