use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.
the class UpdateTest method testFirstMoveSubtreeToRightSibling.
@Test
public void testFirstMoveSubtreeToRightSibling() throws SirixException {
final XdmNodeWriteTrx wtx = holder.getResourceManager().beginNodeWriteTrx();
DocumentCreater.create(wtx);
wtx.moveToDocumentRoot();
for (final long nodeKey : new NonStructuralWrapperAxis(new DescendantAxis(wtx, IncludeSelf.YES))) {
System.out.println(nodeKey + ": " + wtx.getDeweyID());
}
wtx.moveTo(7);
wtx.moveSubtreeToRightSibling(6);
testFirstMoveSubtreeToRightSibling(wtx);
wtx.moveToDocumentRoot();
for (final long nodeKey : new NonStructuralWrapperAxis(new DescendantAxis(wtx, IncludeSelf.YES))) {
System.out.println(nodeKey + ": " + wtx.getDeweyID());
}
wtx.commit();
wtx.moveToDocumentRoot();
for (final long nodeKey : new NonStructuralWrapperAxis(new DescendantAxis(wtx, IncludeSelf.YES))) {
System.out.println(nodeKey + ": " + wtx.getDeweyID());
}
testFirstMoveSubtreeToRightSibling(wtx);
wtx.close();
final XdmNodeReadTrx rtx = holder.getResourceManager().beginNodeReadTrx();
testFirstMoveSubtreeToRightSibling(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.7")).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();
}
use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.
the class XdmResourceManagerTest method testIdempotentClose.
@Test
public void testIdempotentClose() {
final XdmNodeWriteTrx wtx = holder.getResourceManager().beginNodeWriteTrx();
DocumentCreater.create(wtx);
wtx.commit();
wtx.close();
wtx.close();
final XdmNodeReadTrx rtx = holder.getResourceManager().beginNodeReadTrx();
assertEquals(false, rtx.moveTo(14L).hasMoved());
rtx.close();
rtx.close();
holder.getResourceManager().close();
}
use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.
the class AncestorAxisTest method testAxisConventions.
@Test
public void testAxisConventions() throws SirixException {
final XdmNodeReadTrx rtx = holder.getReader();
rtx.moveTo(12L);
AbsAxisTest.testIAxisConventions(new AncestorAxis(rtx), new long[] { 9L, 1L });
rtx.moveTo(4L);
AbsAxisTest.testIAxisConventions(new AncestorAxis(rtx), new long[] { 1L });
rtx.moveTo(5L);
AbsAxisTest.testIAxisConventions(new AncestorAxis(rtx), new long[] { 1L });
rtx.moveTo(1L);
AbsAxisTest.testIAxisConventions(new AncestorAxis(rtx), new long[] {});
}
use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.
the class AncestorAxisTest method testAxisConventionsIncludingSelf.
@Test
public void testAxisConventionsIncludingSelf() throws SirixException {
final XdmNodeReadTrx rtx = holder.getReader();
rtx.moveTo(11L);
AbsAxisTest.testIAxisConventions(new AncestorAxis(rtx, IncludeSelf.YES), new long[] { 11L, 9L, 1L });
rtx.moveTo(5L);
AbsAxisTest.testIAxisConventions(new AncestorAxis(rtx, IncludeSelf.YES), new long[] { 5L, 1L });
rtx.moveTo(4L);
AbsAxisTest.testIAxisConventions(new AncestorAxis(rtx, IncludeSelf.YES), new long[] { 4L, 1L });
rtx.moveTo(1L);
AbsAxisTest.testIAxisConventions(new AncestorAxis(rtx, IncludeSelf.YES), new long[] { 1L });
}
use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.
the class AttributeAxisTest method testIterate.
@Test
public void testIterate() throws SirixException {
final XdmNodeReadTrx rtx = holder.getReader();
rtx.moveToDocumentRoot();
AbsAxisTest.testIAxisConventions(new AttributeAxis(rtx), new long[] {});
rtx.moveTo(1L);
AbsAxisTest.testIAxisConventions(new AttributeAxis(rtx), new long[] { 3L });
rtx.moveTo(9L);
AbsAxisTest.testIAxisConventions(new AttributeAxis(rtx), new long[] { 10L });
rtx.moveTo(12L);
AbsAxisTest.testIAxisConventions(new AttributeAxis(rtx), new long[] {});
rtx.moveTo(2L);
AbsAxisTest.testIAxisConventions(new AttributeAxis(rtx), new long[] {});
}
Aggregations