@Test public void testNewLogger() { RequestLogger logger = Common.client.newLogger(System.out); assertNotNull("Client could not create request logger", logger); }
logger = Common.client.newLogger(out); logger.setContentMax(RequestLogger.ALL_CONTENT); docMgr.startLogging(logger); logger = Common.client.newLogger(out); logger.setContentMax(RequestLogger.ALL_CONTENT); docMgr.startLogging(logger); logger = Common.client.newLogger(out); logger.setContentMax(RequestLogger.ALL_CONTENT); docMgr.startLogging(logger); logger = Common.client.newLogger(out); logger.setContentMax(RequestLogger.ALL_CONTENT); docMgr.startLogging(logger);
@Test public void testSearchLog() { QueryManager qMgr = Common.client.newQueryManager(); ByteArrayOutputStream out = null; RequestLogger logger = null; String outString = null; out = new ByteArrayOutputStream(); logger = Common.client.newLogger(out); logger.setContentMax(RequestLogger.ALL_CONTENT); qMgr.startLogging(logger); QueryDefinition querydef = qMgr.newStringDefinition(); qMgr.search(querydef, new SearchHandle()); outString = new String(out.toByteArray()); assertTrue("Search failed to log output", outString != null && outString.length() > 0); out = new ByteArrayOutputStream(); logger = Common.client.newLogger(out); logger.setContentMax(RequestLogger.ALL_CONTENT); qMgr.startLogging(logger); DeleteQueryDefinition deleteDef = qMgr.newDeleteDefinition(); deleteDef.setCollections("x"); qMgr.delete(deleteDef); outString = new String(out.toByteArray()); assertTrue("SearchDelete failed to log output", outString != null && outString.length() > 0); }
@Test public void testRequestLogger() throws KeyManagementException, NoSuchAlgorithmException, IOException { System.out.println("Running testRequestLogger"); String filename = "bbq1.xml"; String uri = "/request-logger/"; File file = new File("src/test/java/com/marklogic/client/functionaltest/data/" + filename); // create transaction Transaction transaction = client.openTransaction(); // create a manager for XML documents XMLDocumentManager docMgr = client.newXMLDocumentManager(); // create an identifier for the document String docId = uri + filename; // create a handle on the content FileHandle handle = new FileHandle(file); handle.set(file); // create logger RequestLogger logger = client.newLogger(System.out); logger.setContentMax(RequestLogger.ALL_CONTENT); // start logging docMgr.startLogging(logger); // write the document content docMgr.write(docId, handle, transaction); // commit transaction transaction.commit(); // stop logging docMgr.stopLogging(); String expectedContentMax = "9223372036854775807"; assertEquals("Content log is not equal", expectedContentMax, Long.toString(logger.getContentMax())); }
@Test public void testRequestLogger() throws KeyManagementException, NoSuchAlgorithmException, IOException { System.out.println("Running testRequestLogger"); String filename = "bbq1.xml"; String uri = "/request-logger/"; File file = new File("src/test/java/com/marklogic/client/functionaltest/data/" + filename); // create transaction Transaction transaction = client.openTransaction(); // create a manager for XML documents XMLDocumentManager docMgr = client.newXMLDocumentManager(); // create an identifier for the document String docId = uri + filename; // create a handle on the content FileHandle handle = new FileHandle(file); handle.set(file); // create logger RequestLogger logger = client.newLogger(System.out); logger.setContentMax(RequestLogger.ALL_CONTENT); // start logging docMgr.startLogging(logger); // write the document content docMgr.write(docId, handle, transaction); // commit transaction transaction.commit(); // stop logging docMgr.stopLogging(); String expectedContentMax = "9223372036854775807"; assertEquals("Content log is not equal", expectedContentMax, Long.toString(logger.getContentMax())); }
RequestLogger logger = client.newLogger(System.out); logger.setContentMax(RequestLogger.ALL_CONTENT);
RequestLogger logger = Common.client.newLogger(out); DocumentMetadataHandle meta = new DocumentMetadataHandle().withCollections("xml", "products"); Common.client.newXMLDocumentManager().writeAs("test.xml", meta, xml);