@Test public void copy1() { Folder c1 = db.createFolder("/c1"), c2 = db.createFolder("/c2"); XMLDocument original = c1.documents().build(Name.create(db, "original")).elem("test").end("test").commit(); XMLDocument copy = original.copy(c2, Name.keepCreate(db)); assertEquals(1, c1.documents().size()); c1.query().single("/test"); assertEquals(1, c2.documents().size()); c2.query().single("/test"); copy.query().single("/test"); }
@Test public void move1() { Folder c1 = db.createFolder("/c1"), c2 = db.createFolder("/c2"); XMLDocument doc = c1.documents().build(Name.create(db, "original")).elem("test").end("test").commit(); doc.move(c2, Name.keepCreate(db)); assertEquals(0, c1.documents().size()); assertFalse(c1.query().exists("/test")); assertEquals(1, c2.documents().size()); c2.query().single("/test"); doc.query().single("/test"); assertEquals("/c2/original", doc.path()); }