Search in sources :

Example 61 with XdmNodeReadTrx

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

the class VisitorDescendantAxisTest method testIterateIncludingSelfVisitor.

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

        @Override
        protected Iterator<Long> newTargetIterator() {
            final XdmNodeReadTrx rtx = holder.getReader();
            rtx.moveToDocumentRoot();
            return VisitorDescendantAxis.newBuilder(rtx).includeSelf().build();
        }
    }.test();
    rtx.moveTo(1L);
    AbsAxisTest.testIAxisConventions(new VisitorDescendantAxis.Builder(rtx).includeSelf().build(), new long[] { 1L, 4L, 5L, 6L, 7L, 8L, 9L, 11L, 12L, 13L });
    new IteratorTester<Long>(ITERATIONS, IteratorFeature.UNMODIFIABLE, ImmutableList.of(1L, 4L, 5L, 6L, 7L, 8L, 9L, 11L, 12L, 13L), null) {

        @Override
        protected Iterator<Long> newTargetIterator() {
            final XdmNodeReadTrx rtx = holder.getReader();
            rtx.moveTo(1L);
            return VisitorDescendantAxis.newBuilder(rtx).includeSelf().build();
        }
    }.test();
    rtx.moveTo(9L);
    AbsAxisTest.testIAxisConventions(new VisitorDescendantAxis.Builder(rtx).includeSelf().build(), new long[] { 9L, 11L, 12L });
    new IteratorTester<Long>(ITERATIONS, IteratorFeature.UNMODIFIABLE, ImmutableList.of(9L, 11L, 12L), null) {

        @Override
        protected Iterator<Long> newTargetIterator() {
            final XdmNodeReadTrx rtx = holder.getReader();
            rtx.moveTo(9L);
            return VisitorDescendantAxis.newBuilder(rtx).includeSelf().build();
        }
    }.test();
    rtx.moveTo(13L);
    AbsAxisTest.testIAxisConventions(new VisitorDescendantAxis.Builder(rtx).includeSelf().build(), new long[] { 13L });
    new IteratorTester<Long>(ITERATIONS, IteratorFeature.UNMODIFIABLE, ImmutableList.of(13L), null) {

        @Override
        protected Iterator<Long> newTargetIterator() {
            final XdmNodeReadTrx rtx = holder.getReader();
            rtx.moveTo(13L);
            return VisitorDescendantAxis.newBuilder(rtx).includeSelf().build();
        }
    }.test();
}
Also used : XdmNodeReadTrx(org.sirix.api.XdmNodeReadTrx) Iterator(java.util.Iterator) VisitorDescendantAxis(org.sirix.axis.visitor.VisitorDescendantAxis) Test(org.junit.Test)

Example 62 with XdmNodeReadTrx

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

the class NodeFilterTest method testFilterConvetions.

@Test
public void testFilterConvetions() throws SirixException {
    final XdmNodeReadTrx rtx = holder.getReader();
    rtx.moveTo(9L);
    FilterTest.testFilterConventions(new NodeFilter(rtx), true);
    rtx.moveTo(4L);
    FilterTest.testFilterConventions(new NodeFilter(rtx), true);
    rtx.moveTo(1L);
    rtx.moveToAttribute(0);
    FilterTest.testFilterConventions(new NodeFilter(rtx), false);
}
Also used : XdmNodeReadTrx(org.sirix.api.XdmNodeReadTrx) Test(org.junit.Test)

Example 63 with XdmNodeReadTrx

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

the class TextFilterTest method testFilterConvetions.

@Test
public void testFilterConvetions() throws SirixException {
    final XdmNodeReadTrx reader = holder.getReader();
    reader.moveTo(8L);
    FilterTest.testFilterConventions(new TextFilter(reader), true);
    reader.moveTo(3L);
    FilterTest.testFilterConventions(new TextFilter(reader), false);
    reader.moveTo(5L);
    FilterTest.testFilterConventions(new TextFilter(reader), false);
    reader.moveTo(1L);
    reader.moveToAttribute(0);
    FilterTest.testFilterConventions(new TextFilter(reader), false);
}
Also used : XdmNodeReadTrx(org.sirix.api.XdmNodeReadTrx) Test(org.junit.Test)

Example 64 with XdmNodeReadTrx

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

the class ValueFilterTest method testFilterConvetions.

@Test
public void testFilterConvetions() throws SirixException {
    final XdmNodeReadTrx reader = holder.getReader();
    reader.moveTo(4L);
    FilterTest.testFilterConventions(new ValueFilter(reader, "oops1"), true);
    FilterTest.testFilterConventions(new ValueFilter(reader, "foo"), false);
    reader.moveTo(1L);
    reader.moveToAttribute(0);
    FilterTest.testFilterConventions(new ValueFilter(reader, "j"), true);
    reader.moveTo(3L);
    FilterTest.testFilterConventions(new ValueFilter(reader, "j"), true);
}
Also used : XdmNodeReadTrx(org.sirix.api.XdmNodeReadTrx) Test(org.junit.Test)

Example 65 with XdmNodeReadTrx

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

the class AllTimeAxisTest method testAxis.

@Test
public void testAxis() throws SirixException {
    final XdmNodeReadTrx firstReader = holder.getResourceManager().beginNodeReadTrx(1);
    final XdmNodeReadTrx secondReader = holder.getResourceManager().beginNodeReadTrx(2);
    final XdmNodeReadTrx thirdReader = holder.getReader();
    new IteratorTester<XdmNodeReadTrx>(ITERATIONS, IteratorFeature.UNMODIFIABLE, ImmutableList.of(firstReader, secondReader, thirdReader), null) {

        @Override
        protected Iterator<XdmNodeReadTrx> newTargetIterator() {
            return new AllTimeAxis(holder.getReader());
        }
    }.test();
}
Also used : XdmNodeReadTrx(org.sirix.api.XdmNodeReadTrx) Iterator(java.util.Iterator) 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