|
34 | 34 | import org.w3c.dom.NodeList; |
35 | 35 | import org.xml.sax.SAXException; |
36 | 36 |
|
| 37 | +import com.fasterxml.jackson.databind.JsonNode; |
37 | 38 | import com.marklogic.client.document.DocumentManager.Metadata; |
| 39 | +import com.marklogic.client.document.JSONDocumentManager; |
38 | 40 | import com.marklogic.client.document.XMLDocumentManager; |
| 41 | +import com.marklogic.client.extra.jackson.JacksonHandle; |
39 | 42 | import com.marklogic.client.io.DocumentMetadataHandle; |
40 | 43 | import com.marklogic.client.io.DocumentMetadataHandle.Capability; |
41 | 44 | import com.marklogic.client.io.DocumentMetadataHandle.DocumentCollections; |
42 | 45 | import com.marklogic.client.io.DocumentMetadataHandle.DocumentPermissions; |
43 | 46 | import com.marklogic.client.io.DocumentMetadataHandle.DocumentProperties; |
| 47 | +import com.marklogic.client.io.Format; |
44 | 48 | import com.marklogic.client.io.StringHandle; |
45 | 49 |
|
46 | 50 | public class DocumentMetadataHandleTest { |
47 | 51 | @BeforeClass |
48 | 52 | public static void beforeClass() { |
49 | 53 | Common.connect(); |
| 54 | + //System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.wire", "debug"); |
50 | 55 | } |
51 | 56 | @AfterClass |
52 | 57 | public static void afterClass() { |
@@ -165,4 +170,19 @@ public void testReadWriteMetadata() throws SAXException, IOException, XpathExcep |
165 | 170 | assertEquals("Wrong quality", 3, metaReadHandle.getQuality()); |
166 | 171 | } |
167 | 172 | } |
| 173 | + |
| 174 | + /** If we regress on https://github.com/marklogic/java-client-api/issues/92 */ |
| 175 | + @Test |
| 176 | + public void testIssue92() { |
| 177 | + DocumentMetadataHandle metadata = new DocumentMetadataHandle(); |
| 178 | + //metadata.getCollections().add("collection"); |
| 179 | + |
| 180 | + JacksonHandle writeHandle = new JacksonHandle(); |
| 181 | + JsonNode writeDocument = writeHandle.getMapper().convertValue("{\"test\":true}", JsonNode.class); |
| 182 | + writeHandle.set(writeDocument); |
| 183 | + |
| 184 | + JSONDocumentManager jsonDocumentManager = Common.client.newJSONDocumentManager(); |
| 185 | + jsonDocumentManager.write("testIssue92.json", metadata, writeHandle); |
| 186 | + jsonDocumentManager.delete("testIssue92.json"); |
| 187 | + } |
168 | 188 | } |
0 commit comments