Search in sources :

Example 56 with XdmNodeReadTrx

use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.

the class PostOrderTest method testIterateWhole.

@Test
public void testIterateWhole() throws SirixException {
    final XdmNodeReadTrx rtx = holder.getReader();
    rtx.moveToDocumentRoot();
    AbsAxisTest.testIAxisConventions(new PostOrderAxis(rtx), new long[] { 4L, 6L, 7L, 5L, 8L, 11L, 12L, 9L, 13L, 1L, 0L });
    new IteratorTester<Long>(ITERATIONS, IteratorFeature.UNMODIFIABLE, ImmutableList.of(4L, 6L, 7L, 5L, 8L, 11L, 12L, 9L, 13L, 1L, 0L), null) {

        @Override
        protected Iterator<Long> newTargetIterator() {
            final XdmNodeReadTrx rtx = holder.getReader();
            rtx.moveToDocumentRoot();
            return new PostOrderAxis(rtx);
        }
    }.test();
}
Also used : XdmNodeReadTrx(org.sirix.api.XdmNodeReadTrx) Iterator(java.util.Iterator) Test(org.junit.Test)

Example 57 with XdmNodeReadTrx

use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.

the class PostOrderTest method testIterateFirstSubtree.

@Test
public void testIterateFirstSubtree() throws SirixException {
    final XdmNodeReadTrx rtx = holder.getReader();
    rtx.moveTo(5L);
    AbsAxisTest.testIAxisConventions(new PostOrderAxis(rtx), new long[] { 6L, 7L });
    new IteratorTester<Long>(ITERATIONS, IteratorFeature.UNMODIFIABLE, ImmutableList.of(6L, 7L), null) {

        @Override
        protected Iterator<Long> newTargetIterator() {
            final XdmNodeReadTrx rtx = holder.getReader();
            rtx.moveTo(5L);
            return new PostOrderAxis(rtx);
        }
    }.test();
}
Also used : XdmNodeReadTrx(org.sirix.api.XdmNodeReadTrx) Iterator(java.util.Iterator) Test(org.junit.Test)

Example 58 with XdmNodeReadTrx

use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.

the class PostOrderTest method testIterateZero.

@Test
public void testIterateZero() throws SirixException {
    final XdmNodeReadTrx rtx = holder.getReader();
    rtx.moveTo(8L);
    AbsAxisTest.testIAxisConventions(new PostOrderAxis(rtx), new long[] {});
    new IteratorTester<Long>(ITERATIONS, IteratorFeature.UNMODIFIABLE, Collections.emptyList(), null) {

        @Override
        protected Iterator<Long> newTargetIterator() {
            final XdmNodeReadTrx rtx = holder.getReader();
            rtx.moveTo(8L);
            return new PostOrderAxis(rtx);
        }
    }.test();
}
Also used : XdmNodeReadTrx(org.sirix.api.XdmNodeReadTrx) Iterator(java.util.Iterator) Test(org.junit.Test)

Example 59 with XdmNodeReadTrx

use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.

the class PrecedingAxisTest method testAxisConventions.

@Test
public void testAxisConventions() throws SirixException {
    final XdmNodeReadTrx rtx = holder.getReader();
    rtx.moveTo(12L);
    AbsAxisTest.testIAxisConventions(new PrecedingAxis(rtx), new long[] { 11L, 8L, 7L, 6L, 5L, 4L });
    rtx.moveTo(5L);
    AbsAxisTest.testIAxisConventions(new PrecedingAxis(rtx), new long[] { 4L });
    rtx.moveTo(13L);
    AbsAxisTest.testIAxisConventions(new PrecedingAxis(rtx), new long[] { 12L, 11L, 9L, 8L, 7L, 6L, 5L, 4L });
    rtx.moveTo(1L);
    AbsAxisTest.testIAxisConventions(new PrecedingAxis(rtx), new long[] {});
    rtx.moveTo(9L);
    rtx.moveToAttribute(0);
    AbsAxisTest.testIAxisConventions(new PrecedingAxis(rtx), new long[] {});
}
Also used : XdmNodeReadTrx(org.sirix.api.XdmNodeReadTrx) Test(org.junit.Test)

Example 60 with XdmNodeReadTrx

use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.

the class SelfAxisTest method testIterate.

@Test
public void testIterate() throws SirixException {
    final XdmNodeReadTrx rtx = holder.getReader();
    rtx.moveTo(4L);
    AbsAxisTest.testIAxisConventions(new SelfAxis(rtx), new long[] { 4L });
    rtx.moveTo(8L);
    AbsAxisTest.testIAxisConventions(new SelfAxis(rtx), new long[] { 8L });
}
Also used : XdmNodeReadTrx(org.sirix.api.XdmNodeReadTrx) Test(org.junit.Test)

Aggregations

XdmNodeReadTrx (org.sirix.api.XdmNodeReadTrx)150 Test (org.junit.Test)93 XdmNodeWriteTrx (org.sirix.api.XdmNodeWriteTrx)48 QNm (org.brackit.xquery.atomic.QNm)20 DescendantAxis (org.sirix.axis.DescendantAxis)17 Iterator (java.util.Iterator)16 ResourceManager (org.sirix.api.ResourceManager)14 Axis (org.sirix.api.Axis)13 DBNode (org.sirix.xquery.node.DBNode)12 QueryException (org.brackit.xquery.QueryException)11 FilterAxis (org.sirix.axis.filter.FilterAxis)11 IndexController (org.sirix.access.IndexController)10 IndexDef (org.sirix.index.IndexDef)10 Item (org.brackit.xquery.xdm.Item)7 Database (org.sirix.api.Database)7 SirixException (org.sirix.exception.SirixException)6 NonStructuralWrapperAxis (org.sirix.axis.NonStructuralWrapperAxis)5 SirixDeweyID (org.sirix.node.SirixDeweyID)5 Path (java.nio.file.Path)4 AbsAxisTest (org.sirix.axis.AbsAxisTest)4