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 03:26:39 UTC
svn commit: r559271 -
/xml/xindice/trunk/java/tests/src/org/apache/xindice/core/indexer/ValueIndexerTest.java
Author: natalia
Date: Tue Jul 24 18:26:38 2007
New Revision: 559271
URL: http://svn.apache.org/viewvc?view=rev&rev=559271
Log:
Additional tests for empty elements/attributes
Modified:
xml/xindice/trunk/java/tests/src/org/apache/xindice/core/indexer/ValueIndexerTest.java
Modified: xml/xindice/trunk/java/tests/src/org/apache/xindice/core/indexer/ValueIndexerTest.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/tests/src/org/apache/xindice/core/indexer/ValueIndexerTest.java?view=diff&rev=559271&r1=559270&r2=559271
==============================================================================
--- xml/xindice/trunk/java/tests/src/org/apache/xindice/core/indexer/ValueIndexerTest.java (original)
+++ xml/xindice/trunk/java/tests/src/org/apache/xindice/core/indexer/ValueIndexerTest.java Tue Jul 24 18:26:38 2007
@@ -94,11 +94,49 @@
document = DOMParser.toDocument("<test value='aac'/>");
collection.insertDocument("key", document);
- IndexMatch[] match = query(ind, "test@pattern", "ab", IndexQuery.SW);
+ IndexMatch[] match = query(ind, "test@value", "ab", IndexQuery.SW);
assertEquals(2, match.length);
}
+ public void testElementEmptyStringIndex() throws Exception {
+ Indexer ind = createIndex("StrIndex", "test", "string");
+
+ Document document = DOMParser.toDocument("<test value=''>text</test>");
+ collection.insertDocument("key1", document);
+
+ document = DOMParser.toDocument("<test value='abe'/>");
+ collection.insertDocument("key2", document);
+
+ document = DOMParser.toDocument("<test value='bcd'/>");
+ collection.insertDocument("key3", document);
+
+ document = DOMParser.toDocument("<test value='aac'/>");
+ collection.insertDocument("key4", document);
+
+ IndexMatch[] match = query(ind, "test", "", IndexQuery.EQ);
+ assertEquals(3, match.length);
+ }
+
+ public void testAttributeEmptyStringIndex() throws Exception {
+ Indexer ind = createIndex("StrIndex", "test@value", "string");
+
+ Document document = DOMParser.toDocument("<test value=''>text</test>");
+ collection.insertDocument("key1", document);
+
+ document = DOMParser.toDocument("<test value='abe'/>");
+ collection.insertDocument("key2", document);
+
+ document = DOMParser.toDocument("<test value='bcd'/>");
+ collection.insertDocument("key3", document);
+
+ document = DOMParser.toDocument("<test value='aac'/>");
+ collection.insertDocument("key4", document);
+
+ IndexMatch[] match = query(ind, "test@value", "", IndexQuery.EQ);
+ assertEquals(1, match.length);
+ }
+
public void testLongIntIndex() throws Exception {
Indexer ind = createIndex("IntIndex", "test@value", "long");
@@ -111,7 +149,7 @@
document = DOMParser.toDocument("<test value='-1050687000291'/>");
collection.insertDocument("key3", document);
- IndexMatch[] match = query(ind, "test@pattern", "1049903940000", IndexQuery.GT);
+ IndexMatch[] match = query(ind, "test@value", "1049903940000", IndexQuery.GT);
assertEquals(1, match.length);
}
@@ -143,7 +181,7 @@
document = DOMParser.toDocument("<test value='" + Double.POSITIVE_INFINITY + "'/>");
collection.insertDocument("key8", document);
- IndexMatch[] match = query(ind, "test@pattern", "71.48941", IndexQuery.LT);
+ IndexMatch[] match = query(ind, "test@value", "71.48941", IndexQuery.LT);
assertEquals(6, match.length);
match = query(ind, "test@pattern", "-211.499539", IndexQuery.LT);
@@ -159,7 +197,7 @@
document = DOMParser.toDocument("<test value='-112'/>");
collection.insertDocument("key2", document);
- IndexMatch[] match = query(ind, "test@pattern", "-112", IndexQuery.GT);
+ IndexMatch[] match = query(ind, "test@value", "-112", IndexQuery.GT);
assertEquals(1, match.length);
}
@@ -173,7 +211,7 @@
document = DOMParser.toDocument("<test value='\u00FF'/>");
collection.insertDocument("key2", document);
- IndexMatch[] match = query(ind, "test@pattern", "z", IndexQuery.EQ);
+ IndexMatch[] match = query(ind, "test@value", "z", IndexQuery.EQ);
assertEquals(1, match.length);
}
@@ -187,7 +225,7 @@
document = DOMParser.toDocument("<test value='true'/>");
collection.insertDocument("key2", document);
- IndexMatch[] match = query(ind, "test@pattern", "false", IndexQuery.EQ);
+ IndexMatch[] match = query(ind, "test@value", "false", IndexQuery.EQ);
assertEquals(1, match.length);
}