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

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


   

    @Test
    public void resolveTypesWhereWithTwoFromsQualifiedWithAlias() throws Exception {
        String statement = "SELECT * FROM BookType AS MyBookAlias JOIN MyDocType  WHERE MyBookAlias.ISBN = '100'";
        CmisQueryWalker walker = traverseStatement(statement);
        QueryObject qo = walker.queryObj;
        List<CmisSelector> wheres = qo.getWhereReferences();
        assertTrue(1 == wheres.size());
        for (CmisSelector where : wheres) {
            assertTrue(where instanceof ColumnReference);
View Full Code Here


            assertTrue(colRef.getPropertyQueryName().equals(ISBN_PROP));
        }
    }

    private void verifyResolveWhere(String statement) throws Exception {
        CmisQueryWalker walker = traverseStatement(statement);
        QueryObject qo = walker.queryObj;
        Map<String,String> types = qo.getTypes();
        assertTrue(1 == types.size());
        List<CmisSelector> wheres = qo.getWhereReferences();
        assertTrue(1 == wheres.size());
View Full Code Here

    @Test
    public void resolveTypesWhereWithTwoFromsNotUnique() throws Exception {
        String statement = "SELECT * FROM MyDocTypeCopy JOIN MyDocType WHERE MyStringProp = '100'";
       
        try {
            CmisQueryWalker walker = traverseStatement(statement);
            fail("Select with an unqualified property that is not unique should fail.");
        } catch (Exception e) {
            assertTrue(e instanceof CmisInvalidArgumentException);
            assertTrue(e.getMessage().contains("is not a unique property query name within the types in from"));
        }
View Full Code Here

    }
   
    @Test
    public void resolveTypesWhereWithTwoFromsUniqueByQualifying() throws Exception {
        String statement = "SELECT * FROM MyDocTypeCopy JOIN MyDocType WHERE MyDocType.MyStringProp = '100'";        
        CmisQueryWalker walker = traverseStatement(statement);
        QueryObject qo = walker.queryObj;
        List<CmisSelector> wheres = qo.getWhereReferences();
        assertTrue(1 == wheres.size());
        for (CmisSelector where : wheres) {
            assertTrue(where instanceof ColumnReference);
View Full Code Here

    }

    @Test
    public void resolveTypesOrderBy() throws Exception {
        String statement = "SELECT Title AS TitleAlias FROM BookType WHERE Author = 'Jim' ORDER BY TitleAlias";        
        CmisQueryWalker walker = traverseStatement(statement);
        QueryObject qo = walker.queryObj;
        List<SortSpec> sorts = qo.getOrderBys();
        assertTrue(1 == sorts.size());
        for (SortSpec sort : sorts) {
            assertTrue(sort.getSelector() instanceof ColumnReference);
View Full Code Here

    }

    @Test
    public void resolveTypesOrderBy2() throws Exception {
        String statement = "SELECT Title AS TitleAlias FROM BookType WHERE Author = 'Jim' ORDER BY BookType.Author";        
        CmisQueryWalker walker = traverseStatement(statement);
        QueryObject qo = walker.queryObj;
        List<SortSpec> sorts = qo.getOrderBys();
        assertTrue(1 == sorts.size());
        for (SortSpec sort : sorts) {
            assertTrue(sort.getSelector() instanceof ColumnReference);
View Full Code Here

    }

    @Test
    public void resolveTypesOrderBy3() throws Exception {
        String statement = "SELECT Title FROM BookType WHERE ISBN < '100' ORDER BY Author";        
        CmisQueryWalker walker = traverseStatement(statement);
        QueryObject qo = walker.queryObj;
        List<SortSpec> sorts = qo.getOrderBys();
        assertTrue(1 == sorts.size());
        for (SortSpec sort : sorts) {
            assertTrue(sort.getSelector() instanceof ColumnReference);
View Full Code Here

    }

    @Test
    public void resolveJoinTypesSimple() throws Exception {
        String statement = "SELECT * FROM MyDocType JOIN BookType ON MyDocType.MyStringProp = BookType.Title";        
        CmisQueryWalker walker = traverseStatement(statement);
        QueryObject qo = walker.queryObj;
        List<CmisSelector> joins = qo.getJoinReferences();
        assertTrue(2 == joins.size());
        for (CmisSelector join : joins) {
            assertTrue(join instanceof ColumnReference);
View Full Code Here

    @Test
    public void simpleSelectTest1() throws Exception {
        String statement = "SELECT SCORE() FROM cmis:document";
       
        CmisQueryWalker walker = traverseStatementAndCatchExc(statement);
        QueryObject select = walker.queryObj;
        List<CmisSelector> selects = select.getSelectReferences();
        assertTrue(1 == selects.size());
        assertTrue(selects.get(0) instanceof FunctionReference);
        FunctionReference funcRef = ((FunctionReference)selects.get(0));
View Full Code Here

    }
   
    @Test
    public void simpleSelectTest2() throws Exception {
        String statement = "SELECT abc FROM cmis:document";        
        CmisQueryWalker walker = traverseStatementAndCatchExc(statement);
        QueryObject select = walker.queryObj;
        List<CmisSelector> selects = queryObj.getSelectReferences();
        assertTrue(1 == selects.size());
        // nothing should be in where references
        assertTrue(0 == select.getWhereReferences().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.