use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.
the class UpdateTest method testFirstCopySubtreeAsFirstChild.
@Test
public void testFirstCopySubtreeAsFirstChild() throws SirixException {
// Test for one node.
XdmNodeWriteTrx wtx = holder.getResourceManager().beginNodeWriteTrx();
DocumentCreater.create(wtx);
wtx.commit();
wtx.close();
XdmNodeReadTrx rtx = holder.getResourceManager().beginNodeReadTrx();
rtx.moveTo(4);
wtx = holder.getResourceManager().beginNodeWriteTrx();
wtx.moveTo(9);
wtx.copySubtreeAsFirstChild(rtx);
testFirstCopySubtreeAsFirstChild(wtx);
wtx.commit();
wtx.close();
rtx = holder.getResourceManager().beginNodeReadTrx();
testFirstCopySubtreeAsFirstChild(rtx);
rtx.close();
}
use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.
the class UpdateTest method testRemoveDescendantTextConcat2.
/**
* Test for text concatenation.
*/
@Test
public void testRemoveDescendantTextConcat2() throws SirixException {
final XdmNodeWriteTrx wtx = holder.getResourceManager().beginNodeWriteTrx();
DocumentCreater.create(wtx);
wtx.commit();
wtx.moveTo(9L);
wtx.remove();
wtx.moveTo(5L);
wtx.remove();
testRemoveDescendantTextConcat2(wtx);
wtx.commit();
testRemoveDescendantTextConcat2(wtx);
wtx.close();
final XdmNodeReadTrx rtx = holder.getResourceManager().beginNodeReadTrx();
testRemoveDescendantTextConcat2(rtx);
rtx.close();
}
use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.
the class UpdateTest method testInsert.
@Test
public void testInsert() throws SirixException {
final XdmNodeWriteTrx wtx = holder.getResourceManager().beginNodeWriteTrx();
DocumentCreater.create(wtx);
testInsert(wtx);
wtx.commit();
testInsert(wtx);
wtx.close();
final XdmNodeReadTrx rtx = holder.getResourceManager().beginNodeReadTrx();
testInsert(rtx);
rtx.close();
}
use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.
the class UpdateTest method testSubtreeInsertAsRightSibling.
@Test
public void testSubtreeInsertAsRightSibling() throws SirixException, IOException, XMLStreamException {
final XdmNodeWriteTrx wtx = holder.getResourceManager().beginNodeWriteTrx();
DocumentCreater.create(wtx);
wtx.moveTo(5);
wtx.insertSubtreeAsRightSibling(XMLShredder.createStringReader(DocumentCreater.XML_WITHOUT_XMLDECL));
testSubtreeInsertAsRightSibling(wtx);
wtx.commit();
wtx.moveTo(14);
testSubtreeInsertAsRightSibling(wtx);
wtx.close();
final XdmNodeReadTrx rtx = holder.getResourceManager().beginNodeReadTrx();
rtx.moveTo(14);
testSubtreeInsertAsRightSibling(rtx);
rtx.close();
}
use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.
the class UpdateTest method testFirstMoveToFirstChild.
@Test
public void testFirstMoveToFirstChild() throws SirixException {
final XdmNodeWriteTrx wtx = holder.getResourceManager().beginNodeWriteTrx();
DocumentCreater.create(wtx);
wtx.moveTo(7);
wtx.moveSubtreeToFirstChild(6);
testFirstMoveToFirstChild(wtx);
wtx.commit();
testFirstMoveToFirstChild(wtx);
wtx.close();
final XdmNodeReadTrx rtx = holder.getResourceManager().beginNodeReadTrx();
testFirstMoveToFirstChild(rtx);
rtx.moveToDocumentRoot();
final Builder<SirixDeweyID> builder = ImmutableSet.<SirixDeweyID>builder();
final ImmutableSet<SirixDeweyID> ids = builder.add(new SirixDeweyID("1")).add(new SirixDeweyID("1.3")).add(new SirixDeweyID("1.3.0.3")).add(new SirixDeweyID("1.3.1.3")).add(new SirixDeweyID("1.3.3")).add(new SirixDeweyID("1.3.5")).add(new SirixDeweyID("1.3.5.5")).add(new SirixDeweyID("1.3.5.5.3")).add(new SirixDeweyID("1.3.7")).add(new SirixDeweyID("1.3.9")).add(new SirixDeweyID("1.3.9.1.3")).add(new SirixDeweyID("1.3.9.3")).add(new SirixDeweyID("1.3.9.5")).add(new SirixDeweyID("1.3.11")).build();
test(ids.iterator(), new NonStructuralWrapperAxis(new DescendantAxis(rtx, IncludeSelf.YES)));
rtx.close();
}
Aggregations