record -> { String uri = record.getUri(); String collection = record.getMetadata(new DocumentMetadataHandle()).getCollections().iterator().next(); String contents = record.getContentAs(String.class); return uri + "," + collection + "," + contents;
for ( DocumentRecord record : documents ) { JacksonHandle content = record.getContent(new JacksonHandle()); JacksonHandle metadata = record.getMetadata(new JacksonHandle()); if ( "doc1.json".equals(record.getUri()) ) { assertEquals("Failed to read document 1", "dog", content.get().get("animal").textValue());
mhRead = rec.getMetadata(mhRead); validateMetadata(mhRead);
try { for ( DocumentRecord doc: documents ) { DocumentMetadataHandle metadata = doc.getMetadata(new DocumentMetadataHandle()); StringHandle content = doc.getContent(new StringHandle()); if ( "doc4.json".equals(doc.getUri()) ) { try { for ( DocumentRecord doc: documents ) { DocumentMetadataHandle metadata = doc.getMetadata(new DocumentMetadataHandle()); if ( "doc6.json".equals(doc.getUri()) ) { assertEquals("Doc 6 should have the system default quality of 0", 0,
@Test public void testBulkReadMetadataUsingMultipleUriNoTransaction() throws KeyManagementException, NoSuchAlgorithmException, Exception { String docId[] = { "/foo/test/URIFoo1.txt", "/foo/test/URIFoo2.txt", "/foo/test/URIFoo3.txt" }; DocumentMetadataHandle mhRead = new DocumentMetadataHandle(); TextDocumentManager docMgr = client.newTextDocumentManager(); docMgr.setMetadataCategories(Metadata.ALL); DocumentWriteSet writeset = docMgr.newWriteSet(); // put meta-data DocumentMetadataHandle mh = setMetadata(); writeset.addDefault(mh); writeset.add(docId[0], new StringHandle().with("This is so URI foo 1")); writeset.add(docId[1], new StringHandle().with("This is so URI foo 2")); writeset.add(docId[2], new StringHandle().with("This is so URI foo 3")); docMgr.write(writeset); DocumentPage page = docMgr.readMetadata(docId[0], docId[1], docId[2]); // Issue #294 DocumentPage.size() should return correct size assertTrue("DocumentPage Size did not return expected value:: returned== " + page.size(), page.size() == 3); while (page.hasNext()) { DocumentRecord rec = page.next(); rec.getMetadata(mhRead); validateMetadata(mhRead); } validateMetadata(mhRead); mhRead = null; }