Author: mreutegg
Date: Mon Jul 13 08:25:33 2009
New Revision: 793485
URL: http://svn.apache.org/viewvc?rev=793485&view=rev
Log:
JCR-2085: test case (TCK) maintenance for JCR 2.0
- enhance tests
Modified:
jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/QueryObjectModelFactoryTest.java
Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/QueryObjectModelFactoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/QueryObjectModelFactoryTest.java?rev=793485&r1=793484&r2=793485&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/QueryObjectModelFactoryTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/QueryObjectModelFactoryTest.java
Mon Jul 13 08:25:33 2009
@@ -370,7 +370,7 @@
}
/**
- * Test case for {@link QueryObjectModelFactory#fullTextSearch(String, String, String)}
+ * Test case for {@link QueryObjectModelFactory#fullTextSearch(String, String, StaticOperand)}
*/
public void testFullTextSearch() throws RepositoryException {
FullTextSearch ftSearch = qf.fullTextSearch(
@@ -378,15 +378,16 @@
qf.literal(vf.createValue(FULLTEXT_SEARCH_EXPR)));
assertEquals("Wrong selector name", SELECTOR_NAME1, ftSearch.getSelectorName());
assertEquals("Wrong propertyName", propertyName1, ftSearch.getPropertyName());
- // TODO is there some way to check the contents of a StaticOperand?
-
- // minimal test of getFullTextSearchExpression()
+
StaticOperand op = ftSearch.getFullTextSearchExpression();
assertNotNull(op);
+ assertTrue("not a Literal", op instanceof Literal);
+ Literal literal = (Literal) op;
+ assertEquals(FULLTEXT_SEARCH_EXPR, literal.getLiteralValue().getString());
}
/**
- * Test case for {@link QueryObjectModelFactory#fullTextSearch(String, String, String)}
+ * Test case for {@link QueryObjectModelFactory#fullTextSearch(String, String, StaticOperand)}
*/
public void testFullTextSearchAllProperties() throws RepositoryException {
FullTextSearch ftSearch = qf.fullTextSearch(
@@ -394,7 +395,23 @@
qf.literal(vf.createValue(FULLTEXT_SEARCH_EXPR)));
assertEquals("Wrong selector name", SELECTOR_NAME1, ftSearch.getSelectorName());
assertNull("Property name must be null", ftSearch.getPropertyName());
- // TODO is there some way to check the contents of a StaticOperand?
+ }
+
+ /**
+ * Test case for {@link QueryObjectModelFactory#fullTextSearch(String, String, StaticOperand)}
+ */
+ public void testFullTextSearchWithBindVariableValue() throws RepositoryException {
+ FullTextSearch ftSearch = qf.fullTextSearch(
+ SELECTOR_NAME1, propertyName1,
+ qf.bindVariable(VARIABLE_NAME));
+ assertEquals("Wrong selector name", SELECTOR_NAME1, ftSearch.getSelectorName());
+ assertEquals("Wrong propertyName", propertyName1, ftSearch.getPropertyName());
+
+ StaticOperand op = ftSearch.getFullTextSearchExpression();
+ assertNotNull(op);
+ assertTrue("not a BindVariableValue", op instanceof BindVariableValue);
+ BindVariableValue value = (BindVariableValue) op;
+ assertEquals(VARIABLE_NAME, value.getBindVariableName());
}
/**
|