@SuppressWarnings("deprecation") @Test public void testAppend() { storage.append(jsonEntries); Directory directory = storage.getAuditDirectory(); String schemaName = directory.getSchema(); try (Session session = directory.getSession()) { DocumentModelList auditEntries = session.getEntries(); assertEquals(2, auditEntries.size()); String jsonEntry1 = jsonEntries.get(0); DocumentModel auditEntry1 = auditEntries.get(0); assertTrue(auditEntry1.hasSchema(schemaName)); assertEquals(1L, auditEntry1.getPropertyValue(DirectoryAuditStorage.ID_COLUMN)); assertEquals(jsonEntry1, auditEntry1.getPropertyValue(DirectoryAuditStorage.JSON_COLUMN)); String jsonEntry2 = jsonEntries.get(1); DocumentModel auditEntry2 = auditEntries.get(1); assertTrue(auditEntry2.hasSchema(schemaName)); assertEquals(2L, auditEntry2.getPropertyValue(DirectoryAuditStorage.ID_COLUMN)); assertEquals(jsonEntry2, auditEntry2.getPropertyValue(DirectoryAuditStorage.JSON_COLUMN)); } }
@Override public void append(List<String> jsonEntries) { try (Session session = getAuditDirectory().getSession()) { for (String jsonEntry : jsonEntries) { Framework.doPrivileged(() -> session.createEntry(Collections.singletonMap(JSON_COLUMN, jsonEntry))); } } }
DirectoryAuditStorage implements AuditStorage { @Override public void append(List<String> jsonEntries) { try (Session session = getAuditDirectory().getSession()) { for (String jsonEntry : jsonEntries) { Framework.doPrivileged(() -> session.createEntry(Collections.singletonMap(JSON_COLUMN, jsonEntry))); } } } }
DirectoryAuditStorage implements AuditStorage { @Override public void append(List<String> jsonEntries) { try (Session session = getAuditDirectory().getSession()) { for (String jsonEntry : jsonEntries) { Framework.doPrivileged(() -> session.createEntry(Collections.singletonMap(JSON_COLUMN, jsonEntry))); } } }  }
DirectoryAuditStorage implements AuditStorage { @Override public void append(List<String> jsonEntries) { try (Session session = getAuditDirectory().getSession()) { for (String jsonEntry : jsonEntries) { Framework.doPrivileged(() -> session.createEntry(Collections.singletonMap(JSON_COLUMN, jsonEntry))); } } }  @Override void append(List<String> jsonEntries); @Override ScrollResult<String> scroll(String scrollId); @Override ScrollResult<String> scroll(QueryBuilder queryBuilder, int batchSize, int keepAlive); }
DirectoryAuditStorage implements AuditStorage { @Override public void append(List<String> jsonEntries) { try (Session session = getAuditDirectory().getSession()) { for (String jsonEntry : jsonEntries) { Framework.doPrivileged(() -> session.createEntry(Collections.singletonMap(JSON_COLUMN, jsonEntry))); } } }  @Override void append(List<String> jsonEntries); @Override ScrollResult<String> scroll(String scrollId); @Override ScrollResult<String> scroll(QueryBuilder queryBuilder, int batchSize, int keepAlive); static final String NAME; static final String DIRECTORY_NAME; static final String ID_COLUMN; static final String JSON_COLUMN; }