use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.
the class DiffTestHelper method setUpSeventh.
static void setUpSeventh(final Holder holder) throws SirixException, IOException, XMLStreamException {
final XdmNodeWriteTrx wtx = holder.getWriter();
DocumentCreater.create(wtx);
wtx.commit();
final XdmNodeReadTrx rtx = holder.getResourceManager().beginNodeReadTrx(1);
rtx.moveTo(1);
wtx.moveTo(5);
wtx.replaceNode(rtx);
wtx.commit();
rtx.close();
}
use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.
the class ConcurrentAxisTest method testPartConcurrentDescAxis2.
/**
* Test concurrent.
*
* @throws SirixXPathException
*/
// @Bench
@Test
public void testPartConcurrentDescAxis2() throws Exception {
/* query: //regions/africa//location */
final int resultNumber = 55;
final XdmNodeReadTrx firstConcurrRtx = holder.getResourceManager().beginNodeReadTrx();
final Axis axis = new NestedAxis(new NestedAxis(new FilterAxis(new DescendantAxis(firstConcurrRtx, IncludeSelf.YES), new NameFilter(firstConcurrRtx, "regions")), new FilterAxis(new ChildAxis(firstConcurrRtx), new NameFilter(firstConcurrRtx, "africa"))), new ConcurrentAxis(firstConcurrRtx, new FilterAxis(new DescendantAxis(holder.getReader(), IncludeSelf.YES), new NameFilter(holder.getReader(), "location"))));
for (int i = 0; i < resultNumber; i++) {
assertEquals(true, axis.hasNext());
axis.next();
}
assertEquals(axis.hasNext(), false);
}
use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.
the class ConcurrentAxisTest method testConcurrent.
/**
* Test concurrent.
*
* @throws SirixException
*
* @throws SirixXPathException
*/
// @Bench
@Test
public void testConcurrent() throws Exception {
/* query: //regions/africa//location */
final int resultNumber = 55;
final XdmNodeReadTrx firstConcurrRtx = holder.getResourceManager().beginNodeReadTrx();
final XdmNodeReadTrx secondConcurrRtx = holder.getResourceManager().beginNodeReadTrx();
final XdmNodeReadTrx thirdConcurrRtx = holder.getResourceManager().beginNodeReadTrx();
final XdmNodeReadTrx firstRtx = holder.getResourceManager().beginNodeReadTrx();
final XdmNodeReadTrx secondRtx = holder.getResourceManager().beginNodeReadTrx();
final XdmNodeReadTrx thirdRtx = holder.getResourceManager().beginNodeReadTrx();
final Axis axis = new NestedAxis(new NestedAxis(new ConcurrentAxis(firstConcurrRtx, new FilterAxis(new DescendantAxis(firstRtx, IncludeSelf.YES), new NameFilter(firstRtx, "regions"))), new ConcurrentAxis(secondConcurrRtx, new FilterAxis(new ChildAxis(secondRtx), new NameFilter(secondRtx, "africa")))), new ConcurrentAxis(thirdConcurrRtx, new FilterAxis(new DescendantAxis(thirdRtx, IncludeSelf.YES), new NameFilter(thirdRtx, "location"))));
for (int i = 0; i < resultNumber; i++) {
assertEquals(true, axis.hasNext());
axis.next();
}
assertEquals(false, axis.hasNext());
}
use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.
the class CommentFilterTest method testFilterConvetions.
@Test
public void testFilterConvetions() throws SirixException {
final XdmNodeReadTrx wtx = holder.getReader();
wtx.moveTo(9L);
FilterTest.testFilterConventions(new CommentFilter(wtx), false);
wtx.moveTo(4L);
FilterTest.testFilterConventions(new CommentFilter(wtx), false);
wtx.moveTo(1L);
wtx.moveToAttribute(0);
FilterTest.testFilterConventions(new CommentFilter(wtx), false);
wtx.moveTo(9L);
wtx.moveToAttribute(0);
FilterTest.testFilterConventions(new CommentFilter(wtx), false);
}
use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.
the class DocumentRootNodeFilterTest method testFilterConvetions.
@Test
public void testFilterConvetions() throws SirixException {
final XdmNodeReadTrx rtx = holder.getReader();
rtx.moveTo(0L);
FilterTest.testFilterConventions(new DocumentRootNodeFilter(rtx), true);
rtx.moveTo(1L);
FilterTest.testFilterConventions(new DocumentRootNodeFilter(rtx), false);
rtx.moveTo(1L);
rtx.moveToAttribute(0);
FilterTest.testFilterConventions(new DocumentRootNodeFilter(rtx), false);
rtx.moveTo(3L);
FilterTest.testFilterConventions(new DocumentRootNodeFilter(rtx), false);
rtx.moveTo(4L);
FilterTest.testFilterConventions(new DocumentRootNodeFilter(rtx), false);
rtx.moveTo(5L);
FilterTest.testFilterConventions(new DocumentRootNodeFilter(rtx), false);
rtx.moveTo(9L);
FilterTest.testFilterConventions(new DocumentRootNodeFilter(rtx), false);
rtx.moveTo(9L);
rtx.moveToAttribute(0);
FilterTest.testFilterConventions(new DocumentRootNodeFilter(rtx), false);
rtx.moveTo(12L);
FilterTest.testFilterConventions(new DocumentRootNodeFilter(rtx), false);
rtx.moveTo(13L);
rtx.moveToDocumentRoot();
FilterTest.testFilterConventions(new DocumentRootNodeFilter(rtx), true);
}
Aggregations