Package org.apache.chemistry.opencmis.server.support.query

Examples of org.apache.chemistry.opencmis.server.support.query.CmisQueryWalker


    }

    @Test
    public void simpleFromTest4() {
        String statement = "SELECT X.aaa FROM MyType AS X WHERE 10 = ANY X.aaa ";
        CmisQueryWalker walker = traverseStatementAndCatchExc(statement);
        assertNotNull(walker);

        Map<String,String> types = queryObj.getTypes();
        assertTrue(1 == types.size());
View Full Code Here


    @Test
    public void simpleWhereTest() {
        String statement = "SELECT * FROM MyType WHERE MyProp1=123";

        CmisQueryWalker walker = traverseStatementAndCatchExc(statement);
        assertNotNull(walker);

        List<CmisSelector> whereRefs = queryObj.getWhereReferences();
        Map<Integer, CmisSelector> colRefs = queryObj.getColumnReferences();
        assertTrue(1 == whereRefs.size());

        CmisSelector value = whereRefs.iterator().next();
        assertTrue(value instanceof ColumnReference);
        assertEquals("MyProp1", ((ColumnReference)value).getPropertyQueryName());
        // only "*" should be in select references
        assertTrue(1 == queryObj.getSelectReferences().size());

        CommonTree tree = (CommonTree) walker.getTreeNodeStream().getTreeSource();

        // System.out.println("simpleWhereTest printing Tree ...");
        // System.out.println("id in map: " + System.identityHashCode(whereRefs.keySet().iterator().next()));
//        assertTrue(traverseTreeAndFindNodeInColumnMap(tree, colRefs));
        traverseTreeAndFindNodeInColumnMap2(tree, colRefs);
View Full Code Here

    @Test
    public void simpleSortTest1() {
        String statement = "SELECT * FROM MyType ORDER BY abc.def ASC";

        CmisQueryWalker walker = traverseStatementAndCatchExc(statement);
        assertNotNull(walker);

        List<SortSpec> orderBys = queryObj.getOrderBys();
        assertTrue(1 == orderBys.size());

View Full Code Here

    }

    @Test
    public void simpleSortTest2() {
        String statement = "SELECT * FROM MyType ORDER BY def DESC";
        CmisQueryWalker walker = traverseStatementAndCatchExc(statement);
        assertNotNull(walker);

        List<SortSpec> orderBys = queryObj.getOrderBys();
        assertTrue(1 == orderBys.size());

View Full Code Here

    @Test
    public void doubleFromTest() {
        String statement = "SELECT * FROM MyType JOIN YourType WHERE a='1'";

        CmisQueryWalker walker = traverseStatementAndCatchExc(statement);
        assertNotNull(walker);

        QueryObject from = queryObj;
        Map<String,String> types = from.getTypes();
        assertTrue(2 == types.size());
View Full Code Here

        String statement = "SELECT BookType.Author, BookType.Title TitleAlias FROM BookType WHERE TitleAlias <> 'Harry Potter'";
        verifyResolveSelect(statement);
    }

    private void verifyResolveSelect(String statement) throws Exception {
        CmisQueryWalker walker = traverseStatement(statement);
        assertNotNull(walker);
        Map<String,String> types = queryObj.getTypes();
        assertTrue(1 == types.size());
        List<CmisSelector> selects = queryObj.getSelectReferences();
        assertTrue(2 == selects.size());
View Full Code Here

    @Test
    public void resolveTypesWithTwoFromsQualified() throws Exception {
        String statement = "SELECT BookType.Title, MyDocType.MyStringProp FROM BookType JOIN MyDocType WHERE BookType.ISBN = '100'";

        CmisQueryWalker walker = traverseStatement(statement);
        assertNotNull(walker);
        Map<String,String> types = queryObj.getTypes();
        assertTrue(2 == types.size());
        List<CmisSelector> selects = queryObj.getSelectReferences();
        assertTrue(2 == selects.size());
View Full Code Here

    @Test
    public void resolveTypesWithTwoFromsSameTypeCorrectlyQualified()
            throws Exception {
        String statement = "SELECT A.Title FROM BookType A JOIN BookType B";

        CmisQueryWalker walker = traverseStatement(statement);
        assertNotNull(walker);
        Map<String, String> types = queryObj.getTypes();
        assertEquals(2, types.size());
        List<CmisSelector> selects = queryObj.getSelectReferences();
        assertEquals(1, selects.size());
View Full Code Here

    @Test
    public void resolveTypesWithTwoFromsUnqualified() throws Exception {
        String statement = "SELECT Title, MyStringProp FROM BookType JOIN MyDocType AS MyDocAlias WHERE BookType.ISBN = '100'";

        CmisQueryWalker walker = traverseStatement(statement);
        assertNotNull(walker);
       Map<String,String> types = queryObj.getTypes();
        assertTrue(2 == types.size());
        List<CmisSelector> selects = queryObj.getSelectReferences();
        assertTrue(2 == selects.size());
View Full Code Here

    @Test
    public void resolveTypesWithTwoFromsUniqueByQualifying() throws Exception {
        String statement = "SELECT MyDocType.MyStringProp FROM MyDocTypeCopy JOIN MyDocType";

        CmisQueryWalker walker = traverseStatement(statement);
        assertNotNull(walker);
        Map<String,String> types = queryObj.getTypes();
        assertTrue(2 == types.size());
        List<CmisSelector> selects = queryObj.getSelectReferences();
        assertTrue(1 == selects.size());
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.server.support.query.CmisQueryWalker

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.