nestedSet = executeQuery(broker, " result = children.selectParentChild(nestedSet.toNodeSet(), NodeSet.DESCENDANT); assertEquals(2, result.getLength());  nestedSet = executeQuery(broker, " result = children.selectParentChild(nestedSet.toNodeSet(), NodeSet.DESCENDANT); assertEquals(4, result.getLength());  nestedSet = executeQuery(broker, " test = new NameTest(Type.ELEMENT, new QName("section", "")); NodeSet sections = broker.getElementIndex().findElementsByTagName(ElementValue.ELEMENT, docs, test.getName(), null); result = ((NodeSet) nestedSet).selectParentChild(sections.toNodeSet(), NodeSet.DESCENDANT); assertEquals(1, result.getLength());
	public void testAxes() {		DBBroker broker = null;        try {        	assertNotNull(pool);            broker = pool.get(SecurityManager.SYSTEM_USER);            assertNotNull(broker);                        Serializer serializer = broker.getSerializer();            serializer.reset();            DocumentSet docs = root.allDocs(broker, new DocumentSet(), true, false);                        Sequence smallSet = executeQuery(broker, "//SPEECH[LINE &= 'perturbed spirit']", 1, null);            Sequence largeSet = executeQuery(broker, "//SPEECH[LINE &= 'love']", 160, null);            Sequence outerSet = executeQuery(broker, "//SCENE[TITLE &= 'closet']", 1, null);                        NameTest test = new NameTest(Type.ELEMENT, new QName("SPEAKER", ""));            NodeSet speakers = broker.getElementIndex().findElementsByTagName(ElementValue.ELEMENT,                    docs, test.getName(), null);                        System.out.println("Testing NodeSetHelper.selectParentChild ...");            NodeSet result = NodeSetHelper.selectParentChild(speakers, smallSet.toNodeSet(), NodeSet.DESCENDANT, -1);            assertEquals(1, result.getLength());            String value = serialize(broker, result.itemAt(0));            System.out.println("NodeSetHelper.selectParentChild: " + value);            assertEquals(value, "<SPEAKER>HAMLET</SPEAKER>");                        result = NodeSetHelper.selectParentChild(speakers, largeSet.toNodeSet(), NodeSet.DESCENDANT, -1);            assertEquals(160, result.getLength());            System.out.println("NodeSetHelper.selectParentChild: PASS");                        System.out.println("Testing AbstractNodeSet.hasChildrenInSet ...");            result = ((AbstractNodeSet)speakers).hasChildrenInSet(smallSet.toNodeSet(), NodeSet.DESCENDANT, -1);            assertEquals(1, result.getLength());            value = serialize(broker, result.itemAt(0));            System.out.println("AbstractNodeSet.hasChildrenInSet: " + value);            assertEquals(value, "<SPEAKER>HAMLET</SPEAKER>");                        result = ((AbstractNodeSet)speakers).hasChildrenInSet(largeSet.toNodeSet(), NodeSet.DESCENDANT, -1);            assertEquals(160, result.getLength());            System.out.println("AbstractNodeSet.hasChildrenInSet: PASS");                        System.out.println("Testing AbstractNodeSet.selectAncestorDescendant ...");            result = speakers.selectAncestorDescendant(outerSet.toNodeSet(), NodeSet.DESCENDANT, false, -1);            assertEquals(56, result.getLength());            System.out.println("AbstractNodeSet.selectAncestorDescendant: PASS");                        System.out.println("Testing AbstractNodeSet.selectAncestorDescendant2 ...");            result = ((AbstractNodeSet)outerSet).selectAncestorDescendant(outerSet.toNodeSet(), NodeSet.DESCENDANT, true, -1);            assertEquals(1, result.getLength());            System.out.println("AbstractNodeSet.selectAncestorDescendant2: PASS");                        System.out.println("Testing AbstractNodeSet.getParents ...");            result = ((AbstractNodeSet)largeSet).getParents(-1);            assertEquals(49, result.getLength());            System.out.println("AbstractNodeSet.getParents: PASS");                        test = new NameTest(Type.ELEMENT, new QName("SCENE", ""));            NodeSet scenes = broker.getElementIndex().findElementsByTagName(ElementValue.ELEMENT,                    docs, test.getName(), null);            scenes.getLength();            System.out.println("Testing AbstractNodeSet.selectAncestors ...");            result = ((AbstractNodeSet)scenes).selectAncestors(largeSet.toNodeSet(), false, -1);            assertEquals(47, result.getLength());            System.out.println("AbstractNodeSet.selectAncestors: PASS");                        NodeProxy proxy = (NodeProxy) smallSet.itemAt(0);            System.out.println("Testing NodeProxy.getParents ...");            result = proxy.getParents(-1);            assertEquals(1, result.getLength());            System.out.println("NodeProxy.getParents: PASS");                        result = speakers.selectParentChild(proxy, NodeSet.DESCENDANT, -1);            assertEquals(1, result.getLength());                        largeSet = executeQuery(broker, "//SPEECH[LINE &= 'love']/SPEAKER", 160, null);            test = new NameTest(Type.ELEMENT, new QName("LINE", ""));            NodeSet lines = broker.getElementIndex().findElementsByTagName(ElementValue.ELEMENT,                    docs, test.getName(), null);            System.out.println("LINE: " + lines.getLength());            System.out.println("SPEAKER: " + largeSet.getLength());            result = ((AbstractNodeSet) lines).selectFollowingSiblings(largeSet.toNodeSet(), -1);            assertEquals(1451, result.getLength());                        largeSet = executeQuery(broker, "//SPEECH[LINE &= 'love']/LINE[1]", 160, null);            result = ((AbstractNodeSet) speakers).selectPrecedingSiblings(largeSet.toNodeSet(), -1);            assertEquals(160, result.getLength());                        Sequence nestedSet = executeQuery(broker, "//section[@n = '1.1.1']", 1, null);            test = new NameTest(Type.ELEMENT, new QName("para", ""));            NodeSet children = broker.getElementIndex().findElementsByTagName(ElementValue.ELEMENT,                    docs, test.getName(), null);            result = ((AbstractNodeSet)children).hasChildrenInSet(nestedSet.toNodeSet(), NodeSet.DESCENDANT, -1);            assertEquals(3, result.getLength());                    } catch (Exception e) {        	e.printStackTrace();	        fail(e.getMessage());        } finally {        	if (pool != null) pool.release(broker);        }	}