You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-dev@xml.apache.org by na...@apache.org on 2007/07/25 04:22:19 UTC
svn commit: r559284 -
/xml/xindice/trunk/java/tests/src/org/apache/xindice/core/indexer/NameIndexerTest.java
Author: natalia
Date: Tue Jul 24 19:22:18 2007
New Revision: 559284
URL: http://svn.apache.org/viewvc?view=rev&rev=559284
Log:
Tests for wildcard patterns
Modified:
xml/xindice/trunk/java/tests/src/org/apache/xindice/core/indexer/NameIndexerTest.java
Modified: xml/xindice/trunk/java/tests/src/org/apache/xindice/core/indexer/NameIndexerTest.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/tests/src/org/apache/xindice/core/indexer/NameIndexerTest.java?view=diff&rev=559284&r1=559283&r2=559284
==============================================================================
--- xml/xindice/trunk/java/tests/src/org/apache/xindice/core/indexer/NameIndexerTest.java (original)
+++ xml/xindice/trunk/java/tests/src/org/apache/xindice/core/indexer/NameIndexerTest.java Tue Jul 24 19:22:18 2007
@@ -110,4 +110,43 @@
assertEquals(2, match.length);
}
+
+ public void testWildcardElementIndex() throws Exception {
+ Indexer ind = createIndex("index", "*");
+
+ Document document = DOMParser.toDocument("<a><test value='abc'>text</test></a>");
+ collection.insertDocument("key1", document);
+
+ document = DOMParser.toDocument("<b><test value=''>text</test></b>");
+ collection.insertDocument("key2", document);
+
+ document = DOMParser.toDocument("<c><test value='bcd'>text</test></c>");
+ collection.insertDocument("key3", document);
+
+ document = DOMParser.toDocument("<d><test value='aac'>text</test></d>");
+ collection.insertDocument("key4", document);
+ IndexMatch[] match = query(ind, "a");
+
+ assertEquals(1, match.length);
+ }
+
+ public void testWildcardAttributeIndex() throws Exception {
+ Indexer ind = createIndex("index", "test@*");
+
+ Document document = DOMParser.toDocument("<test value1='abc'></test>");
+ collection.insertDocument("key1", document);
+
+ document = DOMParser.toDocument("<test value2=''>q</test>");
+ collection.insertDocument("key2", document);
+
+ document = DOMParser.toDocument("<test value3='bcd'>q</test>");
+ collection.insertDocument("key3", document);
+
+ document = DOMParser.toDocument("<test value4='aac'>q</test>");
+ collection.insertDocument("key4", document);
+ IndexMatch[] match = query(ind, "test@value3");
+
+ assertEquals(1, match.length);
+ }
+
}