use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.
the class PathSummaryTest method testSecondMoveToFirstChild.
@Test
public void testSecondMoveToFirstChild() throws SirixException {
wtx.moveTo(9);
wtx.insertElementAsFirstChild(new QNm("foo"));
wtx.insertElementAsFirstChild(new QNm("bar"));
PathSummaryReader pathSummary = wtx.getPathSummary();
pathSummary.moveToDocumentRoot();
wtx.moveTo(5);
wtx.moveSubtreeToRightSibling(9);
pathSummary = wtx.getPathSummary();
pathSummary.moveToDocumentRoot();
wtx.commit();
wtx.close();
final XdmNodeReadTrx rtx = holder.getResourceManager().beginNodeReadTrx();
rtx.close();
}
use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.
the class UpdateTest method testReplaceTextNode.
@Test
public void testReplaceTextNode() throws SirixException, IOException, XMLStreamException {
final XdmNodeWriteTrx wtx = holder.getResourceManager().beginNodeWriteTrx();
DocumentCreater.create(wtx);
wtx.commit();
XdmNodeReadTrx rtx = holder.getResourceManager().beginNodeReadTrx();
rtx.moveTo(12);
wtx.moveTo(5);
wtx.replaceNode(rtx);
testReplaceTextNode(wtx);
wtx.commit();
testReplaceTextNode(wtx);
wtx.close();
rtx = holder.getResourceManager().beginNodeReadTrx();
testReplaceTextNode(rtx);
rtx.close();
}
use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.
the class UpdateTest method testDelete.
@Test
public void testDelete() throws SirixException {
try (final XdmNodeWriteTrx wtx = holder.getResourceManager().beginNodeWriteTrx()) {
DocumentCreater.create(wtx);
wtx.moveTo(4);
wtx.insertElementAsRightSibling(new QNm("blabla"));
wtx.moveTo(5);
wtx.remove();
assertEquals(8, wtx.getNodeKey());
wtx.moveTo(4);
testDelete(wtx);
wtx.commit();
testDelete(wtx);
wtx.close();
try (final XdmNodeReadTrx rtx = holder.getResourceManager().beginNodeReadTrx()) {
testDelete(rtx);
}
}
}
use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.
the class UpdateTest method testReplaceElementNode.
@Test
public void testReplaceElementNode() throws SirixException, IOException, XMLStreamException {
final XdmNodeWriteTrx wtx = holder.getResourceManager().beginNodeWriteTrx();
DocumentCreater.create(wtx);
wtx.commit();
XdmNodeReadTrx rtx = holder.getResourceManager().beginNodeReadTrx();
rtx.moveTo(11);
wtx.moveTo(5);
wtx.replaceNode(rtx);
testReplaceElementNode(wtx);
wtx.commit();
testReplaceElementNode(wtx);
wtx.close();
rtx = holder.getResourceManager().beginNodeReadTrx();
testReplaceElementNode(rtx);
rtx.close();
}
use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.
the class UpdateTest method testPageBoundary.
@Test
public void testPageBoundary() throws SirixException {
final XdmNodeWriteTrx wtx = holder.getResourceManager().beginNodeWriteTrx();
// Document root.
wtx.insertElementAsFirstChild(new QNm(""));
wtx.insertElementAsFirstChild(new QNm(""));
for (int i = 0; i < 512 << 1 + 1; i++) {
wtx.insertElementAsRightSibling(new QNm(""));
}
testPageBoundary(wtx);
wtx.commit();
testPageBoundary(wtx);
wtx.close();
final XdmNodeReadTrx rtx = holder.getResourceManager().beginNodeReadTrx();
testPageBoundary(rtx);
rtx.close();
}
Aggregations