@Test public void testMalformedDocuments() { MongoCollection<Document> collection = fongo.getDB().getCollection(HISTORY2); Document correct = new Document() .append("type", "added") .append("msg", "msg") .append("timestamp", System.currentTimeMillis()) .append("ref", "referrer") .append("params", new Document("key", "value")) .append( "rec", new Document() .append("text", "text") .append("begin", 0) .append("end", 1) .append("type", "test")); Document d = new Document(DOC_ID, "6") .append( ENTITIES, new Document("2", "ENTITY_NAME") .append(DOC_3, Arrays.asList("broken1", "broken2")) .append(DOC_4, new Document("type", "merged")) .append(DOC_5, Arrays.asList(correct, ENTITY_NAME))); collection.insertOne(d); assertEquals(1, history.getHistory("6").getAllHistory().size()); assertTrue(history.getHistory("6").getHistory(1).isEmpty()); assertTrue(history.getHistory("6").getHistory(2).isEmpty()); assertTrue(history.getHistory("6").getHistory(3).isEmpty()); assertTrue(history.getHistory("6").getHistory(4).isEmpty()); assertEquals(1, history.getHistory("6").getHistory(5).size()); assertEquals( "value", history.getHistory("6").getHistory(5).iterator().next().getParameters("key").get()); }
@Override public DocumentHistory getHistory(String documentId) { return new MongoDocumentHistory(this, collection, documentId); }
MongoHistory extends AbstractBaleenHistory { @Override public DocumentHistory getHistory(String documentId) { return new MongoDocumentHistory(this, collection, documentId); } }
MongoHistory extends AbstractBaleenHistory { @Override public DocumentHistory getHistory(String documentId) { return new MongoDocumentHistory(this, collection, documentId); } MongoHistory();  MongoHistory(SharedMongoResource mongo); }
MongoHistory extends AbstractBaleenHistory { @Override public DocumentHistory getHistory(String documentId) { return new MongoDocumentHistory(this, collection, documentId); } MongoHistory();  MongoHistory(SharedMongoResource mongo); @Override void afterResourcesInitialized(); @Override DocumentHistory getHistory(String documentId); @Override void closeHistory(String documentId); }
MongoHistory extends AbstractBaleenHistory { @Override public DocumentHistory getHistory(String documentId) { return new MongoDocumentHistory(this, collection, documentId); } MongoHistory();  MongoHistory(SharedMongoResource mongo); @Override void afterResourcesInitialized(); @Override DocumentHistory getHistory(String documentId); @Override void closeHistory(String documentId); static final String KEY_MONGO; static final String PARAM_COLLECTION; }