You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2013/09/20 15:33:33 UTC
[11/59] [abbrv] Cleanup of core
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestParserExceptions.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestParserExceptions.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestParserExceptions.java
index 683861c..933bbb1 100644
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestParserExceptions.java
+++ b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestParserExceptions.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.uri.expression;
@@ -32,40 +32,46 @@ public class TestParserExceptions extends TestBase {
public void testOPMparseOrderByString() {
EdmEntityType edmEtAllTypes = edmInfo.getTypeEtAllTypes();
- //CASE 1
- //http://services.odata.org/Northwind/Northwind.svc/Products/?$orderby=UnitPrice%20ascc
- //-->Syntax error at position 10.
- GetPTO(edmEtAllTypes, "String ascc").aExMsgText("Invalid sort order in OData orderby parser at position 8 in \"String ascc\".");
+ // CASE 1
+ // http://services.odata.org/Northwind/Northwind.svc/Products/?$orderby=UnitPrice%20ascc
+ // -->Syntax error at position 10.
+ GetPTO(edmEtAllTypes, "String ascc").aExMsgText(
+ "Invalid sort order in OData orderby parser at position 8 in \"String ascc\".");
- //CASE 2
- //http://services.odata.org/Northwind/Northwind.svc/Products/?$orderby=UnitPrice%20asc,
- //-->Expression expected at position 12.
+ // CASE 2
+ // http://services.odata.org/Northwind/Northwind.svc/Products/?$orderby=UnitPrice%20asc,
+ // -->Expression expected at position 12.
GetPTO(edmEtAllTypes, "String asc,").aExMsgText("Expression expected after position 11 in \"String asc,\".");
- //CASE 3
- //http://services.odata.org/Northwind/Northwind.svc/Products/?$orderby=UnitPrice%20asc%20d
- //-->Syntax error at position 14.
- GetPTO(edmEtAllTypes, "String asc a").aExMsgText("Comma or end of expression expected at position 12 in \"String asc a\".");
-
- //CASE 4
- //http://services.odata.org/Northwind/Northwind.svc/Products/?$orderby=UnitPrice b
- //-->Syntax error at position 10.
- GetPTO(edmEtAllTypes, "String b").aExMsgText("Invalid sort order in OData orderby parser at position 8 in \"String b\".");
-
- //CASE 5
- //http://services.odata.org/Northwind/Northwind.svc/Products/?$orderby=UnitPrice, UnitPrice b
- //-->Syntax error at position 21.
- GetPTO(edmEtAllTypes, "String, String b").aExMsgText("Invalid sort order in OData orderby parser at position 16 in \"String, String b\".");
-
- //CASE 6
- //http://services.odata.org/Northwind/Northwind.svc/Products/?$orderby=UnitPrice a, UnitPrice desc
- //-->Syntax error at position 10.
- GetPTO(edmEtAllTypes, "String a, String desc").aExMsgText("Invalid sort order in OData orderby parser at position 8 in \"String a, String desc\".");
-
- //CASE 7
- //http://services.odata.org/Northwind/Northwind.svc/Products/?$orderby=UnitPrice asc, UnitPrice b
- //-->Syntax error at position 25.
- GetPTO(edmEtAllTypes, "String asc, String b").aExMsgText("Invalid sort order in OData orderby parser at position 20 in \"String asc, String b\".");
+ // CASE 3
+ // http://services.odata.org/Northwind/Northwind.svc/Products/?$orderby=UnitPrice%20asc%20d
+ // -->Syntax error at position 14.
+ GetPTO(edmEtAllTypes, "String asc a").aExMsgText(
+ "Comma or end of expression expected at position 12 in \"String asc a\".");
+
+ // CASE 4
+ // http://services.odata.org/Northwind/Northwind.svc/Products/?$orderby=UnitPrice b
+ // -->Syntax error at position 10.
+ GetPTO(edmEtAllTypes, "String b").aExMsgText(
+ "Invalid sort order in OData orderby parser at position 8 in \"String b\".");
+
+ // CASE 5
+ // http://services.odata.org/Northwind/Northwind.svc/Products/?$orderby=UnitPrice, UnitPrice b
+ // -->Syntax error at position 21.
+ GetPTO(edmEtAllTypes, "String, String b").aExMsgText(
+ "Invalid sort order in OData orderby parser at position 16 in \"String, String b\".");
+
+ // CASE 6
+ // http://services.odata.org/Northwind/Northwind.svc/Products/?$orderby=UnitPrice a, UnitPrice desc
+ // -->Syntax error at position 10.
+ GetPTO(edmEtAllTypes, "String a, String desc").aExMsgText(
+ "Invalid sort order in OData orderby parser at position 8 in \"String a, String desc\".");
+
+ // CASE 7
+ // http://services.odata.org/Northwind/Northwind.svc/Products/?$orderby=UnitPrice asc, UnitPrice b
+ // -->Syntax error at position 25.
+ GetPTO(edmEtAllTypes, "String asc, String b").aExMsgText(
+ "Invalid sort order in OData orderby parser at position 20 in \"String asc, String b\".");
}
@@ -73,214 +79,321 @@ public class TestParserExceptions extends TestBase {
public void testPMvalidateEdmProperty() {
EdmEntityType edmEtAllTypes = edmInfo.getTypeEtAllTypes();
- //OK
+ // OK
GetPTF(edmEtAllTypes, "'text' eq String").aKind(ExpressionKind.BINARY).aSerialized("{'text' eq String}");
- //CASE 1
- //http://services.odata.org/Northwind/Northwind.svc/Products/?$filter=NotAProperty
- //-->No property 'NotAProperty' exists in type 'ODataWeb.Northwind.Model.Product' at position 10.
- GetPTF(edmEtAllTypes, "NotAProperty").aExMsgText("No property \"NotAProperty\" exists in type \"TecRefScenario.EtAllTypes\" at position 1 in \"NotAProperty\".");
-
- //CASE 2
- //http://services.odata.org/Northwind/Northwind.svc/Products/?$filter='text'%20eq%20NotAProperty
- //-->No property 'NotAProperty' exists in type 'ODataWeb.Northwind.Model.Product' at position 10.
- GetPTF(edmEtAllTypes, "'text' eq NotAProperty").aExMsgText("No property \"NotAProperty\" exists in type \"TecRefScenario.EtAllTypes\" at position 11 in \"'text' eq NotAProperty\".");
-
- //CASE 3
- GetPTF(edmEtAllTypes, "Complex/NotAProperty").aExMsgText("No property \"NotAProperty\" exists in type \"TecRefScenario.CtAllTypes\" at position 9 in \"Complex/NotAProperty\".");
-
- //CASE 4
- GetPTF(edmEtAllTypes, "'text' eq Complex/NotAProperty").aExMsgText("No property \"NotAProperty\" exists in type \"TecRefScenario.CtAllTypes\" at position 19 in \"'text' eq Complex/NotAProperty\".");
-
- //CASE 5
- GetPTF(edmEtAllTypes, "String/NotAProperty").aExMsgText("No property \"NotAProperty\" exists in type \"Edm.String\" at position 8 in \"String/NotAProperty\".");
-
- //CASE 6
- //http://services.odata.org/Northwind/Northwind.svc/Products/?$filter='aText'/NotAProperty
- //-->Exception Stack
- GetPTF(edmEtAllTypes, "'aText'/NotAProperty").aExMsgText("Leftside of method operator at position 8 is not a property in \"'aText'/NotAProperty\".");
-
- //CASE 7
- //http://services.odata.org/Northwind/Northwind.svc/Products/?$filter='Hong Kong' eq ProductName/city
- //--> No property 'city' exists in type 'System.String' at position 27.
- GetPTF(edmEtAllTypes, "'Hong Kong' eq DateTime/city").aExMsgText("No property \"city\" exists in type \"Edm.DateTime\" at position 25 in \"'Hong Kong' eq DateTime/city\".");
-
- //CASE 8
- //http://services.odata.org/Northwind/Northwind.svc/Products/?$filter='Hong Kong' eq ProductName/city
- //--> No property 'city' exists in type 'System.String' at position 27.
- GetPTF(edmEtAllTypes, "'Hong Kong' eq String/city").aExMsgText("No property \"city\" exists in type \"Edm.String\" at position 23 in \"'Hong Kong' eq String/city\".");
+ // CASE 1
+ // http://services.odata.org/Northwind/Northwind.svc/Products/?$filter=NotAProperty
+ // -->No property 'NotAProperty' exists in type 'ODataWeb.Northwind.Model.Product' at position 10.
+ GetPTF(edmEtAllTypes, "NotAProperty").aExMsgText(
+ "No property \"NotAProperty\" exists in type \"TecRefScenario.EtAllTypes\" at position 1 in \"NotAProperty\".");
+
+ // CASE 2
+ // http://services.odata.org/Northwind/Northwind.svc/Products/?$filter='text'%20eq%20NotAProperty
+ // -->No property 'NotAProperty' exists in type 'ODataWeb.Northwind.Model.Product' at position 10.
+ GetPTF(edmEtAllTypes, "'text' eq NotAProperty")
+ .aExMsgText(
+ "No property \"NotAProperty\" exists in type \"TecRefScenario.EtAllTypes\" at" +
+ " position 11 in \"'text' eq NotAProperty\".");
+
+ // CASE 3
+ GetPTF(edmEtAllTypes, "Complex/NotAProperty")
+ .aExMsgText(
+ "No property \"NotAProperty\" exists in type \"TecRefScenario.CtAllTypes\" at" +
+ " position 9 in \"Complex/NotAProperty\".");
+
+ // CASE 4
+ GetPTF(edmEtAllTypes, "'text' eq Complex/NotAProperty")
+ .aExMsgText(
+ "No property \"NotAProperty\" exists in type \"TecRefScenario.CtAllTypes\" at " +
+ "position 19 in \"'text' eq Complex/NotAProperty\".");
+
+ // CASE 5
+ GetPTF(edmEtAllTypes, "String/NotAProperty").aExMsgText(
+ "No property \"NotAProperty\" exists in type \"Edm.String\" at position 8 in \"String/NotAProperty\".");
+
+ // CASE 6
+ // http://services.odata.org/Northwind/Northwind.svc/Products/?$filter='aText'/NotAProperty
+ // -->Exception Stack
+ GetPTF(edmEtAllTypes, "'aText'/NotAProperty").aExMsgText(
+ "Leftside of method operator at position 8 is not a property in \"'aText'/NotAProperty\".");
+
+ // CASE 7
+ // http://services.odata.org/Northwind/Northwind.svc/Products/?$filter='Hong Kong' eq ProductName/city
+ // --> No property 'city' exists in type 'System.String' at position 27.
+ GetPTF(edmEtAllTypes, "'Hong Kong' eq DateTime/city").aExMsgText(
+ "No property \"city\" exists in type \"Edm.DateTime\" at position 25 in \"'Hong Kong' eq DateTime/city\".");
+
+ // CASE 8
+ // http://services.odata.org/Northwind/Northwind.svc/Products/?$filter='Hong Kong' eq ProductName/city
+ // --> No property 'city' exists in type 'System.String' at position 27.
+ GetPTF(edmEtAllTypes, "'Hong Kong' eq String/city").aExMsgText(
+ "No property \"city\" exists in type \"Edm.String\" at position 23 in \"'Hong Kong' eq String/city\".");
}
@Test
public void testPMreadParameters() {
- //OK
+ // OK
GetPTF("concat('A','B')").aSerialized("{concat('A','B')}");
- //CASE 12
- //http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=startswith()
- //-->No applicable function found for 'startswith' at position 0 with the specified arguments. The functions considered are: startswith(System.String, System.String).
- GetPTF("startswith()").aExType(ExpressionParserException.class).aExMsgText("No applicable method found for \"startswith\" at position 1 in \"startswith()\" with the specified arguments. Method \"startswith\" requires exact 2 argument(s).");
-
- //CASE 13
- //http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=startswith('A')
- //-->No applicable function found for 'startswith' at position 0 with the specified arguments. The functions considered are: startswith(System.String, System.String).
- GetPTF("startswith('A')").aExType(ExpressionParserException.class).aExMsgText("No applicable method found for \"startswith\" at position 1 in \"startswith('A')\" with the specified arguments. Method \"startswith\" requires exact 2 argument(s).");
-
- //CASE 14
- //http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=startswith('A','B')
- //-->Resource not found for the segment 'Supplier'.
+ // CASE 12
+ // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=startswith()
+ // -->No applicable function found for 'startswith' at position 0 with the specified arguments. The functions
+ // considered are: startswith(System.String, System.String).
+ GetPTF("startswith()")
+ .aExType(ExpressionParserException.class)
+ .aExMsgText(
+ "No applicable method found for \"startswith\" at position 1 in \"startswith()\" with the specified " +
+ "arguments. Method \"startswith\" requires exact 2 argument(s).");
+
+ // CASE 13
+ // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=startswith('A')
+ // -->No applicable function found for 'startswith' at position 0 with the specified arguments. The functions
+ // considered are: startswith(System.String, System.String).
+ GetPTF("startswith('A')")
+ .aExType(ExpressionParserException.class)
+ .aExMsgText(
+ "No applicable method found for \"startswith\" at position 1 in \"startswith('A')\" with the specified " +
+ "arguments. Method \"startswith\" requires exact 2 argument(s).");
+
+ // CASE 14
+ // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=startswith('A','B')
+ // -->Resource not found for the segment 'Supplier'.
GetPTF("startswith('A','B')").aSerialized("{startswith('A','B')}");
- //CASE 15
- //http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=startswith('A','B','C')
- //-->No applicable function found for 'startswith' at position 0 with the specified arguments. The functions considered are: startswith(System.String, System.String).
- GetPTF("startswith('A','B','C')").aExType(ExpressionParserException.class).aExMsgText("No applicable method found for \"startswith\" at position 1 in \"startswith('A','B','C')\" with the specified arguments. Method \"startswith\" requires exact 2 argument(s).");
-
- //CASE 16
- GetPTF("concat()").aExMsgText("No applicable method found for \"concat\" at position 1 in \"concat()\" with the specified arguments. Method \"concat\" requires 2 or more arguments.");
- //CASE 17
- GetPTF("concat('A')").aExMsgText("No applicable method found for \"concat\" at position 1 in \"concat('A')\" with the specified arguments. Method \"concat\" requires 2 or more arguments.");
- //CASE 18
+ // CASE 15
+ // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=startswith('A','B','C')
+ // -->No applicable function found for 'startswith' at position 0 with the specified arguments. The functions
+ // considered are: startswith(System.String, System.String).
+ GetPTF("startswith('A','B','C')")
+ .aExType(ExpressionParserException.class)
+ .aExMsgText(
+ "No applicable method found for \"startswith\" at position 1 in \"startswith('A','B','C')\" with the" +
+ " specified arguments. Method \"startswith\" requires exact 2 argument(s).");
+
+ // CASE 16
+ GetPTF("concat()")
+ .aExMsgText(
+ "No applicable method found for \"concat\" at position 1 in \"concat()\" with the specified arguments." +
+ " Method \"concat\" requires 2 or more arguments.");
+ // CASE 17
+ GetPTF("concat('A')")
+ .aExMsgText(
+ "No applicable method found for \"concat\" at position 1 in \"concat('A')\" with the specified " +
+ "arguments. Method \"concat\" requires 2 or more arguments.");
+ // CASE 18
GetPTF("concat('A','B')").aSerialized("{concat('A','B')}");
- //CASE 19
+ // CASE 19
GetPTF("concat('A','B','C')").aSerialized("{concat('A','B','C')}");
- //CASE 20
- GetPTF("'A' and concat('A')").aExMsgText("No applicable method found for \"concat\" at position 9 in \"'A' and concat('A')\" with the specified arguments. Method \"concat\" requires 2 or more arguments.");
-
- //CASE 1
- //http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=concat(
- //-->Expression expected at position 7.
- GetPTF("concat(").aExType(ExpressionParserException.class).aExMsgText("Expression expected after position 7 in \"concat(\".");
-
- //CASE 2
- //http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=concat(123
- //-->')' or ',' expected at position 10.
- GetPTF("concat(123").aExType(ExpressionParserException.class).aExMsgText("\")\" or \",\" expected after position 10 in \"concat(123\".");
- //.aExMsgText("Missing closing parenthesis \")\" for opening parenthesis \"(\" at position 7 in \"concat(\".");
-
- //CASE 3
- //http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=concat(,
- //Expression expected at position 7.
- GetPTF("concat(,").aExType(ExpressionParserException.class).aExMsgText("Expression expected at position 8 in \"concat(,\".");
-
- //CASE 4
- //http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=concat(123,
- //-->Expression expected at position 11.
- GetPTF("concat(123,").aExType(ExpressionParserException.class).aExMsgText("Expression expected after position 11 in \"concat(123,\".");
-
- //CASE 5
- //min = -1, max = -1,
+ // CASE 20
+ GetPTF("'A' and concat('A')")
+ .aExMsgText(
+ "No applicable method found for \"concat\" at position 9 in \"'A' and concat('A')\" with the specified " +
+ "arguments. Method \"concat\" requires 2 or more arguments.");
+
+ // CASE 1
+ // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=concat(
+ // -->Expression expected at position 7.
+ GetPTF("concat(").aExType(ExpressionParserException.class).aExMsgText(
+ "Expression expected after position 7 in \"concat(\".");
+
+ // CASE 2
+ // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=concat(123
+ // -->')' or ',' expected at position 10.
+ GetPTF("concat(123").aExType(ExpressionParserException.class).aExMsgText(
+ "\")\" or \",\" expected after position 10 in \"concat(123\".");
+ // .aExMsgText("Missing closing parenthesis \")\" for opening parenthesis \"(\" at position 7 in \"concat(\".");
+
+ // CASE 3
+ // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=concat(,
+ // Expression expected at position 7.
+ GetPTF("concat(,").aExType(ExpressionParserException.class).aExMsgText(
+ "Expression expected at position 8 in \"concat(,\".");
+
+ // CASE 4
+ // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=concat(123,
+ // -->Expression expected at position 11.
+ GetPTF("concat(123,").aExType(ExpressionParserException.class).aExMsgText(
+ "Expression expected after position 11 in \"concat(123,\".");
+
+ // CASE 5
+ // min = -1, max = -1,
GetPTF("testingMINMAX1()").aSerialized("{concat()}");
GetPTF("testingMINMAX1('A')").aSerialized("{concat('A')}");
GetPTF("testingMINMAX1('A','B')").aSerialized("{concat('A','B')}");
GetPTF("testingMINMAX1('A','B','C')").aSerialized("{concat('A','B','C')}");
- //CASE 6
- //min = 0, max = -1,
+ // CASE 6
+ // min = 0, max = -1,
GetPTF("testingMINMAX2()").aSerialized("{concat()}");
GetPTF("testingMINMAX2('A')").aSerialized("{concat('A')}");
GetPTF("testingMINMAX2('A','B')").aSerialized("{concat('A','B')}");
GetPTF("testingMINMAX2('A','B','C')").aSerialized("{concat('A','B','C')}");
- //CASE 7
- //min = 2, max = -1,
- GetPTF("testingMINMAX3()").aExType(ExpressionParserException.class).aExMsgText("No applicable method found for \"concat\" at position 1 in \"testingMINMAX3()\" with the specified arguments. Method \"concat\" requires 2 or more arguments.");
- GetPTF("testingMINMAX3('A')").aExType(ExpressionParserException.class).aExMsgText("No applicable method found for \"concat\" at position 1 in \"testingMINMAX3('A')\" with the specified arguments. Method \"concat\" requires 2 or more arguments.");
+ // CASE 7
+ // min = 2, max = -1,
+ GetPTF("testingMINMAX3()")
+ .aExType(ExpressionParserException.class)
+ .aExMsgText(
+ "No applicable method found for \"concat\" at position 1 in \"testingMINMAX3()\" with the specified " +
+ "arguments. Method \"concat\" requires 2 or more arguments.");
+ GetPTF("testingMINMAX3('A')")
+ .aExType(ExpressionParserException.class)
+ .aExMsgText(
+ "No applicable method found for \"concat\" at position 1 in \"testingMINMAX3('A')\" with the specified " +
+ "arguments. Method \"concat\" requires 2 or more arguments.");
GetPTF("testingMINMAX3('A','B')").aSerialized("{concat('A','B')}");
GetPTF("testingMINMAX3('A','B','C')").aSerialized("{concat('A','B','C')}");
- //CASE 8
- //min =-1, max = 0,
+ // CASE 8
+ // min =-1, max = 0,
GetPTF("testingMINMAX4()").aSerialized("{concat()}");
- GetPTF("testingMINMAX4('A')").aExType(ExpressionParserException.class).aExMsgText("No applicable method found for \"concat\" at position 1 in \"testingMINMAX4('A')\" with the specified arguments. Method \"concat\" requires maximal 0 arguments.");
- GetPTF("testingMINMAX4('A','B')").aExType(ExpressionParserException.class).aExMsgText("No applicable method found for \"concat\" at position 1 in \"testingMINMAX4('A','B')\" with the specified arguments. Method \"concat\" requires maximal 0 arguments.");
- GetPTF("testingMINMAX4('A','B','C')").aExType(ExpressionParserException.class).aExMsgText("No applicable method found for \"concat\" at position 1 in \"testingMINMAX4('A','B','C')\" with the specified arguments. Method \"concat\" requires maximal 0 arguments.");
-
- //CASE 9
- //min =-1, max = 2,
+ GetPTF("testingMINMAX4('A')")
+ .aExType(ExpressionParserException.class)
+ .aExMsgText(
+ "No applicable method found for \"concat\" at position 1 in \"testingMINMAX4('A')\" with the specified " +
+ "arguments. Method \"concat\" requires maximal 0 arguments.");
+ GetPTF("testingMINMAX4('A','B')")
+ .aExType(ExpressionParserException.class)
+ .aExMsgText(
+ "No applicable method found for \"concat\" at position 1 in \"testingMINMAX4('A','B')\" with the " +
+ "specified arguments. Method \"concat\" requires maximal 0 arguments.");
+ GetPTF("testingMINMAX4('A','B','C')")
+ .aExType(ExpressionParserException.class)
+ .aExMsgText(
+ "No applicable method found for \"concat\" at position 1 in \"testingMINMAX4('A','B','C')\" with the " +
+ "specified arguments. Method \"concat\" requires maximal 0 arguments.");
+
+ // CASE 9
+ // min =-1, max = 2,
GetPTF("testingMINMAX5()").aSerialized("{concat()}");
GetPTF("testingMINMAX5('A')").aSerialized("{concat('A')}");
GetPTF("testingMINMAX5('A','B')").aSerialized("{concat('A','B')}");
- GetPTF("testingMINMAX5('A','B','C')").aExType(ExpressionParserException.class).aExMsgText("No applicable method found for \"concat\" at position 1 in \"testingMINMAX5('A','B','C')\" with the specified arguments. Method \"concat\" requires maximal 2 arguments.");
-
- //CASE 10
- // min =1, max = 2,
- GetPTF("testingMINMAX6()").aExType(ExpressionParserException.class).aExMsgText("No applicable method found for \"concat\" at position 1 in \"testingMINMAX6()\" with the specified arguments. Method \"concat\" requires between 1 and 2 arguments.");
+ GetPTF("testingMINMAX5('A','B','C')")
+ .aExType(ExpressionParserException.class)
+ .aExMsgText(
+ "No applicable method found for \"concat\" at position 1 in \"testingMINMAX5('A','B','C')\" with the " +
+ "specified arguments. Method \"concat\" requires maximal 2 arguments.");
+
+ // CASE 10
+ // min =1, max = 2,
+ GetPTF("testingMINMAX6()")
+ .aExType(ExpressionParserException.class)
+ .aExMsgText(
+ "No applicable method found for \"concat\" at position 1 in \"testingMINMAX6()\" with the specified " +
+ "arguments. Method \"concat\" requires between 1 and 2 arguments.");
GetPTF("testingMINMAX6('A')").aSerialized("{concat('A')}");
GetPTF("testingMINMAX6('A','B')").aSerialized("{concat('A','B')}");
- GetPTF("testingMINMAX6('A','B','C')").aExType(ExpressionParserException.class).aExMsgText("No applicable method found for \"concat\" at position 1 in \"testingMINMAX6('A','B','C')\" with the specified arguments. Method \"concat\" requires between 1 and 2 arguments.");
-
- //CASE 11
- // min =1, max = 2,
- GetPTF("testingMINMAX7()").aExType(ExpressionParserException.class).aExMsgText("No applicable method found for \"concat\" at position 1 in \"testingMINMAX7()\" with the specified arguments. Method \"concat\" requires exact 1 argument(s).");
+ GetPTF("testingMINMAX6('A','B','C')")
+ .aExType(ExpressionParserException.class)
+ .aExMsgText(
+ "No applicable method found for \"concat\" at position 1 in \"testingMINMAX6('A','B','C')\" with the " +
+ "specified arguments. Method \"concat\" requires between 1 and 2 arguments.");
+
+ // CASE 11
+ // min =1, max = 2,
+ GetPTF("testingMINMAX7()")
+ .aExType(ExpressionParserException.class)
+ .aExMsgText(
+ "No applicable method found for \"concat\" at position 1 in \"testingMINMAX7()\" with the specified " +
+ "arguments. Method \"concat\" requires exact 1 argument(s).");
GetPTF("testingMINMAX7('A')").aSerialized("{concat('A')}");
- GetPTF("testingMINMAX7('A','B')").aExType(ExpressionParserException.class).aExMsgText("No applicable method found for \"concat\" at position 1 in \"testingMINMAX7('A','B')\" with the specified arguments. Method \"concat\" requires exact 1 argument(s).");
- GetPTF("testingMINMAX7('A','B','C')").aExType(ExpressionParserException.class).aExMsgText("No applicable method found for \"concat\" at position 1 in \"testingMINMAX7('A','B','C')\" with the specified arguments. Method \"concat\" requires exact 1 argument(s).");
-
- //CASE 12
- //http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=concat('a' 'b')
- //-->')' or ',' expected at position 11.
+ GetPTF("testingMINMAX7('A','B')")
+ .aExType(ExpressionParserException.class)
+ .aExMsgText(
+ "No applicable method found for \"concat\" at position 1 in \"testingMINMAX7('A','B')\" with the " +
+ "specified arguments. Method \"concat\" requires exact 1 argument(s).");
+ GetPTF("testingMINMAX7('A','B','C')")
+ .aExType(ExpressionParserException.class)
+ .aExMsgText(
+ "No applicable method found for \"concat\" at position 1 in \"testingMINMAX7('A','B','C')\" with " +
+ "the specified arguments. Method \"concat\" requires exact 1 argument(s).");
+
+ // CASE 12
+ // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=concat('a' 'b')
+ // -->')' or ',' expected at position 11.
GetPTF("concat('a' 'b')").aExMsgText("\")\" or \",\" expected after position 10 in \"concat('a' 'b')\".");
}
@Test
public void testPMreadParenthesis() {
- //http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=(123
- //-->')' or operator expected at position 4.
- GetPTF("(123").aExType(ExpressionParserException.class).aExMsgText("Missing closing parenthesis \")\" for opening parenthesis \"(\" at position 1 in \"(123\".");
+ // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=(123
+ // -->')' or operator expected at position 4.
+ GetPTF("(123").aExType(ExpressionParserException.class).aExMsgText(
+ "Missing closing parenthesis \")\" for opening parenthesis \"(\" at position 1 in \"(123\".");
- //http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=(123 add (456
- //-->')' or operator expected at position 13.
- GetPTF("(123 add (456").aExType(ExpressionParserException.class).aExMsgText("Missing closing parenthesis \")\" for opening parenthesis \"(\" at position 10 in \"(123 add (456\".");
+ // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=(123 add (456
+ // -->')' or operator expected at position 13.
+ GetPTF("(123 add (456").aExType(ExpressionParserException.class).aExMsgText(
+ "Missing closing parenthesis \")\" for opening parenthesis \"(\" at position 10 in \"(123 add (456\".");
}
@Test
- public void testPMvalidateBinaryOperator() {/*PM = Parsermethod*/
- //http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=123 add 'abc'
- //-->Operator 'add' incompatible with operand types 'System.Int32' and 'System.String' at position 4.
- GetPTF("123 add 'abc'").aExType(ExpressionParserException.class).aExKey(ExpressionParserException.INVALID_TYPES_FOR_BINARY_OPERATOR).aExMsgText("Operator \"add\" incompatible with operand types \"System.Uint7\" and \"Edm.String\" at position 5 in \"123 add 'abc'\".");
+ public void testPMvalidateBinaryOperator() {/* PM = Parsermethod */
+ // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=123 add 'abc'
+ // -->Operator 'add' incompatible with operand types 'System.Int32' and 'System.String' at position 4.
+ GetPTF("123 add 'abc'")
+ .aExType(ExpressionParserException.class)
+ .aExKey(ExpressionParserException.INVALID_TYPES_FOR_BINARY_OPERATOR)
+ .aExMsgText(
+ "Operator \"add\" incompatible with operand types \"System.Uint7\" and \"Edm.String\" at " +
+ "position 5 in \"123 add 'abc'\".");
}
@Test
- public void testPMvalidateMethodTypes() /*PM = Parsermethod*/{
- //CASE 1
- //http://services.odata.org/Northwind/Northwind.svc/Products/?$filter=year(327686)
- //-->No applicable function found for 'year' at position 0 with the specified arguments. The functions considered are: year(System.DateTime).
+ public void testPMvalidateMethodTypes() /* PM = Parsermethod */{
+ // CASE 1
+ // http://services.odata.org/Northwind/Northwind.svc/Products/?$filter=year(327686)
+ // -->No applicable function found for 'year' at position 0 with the specified arguments. The functions considered
+ // are: year(System.DateTime).
String aInt32 = "327686";
- GetPTF("year(" + aInt32 + ")").aExMsgText("No applicable method found for \"year\" at position 1 in \"year(327686)\" for the specified argument types.");
+ GetPTF("year(" + aInt32 + ")").aExMsgText(
+ "No applicable method found for \"year\" at position 1 in \"year(327686)\" for the specified argument types.");
}
@Test
- public void testPMparseFilterString() { /*PM = Parsermethod*/
-
- //http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter='123
- //-->Unterminated string literal at position 4 in ''123'.
- GetPTF("'123").aExType(ExpressionParserException.class).aExKey(ExpressionParserException.TOKEN_UNDETERMINATED_STRING).aExMsgText("Unterminated string literal at position 1 in \"'123\".");
-
- //http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=1%20add%20'123
- //-->Unterminated string literal at position 10 in '1 add '123'.
- GetPTF("1 add '123").aExType(ExpressionParserException.class).aExKey(ExpressionParserException.TOKEN_UNDETERMINATED_STRING).aExMsgText("Unterminated string literal at position 7 in \"1 add '123\".");
-
- //http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=datetime'123
- //-->Unterminated literal at position 12 in 'datetime'123'.
- GetPTF("datetime'123").aExType(ExpressionParserException.class).aExKey(ExpressionParserException.TOKEN_UNDETERMINATED_STRING).aExMsgText("Unterminated string literal at position 9 in \"datetime'123\".");
-
- //http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=123%20456
- //-->Expression of type 'System.Boolean' expected at position 0.
- GetPTF("123 456").aExType(ExpressionParserException.class).aExKey(ExpressionParserException.INVALID_TRAILING_TOKEN_DETECTED_AFTER_PARSING).aExMsgText("Invalid token \"456\" detected after parsing at position 5 in \"123 456\".");
-
- //http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=123%20456
- //-->Expression of type 'System.Boolean' expected at position 0.
- GetPTF("123 456 789").aExType(ExpressionParserException.class).aExKey(ExpressionParserException.INVALID_TRAILING_TOKEN_DETECTED_AFTER_PARSING).aExMsgText("Invalid token \"456\" detected after parsing at position 5 in \"123 456 789\".");
-
- //http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=abc%20abc
- //-->No property 'abc' exists in type 'ODataWeb.Northwind.Model.Supplier' at position 0.
- GetPTF("abc abc").aExType(ExpressionParserException.class).aExKey(ExpressionParserException.INVALID_TRAILING_TOKEN_DETECTED_AFTER_PARSING).aExMsgText("Invalid token \"abc\" detected after parsing at position 5 in \"abc abc\".");
+ public void testPMparseFilterString() { /* PM = Parsermethod */
+
+ // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter='123
+ // -->Unterminated string literal at position 4 in ''123'.
+ GetPTF("'123").aExType(ExpressionParserException.class).aExKey(
+ ExpressionParserException.TOKEN_UNDETERMINATED_STRING).aExMsgText(
+ "Unterminated string literal at position 1 in \"'123\".");
+
+ // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=1%20add%20'123
+ // -->Unterminated string literal at position 10 in '1 add '123'.
+ GetPTF("1 add '123").aExType(ExpressionParserException.class).aExKey(
+ ExpressionParserException.TOKEN_UNDETERMINATED_STRING).aExMsgText(
+ "Unterminated string literal at position 7 in \"1 add '123\".");
+
+ // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=datetime'123
+ // -->Unterminated literal at position 12 in 'datetime'123'.
+ GetPTF("datetime'123").aExType(ExpressionParserException.class).aExKey(
+ ExpressionParserException.TOKEN_UNDETERMINATED_STRING).aExMsgText(
+ "Unterminated string literal at position 9 in \"datetime'123\".");
+
+ // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=123%20456
+ // -->Expression of type 'System.Boolean' expected at position 0.
+ GetPTF("123 456").aExType(ExpressionParserException.class).aExKey(
+ ExpressionParserException.INVALID_TRAILING_TOKEN_DETECTED_AFTER_PARSING).aExMsgText(
+ "Invalid token \"456\" detected after parsing at position 5 in \"123 456\".");
+
+ // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=123%20456
+ // -->Expression of type 'System.Boolean' expected at position 0.
+ GetPTF("123 456 789").aExType(ExpressionParserException.class).aExKey(
+ ExpressionParserException.INVALID_TRAILING_TOKEN_DETECTED_AFTER_PARSING).aExMsgText(
+ "Invalid token \"456\" detected after parsing at position 5 in \"123 456 789\".");
+
+ // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=abc%20abc
+ // -->No property 'abc' exists in type 'ODataWeb.Northwind.Model.Supplier' at position 0.
+ GetPTF("abc abc").aExType(ExpressionParserException.class).aExKey(
+ ExpressionParserException.INVALID_TRAILING_TOKEN_DETECTED_AFTER_PARSING).aExMsgText(
+ "Invalid token \"abc\" detected after parsing at position 5 in \"abc abc\".");
}
@Test
@@ -290,49 +403,55 @@ public class TestParserExceptions extends TestBase {
GetPTF("( 1 mul 2 )/X eq TEST").aSerialized("{{{1 mul 2}/X} eq TEST}");
- //CASE 1
+ // CASE 1
EdmEntityType edmEtAllTypes = edmInfo.getTypeEtAllTypes();
- GetPTF(edmEtAllTypes, "( 1 mul 2 )/X eq TEST").aExMsgText("Leftside of method operator at position 12 is not a property in \"( 1 mul 2 )/X eq TEST\".");
-
- //CASE 2
- //http://services.odata.org/Northwind/Northwind.svc/Products/?$filter=notsupportedfunction('a')
- //-->Unknown function 'notsupportedfunction' at position 0.
- GetPTF("notsupportedfunction('a')").aExMsgText("Unknown function \"notsupportedfunction\" at position 1 in \"notsupportedfunction('a')\".");
-
- //CASE 3
- //http://services.odata.org/Northwind/Northwind.svc/Products/?$filter=notsupportedfunction('a')
- //-->Unknown function 'notsupportedfunction' at position 0.
- GetPTF("notsupportedfunction ('a')").aExMsgText("Unknown function \"notsupportedfunction\" at position 1 in \"notsupportedfunction ('a')\".");
-
- //CASE 4
- //Use \ instead of /
- GetPTF("Address\\NotAProperty").aExMsgText("Error while tokenizing a ODATA expression on token \"\\\" at position 8 in \"Address\\NotAProperty\".");
-
- //CASE 5
+ GetPTF(edmEtAllTypes, "( 1 mul 2 )/X eq TEST").aExMsgText(
+ "Leftside of method operator at position 12 is not a property in \"( 1 mul 2 )/X eq TEST\".");
+
+ // CASE 2
+ // http://services.odata.org/Northwind/Northwind.svc/Products/?$filter=notsupportedfunction('a')
+ // -->Unknown function 'notsupportedfunction' at position 0.
+ GetPTF("notsupportedfunction('a')").aExMsgText(
+ "Unknown function \"notsupportedfunction\" at position 1 in \"notsupportedfunction('a')\".");
+
+ // CASE 3
+ // http://services.odata.org/Northwind/Northwind.svc/Products/?$filter=notsupportedfunction('a')
+ // -->Unknown function 'notsupportedfunction' at position 0.
+ GetPTF("notsupportedfunction ('a')").aExMsgText(
+ "Unknown function \"notsupportedfunction\" at position 1 in \"notsupportedfunction ('a')\".");
+
+ // CASE 4
+ // Use \ instead of /
+ GetPTF("Address\\NotAProperty").aExMsgText(
+ "Error while tokenizing a ODATA expression on token \"\\\" at position 8 in \"Address\\NotAProperty\".");
+
+ // CASE 5
GetPTF("-(-(- 2d)))").aExMsgText("Invalid token \")\" detected after parsing at position 11 in \"-(-(- 2d)))\".");
- //CASE 6
+ // CASE 6
GetPTF("a b").aExMsgText("Invalid token \"b\" detected after parsing at position 3 in \"a b\".");
- //CASE 7
+ // CASE 7
GetPTF("a eq b b").aExMsgText("Invalid token \"b\" detected after parsing at position 8 in \"a eq b b\".");
- //CASE 8
- GetPTF(edmEtAllTypes, "year(Complex)").aExMsgText("No applicable method found for \"year\" at position 1 in \"year(Complex)\" for the specified argument types.");
+ // CASE 8
+ GetPTF(edmEtAllTypes, "year(Complex)").aExMsgText(
+ "No applicable method found for \"year\" at position 1 in \"year(Complex)\" for the specified argument types.");
- //CASE 9
- //http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=1%20add%202
- //-->Expression of type 'System.Boolean' expected at position 0.
- GetPTF_onlyBinary("1 add 2").aExMsgText("Expression of type \"Edm.Boolean\" expected at position 1 in \"1 add 2\" (actual type is \"Edm.SByte\").");
+ // CASE 9
+ // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=1%20add%202
+ // -->Expression of type 'System.Boolean' expected at position 0.
+ GetPTF_onlyBinary("1 add 2").aExMsgText(
+ "Expression of type \"Edm.Boolean\" expected at position 1 in \"1 add 2\" (actual type is \"Edm.SByte\").");
- //CASE 10
- //http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=1%20add
- //-->Expression expected at position 5.
+ // CASE 10
+ // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=1%20add
+ // -->Expression expected at position 5.
GetPTF_onlyBinary("1 add").aExMsgText("Expression expected after position 5 in \"1 add\".");
- //CASE 11
- //http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=1%20add
- //-->Expression expected at position 5.
+ // CASE 11
+ // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=1%20add
+ // -->Expression expected at position 5.
GetPTF_onlyBinary("1 add ").aExMsgText("Expression expected after position 5 in \"1 add \".");
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestSpec.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestSpec.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestSpec.java
index 3c7b6ba..b507fd1 100644
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestSpec.java
+++ b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestSpec.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.uri.expression;
@@ -89,7 +89,7 @@ public class TestSpec extends TestBase {
@Test
public void testMinimumSpecReq() {
- //ADD
+ // ADD
GetPTF(aDecimal + " add " + aDecimal).aEdmType(decimalInst).aSerialized("{" + aDecimal + " add " + aDecimal + "}");
GetPTF(aDouble + " add " + aDouble).aEdmType(doubleInst).aSerialized("{" + aDouble + " add " + aDouble + "}");
;
@@ -97,48 +97,48 @@ public class TestSpec extends TestBase {
GetPTF(aInt64 + " add " + aInt64).aEdmType(int64Inst).aSerialized("{" + aInt64 + " add " + aInt64 + "}");
GetPTF(aInt32 + " add " + aInt32).aEdmType(int32Inst).aSerialized("{" + aInt32 + " add " + aInt32 + "}");
- //ADD
+ // ADD
GetPTF(aDecimal + " sub " + aDecimal).aEdmType(decimalInst).aSerialized("{" + aDecimal + " sub " + aDecimal + "}");
GetPTF(aDouble + " sub " + aDouble).aEdmType(doubleInst).aSerialized("{" + aDouble + " sub " + aDouble + "}");
GetPTF(aSingle + " sub " + aSingle).aEdmType(singleInst).aSerialized("{" + aSingle + " sub " + aSingle + "}");
GetPTF(aInt64 + " sub " + aInt64).aEdmType(int64Inst).aSerialized("{" + aInt64 + " sub " + aInt64 + "}");
GetPTF(aInt32 + " sub " + aInt32).aEdmType(int32Inst).aSerialized("{" + aInt32 + " sub " + aInt32 + "}");
- //MUL
+ // MUL
GetPTF(aDecimal + " mul " + aDecimal).aEdmType(decimalInst).aSerialized("{" + aDecimal + " mul " + aDecimal + "}");
GetPTF(aDouble + " mul " + aDouble).aEdmType(doubleInst).aSerialized("{" + aDouble + " mul " + aDouble + "}");
GetPTF(aSingle + " mul " + aSingle).aEdmType(singleInst).aSerialized("{" + aSingle + " mul " + aSingle + "}");
GetPTF(aInt64 + " mul " + aInt64).aEdmType(int64Inst).aSerialized("{" + aInt64 + " mul " + aInt64 + "}");
GetPTF(aInt32 + " mul " + aInt32).aEdmType(int32Inst).aSerialized("{" + aInt32 + " mul " + aInt32 + "}");
- //DIV
+ // DIV
GetPTF(aDecimal + " div " + aDecimal).aEdmType(decimalInst).aSerialized("{" + aDecimal + " div " + aDecimal + "}");
GetPTF(aDouble + " div " + aDouble).aEdmType(doubleInst).aSerialized("{" + aDouble + " div " + aDouble + "}");
GetPTF(aSingle + " div " + aSingle).aEdmType(singleInst).aSerialized("{" + aSingle + " div " + aSingle + "}");
GetPTF(aInt64 + " div " + aInt64).aEdmType(int64Inst).aSerialized("{" + aInt64 + " div " + aInt64 + "}");
GetPTF(aInt32 + " div " + aInt32).aEdmType(int32Inst).aSerialized("{" + aInt32 + " div " + aInt32 + "}");
- //MOD
+ // MOD
GetPTF(aDecimal + " mod " + aDecimal).aEdmType(decimalInst).aSerialized("{" + aDecimal + " mod " + aDecimal + "}");
GetPTF(aDouble + " mod " + aDouble).aEdmType(doubleInst).aSerialized("{" + aDouble + " mod " + aDouble + "}");
GetPTF(aSingle + " mod " + aSingle).aEdmType(singleInst).aSerialized("{" + aSingle + " mod " + aSingle + "}");
GetPTF(aInt64 + " mod " + aInt64).aEdmType(int64Inst).aSerialized("{" + aInt64 + " mod " + aInt64 + "}");
GetPTF(aInt32 + " mod " + aInt32).aEdmType(int32Inst).aSerialized("{" + aInt32 + " mod " + aInt32 + "}");
- //NEGATE
+ // NEGATE
GetPTF(" - " + aDecimal).aEdmType(decimalInst).aSerialized("{- " + aDecimal + "}");
GetPTF(" - " + aDouble).aEdmType(doubleInst).aSerialized("{- " + aDouble + "}");
GetPTF(" - " + aSingle).aEdmType(singleInst).aSerialized("{- " + aSingle + "}");
GetPTF(" - " + aInt64).aEdmType(int64Inst).aSerialized("{- " + aInt64 + "}");
GetPTF(" - " + aInt32).aEdmType(int32Inst).aSerialized("{- " + aInt32 + "}");
- //AND
+ // AND
GetPTF(aBoolean + " and " + aBoolean).aEdmType(boolInst).aSerialized("{" + aBoolean + " and " + aBoolean + "}");
- //OR
+ // OR
GetPTF(aBoolean + " or " + aBoolean).aEdmType(boolInst).aSerialized("{" + aBoolean + " or " + aBoolean + "}");
- //EQ
+ // EQ
GetPTF(aDecimal + " eq " + aDecimal).aEdmType(boolInst).aSerialized("{" + aDecimal + " eq " + aDecimal + "}");
GetPTF(aDouble + " eq " + aDouble).aEdmType(boolInst).aSerialized("{" + aDouble + " eq " + aDouble + "}");
GetPTF(aSingle + " eq " + aSingle).aEdmType(boolInst).aSerialized("{" + aSingle + " eq " + aSingle + "}");
@@ -149,7 +149,7 @@ public class TestSpec extends TestBase {
GetPTF(aGuid + " eq " + aGuid).aEdmType(boolInst).aSerialized("{" + aGuid + " eq " + aGuid + "}");
GetPTF(aBinary + " eq " + aBinary).aEdmType(boolInst).aSerialized("{" + aBinary + " eq " + aBinary + "}");
- //NE
+ // NE
GetPTF(aDecimal + " ne " + aDecimal).aEdmType(boolInst).aSerialized("{" + aDecimal + " ne " + aDecimal + "}");
GetPTF(aDouble + " ne " + aDouble).aEdmType(boolInst).aSerialized("{" + aDouble + " ne " + aDouble + "}");
GetPTF(aSingle + " ne " + aSingle).aEdmType(boolInst).aSerialized("{" + aSingle + " ne " + aSingle + "}");
@@ -160,7 +160,7 @@ public class TestSpec extends TestBase {
GetPTF(aGuid + " ne " + aGuid).aEdmType(boolInst).aSerialized("{" + aGuid + " ne " + aGuid + "}");
GetPTF(aBinary + " ne " + aBinary).aEdmType(boolInst).aSerialized("{" + aBinary + " ne " + aBinary + "}");
- //LT
+ // LT
GetPTF(aDecimal + " lt " + aDecimal).aEdmType(boolInst).aSerialized("{" + aDecimal + " lt " + aDecimal + "}");
GetPTF(aDouble + " lt " + aDouble).aEdmType(boolInst).aSerialized("{" + aDouble + " lt " + aDouble + "}");
GetPTF(aSingle + " lt " + aSingle).aEdmType(boolInst).aSerialized("{" + aSingle + " lt " + aSingle + "}");
@@ -171,7 +171,7 @@ public class TestSpec extends TestBase {
GetPTF(aGuid + " lt " + aGuid).aEdmType(boolInst).aSerialized("{" + aGuid + " lt " + aGuid + "}");
GetPTF(aBinary + " lt " + aBinary).aEdmType(boolInst).aSerialized("{" + aBinary + " lt " + aBinary + "}");
- //LE
+ // LE
GetPTF(aDecimal + " le " + aDecimal).aEdmType(boolInst).aSerialized("{" + aDecimal + " le " + aDecimal + "}");
GetPTF(aDouble + " le " + aDouble).aEdmType(boolInst).aSerialized("{" + aDouble + " le " + aDouble + "}");
GetPTF(aSingle + " le " + aSingle).aEdmType(boolInst).aSerialized("{" + aSingle + " le " + aSingle + "}");
@@ -182,7 +182,7 @@ public class TestSpec extends TestBase {
GetPTF(aGuid + " le " + aGuid).aEdmType(boolInst).aSerialized("{" + aGuid + " le " + aGuid + "}");
GetPTF(aBinary + " le " + aBinary).aEdmType(boolInst).aSerialized("{" + aBinary + " le " + aBinary + "}");
- //GT
+ // GT
GetPTF(aDecimal + " gt " + aDecimal).aEdmType(boolInst).aSerialized("{" + aDecimal + " gt " + aDecimal + "}");
GetPTF(aDouble + " gt " + aDouble).aEdmType(boolInst).aSerialized("{" + aDouble + " gt " + aDouble + "}");
GetPTF(aSingle + " gt " + aSingle).aEdmType(boolInst).aSerialized("{" + aSingle + " gt " + aSingle + "}");
@@ -193,7 +193,7 @@ public class TestSpec extends TestBase {
GetPTF(aGuid + " gt " + aGuid).aEdmType(boolInst).aSerialized("{" + aGuid + " gt " + aGuid + "}");
GetPTF(aBinary + " gt " + aBinary).aEdmType(boolInst).aSerialized("{" + aBinary + " gt " + aBinary + "}");
- //GE
+ // GE
GetPTF(aDecimal + " ge " + aDecimal).aEdmType(boolInst).aSerialized("{" + aDecimal + " ge " + aDecimal + "}");
GetPTF(aDouble + " ge " + aDouble).aEdmType(boolInst).aSerialized("{" + aDouble + " ge " + aDouble + "}");
GetPTF(aSingle + " ge " + aSingle).aEdmType(boolInst).aSerialized("{" + aSingle + " ge " + aSingle + "}");
@@ -204,77 +204,77 @@ public class TestSpec extends TestBase {
GetPTF(aGuid + " ge " + aGuid).aEdmType(boolInst).aSerialized("{" + aGuid + " ge " + aGuid + "}");
GetPTF(aBinary + " ge " + aBinary).aEdmType(boolInst).aSerialized("{" + aBinary + " ge " + aBinary + "}");
- //NOT
+ // NOT
GetPTF(" not " + aBoolean).aEdmType(boolInst);
- //ISOF is not supported
+ // ISOF is not supported
- //CAST is not supported
+ // CAST is not supported
- //BOOL lit
+ // BOOL lit
GetPTF("true").aEdmType(boolInst);
GetPTF("false").aEdmType(boolInst);
- //endsWith
+ // endsWith
GetPTF("endswith('ABC','C')").aEdmType(boolInst);
- //indexOf
+ // indexOf
GetPTF("indexof('ABC','B')").aEdmType(int32Inst);
- //replace not supported
+ // replace not supported
- //startsWith
+ // startsWith
GetPTF("startswith('ABC','C')").aEdmType(boolInst);
- //toLower
+ // toLower
GetPTF("tolower('ABC')").aEdmType(stringInst);
- //toUpper
+ // toUpper
GetPTF("toupper('ABC')").aEdmType(stringInst);
- //trim
+ // trim
GetPTF("trim('ABC')").aEdmType(stringInst);
- //substring
+ // substring
GetPTF("substring('ABC'," + aInt32 + ',' + aInt32 + ")").aEdmType(stringInst);
- //subStringOf
+ // subStringOf
GetPTF("substringof('ABC','BC')").aEdmType(boolInst);
- //concat
+ // concat
GetPTF("concat('ABC','BC')").aEdmType(stringInst);
- //tested more in deep in other testcases
+ // tested more in deep in other testcases
- //length
+ // length
GetPTF("length('ABC')").aEdmType(int32Inst);
- //year
+ // year
GetPTF("year(" + aDatetime + ")").aEdmType(int32Inst);
- //month
+ // month
GetPTF("month(" + aDatetime + ")").aEdmType(int32Inst);
- //day
+ // day
GetPTF("day(" + aDatetime + ")").aEdmType(int32Inst);
- //hour
+ // hour
GetPTF("hour(" + aDatetime + ")").aEdmType(int32Inst);
- //minute
+ // minute
GetPTF("minute(" + aDatetime + ")").aEdmType(int32Inst);
- //second
+ // second
GetPTF("second(" + aDatetime + ")").aEdmType(int32Inst);
- //round
+ // round
GetPTF("round(" + aDecimal + ")").aEdmType(decimalInst);
GetPTF("round(" + aDouble + ")").aEdmType(doubleInst);
- //floor
+ // floor
GetPTF("floor(" + aDecimal + ")").aEdmType(decimalInst);
GetPTF("floor(" + aDouble + ")").aEdmType(doubleInst);
- //ceiling
+ // ceiling
GetPTF("ceiling(" + aDecimal + ")").aEdmType(decimalInst);
GetPTF("ceiling(" + aDouble + ")").aEdmType(doubleInst);
@@ -299,14 +299,21 @@ public class TestSpec extends TestBase {
GetPTF(edmEtAllTypes, "'text' eq String").root().aKind(ExpressionKind.BINARY);
- GetPTF(edmEtAllTypes, "Complex/String").root().left().aEdmProperty(complex).aEdmType(complexType).root().right().aEdmProperty(complexString).aEdmType(complexStringType).root().aKind(ExpressionKind.MEMBER).aEdmType(complexStringType);
+ GetPTF(edmEtAllTypes, "Complex/String").root().left().aEdmProperty(complex).aEdmType(complexType).root().right()
+ .aEdmProperty(complexString).aEdmType(complexStringType).root().aKind(ExpressionKind.MEMBER).aEdmType(
+ complexStringType);
- GetPTF(edmEtAllTypes, "Complex/Address/City").root().aKind(ExpressionKind.MEMBER).root().left().aKind(ExpressionKind.MEMBER).root().left().left().aKind(ExpressionKind.PROPERTY).aEdmProperty(complex).aEdmType(complexType).root().left().right().aKind(ExpressionKind.PROPERTY).aEdmProperty(complexAddress).aEdmType(complexAddressType).root().left().aEdmType(complexAddressType).root().right().aKind(ExpressionKind.PROPERTY).aEdmProperty(complexAddressCity).aEdmType(complexAddressCityType).root().aEdmType(complexAddressCityType);
+ GetPTF(edmEtAllTypes, "Complex/Address/City").root().aKind(ExpressionKind.MEMBER).root().left().aKind(
+ ExpressionKind.MEMBER).root().left().left().aKind(ExpressionKind.PROPERTY).aEdmProperty(complex).aEdmType(
+ complexType).root().left().right().aKind(ExpressionKind.PROPERTY).aEdmProperty(complexAddress).aEdmType(
+ complexAddressType).root().left().aEdmType(complexAddressType).root().right().aKind(ExpressionKind.PROPERTY)
+ .aEdmProperty(complexAddressCity).aEdmType(complexAddressCityType).root().aEdmType(complexAddressCityType);
EdmProperty boolean_ = (EdmProperty) edmEtAllTypes.getProperty("Boolean");
EdmSimpleType boolean_Type = (EdmSimpleType) boolean_.getType();
- GetPTF(edmEtAllTypes, "not Boolean").aKind(ExpressionKind.UNARY).aEdmType(boolean_Type).right().aEdmProperty(boolean_).aEdmType(boolean_Type);
+ GetPTF(edmEtAllTypes, "not Boolean").aKind(ExpressionKind.UNARY).aEdmType(boolean_Type).right().aEdmProperty(
+ boolean_).aEdmType(boolean_Type);
} catch (EdmException e) {
fail("Error in testPropertiesWithEdm:" + e.getLocalizedMessage());
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestTokenizer.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestTokenizer.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestTokenizer.java
index 58990b9..5be6fc3 100644
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestTokenizer.java
+++ b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TestTokenizer.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.uri.expression;
@@ -29,7 +29,7 @@ public class TestTokenizer {
@Test
public void tokenizeWhiteSpaces() throws Exception {
- //space
+ // space
getTTW(" ").at(0).aKind(TokenKind.WHITESPACE).aUriLiteral(" ").aPosition(0);
getTTW(" ").at(0).aKind(TokenKind.WHITESPACE).aUriLiteral(" ").aPosition(0);
@@ -38,7 +38,8 @@ public class TestTokenizer {
getTTW(" B").at(0).aKind(TokenKind.WHITESPACE).aUriLiteral(" ").aPosition(0);
- getTTW("A B").at(1).aKind(TokenKind.WHITESPACE).aUriLiteral(" ").aPosition(1).at(2).aKind(TokenKind.LITERAL).aUriLiteral("B").aPosition(4);
+ getTTW("A B").at(1).aKind(TokenKind.WHITESPACE).aUriLiteral(" ").aPosition(1).at(2).aKind(TokenKind.LITERAL)
+ .aUriLiteral("B").aPosition(4);
getTTW("A B C").at(3).aKind(TokenKind.WHITESPACE).aUriLiteral(" ").aPosition(5);
}
@@ -46,22 +47,22 @@ public class TestTokenizer {
@Test
public void tokenizeSymbols() throws Exception {
- //parentheses
+ // parentheses
getTT("(").aKind(TokenKind.OPENPAREN).aUriLiteral("(");
getTT("abc(").at(1).aKind(TokenKind.OPENPAREN).aUriLiteral("(").aPosition(3);
getTT(")").aKind(TokenKind.CLOSEPAREN).aUriLiteral(")");
getTT("abc)").at(1).aKind(TokenKind.CLOSEPAREN).aUriLiteral(")").aPosition(3);
- //symbol
+ // symbol
getTT(",").aKind(TokenKind.COMMA).aUriLiteral(",");
getTT("abc,").at(1).aKind(TokenKind.COMMA).aUriLiteral(",").aPosition(3);
- //minus
+ // minus
getTT("-").aKind(TokenKind.SYMBOL).aUriLiteral("-");
getTT("abc -").at(1).aKind(TokenKind.SYMBOL).aUriLiteral("-").aPosition(4);
- //minus after literal belongs to literal
+ // minus after literal belongs to literal
getTT("abc-").at(0).aKind(TokenKind.LITERAL).aUriLiteral("abc-").aPosition(0);
}
@@ -83,24 +84,26 @@ public class TestTokenizer {
getTT("a").aKind(TokenKind.LITERAL).aUriLiteral("a").aPosition(0);
getTT("abc a").at(1).aKind(TokenKind.LITERAL).aUriLiteral("a").aPosition(4);
- //string
+ // string
getTT("'a'").aKind(TokenKind.SIMPLE_TYPE).aUriLiteral("'a'").aPosition(0);
getTT("abc 'a'").at(1).aKind(TokenKind.SIMPLE_TYPE).aUriLiteral("'a'").aPosition(4);
- //"prefixed type
+ // "prefixed type
getTT("X'00'").aKind(TokenKind.SIMPLE_TYPE).aUriLiteral("X'00'").aPosition(0);
getTT("abc X'00'").at(1).aKind(TokenKind.SIMPLE_TYPE).aUriLiteral("X'00'").aPosition(4);
- //simple types
+ // simple types
getTT("null").aKind(TokenKind.SIMPLE_TYPE).aUriLiteral("null").aPosition(0);
getTT("abc null").at(1).aKind(TokenKind.SIMPLE_TYPE).aUriLiteral("null").aPosition(4);
getTT("128").aKind(TokenKind.SIMPLE_TYPE).aUriLiteral("128").aPosition(0);
getTT("abc 128").at(1).aKind(TokenKind.SIMPLE_TYPE).aUriLiteral("128").aPosition(4);
- //do special types
- getTT("datetime'2011-01-12T00:00:00'").aKind(TokenKind.SIMPLE_TYPE).aUriLiteral("datetime'2011-01-12T00:00:00'").aPosition(0);
- getTT("abc datetime'2011-01-12T00:00:00'").at(1).aKind(TokenKind.SIMPLE_TYPE).aUriLiteral("datetime'2011-01-12T00:00:00'").aPosition(4);
+ // do special types
+ getTT("datetime'2011-01-12T00:00:00'").aKind(TokenKind.SIMPLE_TYPE).aUriLiteral("datetime'2011-01-12T00:00:00'")
+ .aPosition(0);
+ getTT("abc datetime'2011-01-12T00:00:00'").at(1).aKind(TokenKind.SIMPLE_TYPE).aUriLiteral(
+ "datetime'2011-01-12T00:00:00'").aPosition(4);
}
@Test
@@ -111,33 +114,37 @@ public class TestTokenizer {
@Test
public void testExceptions() throws Exception {
- //http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter='a
- //-->Unterminated string literal at position 2 in ''a'.
+ // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter='a
+ // -->Unterminated string literal at position 2 in ''a'.
getTT("'a").aExMsgText("Unterminated string literal at position 1 in \"'a\".");
- //http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=X'g'
- //-->Unrecognized 'Edm.Binary' literal 'X'g'' in '0'.
+ // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=X'g'
+ // -->Unrecognized 'Edm.Binary' literal 'X'g'' in '0'.
getTT("X'g'").aExMsgText("Type detection error for string like token 'X'g'' at position '1'.");
- //http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=\
- //-->Syntax error '\' at position 0.
+ // http://services.odata.org/Northwind/Northwind.svc/Products(1)/Supplier?$filter=\
+ // -->Syntax error '\' at position 0.
getTT("\\").aExMsgText("Unknown character '\\' at position '0' detected in \"\\\".");
}
@Test
public void tokenizeFunction() throws Exception {
- getTT("substringof('10')").at(0).aKind(TokenKind.LITERAL).aUriLiteral("substringof").at(2).aKind(TokenKind.SIMPLE_TYPE).aUriLiteral("'10'");
+ getTT("substringof('10')").at(0).aKind(TokenKind.LITERAL).aUriLiteral("substringof").at(2).aKind(
+ TokenKind.SIMPLE_TYPE).aUriLiteral("'10'");
- getTT("substringof ( '10' ) ").at(0).aKind(TokenKind.LITERAL).aUriLiteral("substringof").at(2).aKind(TokenKind.SIMPLE_TYPE).aUriLiteral("'10'");
+ getTT("substringof ( '10' ) ").at(0).aKind(TokenKind.LITERAL).aUriLiteral("substringof").at(2).aKind(
+ TokenKind.SIMPLE_TYPE).aUriLiteral("'10'");
}
@Test
public void testEx1111ceptions() throws Exception {
getTT("a 1").at(0).aKind(TokenKind.LITERAL).aUriLiteral("a").at(1).aKind(TokenKind.SIMPLE_TYPE).aUriLiteral("1");
- getTT("a eq b").at(0).aKind(TokenKind.LITERAL).aUriLiteral("a").at(1).aKind(TokenKind.LITERAL).aUriLiteral("eq").at(2).aKind(TokenKind.LITERAL).aUriLiteral("b");
+ getTT("a eq b").at(0).aKind(TokenKind.LITERAL).aUriLiteral("a").at(1).aKind(TokenKind.LITERAL).aUriLiteral("eq")
+ .at(2).aKind(TokenKind.LITERAL).aUriLiteral("b");
- getTT("start_date eq datetime'2011-01-12T00:00:00' and end_date eq datetime'2011-12-31T00:00:00'").at(2).aUriLiteral("datetime'2011-01-12T00:00:00'");
+ getTT("start_date eq datetime'2011-01-12T00:00:00' and end_date eq datetime'2011-12-31T00:00:00'").at(2)
+ .aUriLiteral("datetime'2011-01-12T00:00:00'");
getTT("'a%b'").at(0).aKind(TokenKind.SIMPLE_TYPE).aUriLiteral("'a%b'");
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TokenTool.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TokenTool.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TokenTool.java
index 13729f1..446d22e 100644
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TokenTool.java
+++ b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/TokenTool.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.uri.expression;
@@ -73,10 +73,10 @@ public class TokenTool {
/**
* Checks that the Type of the token matches the <code>kind</code>
- *
+ *
* @param kind Kind to be compared with the token type
* @return Returns <code>this</code>
- * @throws AssertionError
+ * @throws AssertionError
*/
public TokenTool aKind(final TokenKind kind) {
assertEquals(kind, token.getKind());
@@ -98,7 +98,7 @@ public class TokenTool {
/**
* Checks that the Value of the token matches the <code>stringValue</code>
*
- * @param stringValue Value to be compared with the token value
+ * @param stringValue Value to be compared with the token value
* @return Returns <code>this</code>
* @throws AssertionError
*/
@@ -231,9 +231,9 @@ public class TokenTool {
/**
* Verifies that the message text of the thrown exception serialized is {@paramref messageText}
- * @param messageText
- * Expected message text
- * @return this
+ * @param messageText
+ * Expected message text
+ * @return this
*/
public TokenTool aExMsgText(final String messageText) {
String info = "aExMessageText(" + expression + ")-->";
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/VisitorTool.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/VisitorTool.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/VisitorTool.java
index 68a4312..c2b3ced 100644
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/VisitorTool.java
+++ b/odata-core/src/test/java/org/apache/olingo/odata2/core/uri/expression/VisitorTool.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.uri.expression;
@@ -40,12 +40,14 @@ import org.apache.olingo.odata2.api.uri.expression.UnaryOperator;
public class VisitorTool implements ExpressionVisitor {
@Override
- public Object visitBinary(final BinaryExpression binaryExpression, final BinaryOperator operator, final Object leftSide, final Object rightSide) {
+ public Object visitBinary(final BinaryExpression binaryExpression, final BinaryOperator operator,
+ final Object leftSide, final Object rightSide) {
return "{" + leftSide.toString() + " " + operator.toUriLiteral() + " " + rightSide.toString() + "}";
}
@Override
- public Object visitFilterExpression(final FilterExpression filterExpression, final String expressionString, final Object expression) {
+ public Object visitFilterExpression(final FilterExpression filterExpression, final String expressionString,
+ final Object expression) {
return expression;
}
@@ -55,7 +57,8 @@ public class VisitorTool implements ExpressionVisitor {
}
@Override
- public Object visitMethod(final MethodExpression methodExpression, final MethodOperator method, final List<Object> retParameters) {
+ public Object visitMethod(final MethodExpression methodExpression, final MethodOperator method,
+ final List<Object> retParameters) {
StringBuilder sb = new StringBuilder();
sb.append("{");
sb.append(method.toUriLiteral());
@@ -89,7 +92,8 @@ public class VisitorTool implements ExpressionVisitor {
}
@Override
- public Object visitOrderByExpression(final OrderByExpression orderByExpression, final String expressionString, final List<Object> orders) {
+ public Object visitOrderByExpression(final OrderByExpression orderByExpression, final String expressionString,
+ final List<Object> orders) {
StringBuilder sb = new StringBuilder();
sb.append("{");
sb.append("oc");
@@ -108,7 +112,8 @@ public class VisitorTool implements ExpressionVisitor {
}
@Override
- public Object visitOrder(final OrderExpression orderExpression, final Object filterResult, final SortOrder sortOrder) {
+ public Object visitOrder(final OrderExpression orderExpression, final Object filterResult,
+ final SortOrder sortOrder) {
return "{o(" + filterResult + ", " + sortOrder.toString() + ")}";
}