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();
}
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);
}
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);
}
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);
}
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();
}
Aggregations