This project has retired. For details please refer to its
Attic page.
TestParserExt xref
1/*2 * Licensed to the Apache Software Foundation (ASF) under one3 * or more contributor license agreements. See the NOTICE file4 * distributed with this work for additional information5 * regarding copyright ownership. The ASF licenses this file6 * to you under the Apache License, Version 2.0 (the7 * "License"); you may not use this file except in compliance8 * with the License. You may obtain a copy of the License at9 *10 * http://www.apache.org/licenses/LICENSE-2.011 *12 * Unless required by applicable law or agreed to in writing,13 * software distributed under the License is distributed on an14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY15 * KIND, either express or implied. See the License for the16 * specific language governing permissions and limitations17 * under the License.18 */19package org.apache.chemistry.opencmis.server.support.query;
2021import org.apache.commons.logging.Log;
22import org.apache.commons.logging.LogFactory;
23import org.junit.After;
24import org.junit.Before;
25import org.junit.Test;
2627publicclassTestParserExtextendsAbstractParserTest {
2829privatestaticfinal Log log = LogFactory.getLog(TestParserStrict.class);
3031 @Before
32publicvoid setUp() throws Exception {
33super.setUp(CmisQlStrictLexer.class, CmisQlExtParser.class, null);
34 }
3536 @Override
37 @After
38publicvoid tearDown() {
39super.tearDown();
40 }
4142 @Test
43publicvoid test_predicate1() {
44 testParser("value_expression", "LOWER(foo)", "(FUNC LOWER (COL foo))");
45 }
4647 @Test
48publicvoid test_query1() {
49 testParser("query", "SELECT DISTINCT a, b, c FROM Document", "(SELECT DISTINCT (LIST (COL a) (COL b) (COL c)) (FROM (TABLE Document)))");
50 }
5152 @Test
53publicvoid test_query2() {
54 testParserOk("query",
55"SELECT Y.CLAIM_NUM, X.PROPERTY_ADDRESS, Y.DAMAGE_ESTIMATES " +
56"FROM POLICY AS X JOIN CLAIMS AS Y ON X.POLICY_NUM = Y.POLICY_NUM " +
57" WHERE ( 100000 <= ANY Y.DAMAGE_ESTIMATES ) AND ( Y.CAUSE NOT LIKE '%Katrina%' )");
58 }
596061 @Test
62publicvoid test_query3() {
63 testParserOk("query",
64"SELECT OBJECT_ID, SCORE() AS X, DESTINATION, DEPARTURE_DATES " +
65"FROM TRAVEL_BROCHURE " +
66"WHERE ( CONTAINS('CARIBBEAN CENTRAL AMERICA CRUISE TOUR') ) AND( '2010-1-1' < ANY DEPARTURE_DATES )");
67 }
68 }