public void createTestDB()
throws Exception {
foo = sess.createDatabase("update_test");
// Create test design document
Document design = new Document();
design.put("_id", "_design/junit");
JSONObject funcs = new JSONObject();
funcs.put("put", JSONUtils.stringSerializedFunction("function(doc,req){doc.Field1=req.query.field1; return [doc, '{\\\"ok\\\":\\\"true\\\"}'];}"));
funcs.put("post", JSONUtils.stringSerializedFunction("function(doc,req){doc.Field2=req.form.field2; return [doc, '{\\\"ok\\\":\\\"true\\\"}'];}"));
design.accumulate("updates", funcs);
// System.err.println("UDFUNCS: " + design.toString());
foo.saveDocument(design);
// Create a document containing test data to process
Document testDoc = new Document();
testDoc.put("_id", "test_data");
testDoc.put("Field1", "Default");
testDoc.put("Field2", "Default");
foo.saveDocument(testDoc);
}