Skip to content

Instantly share code, notes, and snippets.



Created May 17, 2020
What would you like to do?
(ns minibench.core
[org.basex BaseXServer]
[org.basex.api.client ClientSession]))
(defonce server (BaseXServer. (make-array String 0)))
(def running (atom true))
(def r (Random.))
(defn launch-bg
(fn []
(with-open [session (ClientSession. "localhost", 1984, "admin", "admin")]
(.execute session (str "OPEN input"))
(while @running
(println "Executing " query)
(.execute session (str "XQUERY " query))
(Thread/sleep (.nextInt r 500))))))
(let [input "c:/Users/emman/workspace/vendor/basex/basex-examples/src/main/resources/xml/input.xml"]
(with-open [session (ClientSession. "localhost", 1984, "admin", "admin")]
(.execute session (str "CREATE DB input " input))
(.execute session (str "XQUERY //li")))
(reset! running true)
(launch-bg "//li")
(launch-bg "insert node <li>new node</li> as last into /html/body//ul")
(launch-bg "insert node <new>One more</new> as last into /html/body")
(Thread/sleep 10000)
(reset! running false)
"END: "
(.execute session (str "XQUERY //li")))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment