Package javax.jcr.query.qom

Examples of javax.jcr.query.qom.FullTextSearch


    /**
     * Test case for {@link QueryObjectModelFactory#fullTextSearch(String, String, StaticOperand)}
     */
    public void testFullTextSearch() throws RepositoryException {
        FullTextSearch ftSearch = qf.fullTextSearch(
                SELECTOR_NAME1, propertyName1,
                qf.literal(vf.createValue(FULLTEXT_SEARCH_EXPR)));
        assertEquals("Wrong selector name", SELECTOR_NAME1, ftSearch.getSelectorName());
        assertEquals("Wrong propertyName", propertyName1, ftSearch.getPropertyName());

        StaticOperand op = ftSearch.getFullTextSearchExpression();
        assertNotNull(op);
        assertTrue("not a Literal", op instanceof Literal);
        Literal literal = (Literal) op;
        assertEquals(FULLTEXT_SEARCH_EXPR, literal.getLiteralValue().getString());
    }
View Full Code Here


    /**
     * Test case for {@link QueryObjectModelFactory#fullTextSearch(String, String, StaticOperand)}
     */
    public void testFullTextSearchAllProperties() throws RepositoryException {
        FullTextSearch ftSearch = qf.fullTextSearch(
                SELECTOR_NAME1, null,
                qf.literal(vf.createValue(FULLTEXT_SEARCH_EXPR)));
        assertEquals("Wrong selector name", SELECTOR_NAME1, ftSearch.getSelectorName());
        assertNull("Property name must be null", ftSearch.getPropertyName());
    }
View Full Code Here

    /**
     * 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());
    }
View Full Code Here

            return Collections.singleton(cn.getSelectorName());
        } else if (constraint instanceof DescendantNode) {
            DescendantNode dn = (DescendantNode) constraint;
            return Collections.singleton(dn.getSelectorName());
        } else if (constraint instanceof FullTextSearch) {
            FullTextSearch fts = (FullTextSearch) constraint;
            return Collections.singleton(fts.getSelectorName());
        } else {
            throw new UnsupportedRepositoryOperationException(
                    "Unknown constraint type: " + constraint);
        }
    }
View Full Code Here

    /**
     * Test case for {@link QueryObjectModelFactory#fullTextSearch(String, String, String)}
     */
    public void testFullTextSearch() throws RepositoryException {
        FullTextSearch ftSearch = qf.fullTextSearch(
                SELECTOR_NAME1, propertyName1,
                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);
    }
View Full Code Here

    /**
     * Test case for {@link QueryObjectModelFactory#fullTextSearch(String, String, String)}
     */
    public void testFullTextSearchAllProperties() throws RepositoryException {
        FullTextSearch ftSearch = qf.fullTextSearch(
                SELECTOR_NAME1, null,
                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?
    }
View Full Code Here

    }

    @Test
    public void fullTextSearch() throws RepositoryException {
        Literal l = f.literal(vf.createValue(1));
        FullTextSearch x = f.fullTextSearch("selectorName", "propertyName", l);
        assertEquals("selectorName", x.getSelectorName());
        assertEquals("propertyName", x.getPropertyName());
        assertEquals(l, x.getFullTextSearchExpression());
        assertEquals("CONTAINS([selectorName].[propertyName], 1)", x.toString());
       
        assertEquals("CONTAINS([p], null)", f.fullTextSearch(null,  "p"null).toString());
        assertEquals("CONTAINS([s].[p], null)", f.fullTextSearch("s""p"null).toString());
        assertEquals("CONTAINS([s].*, null)", f.fullTextSearch("s",  null,  null).toString());
        assertEquals("CONTAINS(*, null)", f.fullTextSearch(null,  null,  null).toString());
View Full Code Here

    }

    @Test
    public void fullTextSearch() throws RepositoryException {
        Literal l = f.literal(vf.createValue(1));
        FullTextSearch x = f.fullTextSearch("selectorName", "propertyName", l);
        assertEquals("selectorName", x.getSelectorName());
        assertEquals("propertyName", x.getPropertyName());
        assertEquals(l, x.getFullTextSearchExpression());
    }
View Full Code Here

    /**
     * Test case for {@link QueryObjectModelFactory#fullTextSearch(String, String, String)}
     */
    public void testFullTextSearch() throws RepositoryException {
        FullTextSearch ftSearch = qf.fullTextSearch(SELECTOR_NAME1, propertyName1, 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?
    }
View Full Code Here

    /**
     * Test case for {@link QueryObjectModelFactory#fullTextSearch(String, String, String)}
     */
    public void testFullTextSearchAllProperties() throws RepositoryException {
        FullTextSearch ftSearch = qf.fullTextSearch(SELECTOR_NAME1, null, 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?
    }
View Full Code Here

TOP

Related Classes of javax.jcr.query.qom.FullTextSearch

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.