You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ko...@apache.org on 2013/12/13 10:04:20 UTC
[1/9] [OLINGO-63] Uri Parser: adoptions in lexer and parser,
create UriParserImpl to convert the parsetree into internal
structures, moved parser antlr part from .../olingo/producer/... to
.../olingo/odata4/producer
Updated Branches:
refs/heads/master 82ae60600 -> 10ac7ee37
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/producer/core/uri/antlr/UriTreeReaderTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/producer/core/uri/antlr/UriTreeReaderTest.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/producer/core/uri/antlr/UriTreeReaderTest.java
deleted file mode 100644
index 8ca10f3..0000000
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/producer/core/uri/antlr/UriTreeReaderTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * 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
- *
- * 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.
- ******************************************************************************/
-package org.apache.olingo.producer.core.uri.antlr;
-
-import org.apache.olingo.odata4.producer.api.uri.UriPathInfoKind;
-import org.apache.olingo.odata4.producer.core.testutil.UriResourcePathValidator;
-
-public class UriTreeReaderTest {
- UriResourcePathValidator test = null;
-
- public UriTreeReaderTest() {
- test = new UriResourcePathValidator();
- // test.setEdm(new EdmIm)
- }
-
- /*
- * @Test
- * public void testShortUris() {
- * test.run("$batch").isKind(UriInfoKind.batch);
- * test.run("$all").isKind(UriInfoKind.all);
- * test.run("$crossjoin(abc)").isKind(UriInfoKind.crossjoin);
- * }
- */
-
- // @Test
- public void testEntitySet() {
- test.run("Employees").isUriPathInfoKind(UriPathInfoKind.entitySet);
-
- test.run("Employees").isUriPathInfoKind(UriPathInfoKind.entitySet);
- test.run("Employees('1')").isUriPathInfoKind(UriPathInfoKind.entitySet);
- test.run("Employees(EmployeeId='1')").isUriPathInfoKind(UriPathInfoKind.entitySet);
-
- test.run("Employees('1')/EmployeeName").isUriPathInfoKind(UriPathInfoKind.entitySet);
-
- test.run("Employees/RefScenario.ManagerType").isUriPathInfoKind(UriPathInfoKind.entitySet);
- test.run("Employees/RefScenario.ManagerType('1')").isUriPathInfoKind(UriPathInfoKind.entitySet);
-
- test.run("Employees/Location").isUriPathInfoKind(UriPathInfoKind.entitySet);
- test.run("Employees/Location/Country").isUriPathInfoKind(UriPathInfoKind.entitySet);
- }
- /*
- * //@Test
- * public void testSingleton() {
- * test.run("Company").isUriPathInfoKind(UriPathInfoImpl.UriPathInfoKind.singleton);
- * }
- */
- /*
- * //@Test
- * public void testActionImport() {
- * test.run("actionImport1").isUriPathInfoKind(UriPathInfoImpl.UriPathInfoKind.actionImport);
- * }
- */
- /*
- * //@Test
- * public void testFunctionImport() {
- * test.run("MaximalAge").isUriPathInfoKind(UriPathInfoImpl.UriPathInfoKind.functioncall);
- * }
- */
- /*
- * //@Test
- * public void testBoundFunctions() {
- *
- * test.run("Employees/RefScenario.bf_entity_set_rt_entity(NonBindingParameter='1')").isUriPathInfoKind(
- * UriPathInfoImpl.UriPathInfoKind.boundFunctioncall);
- * test.run("Employees('1')/EmployeeName/RefScenario.bf_pprop_rt_entity_set()").isUriPathInfoKind(
- * UriPathInfoImpl.UriPathInfoKind.boundFunctioncall);
- * test.run("Company/RefScenario.bf_singleton_rt_entity_set()('1')").isUriPathInfoKind(
- * UriPathInfoImpl.UriPathInfoKind.boundFunctioncall);
- * // testUri("Company/RefScenario.bf_singleton_rt_entity_set()('1')/EmployeeName/"
- * // +"RefScenario.bf_pprop_rt_entity_set()",
- * // UriPathInfoImpl.UriPathInfoKind.boundFunctioncall);
- * }
- */
- /*
- * //@Test
- * public void testBoundActions() {
- * test.run("Employees('1')/RefScenario.ba_entity_rt_pprop")
- * .isUriPathInfoKind(UriPathInfoImpl.UriPathInfoKind.boundActionImport);
- * test.run("Employees('1')/EmployeeName/RefScenario.ba_pprop_rt_entity_set").isUriPathInfoKind(
- * UriPathInfoImpl.UriPathInfoKind.boundActionImport);
- * }
- */
- /*
- * //@Test
- * public void testNavigationFunction() {
- * test.run("Employees('1')/ne_Manager").isUriPathInfoKind(UriPathInfoImpl.UriPathInfoKind.navicationProperty);
- * test.run("Teams('1')/nt_Employees('1')").isUriPathInfoKind(UriPathInfoImpl.UriPathInfoKind.navicationProperty);
- * // testUri("Teams('1')/nt_Employees('1')/EmployeeName", UriPathInfoImpl.UriPathInfoKind.navicationProperty);
- * }
- */
-
-}
[3/9] [OLINGO-63] Uri Parser: adoptions in lexer and parser,
create UriParserImpl to convert the parsetree into internal
structures, moved parser antlr part from .../olingo/producer/... to
.../olingo/odata4/producer
Posted by ko...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java
new file mode 100644
index 0000000..e753744
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java
@@ -0,0 +1,354 @@
+/*******************************************************************************
+ * 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
+ *
+ * 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.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.uri.antlr;
+
+import java.util.Arrays;
+
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
+import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.odata4.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.producer.api.uri.UriPathInfoKind;
+import org.apache.olingo.odata4.producer.core.testutil.EdmTechProvider;
+import org.apache.olingo.odata4.producer.core.testutil.UriResourcePathValidator;
+import org.junit.Test;
+
+public class TestUriParserImpl {
+ UriResourcePathValidator test = null;
+ Edm edm = null;
+
+ private final String PropertyString = "PropertyString='ABC'";
+ private final String PropertyInt16 = "PropertyInt16=1";
+ private final String PropertyBoolean = "PropertyBoolean=true";
+ private final String PropertyByte = "PropertyByte=1";
+ private final String PropertySByte = "PropertySByte=1";
+ private final String PropertyInt32 = "PropertyInt32=12";
+ private final String PropertyInt64 = "PropertyInt64=64";
+ private final String PropertyDecimal = "PropertyDecimal=12";
+ private final String PropertyDate = "PropertyDate=2013-09-25";
+ private final String PropertyDateTimeOffset = "PropertyDateTimeOffset=2002-10-10T12:00:00-05:00";
+ private final String PropertyDuration = "PropertyDuration=duration'P10DT5H34M21.123456789012S'";
+ private final String PropertyGuid = "PropertyGuid=12345678-1234-1234-1234-123456789012";
+ private final String PropertyTimeOfDay = "PropertyTimeOfDay=12:34:55.123456789012";
+ private final String allKeys = PropertyString + "," + PropertyInt16 + "," + PropertyBoolean + "," + PropertyByte
+ + "," + PropertySByte + "," + PropertyInt32 + "," + PropertyInt64 + "," + PropertyDecimal + "," + PropertyDate
+ + "," + PropertyDateTimeOffset + "," + PropertyDuration + "," + PropertyGuid + "," + PropertyTimeOfDay;
+
+ public TestUriParserImpl() {
+ test = new UriResourcePathValidator();
+ edm = new EdmProviderImpl(new EdmTechProvider());
+ test.setEdm(edm);
+ }
+
+ @Test
+ public void test() {
+
+ test.run("ESAllKey(" + allKeys + ")")
+ .isUriPathInfoKind(UriPathInfoKind.entitySet)
+ .isKeyPredicate(0, "PropertyString", "'ABC'")
+ .isKeyPredicate(1, "PropertyInt16", "1");
+ }
+
+ @Test
+ public void testShortUris() {
+ test.run("$batch").isKind(UriInfoKind.batch);
+ test.run("$all").isKind(UriInfoKind.all);
+ test.run("$crossjoin(abc)").isKind(UriInfoKind.crossjoin);
+ }
+
+ @Test
+ public void testDollarEntity() {
+ // TODO
+ }
+
+ @Test
+ public void testEntitySet() {
+ test.run("ESAllPrim")
+ .isUriPathInfoKind(UriPathInfoKind.entitySet)
+ .isType(new FullQualifiedName("com.sap.odata.test1", "ETAllPrim"));
+
+ // with one key
+ test.run("ESAllPrim(1)")
+ .isUriPathInfoKind(UriPathInfoKind.entitySet)
+ .isType(new FullQualifiedName("com.sap.odata.test1", "ETAllPrim"))
+ .isKeyPredicate(0, "PropertyInt16", "1");
+
+ test.run("ESAllPrim(PropertyInt16=1)")
+ .isUriPathInfoKind(UriPathInfoKind.entitySet)
+ .isKeyPredicate(0, "PropertyInt16", "1");
+
+ // with two keys
+ test.run("ESTwoKeyTwoPrim(PropertyInt16=1, PropertyString='ABC')")
+ .isUriPathInfoKind(UriPathInfoKind.entitySet)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'ABC'");
+
+ // with all keys
+ test.run("ESAllKey(" + allKeys + ")")
+ .isUriPathInfoKind(UriPathInfoKind.entitySet)
+ .isKeyPredicate(0, "PropertyString", "'ABC'")
+ .isKeyPredicate(1, "PropertyInt16", "1")
+ .isKeyPredicate(2, "PropertyBoolean", "true")
+ .isKeyPredicate(3, "PropertyByte", "1")
+ .isKeyPredicate(4, "PropertySByte", "1")
+ .isKeyPredicate(5, "PropertyInt32", "12")
+ .isKeyPredicate(6, "PropertyInt64", "64")
+ .isKeyPredicate(7, "PropertyDecimal", "12")
+ .isKeyPredicate(8, "PropertyDate", "2013-09-25")
+ .isKeyPredicate(9, "PropertyDateTimeOffset", "2002-10-10T12:00:00-05:00")
+ .isKeyPredicate(10, "PropertyDuration", "duration'P10DT5H34M21.123456789012S'")
+ .isKeyPredicate(11, "PropertyGuid", "12345678-1234-1234-1234-123456789012")
+ .isKeyPredicate(12, "PropertyTimeOfDay", "12:34:55.123456789012");
+
+ // with property
+ test.run("ESAllPrim(1)/PropertyString")
+ .isUriPathInfoKind(UriPathInfoKind.entitySet)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isProperties(Arrays.asList("PropertyString"));
+
+ // with complex property
+ test.run("ESCompAllPrim(1)/PropertyComplex")
+ .isUriPathInfoKind(UriPathInfoKind.entitySet)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isProperty(0, "PropertyComplex", EdmTechProvider.nameCTAllPrim);
+
+ // with two properties
+ test.run("ESCompAllPrim(1)/PropertyComplex/PropertyString")
+ .isUriPathInfoKind(UriPathInfoKind.entitySet)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isProperty(0, "PropertyComplex", EdmTechProvider.nameCTAllPrim)
+ .isProperty(1, "PropertyString", EdmTechProvider.nameString);
+ }
+
+ @Test
+ public void testEntitySetNav() {
+
+ test.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne")
+ .at(0)
+ .isUriPathInfoKind(UriPathInfoKind.entitySet)
+ .isInitialType(EdmTechProvider.nameETKeyNav)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isProperty(0, "NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav)
+ .at(1)
+ .isUriPathInfoKind(UriPathInfoKind.navEntitySet)
+ .isType(EdmTechProvider.nameETTwoKeyNav);
+
+ test.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/PropertyString")
+ .at(0)
+ .isUriPathInfoKind(UriPathInfoKind.entitySet)
+ .isInitialType(EdmTechProvider.nameETKeyNav)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isProperty(0, "NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav)
+ .at(1)
+ .isUriPathInfoKind(UriPathInfoKind.navEntitySet)
+ .isInitialType(EdmTechProvider.nameETTwoKeyNav)
+ .isType(EdmTechProvider.nameString)
+ .isProperty(0, "PropertyString", EdmTechProvider.nameString);
+
+ test.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/NavPropertyETKeyNavOne")
+ .at(0)
+ .isUriPathInfoKind(UriPathInfoKind.entitySet)
+ .isInitialType(EdmTechProvider.nameETKeyNav)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isProperty(0, "NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav)
+ .at(1)
+ .isUriPathInfoKind(UriPathInfoKind.navEntitySet)
+ .isInitialType(EdmTechProvider.nameETTwoKeyNav)
+ .isType(EdmTechProvider.nameETKeyNav)
+ .at(2)
+ .isUriPathInfoKind(UriPathInfoKind.navEntitySet)
+ .isInitialType(EdmTechProvider.nameETKeyNav)
+ .isType(EdmTechProvider.nameETKeyNav);
+
+ test.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/NavPropertyETKeyNavOne/PropertyString")
+ .at(0)
+ .isUriPathInfoKind(UriPathInfoKind.entitySet)
+ .isInitialType(EdmTechProvider.nameETKeyNav)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isProperty(0, "NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav)
+ .at(1)
+ .isUriPathInfoKind(UriPathInfoKind.navEntitySet)
+ .isInitialType(EdmTechProvider.nameETTwoKeyNav)
+ .isType(EdmTechProvider.nameETKeyNav)
+ .at(2)
+ .isUriPathInfoKind(UriPathInfoKind.navEntitySet)
+ .isInitialType(EdmTechProvider.nameETKeyNav)
+ .isType(EdmTechProvider.nameString)
+ .isProperty(0, "PropertyString", EdmTechProvider.nameString);
+
+ }
+
+ @Test
+ public void testTypeFilter() {
+ // test.run("ESTwoPrim");
+ test.run("ESTwoPrim/com.sap.odata.test1.ETBase")
+ .isUriPathInfoKind(UriPathInfoKind.entitySet)
+ .isType(new FullQualifiedName("com.sap.odata.test1", "ETBase"));
+
+ test.run("ESTwoPrim/com.sap.odata.test1.ETBase/AdditionalPropertyString_5")
+ .isUriPathInfoKind(UriPathInfoKind.entitySet)
+ .isType(new FullQualifiedName("Edm", "String"))
+ .isProperties(Arrays.asList("AdditionalPropertyString_5"))
+ .isProperty(0, "AdditionalPropertyString_5", EdmTechProvider.nameString);
+ }
+
+ @Test
+ public void testSingleton() {
+ test.run("SI")
+ .isUriPathInfoKind(UriPathInfoKind.singleton)
+ .isType(EdmTechProvider.nameETTwoPrim);
+
+ test.run("SI/PropertyInt16")
+ .isUriPathInfoKind(UriPathInfoKind.singleton)
+ .isInitialType(EdmTechProvider.nameETTwoPrim)
+ .isType(EdmTechProvider.nameInt16)
+ .isProperty(0, "PropertyInt16", EdmTechProvider.nameInt16);
+
+ test.run("SI/com.sap.odata.test1.ETBase/AdditionalPropertyString_5")
+ .isUriPathInfoKind(UriPathInfoKind.singleton)
+ .isType(new FullQualifiedName("Edm", "String"))
+ .isProperties(Arrays.asList("AdditionalPropertyString_5"))
+ .isProperty(0, "AdditionalPropertyString_5", EdmTechProvider.nameString);
+
+ test.run("SINav/NavPropertyETKeyNavOne")
+ .at(0)
+ .isUriPathInfoKind(UriPathInfoKind.singleton)
+ .isType(EdmTechProvider.nameETKeyNav)
+ .isInitialType(EdmTechProvider.nameETTwoKeyNav)
+ .isCollection(false)
+ .at(1)
+ .isType(EdmTechProvider.nameETKeyNav);
+
+ test.run("SINav/NavPropertyETKeyNavOne/PropertyInt16")
+ .at(0)
+ .isUriPathInfoKind(UriPathInfoKind.singleton)
+ .isType(EdmTechProvider.nameETKeyNav)
+ .isInitialType(EdmTechProvider.nameETTwoKeyNav)
+ .isCollection(false)
+ .at(1)
+ .isInitialType(EdmTechProvider.nameETKeyNav)
+ .isType(EdmTechProvider.nameInt16);
+
+ test.run("SINav/NavPropertyETKeyNavMany(1)")
+ .at(0)
+ .isUriPathInfoKind(UriPathInfoKind.singleton)
+ .isType(EdmTechProvider.nameETKeyNav)
+ .isInitialType(EdmTechProvider.nameETTwoKeyNav)
+ .isCollection(true)
+ .at(1)
+ .isType(EdmTechProvider.nameETKeyNav);
+
+ test.run("SINav/NavPropertyETKeyNavMany(1)/PropertyInt16")
+ .at(0)
+ .isUriPathInfoKind(UriPathInfoKind.singleton)
+ .isType(EdmTechProvider.nameETKeyNav)
+ .isInitialType(EdmTechProvider.nameETTwoKeyNav)
+ .isCollection(true)
+ .at(1)
+ .isInitialType(EdmTechProvider.nameETKeyNav)
+ .isType(EdmTechProvider.nameInt16);
+
+ }
+
+ @Test
+ public void testActionImport() {
+
+ test.run("AIRTPrimParam")
+ .isUriPathInfoKind(UriPathInfoKind.action)
+ .isType(EdmTechProvider.nameString);
+
+ test.run("AIRTPrimCollParam")
+ .isUriPathInfoKind(UriPathInfoKind.action)
+ .isType(EdmTechProvider.nameString)
+ .isCollection(true);
+
+ test.run("AIRTETParam")
+ .isUriPathInfoKind(UriPathInfoKind.action)
+ .isType(EdmTechProvider.nameETTwoKeyTwoPrim)
+ .isCollection(false);
+
+ test.run("AIRTETCollAllPrimParam")
+ .isUriPathInfoKind(UriPathInfoKind.action)
+ .isType(EdmTechProvider.nameETCollAllPrim)
+ .isCollection(true);
+
+ test.run("AIRTETCollAllPrimParam(1)")
+ .isUriPathInfoKind(UriPathInfoKind.action)
+ .isType(EdmTechProvider.nameETCollAllPrim)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isCollection(false);
+ test.run("AIRTETCollAllPrimParam(ParameterInt16=1)")
+ .isUriPathInfoKind(UriPathInfoKind.action)
+ .isType(EdmTechProvider.nameETCollAllPrim)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isCollection(false);
+ }
+
+ /*
+ * //@Test
+ * public void testFunctionImport() {
+ * test.run("MaximalAge").isUriPathInfoKind(UriPathInfoImpl.UriPathInfoKind.functioncall);
+ * }
+ */
+ /*
+ * //@Test
+ * public void testBoundFunctions() {
+ *
+ * test.run("Employees/RefScenario.bf_entity_set_rt_entity(NonBindingParameter='1')").isUriPathInfoKind(
+ * UriPathInfoImpl.UriPathInfoKind.boundFunctioncall);
+ * test.run("Employees('1')/EmployeeName/RefScenario.bf_pprop_rt_entity_set()").isUriPathInfoKind(
+ * UriPathInfoImpl.UriPathInfoKind.boundFunctioncall);
+ * test.run("Company/RefScenario.bf_singleton_rt_entity_set()('1')").isUriPathInfoKind(
+ * UriPathInfoImpl.UriPathInfoKind.boundFunctioncall);
+ * // testUri("Company/RefScenario.bf_singleton_rt_entity_set()('1')/EmployeeName/"
+ * // +"RefScenario.bf_pprop_rt_entity_set()",
+ * // UriPathInfoImpl.UriPathInfoKind.boundFunctioncall);
+ * }
+ */
+ /*
+ * //@Test
+ * public void testBoundActions() {
+ * test.run("Employees('1')/RefScenario.ba_entity_rt_pprop")
+ * .isUriPathInfoKind(UriPathInfoImpl.UriPathInfoKind.boundActionImport);
+ * test.run("Employees('1')/EmployeeName/RefScenario.ba_pprop_rt_entity_set").isUriPathInfoKind(
+ * UriPathInfoImpl.UriPathInfoKind.boundActionImport);
+ * }
+ */
+ /*
+ * //@Test
+ * public void testNavigationFunction() {
+ * test.run("Employees('1')/ne_Manager").isUriPathInfoKind(UriPathInfoImpl.UriPathInfoKind.navicationProperty);
+ * test.run("Teams('1')/nt_Employees('1')").isUriPathInfoKind(UriPathInfoImpl.UriPathInfoKind.navicationProperty);
+ * // testUri("Teams('1')/nt_Employees('1')/EmployeeName", UriPathInfoImpl.UriPathInfoKind.navicationProperty);
+ * }
+ */
+
+ @Test
+ public void testErrors() {
+ //the following is wrong and must throw an error behind an Action are not () allowed
+ //test.run("AIRTPrimParam()");
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/producer/core/uri/antlr/TestLexer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/producer/core/uri/antlr/TestLexer.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/producer/core/uri/antlr/TestLexer.java
deleted file mode 100644
index 6fb9f08..0000000
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/producer/core/uri/antlr/TestLexer.java
+++ /dev/null
@@ -1,424 +0,0 @@
-/*******************************************************************************
- * 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
- *
- * 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.
- ******************************************************************************/
-package org.apache.olingo.producer.core.uri.antlr;
-
-import org.antlr.v4.runtime.Lexer;
-import org.apache.olingo.odata4.producer.core.testutil.TokenValidator;
-import org.junit.Test;
-
-public class TestLexer {
-
- private TokenValidator test = null;
-
- private static final String cPCT_ENCODED = "%45%46%47" + "%22" + "%5C";// last two chars are not in
- // cPCT_ENCODED_UNESCAPED
- private static final String cPCT_ENCODED_UNESCAPED = "%45%46%47";
- private static final String cUNRESERVED = "ABCabc123-._~";
- private static final String cOTHER_DELIMS = "!()*+,;";
- private static final String cSUB_DELIMS = "$&'=" + cOTHER_DELIMS;
-
- // private static final String cPCTENCODEDnoSQUOTE = "%65%66%67";
- // private static final String cPCHARnoSQUOTE = cUNRESERVED + cPCTENCODEDnoSQUOTE + cOTHER_DELIMS + "$&=:@";
-
- private static final String cPCHAR = cUNRESERVED + cPCT_ENCODED + cSUB_DELIMS + ":@";
-
- private static final String cQCHAR_UNESCAPED = cUNRESERVED + cPCT_ENCODED_UNESCAPED + cOTHER_DELIMS + ":@/?$'=";
-
- public TestLexer() {
- test = new TokenValidator();
- }
-
- @Test
- public void test() {
- test.globalMode(Lexer.DEFAULT_MODE);
- test.run("ODI?$filter=geo.distance(geometry'SRID=0;Point(142.1 64.1)',geometry'SRID=0;Point(142.1 64.1)')");
- // test.log(1).run("$filter='ABC'").isText("ABC").isType(UriLexer.STRING);
- // test.log(1).run("ODI?$filter=1 add 2 mul 3");
- // test.log(1).run("1 + 2 + 3");
- // test.log(1).run("ODI?$filter=geography'SRID=0;Collection(LineString(142.1 64.1,3.14 2.78))'");
- // test.log(1).run("ODI?$filter=1 mul 2 add 3");
- // test.globalMode(UriLexer.MODE_QUERY);
- // test.log(1).run("$entity?$id='A'&sdf=ssdf&$id=ABC");
- // test.run("$skiptoken=top");
-
- /*
- * test.log(1).run("ODI?$filter=geo.intersects("
- * + "geometry'SRID=0;Point(142.1 64.1)',"
- * + "geometry'SRID=0;Polygon((1 1,1 1),(1 1,2 2,3 3,1 1))')");
- */
- }
-
- // ;------------------------------------------------------------------------------
- // ; 0. URI
- // ;------------------------------------------------------------------------------
-
- @Test
- public void testUriTokens() {
- test.globalMode(UriLexer.MODE_QUERY);
- test.run("#").isText("#").isType(UriLexer.FRAGMENT);
- test.run("$count").isText("$count").isType(UriLexer.COUNT);
- test.run("$ref").isText("$ref").isType(UriLexer.REF);
- test.run("$value").isText("$value").isType(UriLexer.VALUE);
- }
-
- // ;------------------------------------------------------------------------------
- // ; 2. Query Options
- // ;------------------------------------------------------------------------------
- @Test
- public void testQueryOptionsTokens() {
-
- test.globalMode(UriLexer.MODE_QUERY);
- test.run("$skip=1").isAllText("$skip=1").isType(UriLexer.SKIP);
- test.run("$skip=2").isAllText("$skip=2").isType(UriLexer.SKIP);
- test.run("$skip=123").isAllText("$skip=123").isType(UriLexer.SKIP);
-
- // TODO check and add error handling
- // test.run("$skip=A").isExType(LexerNoViableAltException.class);
-
- test.run("$top=1").isAllText("$top=1").isType(UriLexer.TOP);
- test.run("$top=2").isAllText("$top=2").isType(UriLexer.TOP);
- test.run("$top=123").isAllText("$top=123").isType(UriLexer.TOP);
- // TODO check and add error handling
- // test.run("$top=A").isExType(LexerNoViableAltException.class);
-
- test.run("$levels=1").isAllText("$levels=1").isType(UriLexer.LEVELS);
- test.run("$levels=2").isAllText("$levels=2").isType(UriLexer.LEVELS);
- test.run("$levels=123").isAllText("$levels=123").isType(UriLexer.LEVELS);
- test.run("$levels=max").isAllText("$levels=max").isType(UriLexer.LEVELS);
- // TODO check and add error handling
- // test.run("$levels=A").isExType(LexerNoViableAltException.class);
-
- test.run("$format=atom").isAllText("$format=atom").isType(UriLexer.FORMAT);
- test.run("$format=json").isAllText("$format=json").isType(UriLexer.FORMAT);
- test.run("$format=xml").isAllText("$format=xml").isType(UriLexer.FORMAT);
- test.run("$format=abc/def").isAllText("$format=abc/def").isType(UriLexer.FORMAT);
- // TODO check and add error handling
- // test.run("$format=abc").isExType(LexerNoViableAltException.class);
-
- test.run("$id=123").isAllText("$id=123").isType(UriLexer.ID);
- test.run("$id=ABC").isAllText("$id=ABC").isType(UriLexer.ID);
-
- test.run("$skiptoken=ABC").isAllText("$skiptoken=ABC").isType(UriLexer.SKIPTOKEN);
- test.run("$skiptoken=ABC").isAllText("$skiptoken=ABC").isType(UriLexer.SKIPTOKEN);
-
- test.run("$search=\"ABC\"").isAllText("$search=\"ABC\"").isType(UriLexer.SEARCH);
- test.run("$search=ABC").isAllText("$search=ABC").isType(UriLexer.SEARCH);
- test.run("$search=\"A%20B%20C\"").isAllText("$search=\"A%20B%20C\"").isType(UriLexer.SEARCH);
- }
-
- // ;------------------------------------------------------------------------------
- // ; 4. Expressions
- // ;------------------------------------------------------------------------------
- @Test
- public void testQueryExpressions() {
- test.globalMode(Lexer.DEFAULT_MODE);
- // assertEquals("expected","actual");
-
- test.run("$it").isText("$it").isType(UriLexer.IMPLICIT_VARIABLE_EXPR);
- // TODO check and add error handling
- // test.run("$itabc").isText("$it").isType(UriLexer.IMPLICIT_VARIABLE_EXPR);
-
- test.run("$filter=contains(").at(2).isText("contains(").isType(UriLexer.CONTAINS_WORD);
-
- test.run("$filter=containsabc").at(2).isText("containsabc")
- .isType(UriLexer.ODATAIDENTIFIER); // test that this is a ODI
-
- test.run("$filter=startswith(").at(2).isText("startswith(").isType(UriLexer.STARTSWITH_WORD);
- test.run("$filter=endswith(").at(2).isText("endswith(").isType(UriLexer.ENDSWITH_WORD);
- test.run("$filter=length(").at(2).isText("length(").isType(UriLexer.LENGTH_WORD);
- test.run("$filter=indexof(").at(2).isText("indexof(").isType(UriLexer.INDEXOF_WORD);
- test.run("$filter=substring(").at(2).isText("substring(").isType(UriLexer.SUBSTRING_WORD);
- test.run("$filter=tolower(").at(2).isText("tolower(").isType(UriLexer.TOLOWER_WORD);
- test.run("$filter=toupper(").at(2).isText("toupper(").isType(UriLexer.TOUPPER_WORD);
- test.run("$filter=trim(").at(2).isText("trim(").isType(UriLexer.TRIM_WORD);
- test.run("$filter=concat(").at(2).isText("concat(").isType(UriLexer.CONCAT_WORD);
-
- }
-
- /*
- * // ;------------------------------------------------------------------------------
- * // ; 5. JSON format for function parameters
- * // ;------------------------------------------------------------------------------
- *
- * @Test
- * public void testQueryJSON_and_otheres() {
- * // QUOTATION_MARK
- * test.run("\"").isText("\"").isType(UriLexer.QUOTATION_MARK);
- * test.run("%22").isText("%22").isType(UriLexer.QUOTATION_MARK);
- *
- * // Lexer rule QCHAR_UNESCAPED
- * test.run("\"abc\"").isText("\"abc\"").isType(UriLexer.STRING_IN_JSON);
- *
- * // Lexer rule QCHAR_JSON_SPECIAL
- * test.run("\"" + cQCHAR_JSON_SPECIAL + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- *
- * // Lexer rule CHAR_IN_JSON
- * test.run("\"" + cQCHAR_UNESCAPED + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- * test.run("\"" + cQCHAR_JSON_SPECIAL + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- *
- * // Lexer rule ESCAPE CHAR_IN_JSON
- * test.run("\"" + cESCAPE + cQUOTATION_MARK + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- * test.run("\"" + cESCAPE + cESCAPE + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- * test.run("\"" + cESCAPE + "/" + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- * test.run("\"" + cESCAPE + "%2F" + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- * test.run("\"" + cESCAPE + "b" + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- * test.run("\"" + cESCAPE + "f" + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- * test.run("\"" + cESCAPE + "n" + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- * test.run("\"" + cESCAPE + "r" + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- * test.run("\"" + cESCAPE + "t" + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- * test.run("\"" + cESCAPE + "u12AB" + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
- * }
- *
- * // ;------------------------------------------------------------------------------
- * // ; 6. Names and identifiers
- * // ;------------------------------------------------------------------------------
- *
- * @Test
- * public void testNamesAndIdentifiers() {
- *
- * test.run("Binary").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Boolean").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Byte").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Date").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("DateTimeOffset").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Decimal").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Double").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Duration").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Guid").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Int16").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Int32").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Int64").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("SByte").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Single").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Stream").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("String").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("TimeOfDay").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- *
- * test.run("Geography").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run("Geometry").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- *
- * String g = "Geography";
- * test.run(g ).isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "Collection").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "LineString").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "MultiLineString").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "MultiPoint").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "MultiPolygon").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "Point").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "LineString").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "Polygon").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- *
- * g = "Geometry";
- * test.run(g ).isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "Collection").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "LineString").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "MultiLineString").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "MultiPoint").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "MultiPolygon").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "Point").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "LineString").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- * test.run(g + "Polygon").isInput().isType(UriLexer.PRIMITIVETYPENAME);
- *
- * }
- *
- * @Test
- * public void testNameClaches() {
- * -- test.run("Collection").isInput().isType(UriLexer.COLLECTION_CS_FIX);
- * test.run("LineString").isInput().isType(UriLexer.LINESTRING_CS_FIX);
- * test.run("MultiLineString").isInput().isType(UriLexer.MULTILINESTRING_CS_FIX);
- * test.run("MultiPoint").isInput().isType(UriLexer.MULTIPOINT_CS_FIX);
- * test.run("MultiPolygon").isInput().isType(UriLexer.MULTIPOLYGON_CS_FIX);
- * test.run("Point").isInput().isType(UriLexer.POINT_CS_FIX);
- * test.run("Polygon").isInput().isType(UriLexer.POLYGON_CS_FIX);
- * test.run("Srid").isInput().isType(UriLexer.SRID_CS);--
- * }
- */
- // ;------------------------------------------------------------------------------
- // ; 7. Literal Data Values
- // ;------------------------------------------------------------------------------
-
- @Test
- public void testLiteralDataValues() {
- test.globalMode(Lexer.DEFAULT_MODE);
- // null
- test.run("null").isInput().isType(UriLexer.NULLVALUE);
-
- // binary
- test.run("binary'ABCD'").isInput().isType(UriLexer.BINARY);
- test.run("BiNaRy'ABCD'").isInput().isType(UriLexer.BINARY);
-
- // not a binary TODO add error handling
- test.run("BiNaRy'ABCDA'")
- .at(0).isText("BiNaRy").isType(UriLexer.ODATAIDENTIFIER)
- .at(1).isText("'ABCDA'").isType(UriLexer.STRING);
-
- // boolean
- test.run("true").isInput().isType(UriLexer.TRUE);
- test.run("false").isInput().isType(UriLexer.FALSE);
- test.run("TrUe").isInput().isType(UriLexer.BOOLEAN);
- test.run("FaLsE").isInput().isType(UriLexer.BOOLEAN);
-
- // Lexer rule INT
- test.run("123").isInput().isType(UriLexer.INT);
- test.run("123456789").isInput().isType(UriLexer.INT);
- test.run("+123").isInput().isType(UriLexer.INT);
- test.run("+123456789").isInput().isType(UriLexer.INT);
- test.run("-123").isInput().isType(UriLexer.INT);
- test.run("-123456789").isInput().isType(UriLexer.INT);
-
- // Lexer rule DECIMAL
- test.run("0.1").isInput().isType(UriLexer.DECIMAL);
- test.run("1.1").isInput().isType(UriLexer.DECIMAL);
- test.run("+0.1").isInput().isType(UriLexer.DECIMAL);
- test.run("+1.1").isInput().isType(UriLexer.DECIMAL);
- test.run("-0.1").isInput().isType(UriLexer.DECIMAL);
- test.run("-1.1").isInput().isType(UriLexer.DECIMAL);
-
- // Lexer rule EXP
- test.run("1.1e+1").isInput().isType(UriLexer.DECIMAL);
- test.run("1.1e-1").isInput().isType(UriLexer.DECIMAL);
-
- test.run("NaN").isInput().isType(UriLexer.NANINFINITY);
- test.run("-INF").isInput().isType(UriLexer.NANINFINITY);
- test.run("INF").isInput().isType(UriLexer.NANINFINITY);
-
- // Lexer rule GUID
- test.run("guid'1234ABCD-12AB-23CD-45EF-123456780ABC'").isInput().isType(UriLexer.GUID);
- test.run("GuId'1234ABCD-12AB-23CD-45EF-123456780ABC'").isInput().isType(UriLexer.GUID);
-
- // Lexer rule DATE
- test.run("date'2013-11-15'").isInput().isType(UriLexer.DATE);
- test.run("DaTe'2013-11-15'").isInput().isType(UriLexer.DATE);
-
- // Lexer rule DATETIMEOFFSET
- test.run("datetimeoffset'2013-11-15T13:35Z'").isInput().isType(UriLexer.DATETIMEOFFSET);
- test.run("datetimeoffset'2013-11-15T13:35:10Z'").isInput().isType(UriLexer.DATETIMEOFFSET);
- test.run("datetimeoffset'2013-11-15T13:35:10.1234Z'").isInput().isType(UriLexer.DATETIMEOFFSET);
-
- test.run("datetimeoffset'2013-11-15T13:35:10.1234+01:30'").isInput().isType(UriLexer.DATETIMEOFFSET);
- test.run("datetimeoffset'2013-11-15T13:35:10.1234-01:12'").isInput().isType(UriLexer.DATETIMEOFFSET);
-
- test.run("DaTeTiMeOfFsEt'2013-11-15T13:35Z'").isInput().isType(UriLexer.DATETIMEOFFSET);
-
- // Lexer rule DURATION
- test.run("duration'PT67S'").isInput().isType(UriLexer.DURATION);
- test.run("duration'PT67.89S'").isInput().isType(UriLexer.DURATION);
-
- test.run("duration'PT5M'").isInput().isType(UriLexer.DURATION);
- test.run("duration'PT5M67S'").isInput().isType(UriLexer.DURATION);
- test.run("duration'PT5M67.89S'").isInput().isType(UriLexer.DURATION);
-
- test.run("duration'PT4H'").isInput().isType(UriLexer.DURATION);
- test.run("duration'PT4H67S'").isInput().isType(UriLexer.DURATION);
- test.run("duration'PT4H67.89S'").isInput().isType(UriLexer.DURATION);
- test.run("duration'PT4H5M'").isInput().isType(UriLexer.DURATION);
- test.run("duration'PT4H5M67S'").isInput().isType(UriLexer.DURATION);
- test.run("duration'PT4H5M67.89S'").isInput().isType(UriLexer.DURATION);
-
- test.run("duration'P3D'");
- test.run("duration'P3DT67S'").isInput().isType(UriLexer.DURATION);
- test.run("duration'P3DT67.89S'").isInput().isType(UriLexer.DURATION);
- test.run("duration'P3DT5M'").isInput().isType(UriLexer.DURATION);
- test.run("duration'P3DT5M67S'").isInput().isType(UriLexer.DURATION);
- test.run("duration'P3DT5M67.89S'").isInput().isType(UriLexer.DURATION);
- test.run("duration'P3DT4H'").isInput().isType(UriLexer.DURATION);
- test.run("duration'P3DT4H67S'").isInput().isType(UriLexer.DURATION);
- test.run("duration'P3DT4H67.89S'").isInput().isType(UriLexer.DURATION);
- test.run("duration'P3DT4H5M'").isInput().isType(UriLexer.DURATION);
- test.run("duration'P3DT4H5M67S'").isInput().isType(UriLexer.DURATION);
- test.run("duration'P3DT4H5M67.89S'").isInput().isType(UriLexer.DURATION);
-
- test.run("DuRaTiOn'P3DT4H5M67.89S'").isInput().isType(UriLexer.DURATION);
- test.run("DuRaTiOn'-P3DT4H5M67.89S'").isInput().isType(UriLexer.DURATION);
-
- test.run("timeofday'20:00'").isInput().isType(UriLexer.TIMEOFDAY);
- test.run("timeofday'20:15:01'").isInput().isType(UriLexer.TIMEOFDAY);
- test.run("timeofday'20:15:01.02'").isInput().isType(UriLexer.TIMEOFDAY);
-
- test.run("timeofday'20:15:01.02'").isInput().isType(UriLexer.TIMEOFDAY);
-
- // String
- test.run("'ABC'").isText("'ABC'").isType(UriLexer.STRING);
- test.run("'A%20C'").isInput().isType(UriLexer.STRING);
- test.run("'%20%20%20ABC'").isInput().isType(UriLexer.STRING);
-
- }
-
- /*
- * // ;------------------------------------------------------------------------------
- * // ; 0. misc
- * // ;------------------------------------------------------------------------------
- *
- * @Test
- * public void testCriticalOrder() {
- * // Test lexer rule STRING
- * test.run("'abc'").isInput().isType(UriLexer.STRING);
- *
- * // Test lexer rule SEARCHWORD
- * test.run("abc", true).isInput().isType(UriLexer.SEARCHWORD);
- *
- * // Test lexer rule SEARCHPHRASE
- * test.run("\"abc\"", true).isInput().isType(UriLexer.SEARCHPHRASE);
- *
- * // Test lexer rule ODATAIDENTIFIER
- * test.run("abc").isInput().isType(UriLexer.ODATAIDENTIFIER);
- *
- * test.run("\"abc\"").isInput().isType(UriLexer.STRING_IN_JSON);
- * }
- */
- @Test
- public void testDelims() {
- String reserved = "/";
- test.globalMode(UriLexer.MODE_QUERY);
- // Test lexer rule UNRESERVED
- test.run("$format=A/" + cUNRESERVED).isAllInput().isType(UriLexer.FORMAT);
- test.run("$format=A/" + cUNRESERVED + reserved).isType(UriLexer.FORMAT).at(4).isText(cUNRESERVED);
- // Test lexer rule PCT_ENCODED
- test.run("$format=A/" + cPCT_ENCODED).isAllInput().isType(UriLexer.FORMAT);
- test.run("$format=A/" + cPCT_ENCODED + reserved).isType(UriLexer.FORMAT).at(4).isText(cPCT_ENCODED);
- // Test lexer rule SUB_DELIMS
- test.run("$format=A/" + cSUB_DELIMS).isAllInput().isType(UriLexer.FORMAT);
- test.run("$format=A/" + cSUB_DELIMS + reserved).isType(UriLexer.FORMAT).at(4).isText(cSUB_DELIMS);
- // Test lexer rule PCHAR rest
- test.run("$format=A/:@").isAllText("$format=A/:@").isType(UriLexer.FORMAT);
- test.run("$format=A/:@" + reserved).isType(UriLexer.FORMAT).at(4).isText(":@");
- // Test lexer rule PCHAR all
- test.run("$format=" + cPCHAR + "/" + cPCHAR).isAllInput().isType(UriLexer.FORMAT);
- test.run("$format=" + cPCHAR + "/" + cPCHAR + reserved)
- .isType(UriLexer.FORMAT).at(4)
- .isText(cPCHAR);
-
- // Test lexer rule QCHAR_NO_AMP
- String amp = "&";
- // Test lexer rule UNRESERVED
- test.run("$id=" + cUNRESERVED).isAllInput().isType(UriLexer.ID);
- test.run("$id=" + cUNRESERVED + amp).isType(UriLexer.ID).at(2).isText(cUNRESERVED);
- // Test lexer rule PCT_ENCODED
- test.run("$id=" + cPCT_ENCODED).isAllInput().isType(UriLexer.ID);
- test.run("$id=" + cPCT_ENCODED + amp).isType(UriLexer.ID).at(2).isText(cPCT_ENCODED);
- // Test lexer rule OTHER_DELIMS
- test.run("$id=" + cOTHER_DELIMS).isAllInput().isType(UriLexer.ID);
- test.run("$id=" + cOTHER_DELIMS + amp).isType(UriLexer.ID).at(2).isText(cOTHER_DELIMS);
- // Lexer rule QCHAR_NO_AMP rest
- test.run("$id=:@/?$'=").isAllText("$id=:@/?$'=").isType(UriLexer.ID);
- test.run("$id=:@/?$'=" + amp).isType(UriLexer.ID).at(2).isText(":@/?$'=");
-
- }
-
-}
[8/9] [OLINGO-63] Uri Parser: adoptions in lexer and parser,
create UriParserImpl to convert the parsetree into internal
structures, moved parser antlr part from .../olingo/producer/... to
.../olingo/odata4/producer
Posted by ko...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/producer/core/uri/antlr/UriLexerPart.g4
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/producer/core/uri/antlr/UriLexerPart.g4 b/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/producer/core/uri/antlr/UriLexerPart.g4
deleted file mode 100644
index a79f14c..0000000
--- a/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/producer/core/uri/antlr/UriLexerPart.g4
+++ /dev/null
@@ -1,438 +0,0 @@
-/*******************************************************************************
- * 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
- *
- * 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.
- ******************************************************************************/
- lexer grammar UriLexerPart;
-
-@lexer::members {
-//custom lexer members -->
- boolean debug = false;
- private void out(String out) { if(debug) { System.out.println(out); } };
-
- boolean bInSearch = false;
- public boolean inSearch() { /*out("?SW?="+bInSearch);*/ return bInSearch; };
- public void setInSearch(boolean value) { bInSearch=value; /*out("SW=set to "+ bInSearch);*/ };
-
- boolean bInGeo = false;
- public boolean inGeo() { /*out("?Geo?="+bInGeo);*/ return bInGeo; };
- public void setInGeo(boolean value) { bInGeo=value; /*out("Geo=set to "+ bInGeo);*/ };
-
- //testing
- boolean bInCustomOption = false;
- public boolean inCustomOption() { /*out("?CUST?="+bInCustomOption);*/ return bInCustomOption; };
- public void setINCustomOption(boolean value) { bInCustomOption=value; /*out("CUST=set to "+ bInCustomOption);*/ };
-
-
-//<-- custom lexer members
-}
-
-
-//;------------------------------------------------------------------------------
-//; 0. URI
-//;------------------------------------------------------------------------------
-
-FRAGMENT : '#';
-
-COUNT : '$count';
-REF : '$ref';
-VALUE : '$value';
-
-
-//;------------------------------------------------------------------------------
-//; 2. Query Options
-//;------------------------------------------------------------------------------
-
-SKIP : '$skip' EQ DIGIT+;
-TOP : '$top' EQ DIGIT+;
-
-LEVELS : '$levels' EQ ( DIGIT+ | 'max' );
-
-FORMAT : '$format' EQ
- ( 'atom'
- | 'json'
- | 'xml'
- | PCHAR+ '/' PCHAR+
- );
-
-ID : '$id' EQ QCHAR_NO_AMP+;
-
-SKIPTOKEN : '$skiptoken' EQ QCHAR_NO_AMP+;
-
-
-//;------------------------------------------------------------------------------
-//; 4. Expressions
-//;------------------------------------------------------------------------------
-
-IMPLICIT_VARIABLE_EXPR : '$it';
-
-CONTAINS : 'contains';
-STARTSWITH : 'startswith';
-ENDSWITH : 'endswith';
-LENGTH : 'length';
-INDEXOF : 'indexof';
-SUBSTRING : 'substring';
-TOLOWER : 'tolower';
-TOUPPER : 'toupper';
-TRIM : 'trim';
-CONCAT : 'concat';
-
-
-//;------------------------------------------------------------------------------
-//; 5. JSON format for function parameters
-//;------------------------------------------------------------------------------
-
-QUOTATION_MARK : DQUOTE | '%22';
-
-fragment CHAR_IN_JSON : QCHAR_UNESCAPED
- | QCHAR_JSON_SPECIAL
- | ESCAPE
- ( QUOTATION_MARK
- | ESCAPE
- | ( '/' | '%2F' ) //; solidus U+002F
- | 'b' //; backspace U+0008
- | 'f' //; form feed U+000C
- | 'n' //; line feed U+000A
- | 'r' //; carriage return U+000D
- | 't' //; tab U+0009
- | 'u' HEXDIG HEXDIG HEXDIG HEXDIG //; U+XXXX
- );
-
-fragment QCHAR_JSON_SPECIAL : SP | ':' | '{' | '}' | '[' | ']'; //; some agents put these unencoded into the query part of a URL
-
-fragment ESCAPE : '\\' | '%5C'; //; reverse solidus U+005C
-
-BEGIN_OBJECT : WS* ( '{' / '%7B' ) WS*;
-END_OBJECT : WS* ( '}' / '%7D' ) WS*;
-
-BEGIN_ARRAY : WS* ( '[' / '%5B' ) WS*;
-END_ARRAY : WS* ( ']' / '%5D' ) WS*;
-
-NAME_SEPARATOR : WS* COLON WS*;
-//VALUE_SEPARATOR : WS* COMMA WS*;
-
-//;------------------------------------------------------------------------------
-//; 6. Names and identifiers
-//;------------------------------------------------------------------------------
-
-fragment ODI_LEADINGCHARACTER : ALPHA | '_'; //TODO; plus Unicode characters from the categories L or Nl
-fragment ODI_CHARACTER : ALPHA | '_' | DIGIT; //TODO; plus Unicode characters from the categories L, Nl, Nd, Mn, Mc, Pc, or Cf
-
-
-PRIMITIVETYPENAME : ('Edm.')?
- ( 'Binary'
- | 'Boolean'
- | 'Byte'
- | 'Date'
- | 'DateTimeOffset'
- | 'Decimal'
- | 'Double'
- | 'Duration'
- | 'Guid'
- | 'Int16'
- | 'Int32'
- | 'Int64'
- | 'SByte'
- | 'Single'
- | 'Stream'
- | 'String'
- | 'TimeOfDay'
- | (ABSTRACTSPATIALTYPENAME ) ( CONCRETESPATIALTYPENAME )?
- );
-
-fragment ABSTRACTSPATIALTYPENAME : GEOGRAPHY_CS_FIX
- | GEOMETRY_CS_FIX
- ;
-
-fragment CONCRETESPATIALTYPENAME : COLLECTION_CS_FIX
- | LINESTRING_CS_FIX
- | MULTILINESTRING_CS_FIX
- | MULTIPOINT_CS_FIX
- | MULTIPOLYGON_CS_FIX
- | POINT_CS_FIX
- | POLYGON_CS_FIX
- ;
-/*
-fragment COLLECTION_CS_FIX1 : 'Collection';
-fragment LINESTRING_CS_FIX1 : 'LineString';
-fragment MULTILINESTRING_CS_FIX1 : 'MultiLineString';
-fragment MULTIPOINT_CS_FIX1 : 'MultiPoint';
-fragment MULTIPOLYGON_CS_FIX1 : 'MultiPolygon';
-fragment POINT_CS_FIX1 : 'Point';
-fragment POLYGON_CS_FIX1 : 'Polygon';
-*/
-
-
-//;------------------------------------------------------------------------------
-//; 7. Literal Data Values
-//;------------------------------------------------------------------------------
-
-NULLVALUE : 'null';
-fragment SQUOTEinSTRING : SQUOTE SQUOTE ;
-
-BINARY : ('X'| B I N A R Y) SQUOTE (HEXDIG HEXDIG)* SQUOTE;
-
-TRUE : 'true';
-FALSE : 'false';
-BOOLEAN : T R U E
- | F A L S E
- ;
-
-fragment DIGITS : DIGIT+;
-
-INT : SIGN? DIGITS;
-DECIMAL : INT '.' DIGITS ('e' SIGN? DIGITS)?;
-
-NANINFINITY : 'NaN' | '-INF' | 'INF';
-
-
-// --------------------- GUID ---------------------
-GUID : G U I D SQUOTE GUIDVALUE SQUOTE;
-fragment GUIDVALUE : HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG'-'
- HEXDIG HEXDIG HEXDIG HEXDIG '-'
- HEXDIG HEXDIG HEXDIG HEXDIG '-'
- HEXDIG HEXDIG HEXDIG HEXDIG '-'
- HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG;
-
-// --------------------- DATE ---------------------
-DATE : DATETOKEN SQUOTE DATETOKEN_VALUE SQUOTE;
-fragment DATETOKEN : D A T E;
-fragment DATETOKEN_VALUE : YEAR '-' MONTH '-' DAY;
-
-// --------------------- DATETIMEOFFSET ---------------------
-DATETIMEOFFSET : DATEOFFSETTOKEN SQUOTE DATETIMEOFFSET_VALUE SQUOTE;
-fragment DATEOFFSETTOKEN : D A T E T I M E O F F S E T;
-fragment DATETIMEOFFSET_VALUE : YEAR '-' MONTH '-' DAY T HOUR ':' MINUTE ( ':' SECOND ( '.' FRACTIONALSECONDS )? )? ( Z | SIGN HOUR ':' MINUTE );
-
-// --------------------- DURATION ---------------------
-DURATION : DURATIONTOKEN SQUOTE DURATIONVALUE SQUOTE;
-fragment DURATIONTOKEN : D U R A T I O N;
-
-fragment DUDAYFRAG : DIGITS 'D';
-fragment DUHOURFRAG : DIGITS 'H';
-fragment DUMINUTEFRAG : DIGITS 'M';
-fragment DUSECONDFRAG : DIGITS ('.' DIGITS)? 'S';
-fragment DUTIMEFRAG : 'T' (
- ( DUHOURFRAG DUMINUTEFRAG? DUSECONDFRAG?)
- | (DUMINUTEFRAG DUSECONDFRAG?)
- | DUSECONDFRAG
- );
-fragment DUDAYTIMEFRAG : DUDAYFRAG DUTIMEFRAG? | DUTIMEFRAG;
-
-fragment DURATIONVALUE : '-'? 'P' DUDAYTIMEFRAG;
-
-// --------------------- TIMEOFDAY ---------------------
-TIMEOFDAY : TIMEOFDAYTO SQUOTE TIMEOFDAYVALUE SQUOTE;
-fragment TIMEOFDAYTO : T I M E O F D A Y;
-fragment TIMEOFDAYVALUE : HOUR ':' MINUTE ( ':' SECOND ( '.' FRACTIONALSECONDS )? )?;
-
-// --------------------- date helper ---------------------
-
-fragment ONEtoNINE : '1'..'9';
-
-fragment YEAR : ('-')? ( '0' DIGIT DIGIT DIGIT | ONEtoNINE DIGIT DIGIT DIGIT );
-
-fragment MONTH : '0' ONEtoNINE
- | '1' ( '0' | '1' | '2' )
- ;
-
-fragment DAY : '0' ONEtoNINE
- | ('1'|'2') DIGIT
- | '3' ('0'|'1')
- ;
-
-fragment HOUR : ('0' | '1') DIGIT
- | '2' ( '0'..'3')
- ;
-
-fragment MINUTE : ZEROtoFIFTYNINE;
-fragment SECOND : ZEROtoFIFTYNINE;
-fragment FRACTIONALSECONDS : DIGIT+;
-fragment ZEROtoFIFTYNINE : ('0'..'5') DIGIT;
-
-
-
-
-
-
-
-COLLECTION_CS_FIX : 'Collection';
-fragment LINESTRING_CS_FIX : 'LineString';
-fragment MULTILINESTRING_CS_FIX : 'MultiLineString';
-fragment MULTIPOINT_CS_FIX : 'MultiPoint';
-fragment MULTIPOLYGON_CS_FIX : 'MultiPolygon';
-fragment POINT_CS_FIX : 'Point';
-fragment POLYGON_CS_FIX : 'Polygon';
-
-COLLECTION_CS : ( COLLECTION_CS_FIX | C O L L E C T I O N );
-LINESTRING_CS : ( LINESTRING_CS_FIX | L I N E S T R I N G ) ;
-MULTILINESTRING_CS : ( MULTILINESTRING_CS_FIX | M U L T I L I N E S T R I N G);
-MULTIPOINT_CS : ( MULTIPOINT_CS_FIX | M U L T I P O I N T );
-MULTIPOLYGON_CS : ( MULTIPOLYGON_CS_FIX | M U L T I P O L Y G O N);
-POINT_CS : ( POINT_CS_FIX | P O I N T );
-POLYGON_CS : ( POLYGON_CS_FIX | P O L Y G O N );
-
-
-SRID_CS : S R I D;
-
-//fragment SQUOTE1 : ('\'' | '%27')-> mode(DEFAULT_MODE);
-
-
-
-GEOGRAPHYPREFIX : (GEOGRAPHY_CS_FIX | G E O G R A P H Y) SQUOTE { setInGeo(true); } ;
-GEOMETRYPREFIX : (GEOMETRY_CS_FIX | G E O M E T R Y) SQUOTE { setInGeo(true); } ;
-
-fragment GEOGRAPHY_CS_FIX : 'Geography';
-fragment GEOMETRY_CS_FIX : 'Geometry';
-//;------------------------------------------------------------------------------
-//; 9. Punctuation
-//;------------------------------------------------------------------------------
-
-fragment WS : ( SP | HTAB | '%20' | '%09' );
-WSP : WS+ { !inGeo() }?;
-
-// we can't not emit a single WS inside filter expression where left-recursion applies
-// commonExpr : INT
-// | commonExpr WS+ ('mul'|'div'|'mod') WS+ commonExpr
-// does not work... ^^^ ^^^ but:
-// commonExpr : INT
-// | commonExpr WSP ('mul'|'div'|'mod') WSP commonExpr
-// a single WS in only allowed/required in geometry
-
-
-WSG : WS { inGeo() }?;
-
-fragment AT_PURE : '@';
-AT : AT_PURE | '%40';
-COLON : ':' | '%3A';
-COMMA : ',' | '%2C';
-EQ : '=';
-SIGN : '+' | '%2B' |'-';
-SEMI : ';' | '%3B';
-STAR : '*';
-SQUOTE : '\'' | '%27';
-OPEN : '(' | '%28';
-CLOSE : ')' | '%29';
-
-
-//;------------------------------------------------------------------------------
-//; A. URI syntax [RFC3986]
-//;------------------------------------------------------------------------------
-
-QM : '?';
-
-fragment PCHAR : UNRESERVED | PCT_ENCODED | SUB_DELIMS | ':' | AT_PURE;
-
-fragment PCHARnoSQUOTE : UNRESERVED| PCTENCODEDnoSQUOTE | OTHER_DELIMS | '$' | '&' | EQ | ':' | AT_PURE;
-
-fragment PCT_ENCODED : '%' HEXDIG HEXDIG;
-fragment UNRESERVED : ALPHA | DIGIT | '-' |'.' | '_' | '~';
-fragment SUB_DELIMS : '$' | '&' | '\'' | EQ | OTHER_DELIMS;
-fragment OTHER_DELIMS : '!' | '(' | ')' | '*' | '+' | COMMA | ';';
-
-
-fragment PCTENCODEDnoSQUOTE : '%' ( '0'|'1'|'3'..'9' | AtoF ) HEXDIG
- | '%' '2' ( '0'..'6'|'8'|'9' | AtoF )
- ;
-
-fragment QCHAR_NO_AMP : UNRESERVED | PCT_ENCODED | OTHER_DELIMS | ':' | AT_PURE | '/' | '?' | '$' | '\'' | EQ;
-fragment QCHAR_NO_AMP_EQ : UNRESERVED | PCT_ENCODED | OTHER_DELIMS | ':' | AT_PURE | '/' | '?' | '$' | '\'';
-fragment QCHAR_NO_AMP_EQ_AT_DOLLAR : UNRESERVED | PCT_ENCODED | OTHER_DELIMS | ':' | '/' | '?' | '\'';
-
-fragment QCHAR_UNESCAPED : UNRESERVED | PCT_ENCODED_UNESCAPED | OTHER_DELIMS | ':' | AT_PURE | '/' | '?' | '$' | '\'' | EQ;
-fragment PCT_ENCODED_UNESCAPED : '%' ( '0' | '1' | '3' | '4' | '6' | '8' | '9' | 'A'..'F' ) HEXDIG
- | '%' '2' ( '0' | '1' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'A'..'F' )
- | '%' '5' ( DIGIT | 'A' | 'B' | 'D' | 'E' | 'F' );
-
-fragment QCHAR_NO_AMP_DQUOTE : QCHAR_UNESCAPED
- | ESCAPE ( ESCAPE | QUOTATION_MARK );
-
-//;------------------------------------------------------------------------------
-//; B. IRI syntax [RFC3987]
-//;------------------------------------------------------------------------------
-//; Note: these are over-generous stubs, for the actual patterns refer to RFC3987
-//;------------------------------------------------------------------------------
-
-//IRI_IN_HEADER : ( VCHAR | obs-text )+;
-
-//;------------------------------------------------------------------------------
-//; C. ABNF core definitions [RFC5234]
-//;------------------------------------------------------------------------------
-
-fragment ALPHA : 'a'..'z'|'A'..'Z';
-fragment HEXDIG : DIGIT | AtoF;
-fragment AtoF : 'a'..'f'|'A'..'F';
-
-//fragment VCHAR : '\u0021'..'\u007E';
-
-DIGIT : '0'..'9';
-DQUOTE : '\u0022';
-SP : ' ';//'\u0020'; // a simple space
-HTAB : '%09';
-
-//;------------------------------------------------------------------------------
-//; End of odata-abnf-construction-rules
-//;------------------------------------------------------------------------------
-
-
-//;------------------------------------------------------------------------------
-//; HELPER
-//;------------------------------------------------------------------------------
-
-fragment A : 'a'|'A';
-fragment B : 'b'|'B';
-fragment C : 'c'|'C';
-fragment D : 'd'|'D';
-fragment E : 'e'|'E';
-fragment F : 'f'|'F';
-fragment G : 'g'|'G';
-fragment H : 'h'|'H';
-fragment I : 'i'|'I';
-fragment L : 'l'|'L';
-fragment M : 'm'|'M';
-fragment N : 'n'|'N';
-fragment O : 'o'|'O';
-fragment P : 'p'|'P';
-fragment R : 'r'|'R';
-fragment S : 's'|'S';
-fragment T : 't'|'T';
-fragment U : 'u'|'U';
-fragment Y : 'y'|'Y';
-fragment Z : 'z'|'Z';
-
-
-/* D O N T C H A N G E T H E O R D E R O F T H I S*/
-/* D O N T C H A N G E T H E O R D E R O F T H I S*/
-/* D O N T C H A N G E T H E O R D E R O F T H I S*/
-STRING : SQUOTE (SQUOTEinSTRING | PCHARnoSQUOTE )* SQUOTE { !inGeo() }?;
-
-//conflict with ODATAIDENTIFIER, fixed with predicate
-SEARCHWORD : ALPHA+ { inSearch() }?; //; Actually: any character from the Unicode categories L or Nl,
- //; but not the words AND, OR, and NOT which are match far above
-
-//conflict with STRING_IN_JSON, fixed with predicate
-SEARCHPHRASE : QUOTATION_MARK QCHAR_NO_AMP_DQUOTE+ QUOTATION_MARK { inSearch() }?;
-
-ODATAIDENTIFIER : ODI_LEADINGCHARACTER (ODI_CHARACTER)*;
-
-//AT_ODATAIDENTIFIER : AT ODATAIDENTIFIER;
-
-STRING_IN_JSON : QUOTATION_MARK CHAR_IN_JSON* QUOTATION_MARK;
-/* D O N T C H A N G E T H E O R D E R O F T H I S*/
-/* D O N T C H A N G E T H E O R D E R O F T H I S*/
-/* D O N T C H A N G E T H E O R D E R O F T H I S*/
-
-
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/producer/core/uri/antlr/UriParser.g4
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/producer/core/uri/antlr/UriParser.g4 b/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/producer/core/uri/antlr/UriParser.g4
deleted file mode 100644
index cc2542a..0000000
--- a/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/producer/core/uri/antlr/UriParser.g4
+++ /dev/null
@@ -1,555 +0,0 @@
-/*******************************************************************************
- * 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
- *
- * 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.
- ******************************************************************************/
-
- grammar UriParser;
-
-
-//Antlr4 (as most parsers) has a lexer for token detection and a parser which defines
-//rules based on the tokens. However its hard to define a clear lexer on the
-//ODATA URI syntax due to some reasons:
-// - the syntax is based on the URI specification and there fore contains the definition
-// of delimiters and percent encoding
-// - the syntax includes JSON
-// - the syntax includes a expression syntax which comes from ODATA itself (e.g. $filter)
-// - the syntax includes searchstring and searchword
-// - the ABNF describing syntax is not defined in a context free manner
-// so there are several kinds of "String" tokens:
-// - strings with single quotes,
-// - strings with single quotes and a special syntax within the quotes (like geometry data)
-// - strings with double quotes
-// - strings without quotes ( usually identifiers, searchstrings, searchwords, custom parameters)
-// but each with different allowed charactersets
-// Drawing a simple line between lexer and parser is not possible.
-//
-// This grammer is a compromiss we have choosen to satisfy the requirements we have
-// - the grammer is context free
-// - this makes the parser much simpler and we have a clear saparation between parsing and
-// EDM validation, but also creates a parse tree which is not semantically correct from the
-// EDM perspective ( e.g.it will not pass the EDM validation)
-// - the grammer can not be applied on a full URI string
-// - the URI should be split according the URI specification before used as input for the
-// ODATA parser
-// - while creating the grammer the antlr lexer modes where only allowed in pure lexer grammers
-// not in combined grammers, and is was not possible to include lexer grammer with a mode into
-// a combined grammar without creating JAVA errors.
-
-// see https://github.com/antlr/antlr4/issues/160 "Support importing multi-mode lexer grammars"
-
-
-//Naming convention
-// ...
-//Decoding encoding
-//- within rule "resourcePath": special chars used in EDM.Strings must still be encoded when
-// used as tokenizer input
-// e.g. .../Employees(id='Hugo%2FMueller')/EmployeeName <-- SLASH must be encoded to '%2F' in "Hugo/Mueller"
-// but it must not be encoded before the EmployeeName
-
-
-
-options {
- language = Java;
- tokenVocab=UriLexer;
-}
-
-
-
-
-
-//;------------------------------------------------------------------------------
-//; 0. URI
-//;------------------------------------------------------------------------------
-
-//ABNF odataUri and serviceRoot are currently not used here
-//odataUri = serviceRoot [ odataRelativeUri ]
-//
-//serviceRoot = ( "https" / "http" ) ; Note: case-insensitive
-// "://" host [ ":" port ]
-// "/" *( segment-nz "/" )
-
-
-odataRelativeUriEOF : odataRelativeUri? EOF;
-
-//QM and FRAGMENT enable next lexer mode
-odataRelativeUri : BATCH # batchAlt //TODO alt at beginnig
- | ENTITY QM eo=entityOptions # entityAlt
- | METADATA ( QM format )? ( FRAGMENT contextFragment )? # metadataAlt
- | resourcePath ( QM queryOptions )? # resourcePathAlt
-
- ;
-
-//;------------------------------------------------------------------------------
-//; 1. Resource Path
-//;------------------------------------------------------------------------------
-
-resourcePath : ALL # allAlt
- | crossjoin # crossjoinAlt
- | pathSegments # pathSegmentsAlt
- ;
-crossjoin : CROSSJOIN OPEN odi+=odataIdentifier ( COMMA odi+=odataIdentifier )* CLOSE;
-
-pathSegments : ps+=pathSegment (SLASH ps+=pathSegment)* constSegment?;
-
-pathSegment : ns=namespace? odi=odataIdentifier nvl=nameValueOptList*;
-
-nameValueOptList : vo=valueOnly | nvl=nameValueList;
-valueOnly : OPEN (primitiveLiteral ) CLOSE;
-nameValueList : OPEN kvp+=nameValuePair ( COMMA kvp+=nameValuePair )* CLOSE;
-nameValuePair : odi=odataIdentifier EQ (AT ali=odataIdentifier | val1=primitiveLiteral /*| val2=enumX*/);
-
-constSegment : SLASH (v=value | c=count | r=ref );
-
-count : COUNT;
-ref : REF;
-value : VALUE;
-//;------------------------------------------------------------------------------
-//; 2. Query Options
-//;------------------------------------------------------------------------------
-
-queryOptions : qo+=queryOption ( AMP qo+=queryOption )*;
-
-queryOption : systemQueryOption
- | AT aliasAndValue
- | customQueryOption
- ;
-
-entityOptions : (eob+=entityOption AMP )* ID EQ REST ( AMP eoa+=entityOption )*;
-entityOption : ( expand | format | select )
- | customQueryOption
-
- ;
-
-
-
-systemQueryOption : expand
- | filter
- | format
- | id
- | inlinecount
- | orderby
- | search
- | select
- | skip
- | skiptoken
- | top
- ;
-
-id : ID EQ REST;
-skiptoken : SKIPTOKEN EQ REST;
-expand : EXPAND EQ expandItemList;
-
-expandItemList : expandItem ( COMMA expandItem )*;
-
-expandItem : STAR ( SLASH ref | OPEN (LEVELS EQ INT | LEVELSMAX) CLOSE )?
- | expandPath expandPathExtension?;
-
-expandPath : ( namespace? odataIdentifier ) ( SLASH namespace? odataIdentifier )*;
-expandPathExtension : SLASH ref ( OPEN expandRefOption ( SEMI expandRefOption )* CLOSE )?
- | SLASH count ( OPEN expandCountOption ( SEMI expandCountOption )* CLOSE )?
- | OPEN expandOption ( SEMI expandOption )* CLOSE
- ;
-expandCountOption : filterInline
- | searchInline
- ;
-expandRefOption : expandCountOption
- | orderbyInline
- | skipInline
- | top
- | inlinecount
- ;
-expandOption : expandRefOption
- | select
- | expand
- | LEVELS;
-
-filter : FILTER EQ commonExpr;
-filterInline : FILTER_INLINE EQ commonExpr;
-
-
-
-orderby : ORDERBY EQ orderbyItem ( COMMA orderbyItem )*;
-orderbyInline : ORDERBY_INLINE EQ orderbyItem ( COMMA orderbyItem )*;
-orderbyItem : commonExpr ( WSP ( ASC | DESC ) )?;
-
-//this is completly done in lexer grammer to avoid ambiguities with odataIdentifier and STRING
-skip : SKIP EQ INT;
-skipInline : SKIP_INLINE EQ INT;
-top : TOP EQ INT;
-format : FORMAT EQ ( ATOM | JSON | XML | PCHARS ( SLASH PCHARS)?);
-
-inlinecount : COUNT EQ booleanNonCase;
-
-search : SEARCH searchSpecialToken;
-searchInline : SEARCH_INLINE searchSpecialToken;
-
-searchSpecialToken : EQ WSP? searchExpr;
-
-searchExpr : (NOT WSP) searchExpr
- | searchExpr searchExpr
- | searchExpr WSP searchExpr
- | searchExpr ( WSP AND WSP) searchExpr
- | searchExpr ( WSP OR WSP) searchExpr
- | searchPhrase
- | searchWord
- ;
-
-searchPhrase : SEARCHPHRASE;
-searchWord : SEARCHWORD;
-
-select : SELECT EQ selectItem ( COMMA selectItem )*;
-selectItem : namespace? STAR
- | (namespace? odataIdentifier nameValueOptList? ) ( SLASH namespace? odataIdentifier nameValueOptList? )*
- ;
-
-aliasAndValue : odataIdentifier EQ parameterValue;
-parameterValue : //arrayOrObject
- commonExpr
- ;
-
-
-
-customQueryOption : customName ( EQ customValue)?
- ;
-customName : CUSTOMNAME;
-customValue : CUSTOMVALUE;
-
-
-
-//;------------------------------------------------------------------------------
-//; 3. Context URL Fragments
-//;------------------------------------------------------------------------------
-//ps+=pathSegment (SLASH ps+=pathSegment)*
-//PRIMITIVETYPENAME
-contextFragment : REF
- /*| PRIMITIVETYPENAME*/
- | COLLECTION_REF
- | COLLECTION_ENTITY_TYPE
- | COLLECTION_COMPLEX_TYPE
- | COLLECTION ( /*PRIMITIVETYPENAME |*/ namespace? odataIdentifier ) CLOSE
- | namespace? odataIdentifier
- ( SLASH ( DELETED_ENTITY | LINK | DELETED_LINK )
- | nameValueOptList? ( SLASH namespace? odataIdentifier)* ( propertyList )? ( SLASH DELTA) ? (SLASH ENTITY) ?
- )
- ;
-
-propertyList : OPEN propertyListItem ( COMMA propertyListItem )* CLOSE;
-propertyListItem : STAR //; all structural properties
- | propertyListProperty
- ;
-propertyListProperty : namespace? odataIdentifier ( SLASH namespace? odataIdentifier)* ( PLUS )? ( propertyList)?
- ;
-
-
-//;------------------------------------------------------------------------------
-//; 4. Expressions
-//;------------------------------------------------------------------------------
-
-// this expression part of the grammer is not similar to the ABNF because
-// we had to introduced operator precesence witch is not reflected in the ABNF
-
-test : test_expr EOF;
-test_expr : INT
- //| test_expr /*WSP*/ ( '!' | '*' ) /*WSP*/ test_expr;
- //| test_expr WSP ( '!' | '*' ) WSP test_expr;
- | test_expr ( WSP '!' WSP | WSP '*' WSP ) test_expr;
-
-commonExpr : OPEN commonExpr CLOSE #altPharenthesis
- | methodCallExpr #altMethod
- | ( unary WSP ) commonExpr #altUnary
- | memberExpr #altMember
- | commonExpr (WSP MUL WSP | WSP DIV WSP | WSP MOD WSP ) commonExpr #altMult
- | commonExpr (WSP ADD WSP | WSP SUB WSP) commonExpr #altAdd
- | commonExpr (WSP GT WSP | WSP GE WSP | WSP LT WSP | WSP LE WSP | WSP ISOF WSP) commonExpr #altComparisn
- | commonExpr (WSP EQ_ALPHA WSP | WSP NE WSP) commonExpr #altEquality
- | commonExpr (WSP AND WSP) commonExpr #altAnd
- | commonExpr (WSP OR WSP) commonExpr #altOr
- | rootExpr #altRoot //; $...
- | AT odataIdentifier #altAlias // @...
- | primitiveLiteral #altLiteral // ...
- ;
-
-unary : (MINUS| NOT) ;
-
-rootExpr : ROOT pathSegments;
-
-memberExpr : '$it' | '$it/'? pathSegments;
-
-anyExpr : 'any' OPEN WSP /* [ lambdaVariableExpr BWS COLON BWS lambdaPredicateExpr ] WS* */ CLOSE;
-allExpr : 'all' OPEN WSP /* lambdaVariableExpr BWS COLON BWS lambdaPredicateExpr WS* */ CLOSE;
-
-methodCallExpr : indexOfMethodCallExpr
- | toLowerMethodCallExpr
- | toUpperMethodCallExpr
- | trimMethodCallExpr
- | substringMethodCallExpr
- | concatMethodCallExpr
- | lengthMethodCallExpr
- | yearMethodCallExpr
- | monthMethodCallExpr
- | dayMethodCallExpr
- | hourMethodCallExpr
- | minuteMethodCallExpr
- | secondMethodCallExpr
- | fractionalsecondsMethodCallExpr
- | totalsecondsMethodCallExpr
- | dateMethodCallExpr
- | timeMethodCallExpr
- | roundMethodCallExpr
- | floorMethodCallExpr
- | ceilingMethodCallExpr
- | distanceMethodCallExpr
- | geoLengthMethodCallExpr
- | totalOffsetMinutesMethodCallExpr
- | minDateTimeMethodCallExpr
- | maxDateTimeMethodCallExpr
- | nowMethodCallExpr
- //from boolean
- | isofExpr
- | castExpr
- | endsWithMethodCallExpr
- | startsWithMethodCallExpr
- | containsMethodCallExpr
- | intersectsMethodCallExpr
- ;
-
-
-containsMethodCallExpr : CONTAINS_WORD WSP? commonExpr WSP? COMMA WSP? commonExpr WSP? CLOSE;
-startsWithMethodCallExpr : STARTSWITH_WORD WSP? commonExpr WSP? COMMA WSP? commonExpr WSP? CLOSE;
-endsWithMethodCallExpr : ENDSWITH_WORD WSP? commonExpr WSP? COMMA WSP? commonExpr WSP? CLOSE;
-lengthMethodCallExpr : LENGTH_WORD WSP? commonExpr WSP? CLOSE;
-indexOfMethodCallExpr : INDEXOF_WORD WSP? commonExpr WSP? COMMA WSP? commonExpr WSP? CLOSE;
-substringMethodCallExpr : SUBSTRING_WORD WSP? commonExpr WSP? COMMA WSP? commonExpr WSP? ( COMMA WSP? commonExpr WSP? )? CLOSE;
-toLowerMethodCallExpr : TOLOWER_WORD WSP? commonExpr WSP? CLOSE;
-toUpperMethodCallExpr : TOUPPER_WORD WSP? commonExpr WSP? CLOSE;
-trimMethodCallExpr : TRIM_WORD WSP? commonExpr WSP? CLOSE;
-concatMethodCallExpr : CONCAT_WORD WSP? commonExpr WSP? COMMA WSP? commonExpr WSP? CLOSE;
-
-yearMethodCallExpr : YEAR_WORD WSP? commonExpr WSP? CLOSE;
-monthMethodCallExpr : MONTH_WORD WSP? commonExpr WSP? CLOSE;
-dayMethodCallExpr : DAY_WORD WSP? commonExpr WSP? CLOSE;
-hourMethodCallExpr : HOUR_WORD WSP? commonExpr WSP? CLOSE;
-minuteMethodCallExpr : MINUTE_WORD WSP? commonExpr WSP? CLOSE;
-secondMethodCallExpr : SECOND_WORD WSP? commonExpr WSP? CLOSE;
-fractionalsecondsMethodCallExpr : FRACTIONALSECONDS_WORD WSP? commonExpr WSP? CLOSE;
-totalsecondsMethodCallExpr : TOTALSECONDS_WORD WSP? commonExpr WSP? CLOSE;
-dateMethodCallExpr : DATE_WORD WSP? commonExpr WSP? CLOSE;
-timeMethodCallExpr : TIME_WORD WSP? commonExpr WSP? CLOSE;
-totalOffsetMinutesMethodCallExpr : TOTALOFFSETMINUTES_WORD WSP? commonExpr WSP? CLOSE;
-
-minDateTimeMethodCallExpr : MINDATETIME_WORD WSP? CLOSE;
-maxDateTimeMethodCallExpr : MAXDATETIME_WORD WSP? CLOSE;
-nowMethodCallExpr : NOW_WORD WSP? CLOSE;
-
-roundMethodCallExpr : ROUND_WORD WSP? commonExpr WSP? CLOSE;
-floorMethodCallExpr : FLOOR_WORD WSP? commonExpr WSP? CLOSE;
-ceilingMethodCallExpr : CEILING_WORD WSP? commonExpr WSP? CLOSE;
-
-distanceMethodCallExpr : GEO_DISTANCE_WORD WSP? commonExpr WSP? COMMA WSP? commonExpr WSP? CLOSE;
-geoLengthMethodCallExpr : GEO_LENGTH_WORD WSP? commonExpr WSP? CLOSE;
-intersectsMethodCallExpr : GEO_INTERSECTS_WORD WSP? commonExpr WSP? COMMA WSP? commonExpr WSP? CLOSE;
-
-isofExpr : ISOF_WORD WSP? ( commonExpr WSP? COMMA WSP? )? qualifiedtypename WSP? CLOSE;
-castExpr : CAST_WORD WSP? ( commonExpr WSP? COMMA WSP? )? qualifiedtypename WSP? CLOSE;
-
-//;------------------------------------------------------------------------------
-//; 5. JSON format for function parameters
-//;------------------------------------------------------------------------------
-//; Note: the query part of a URI needs to be partially percent-decoded before
-//; applying these rules, see comment at the top of this file
-//;------------------------------------------------------------------------------
-/*
-arrayOrObject : complexColInUri
- | complexInUri
- | rootExprCol
- | primitiveColInUri;
-
-complexColInUri : BEGIN_ARRAY
- ( complexInUri ( WS* COMMA WS* complexInUri )* )?
- END_ARRAY;
-
-complexInUri : BEGIN_OBJECT ( jv+=json_value ( WS* COMMA WS* jv+=json_value)* )? END_OBJECT;
-
-json_value : annotationInUri
- | primitivePropertyInUri
- | complexPropertyInUri
- | collectionPropertyInUri
- | navigationPropertyInUri
- ;
-
-collectionPropertyInUri : QUOTATION_MARK odataIdentifier QUOTATION_MARK
- NAME_SEPARATOR
- ( primitiveColInUri | complexColInUri )
- ;
-
-primitiveColInUri : BEGIN_ARRAY ( plj+=primitive1LiteralInJSON *( WS* COMMA WS* plj+=primitive1LiteralInJSON ) )? END_ARRAY
- ;
-
-complexPropertyInUri : QUOTATION_MARK odataIdentifier QUOTATION_MARK
- NAME_SEPARATOR
- complexInUri
- ;
-
-annotationInUri : QUOTATION_MARK ns=namespace? odi=odataIdentifier QUOTATION_MARK
- NAME_SEPARATOR
- ( complexInUri | complexColInUri | primitive1LiteralInJSON | primitiveColInUri );
-
-primitivePropertyInUri : QUOTATION_MARK odataIdentifier QUOTATION_MARK
- NAME_SEPARATOR
- primitive1LiteralInJSON;
-
-
-navigationPropertyInUri : QUOTATION_MARK odataIdentifier QUOTATION_MARK
- NAME_SEPARATOR ( rootExpr | rootExprCol )
- ;
-
-rootExprCol : BEGIN_ARRAY
- ( rootExpr *( WS* COMMA WS* rootExpr ) )?
- END_ARRAY
- ;
-
-//; JSON syntax: adapted to URI restrictions from [RFC4627]
-primitive1LiteralInJSON : STRING_IN_JSON
- | number_in_json
- | TRUE
- | FALSE
- | 'null'
- ;
-
-number_in_json : INT | DECIMAL;
-*/
-//;------------------------------------------------------------------------------
-//; 6. Names and identifiers
-//;------------------------------------------------------------------------------
-
-qualifiedtypename : namespace odataIdentifier
- | 'collection' OPEN ( namespace odataIdentifier ) CLOSE
- ;
-
-namespace : (odataIdentifier POINT)+;
-
-odataIdentifier : ODATAIDENTIFIER;
-
-//;------------------------------------------------------------------------------
-//; 7. Literal Data Values
-//;------------------------------------------------------------------------------
-
-
-/*TODO add missing values*/
-primitiveLiteral : nullrule
- | booleanNonCase
- | DECIMAL //includes double and single literals
- | INT //includes int16/int32 and int64 literals
- | BINARY
- | DATE
- | DATETIMEOFFSET
- | DURATION
- | GUID
- | string
- | TIMEOFDAY
- | geographyCollection
- | geographyLineString
- | geographyMultilineString
- | geographyMultipoint
- | geographyMultipolygon
- | geographyPoint
- | geographyPolygon
- | geometryCollection
- | geometryLineString
- | geometryMultilineString
- | geometryMultipoint
- | geometryMultipolygon
- | geometryPoint
- | geometryPolygon
- | enumX
- ;
-
-
-nullrule : NULLVALUE;// (SQUOTE qualifiedtypename SQUOTE)?;
-booleanNonCase : BOOLEAN | TRUE | FALSE;
-string : STRING;
-
-
-enumX : namespace odataIdentifier STRING /*SQUOTE enumValue SQUOTE*/;
-enumValue : singleEnumValue *( COMMA singleEnumValue );
-singleEnumValue : odataIdentifier / INT;
-
-
-geographyCollection : GEOGRAPHY fullCollectionLiteral SQUOTE;
-fullCollectionLiteral : sridLiteral collectionLiteral;
-
-collectionLiteral : (COLLECTION ) OPEN geoLiteral ( COMMA geoLiteral )* CLOSE;
-
-geoLiteral : collectionLiteral
- | lineStringLiteral
- | multipointLiteral
- | multilineStringLiteral
- | multipolygonLiteral
- | pointLiteral
- | polygonLiteral;
-
-geographyLineString : GEOGRAPHY fullLineStringLiteral SQUOTE;
-fullLineStringLiteral : sridLiteral lineStringLiteral;
-lineStringLiteral : LINESTRING lineStringData;
-lineStringData : OPEN positionLiteral ( COMMA positionLiteral )* CLOSE;
-
-geographyMultilineString : GEOGRAPHY fullMultilineStringLiteral SQUOTE;
-fullMultilineStringLiteral : sridLiteral multilineStringLiteral;
-multilineStringLiteral : MULTILINESTRING OPEN ( lineStringData ( COMMA lineStringData )* )? CLOSE;
-
-geographyMultipoint : GEOGRAPHY fullMultipointLiteral SQUOTE;
-fullMultipointLiteral : sridLiteral multipointLiteral;
-multipointLiteral : MULTIPOINT OPEN ( pointData ( COMMA pointData )* )? CLOSE ;
-
-geographyMultipolygon : GEOGRAPHY fullmultipolygonLiteral SQUOTE;
-fullmultipolygonLiteral : sridLiteral multipolygonLiteral;
-multipolygonLiteral : MULTIPOLYGON OPEN ( polygonData ( COMMA polygonData )* )? CLOSE;
-
-geographyPoint : GEOGRAPHY fullpointLiteral SQUOTE;
-fullpointLiteral : sridLiteral pointLiteral;
-
-pointLiteral : GEO_POINT pointData;
-pointData : OPEN positionLiteral CLOSE;
-
-positionLiteral : (DECIMAL | INT ) WSP (DECIMAL | INT ); //; longitude, then latitude
-
-
-geographyPolygon : GEOGRAPHY fullPolygonLiteral SQUOTE;
-fullPolygonLiteral : sridLiteral polygonLiteral;
-polygonLiteral : POLYGON polygonData;
-polygonData : OPEN ringLiteral ( COMMA ringLiteral )* CLOSE;
-ringLiteral : OPEN positionLiteral ( COMMA positionLiteral )* CLOSE;
-
-
-geometryCollection : GEOMETRY fullCollectionLiteral SQUOTE;
-geometryLineString : GEOMETRY fullLineStringLiteral SQUOTE;
-geometryMultilineString : GEOMETRY fullMultilineStringLiteral SQUOTE;
-geometryMultipoint : GEOMETRY fullMultipointLiteral SQUOTE;
-geometryMultipolygon : GEOMETRY fullmultipolygonLiteral SQUOTE;
-geometryPoint : GEOMETRY fullpointLiteral SQUOTE;
-geometryPolygon : GEOMETRY fullPolygonLiteral SQUOTE;
-
-sridLiteral : SRID EQ INT SEMI;
-
-
-
-
-
-/*
-mode MODEd333gh;
-
-MO12E1 : 'ASD' -> mode(DEFAULT_MODE);*/
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ErrorHandler.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ErrorHandler.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ErrorHandler.java
index 7f9761c..1bb1f37 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ErrorHandler.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ErrorHandler.java
@@ -25,7 +25,7 @@ import org.antlr.v4.runtime.BaseErrorListener;
import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.Recognizer;
-import org.apache.olingo.producer.core.uri.antlr.UriLexer;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriLexer;
public class ErrorHandler<T> extends BaseErrorListener {
@Override
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/KeyPredicateImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/KeyPredicateImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/KeyPredicateImpl.java
deleted file mode 100644
index bbc301f..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/KeyPredicateImpl.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * 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
- *
- * 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.
- ******************************************************************************/
-package org.apache.olingo.odata4.producer.core.uri;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
-import org.apache.olingo.odata4.producer.api.uri.KeyPredicate;
-
-/**
- *
- */
-public class KeyPredicateImpl implements KeyPredicate {
-
- public KeyPredicateImpl(final String literal, final EdmProperty property) {
- super();
- this.literal = literal;
- this.property = property;
- }
-
- private String literal;
- private EdmProperty property;
-
- @Override
- public String getLiteral() {
- return literal;
- }
-
- public void setValue(final String value) {
- literal = value;
- }
-
- @Override
- public EdmProperty getProperty() {
- return property;
- }
-
- public void setProperty(final EdmProperty property) {
- this.property = property;
- }
-
- @Override
- public String toString() {
- return "KeyPredicate: literal=" + literal + ", propertyName=" + property;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ParserAdapter.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ParserAdapter.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ParserAdapter.java
new file mode 100644
index 0000000..30c7440
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/ParserAdapter.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * 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
+ *
+ * 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.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.uri;
+
+import org.antlr.v4.runtime.ANTLRInputStream;
+import org.antlr.v4.runtime.BailErrorStrategy;
+import org.antlr.v4.runtime.CommonTokenStream;
+import org.antlr.v4.runtime.DefaultErrorStrategy;
+import org.antlr.v4.runtime.atn.PredictionMode;
+import org.antlr.v4.runtime.misc.ParseCancellationException;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriLexer;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.OdataRelativeUriEOFContext;
+
+public class ParserAdapter {
+ static public OdataRelativeUriEOFContext parseInput(final String input) throws UriParserException {
+ UriParserParser parser = null;
+ UriLexer lexer = null;
+ OdataRelativeUriEOFContext ret = null;
+
+ // Use 2 stage approach to improve performance
+ // see https://github.com/antlr/antlr4/issues/192
+
+ // stage= 1
+ try {
+ // create parser
+ lexer = new UriLexer(new ANTLRInputStream(input));
+ parser = new UriParserParser(new CommonTokenStream(lexer));
+
+ // Bail out of parser at first syntax error. --> proceeds in catch block with step 2
+ parser.setErrorHandler(new BailErrorStrategy());
+
+ // User the faster LL parsing
+ parser.getInterpreter().setPredictionMode(PredictionMode.SLL);
+ ret = parser.odataRelativeUriEOF();
+
+ } catch (ParseCancellationException hardException) {
+
+ try {
+ // create parser
+ lexer = new UriLexer(new ANTLRInputStream(input));
+ parser = new UriParserParser(new CommonTokenStream(lexer));
+
+
+ // Used default error strategy
+ parser.setErrorHandler(new DefaultErrorStrategy());
+
+ // User the slower SLL parsing
+ parser.getInterpreter().setPredictionMode(PredictionMode.LL);
+
+ ret = parser.odataRelativeUriEOF();
+
+ } catch (Exception weakException) {
+ throw new UriParserException("Error in Parser", weakException);
+
+ // exceptionOnStage = 2;
+ }
+ } catch (Exception hardException) {
+ throw new UriParserException("Error in Parser", hardException);
+ }
+
+ return ret;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImpl.java
index 8a4fe52..a6c28d3 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImpl.java
@@ -18,51 +18,19 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.core.uri;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.odata4.producer.api.uri.UriInfo;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoBatch;
import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
-import org.apache.olingo.odata4.producer.api.uri.UriPathInfo;
-public class UriInfoImpl implements UriInfo, UriInfoBatch {
- private UriInfoKind kind;
- private List<UriPathInfo> uriPathInfos = new ArrayList<UriPathInfo>();
+public class UriInfoImpl {
- @Override
- public UriInfoKind getKind() {
- return kind;
- }
+ private UriInfoKind kind;
public UriInfoImpl setKind(final UriInfoKind kind) {
this.kind = kind;
return this;
}
- public void addUriPathInfo(final UriPathInfo uriPathInfo) {
- uriPathInfos.add(uriPathInfo);
+ public Object getKind() {
+ return kind;
}
- /*
- * private Edm edm = null;
- * private List<UriPathInfoImpl> pathInfos = new ArrayList<UriPathInfoImpl>();
- *
- * public Edm getEdm() {
- * return edm;
- * }
- *
- * public void addUriPathInfo(final UriPathInfoImpl uriPathInfoImpl) {
- * pathInfos.add(uriPathInfoImpl);
- * }
- *
- * public UriPathInfoImpl getLastUriPathInfo() {
- * if (!pathInfos.isEmpty()) {
- * return pathInfos.get(pathInfos.size() - 1);
- * } else {
- * return null;
- * }
- * }
- */
-
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplAll.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplAll.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplAll.java
new file mode 100644
index 0000000..fa88bec
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplAll.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * 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
+ *
+ * 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.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.uri;
+
+import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
+
+
+public class UriInfoImplAll extends UriInfoImpl {
+ public UriInfoImplAll() {
+ this.setKind(UriInfoKind.all);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplBatch.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplBatch.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplBatch.java
new file mode 100644
index 0000000..ae42556
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplBatch.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * 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
+ *
+ * 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.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.uri;
+
+import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
+
+public class UriInfoImplBatch extends UriInfoImpl {
+ public UriInfoImplBatch() {
+ this.setKind(UriInfoKind.batch);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplCrossjoin.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplCrossjoin.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplCrossjoin.java
new file mode 100644
index 0000000..2c283cb
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplCrossjoin.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * 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
+ *
+ * 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.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.uri;
+
+import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
+
+public class UriInfoImplCrossjoin extends UriInfoImpl {
+ public UriInfoImplCrossjoin() {
+ this.setKind(UriInfoKind.crossjoin);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplEntity.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplEntity.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplEntity.java
new file mode 100644
index 0000000..8d89d47
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplEntity.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * 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
+ *
+ * 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.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.uri;
+
+import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
+
+public class UriInfoImplEntity extends UriInfoImpl {
+ public UriInfoImplEntity() {
+ this.setKind(UriInfoKind.entity);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplMetadata.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplMetadata.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplMetadata.java
new file mode 100644
index 0000000..b29f706
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplMetadata.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * 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
+ *
+ * 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.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.uri;
+
+import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
+
+public class UriInfoImplMetadata extends UriInfoImpl {
+ public UriInfoImplMetadata() {
+ this.setKind(UriInfoKind.metadata);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplPath.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplPath.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplPath.java
new file mode 100644
index 0000000..9a66876
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplPath.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * 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
+ *
+ * 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.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.uri;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
+
+public class UriInfoImplPath extends UriInfoImpl {
+
+ List<UriPathInfoImpl> pathInfos = new ArrayList<UriPathInfoImpl>();
+
+ public UriInfoImplPath() {
+ this.setKind(UriInfoKind.path);
+ }
+
+ public UriInfoImpl addPathInfo(UriPathInfoImpl pathInfo) {
+ pathInfos.add(pathInfo);
+ return this;
+ }
+
+ public UriPathInfoImpl getLastUriPathInfo() {
+ if (pathInfos.size() > 0) {
+ return pathInfos.get(pathInfos.size() - 1);
+ }
+ return null;
+ }
+
+ public UriPathInfoImpl getUriPathInfo(int index) {
+ return pathInfos.get(index);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriKeyPredicateList.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriKeyPredicateList.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriKeyPredicateList.java
new file mode 100644
index 0000000..940b96a
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriKeyPredicateList.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * 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
+ *
+ * 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.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.uri;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class UriKeyPredicateList {
+
+ private List<String> names = new ArrayList<String>();
+ private List<String> values = new ArrayList<String>();
+
+ public UriKeyPredicateList add(String name, String value) {
+ names.add(name);
+ values.add(value);
+ return this;
+ }
+
+ public List<String> getNames() {
+ return names;
+ }
+
+ public String getName(int index) {
+ return names.get(index);
+
+ }
+
+ public Object getValue(int index) {
+ return values.get(index);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParameterlist.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParameterlist.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParameterlist.java
new file mode 100644
index 0000000..edab1de
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParameterlist.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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
+ *
+ * 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.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.uri;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class UriParameterlist {
+
+ private List<String> names = new ArrayList<String>();
+ private List<String> values = new ArrayList<String>();
+ private List<String> aliases = new ArrayList<String>();
+
+ public UriParameterlist add(String name, String value, String alias) {
+ names.add(name);
+ values.add(value);
+ aliases.add(alias);
+ return this;
+
+ }
+
+ public List<String> getNames() {
+
+ return names;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserException.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserException.java
new file mode 100644
index 0000000..8997ce3
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserException.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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
+ *
+ * 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.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.uri;
+
+//TODO Check name of this exception when implementing proper error handling
+public class UriParserException extends Exception {
+
+ public UriParserException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -1813203179082217112L;
+
+}
[4/9] [OLINGO-63] Uri Parser: adoptions in lexer and parser,
create UriParserImpl to convert the parsetree into internal
structures, moved parser antlr part from .../olingo/producer/... to
.../olingo/odata4/producer
Posted by ko...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestParser.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestParser.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestParser.java
new file mode 100644
index 0000000..0a6e0df
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestParser.java
@@ -0,0 +1,1450 @@
+/*******************************************************************************
+ * 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
+ *
+ * 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.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.uri.antlr;
+
+import org.apache.olingo.odata4.producer.core.testutil.ParserValidator;
+import org.junit.Test;
+
+/**
+ * The class {@link TestParser} contains regression tests which work directly on the
+ * output of the parser (which is generated by ANTLR). These tests should only test the
+ * parser and must NOT require any EDM in order to ensure that the parser can run in a
+ * context free manner.
+ * The single test cases are written according the ABNF (not the parser) since we
+ * want if the parser works as defined in the ABNF.
+ *
+ * Ideally these test detect any (wrong) change on the grammar files
+ */
+public class TestParser {
+ private ParserValidator test = null;
+
+ public TestParser() {
+ test = new ParserValidator();
+ }
+
+ @Test
+ public void test() {
+ test.log(2).aAM().aFC().aCS().run("ODI?$filter=(1) mul 2").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr("
+ + "commonExpr(( commonExpr(primitiveLiteral(1)) )) "
+ + "mul "
+ + "commonExpr(primitiveLiteral(2)))))))) <EOF>)");
+
+ // test.log(2).run("ESTwoKeyTwoPrim(PropertyInt16=1,PropertyString='ABC')");
+ /*
+ * test.log(2).run("ODI?$filter=geo.distance("+
+ * "geometry'SRID=0;Point(142.1 64.1)',geometry'SRID=0;Point(142.1 64.1)')")
+ * .isText("odataRelativeUriEOF(odataRelativeUri("
+ * + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ * + "queryOption(systemQueryOption("
+ * + "filter($filter = commonExpr(methodCallExpr("
+ * + "distanceMethodCallExpr("
+ * + "geo.distance( "
+ * + "commonExpr(primitiveLiteral(geometryPoint(geometry' fullpointLiteral(sridLiteral(SRID = 0 ;) "
+ * + "pointLiteral(Point pointData(( positionLiteral(142.1 64.1) )))) '))) , "
+ * + "commonExpr(primitiveLiteral(geometryPoint(geometry' fullpointLiteral(sridLiteral(SRID = 0 ;) "
+ * + "pointLiteral(Point pointData(( positionLiteral(142.1 64.1) )))) '))) ))))))))) <EOF>)");
+ */
+ }
+
+ // ;------------------------------------------------------------------------------
+ // ; 0. URI
+ // ;------------------------------------------------------------------------------
+ @Test
+ public void testUri() {
+ // Test parser rule odataRelativeUri
+ test.run("$batch").isText("odataRelativeUriEOF(odataRelativeUri($batch) <EOF>)");
+
+ // TODO do more tests on entity
+ test.run("$entity?$id=ODI").isText("odataRelativeUriEOF(odataRelativeUri($entity ? "
+ + "entityOptions($id = ODI)) <EOF>)");
+
+ test.run("$entity?$select=*&$id=ODI").isText("odataRelativeUriEOF(odataRelativeUri($entity ? "
+ + "entityOptions(entityOption("
+ + "select($select = selectItem(*))) & "
+ + "$id = ODI)) <EOF>)");
+ test.run("$entity?$id=ODI&$select=*").isText("odataRelativeUriEOF(odataRelativeUri($entity ? "
+ + "entityOptions("
+ + "$id = ODI & entityOption("
+ + "select($select = selectItem(*))))) <EOF>)");
+ test.run("$entity?$select=*&$id=ODI&$format=json").isText("odataRelativeUriEOF(odataRelativeUri($entity ? "
+ + "entityOptions(entityOption(select("
+ + "$select = selectItem(*))) & "
+ + "$id = ODI & entityOption(format("
+ + "$format = json)))) <EOF>)");
+
+ // TODO do more tests on entity
+ test.run("$metadata").isText("odataRelativeUriEOF(odataRelativeUri($metadata) <EOF>)");
+
+ test.run("ODI").isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment(odataIdentifier(ODI))))) <EOF>)");
+
+ // Test parser rule resourcePath
+ test.run("$all").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath($all)) <EOF>)");
+
+ test.run("$crossjoin(ODI)").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath("
+ + "crossjoin($crossjoin ( odataIdentifier(ODI) )))) <EOF>)");
+
+ // Test parser rule pathSegments
+ test.run("ODI/ODI").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
+ + "pathSegment(odataIdentifier(ODI)) / "
+ + "pathSegment(odataIdentifier(ODI))))) <EOF>)");
+ test.run("NS.ODI/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
+ + "pathSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
+ + "pathSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))) <EOF>)");
+ test.run("NS.ODI/ODI/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
+ + "pathSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
+ + "pathSegment(odataIdentifier(ODI)) / "
+ + "pathSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))) <EOF>)");
+ // Test parser rule constSegment
+ test.run("ODI/$value").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
+ + "pathSegment(odataIdentifier(ODI)) "
+ + "constSegment(/ value($value))))) <EOF>)");
+ test.run("ODI/$count").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
+ + "pathSegment(odataIdentifier(ODI)) "
+ + "constSegment(/ count($count))))) <EOF>)");
+ test.run("ODI/$ref").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
+ + "pathSegment(odataIdentifier(ODI)) "
+ + "constSegment(/ ref($ref))))) <EOF>)");
+
+ // Test parser rule pathSegment
+ test.run("NS.ODI")
+ .isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))) <EOF>)");
+ test.run("ODI(1)")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI) nameValueOptList(( valueOnly(primitiveLiteral(1)) )))))) <EOF>)");
+
+ test.run("ODI('ABC')")
+ .isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI) nameValueOptList(( valueOnly(primitiveLiteral(string('ABC'))) )))))) <EOF>)");
+
+ test.run("ODI(K1=1)")
+ .isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI) "
+ + "nameValueOptList(( nameValueList(nameValuePair(odataIdentifier(K1) = "
+ + "primitiveLiteral(1))) )))))) <EOF>)");
+
+ test.run("ODI(K1='ABC')")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI) "
+ + "nameValueOptList(( nameValueList(nameValuePair(odataIdentifier(K1) = "
+ + "primitiveLiteral(string('ABC')))) )))))) <EOF>)");
+
+ test.run("ODI(K1='ABC',K2=123)")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI) nameValueOptList(( nameValueList("
+ + "nameValuePair(odataIdentifier(K1) = primitiveLiteral(string('ABC'))) , "
+ + "nameValuePair(odataIdentifier(K2) = primitiveLiteral(123))) )))))) <EOF>)");
+
+ test.run("ODI(K1=1)(P1=1)")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI) nameValueOptList(( nameValueList("
+ + "nameValuePair(odataIdentifier(K1) = primitiveLiteral(1))) )) nameValueOptList(( nameValueList("
+ + "nameValuePair(odataIdentifier(P1) = primitiveLiteral(1))) )))))) <EOF>)");
+
+ test.run("ODI(K1='ABC',K2=123)(P1='ABC',P2=123)")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI) nameValueOptList(( nameValueList("
+ + "nameValuePair(odataIdentifier(K1) = primitiveLiteral(string('ABC'))) , "
+ + "nameValuePair(odataIdentifier(K2) = primitiveLiteral(123))) )) nameValueOptList(( nameValueList("
+ + "nameValuePair(odataIdentifier(P1) = primitiveLiteral(string('ABC'))) , "
+ + "nameValuePair(odataIdentifier(P2) = primitiveLiteral(123))) )))))) <EOF>)");
+
+ test.run("NS.ODI(K1='ABC',K2=123)(P1='ABC',P2=123)")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "namespace(odataIdentifier(NS) .) "
+ + "odataIdentifier(ODI) nameValueOptList(( nameValueList("
+ + "nameValuePair(odataIdentifier(K1) = primitiveLiteral(string('ABC'))) , "
+ + "nameValuePair(odataIdentifier(K2) = primitiveLiteral(123))) )) "
+ + "nameValueOptList(( nameValueList("
+ + "nameValuePair(odataIdentifier(P1) = primitiveLiteral(string('ABC'))) , "
+ + "nameValuePair(odataIdentifier(P2) = primitiveLiteral(123))) )))))) <EOF>)");
+
+ test.run("ODI(K1=@ABC)").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath("
+ + "pathSegments(pathSegment(odataIdentifier(ODI) nameValueOptList(( nameValueList("
+ + "nameValuePair(odataIdentifier(K1) = @ odataIdentifier(ABC))) )))))) <EOF>)");
+
+ test.run("ODI(K1=1,K2=@ABC)").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath("
+ + "pathSegments(pathSegment(odataIdentifier(ODI) nameValueOptList(( nameValueList("
+ + "nameValuePair(odataIdentifier(K1) = primitiveLiteral(1)) , "
+ + "nameValuePair(odataIdentifier(K2) = @ odataIdentifier(ABC))) )))))) <EOF>)");
+
+ }
+
+ // TODO error testing
+ @Test
+ public void testUriError() {
+ // test.run("$entity").isExType(InputMismatchException.class);
+ // test.run("$entity").isText("");
+ }
+
+ // ;------------------------------------------------------------------------------
+ // ; 2. Query Options
+ // ;------------------------------------------------------------------------------
+
+ @Test
+ public void testQueryOptions() {
+
+ // Test parser rule expand
+ test.run("ODI?$expand=*").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "expand($expand = expandItemList(expandItem(*))))))) <EOF>)");
+
+ test.run("ODI?$expand=*,*,*").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "expand($expand = expandItemList("
+ + "expandItem(*) , "
+ + "expandItem(*) , "
+ + "expandItem(*))))))) <EOF>)");
+
+ test.run("ODI?$expand=*/$ref").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "expand($expand = expandItemList("
+ + "expandItem(* / ref($ref)))))))) <EOF>)");
+
+ test.run("ODI?$expand=*/$ref,*,*/$ref").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "expand($expand = expandItemList(expandItem(* / ref($ref)) , "
+ + "expandItem(*) , "
+ + "expandItem(* / ref($ref)))))))) <EOF>)");
+
+ // Test parser rules expand -> levels
+ test.run("ODI?$expand=*($levels=12)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "expand($expand = expandItemList("
+ + "expandItem(* ( $levels = 12 )))))))) <EOF>)");
+ test.run("ODI?$expand=*($levels=max)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "expand($expand = expandItemList("
+ + "expandItem(* ( $levels=max )))))))) <EOF>)");
+
+ // Test parser rules expand -> expandPath
+ test.run("ODI?$expand=ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "expand($expand = expandItemList(expandItem("
+ + "expandPath(odataIdentifier(ODI))))))))) <EOF>)");
+
+ test.run("ODI?$expand=NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "expand($expand = expandItemList(expandItem("
+ + "expandPath(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))))))) <EOF>)");
+
+ test.run("ODI?$expand=ODI/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "expand($expand = expandItemList(expandItem("
+ + "expandPath("
+ + "odataIdentifier(ODI) / "
+ + "namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))))))) <EOF>)");
+
+ test.run("ODI?$expand=ODI/NS.ODI/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "expand($expand = expandItemList(expandItem("
+ + "expandPath("
+ + "odataIdentifier(ODI) / "
+ + "namespace(odataIdentifier(NS) .) odataIdentifier(ODI) / "
+ + "odataIdentifier(ODI))))))))) <EOF>)");
+
+ test.run("ODI?$expand=ODI/$ref").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "expand($expand = expandItemList("
+ + "expandItem(expandPath(odataIdentifier(ODI)) expandPathExtension(/ ref($ref))))))))) <EOF>)");
+
+ // Test options for expand items
+ test.run("ODI?$expand=ODI/$ref($skip=1)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "expand($expand = expandItemList("
+ + "expandItem(expandPath(odataIdentifier(ODI)) "
+ + "expandPathExtension(/ ref($ref) ( expandRefOption(skipInline($skip = 1)) ))))))))) <EOF>)");
+
+ test.run("ODI?$expand=ODI/$count").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "expand($expand = expandItemList("
+ + "expandItem(expandPath(odataIdentifier(ODI)) "
+ + "expandPathExtension(/ count($count))))))))) <EOF>)");
+
+ test.run("ODI?$expand=ODI/$count($filter=1)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "expand($expand = expandItemList("
+ + "expandItem(expandPath(odataIdentifier(ODI)) expandPathExtension(/ count($count) ( "
+ + "expandCountOption("
+ + "filterInline($filter = commonExpr(primitiveLiteral(1)))) ))))))))) <EOF>)");
+
+ test.run("ODI?$expand=ODI/$count($search=\"abc\")").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "expand($expand = expandItemList("
+ + "expandItem(expandPath(odataIdentifier(ODI)) expandPathExtension(/ count($count) ( "
+ + "expandCountOption("
+ + "searchInline($search searchSpecialToken(= searchExpr(searchPhrase(\"abc\"))))) ))))))))) <EOF>)");
+
+ test.run("ODI?$expand=ODI/$ref($skip=1;$filter=true)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "expand($expand = expandItemList("
+ + "expandItem(expandPath(odataIdentifier(ODI)) expandPathExtension(/ ref($ref) ( "
+ + "expandRefOption(skipInline($skip = 1)) ; "
+ + "expandRefOption(expandCountOption("
+ + "filterInline($filter = commonExpr(primitiveLiteral(booleanNonCase(true)))))) ))))))))) <EOF>)");
+
+ test.run("ODI?$expand=ODI($skip=1;$filter=true)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "expand($expand = expandItemList("
+ + "expandItem(expandPath(odataIdentifier(ODI)) expandPathExtension(( "
+ + "expandOption(expandRefOption(skipInline($skip = 1))) ; "
+ + "expandOption(expandRefOption(expandCountOption("
+ + "filterInline($filter = commonExpr(primitiveLiteral(booleanNonCase(true))))))) ))))))))) <EOF>)");
+
+ // Test parser rule filter ( more filter test in method testExpressions)
+ test.run("ODI?$filter=true")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = commonExpr("
+ + "primitiveLiteral(booleanNonCase(true)))))))) <EOF>)");
+
+ // Test parser rule format
+ test.run("ODI?$format=atom").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(format($format = atom))))) <EOF>)");
+
+ test.run("ODI?$format=json").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(format($format = json))))) <EOF>)");
+
+ test.run("ODI?$format=xml").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(format($format = xml))))) <EOF>)");
+
+ // Test parser rule id
+ test.run("ODI?$id=abc").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(id($id = abc))))) <EOF>)");
+
+ // Test parser rule count
+ /*
+ * TODO add count to new mode based lexer
+ * test.lexerlog(1).run("ODI?$count=true").isText("odataRelativeUriEOF(odataRelativeUri("
+ * + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ * + "systemQueryOption("
+ * + "inlinecount($count = booleanNonCase(true)))))) <EOF>)");
+ */
+ test.run("ODI?$count=false").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption("
+ + "inlinecount($count = booleanNonCase(false)))))) <EOF>)");
+
+ test.run("ODI?$count=TrUe").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption("
+ + "inlinecount($count = booleanNonCase(TrUe)))))) <EOF>)");
+
+ // Test parser rule orderby
+ test.run("ODI?$orderby=ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(orderby($orderby = "
+ + "orderbyItem(commonExpr("
+ + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))))))))) <EOF>)");
+
+ test.run("ODI?$orderby=ODI asc").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(orderby($orderby = "
+ + "orderbyItem(commonExpr("
+ + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))) asc)))))) <EOF>)");
+
+ test.run("ODI?$orderby=ODI desc").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(orderby($orderby = "
+ + "orderbyItem(commonExpr("
+ + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))) desc)))))) <EOF>)");
+
+ test.run("ODI?$orderby=ODI desc,ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(orderby($orderby = "
+ + "orderbyItem(commonExpr("
+ + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))) desc) , "
+ + "orderbyItem(commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))))))))) <EOF>)");
+
+ test.run("ODI?$orderby=ODI desc,ODI asc").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(orderby($orderby = "
+ + "orderbyItem(commonExpr("
+ + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))) desc) , "
+ + "orderbyItem(commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))) asc)))))) <EOF>)");
+
+ test.aFC().aAM().aCS().run("ODI?$orderby=3 add 4,ODI asc").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "orderby($orderby = "
+ + "orderbyItem(commonExpr(commonExpr(primitiveLiteral(3)) add commonExpr(primitiveLiteral(4)))) , "
+ + "orderbyItem(commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))) asc)))))) <EOF>)");
+
+ // Test parser rule skiptoken
+ test.run("ODI?$skiptoken=abc").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
+ + "pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption(skiptoken($skiptoken = abc))))) <EOF>)");
+
+ // Test parser rule search
+ test.run("ODI?$search=abc").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption(search("
+ + "$search searchSpecialToken(= searchExpr(searchWord(abc)))))))) <EOF>)");
+
+ test.run("ODI?$search=NOT abc").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption(search("
+ + "$search searchSpecialToken(= searchExpr(NOT searchExpr(searchWord(abc))))))))) <EOF>)");
+
+ test.aAM().aFC().aCS().run("ODI?$search=abc abc").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption(search("
+ + "$search searchSpecialToken(= searchExpr(searchExpr(searchWord(abc)) s"
+ + "earchExpr(searchWord(abc))))))))) <EOF>)");
+
+ test.aAM().aFC().aCS().run("ODI?$search=abc AND abc").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption(search("
+ + "$search searchSpecialToken(= searchExpr(searchExpr(searchWord(abc)) AND "
+ + "searchExpr(searchWord(abc))))))))) <EOF>)");
+
+ test.aAM().aFC().aCS().run("ODI?$search=abc OR abc").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption(search($search searchSpecialToken(= searchExpr(searchExpr(searchWord(abc)) OR "
+ + "searchExpr(searchWord(abc))))))))) <EOF>)");
+
+ test.run("ODI?$search=\"a%20b%20c\"").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(search("
+ + "$search searchSpecialToken(= searchExpr(searchPhrase(\"a%20b%20c\")))))))) <EOF>)");
+
+ // Test parser rule search
+ test.run("ODI?$select=*").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption(select("
+ + "$select = selectItem(*)))))) <EOF>)");
+
+ test.run("ODI?$select=ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption(select("
+ + "$select = selectItem(odataIdentifier(ODI))))))) <EOF>)");
+
+ test.run("ODI?$select=NS.*").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption(select("
+ + "$select = selectItem(namespace(odataIdentifier(NS) .) *)))))) <EOF>)");
+
+ test.run("ODI?$select=NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption(select("
+ + "$select = selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))))) <EOF>)");
+
+ test.run("ODI?$select=NS.ODI/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption(select("
+ + "$select = selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) "
+ + "/ odataIdentifier(ODI))))))) <EOF>)");
+
+ test.run("ODI?$select=NS.ODI/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption(select("
+ + "$select = selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) "
+ + "/ namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))))) <EOF>)");
+
+ test.run("ODI?$select=ODI,ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption(select($select = selectItem(odataIdentifier(ODI)) , "
+ + "selectItem(odataIdentifier(ODI))))))) <EOF>)");
+
+ test.run("ODI?$select=NS.ODI,NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption(select($select = selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) , "
+ + "selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))))) <EOF>)");
+
+ test.run("ODI?$select=NS.ODI/ODIm,NS.ODI/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption(select($select = selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) "
+ + "/ odataIdentifier(ODIm)) , selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) "
+ + "/ odataIdentifier(ODI))))))) <EOF>)");
+
+ test.run("ODI?$select=NS.ODI/NS.ODI,NS.ODI/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption(select($select = selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) "
+ + "/ namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) , "
+ + "selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) "
+ + "/ namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))))) <EOF>)");
+
+ test.run("ODI?$skip=123").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(skip($skip = 123))))) <EOF>)");
+
+ test.run("ODI?$skiptoken=abc").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(skiptoken($skiptoken = abc))))) <EOF>)");
+
+ test.run("ODI?$top=123").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(top($top = 123))))) <EOF>)");
+
+ // test.run("ODI?customparameter=abc");
+
+ // test.run("ODI").isText("");
+ };
+
+ @Test
+ public void testExpressions() {
+ // Test parser rule commonExpr -> primitiveLiteral
+ test.run("ODI?$filter=null").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? "
+ + "queryOptions(queryOption(systemQueryOption(filter($filter = commonExpr("
+ + "primitiveLiteral(nullrule(null)))))))) <EOF>)");
+
+ test.run("ODI?$filter=true").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = commonExpr("
+ + "primitiveLiteral(booleanNonCase(true)))))))) <EOF>)");
+
+ test.run("ODI?$filter=false").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = commonExpr("
+ + "primitiveLiteral(booleanNonCase(false)))))))) <EOF>)");
+
+ test.run("ODI?$filter=1").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = commonExpr("
+ + "primitiveLiteral(1))))))) <EOF>)");
+
+ test.run("ODI?$filter=-1").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = commonExpr("
+ + "primitiveLiteral(-1))))))) <EOF>)");
+
+ test.run("ODI?$filter=1.1").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = commonExpr("
+ + "primitiveLiteral(1.1))))))) <EOF>)");
+
+ test.run("ODI?$filter=-1.2").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = commonExpr("
+ + "primitiveLiteral(-1.2))))))) <EOF>)");
+
+ test.run("ODI?$filter=-1.2e3").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = commonExpr("
+ + "primitiveLiteral(-1.2e3))))))) <EOF>)");
+
+ test.run("ODI?$filter=-1.2e-3").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = commonExpr("
+ + "primitiveLiteral(-1.2e-3))))))) <EOF>)");
+
+ test.run("ODI?$filter=binary'12AB'").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = commonExpr("
+ + "primitiveLiteral(binary'12AB'))))))) <EOF>)");
+
+ test.run("ODI?$filter=BiNaRy'12AB'").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = commonExpr("
+ + "primitiveLiteral(BiNaRy'12AB'))))))) <EOF>)");
+
+ test.run("ODI?$filter=2013-11-15").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = commonExpr("
+ + "primitiveLiteral(2013-11-15))))))) <EOF>)");
+
+ test.run("ODI?$filter=2013-11-15T13:35Z").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = commonExpr("
+ + "primitiveLiteral(2013-11-15T13:35Z))))))) <EOF>)");
+
+ test.run("ODI?$filter=duration'PT67S'").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = commonExpr("
+ + "primitiveLiteral(duration'PT67S'))))))) <EOF>)");
+
+ test.run("ODI?$filter=1234ABCD-12AB-23CD-45EF-123456780ABC").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = commonExpr("
+ + "primitiveLiteral(1234ABCD-12AB-23CD-45EF-123456780ABC))))))) <EOF>)");
+
+ test.run("ODI?$filter='ABC'").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = commonExpr("
+ + "primitiveLiteral(string('ABC')))))))) <EOF>)");
+
+ test.run("ODI?$filter=20:00").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = commonExpr("
+ + "primitiveLiteral(20:00))))))) <EOF>)");
+
+ // Test enum
+ test.run("ODI?$filter=NS.ODI'1'").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = commonExpr("
+ + "primitiveLiteral(enumX(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) '1')))))))) <EOF>)");
+ test.run("ODI?$filter=NS.ODI'1,3'").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = commonExpr("
+ + "primitiveLiteral(enumX(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) '1,3')))))))) <EOF>)");
+ test.run("ODI?$filter=NS.ODI'ODI,3'").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = commonExpr("
+ + "primitiveLiteral(enumX(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) 'ODI,3')))))))) <EOF>)");
+
+ // Test Geometry
+
+ // Rule GeographyCollection
+
+ test.run("ODI?$filter=geography'SRID=0;Collection(LineString(142.1 64.1,3.14 2.78))'")
+ .isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(primitiveLiteral(geographyCollection("
+ + "geography' fullCollectionLiteral(sridLiteral(SRID = 0 ;) collectionLiteral("
+ + "Collection ( geoLiteral(lineStringLiteral("
+ + "LineString lineStringData(( "
+ + "positionLiteral(142.1 64.1) , "
+ + "positionLiteral(3.14 2.78) )))) ))) ')))))))) <EOF>)");
+
+ // Rule GeographyLineString
+ test.run("ODI?$filter=geography'SRID=0;LineString(142.1 64.1,3.14 2.78)'")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(primitiveLiteral(geographyLineString("
+ + "geography' fullLineStringLiteral(sridLiteral(SRID = 0 ;) lineStringLiteral("
+ + "LineString lineStringData(( positionLiteral(142.1 64.1) , positionLiteral(3.14 2.78) )))) '"
+ + ")))))))) <EOF>)");
+
+ // Rule GeographyMultiLineString
+ test.run("ODI?$filter=geography'SRID=0;MultiLineString((142.1 64.1,3.14 2.78),(142.1 64.1,3.14 2.78))'")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(primitiveLiteral(geographyMultilineString("
+ + "geography' fullMultilineStringLiteral(sridLiteral(SRID = 0 ;) multilineStringLiteral("
+ + "MultiLineString ( "
+ + "lineStringData(( positionLiteral(142.1 64.1) , positionLiteral(3.14 2.78) )) , "
+ + "lineStringData(( positionLiteral(142.1 64.1) , positionLiteral(3.14 2.78) )) ))) '"
+ + ")))))))) <EOF>)");
+
+ // Rule GeographyMultiPoint
+ test.run("ODI?$filter=geography'SRID=0;MultiPoint()'")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(primitiveLiteral(geographyMultipoint("
+ + "geography' fullMultipointLiteral(sridLiteral(SRID = 0 ;) multipointLiteral("
+ + "MultiPoint ( ))) ')))))))) <EOF>)");
+ // Rule GeographyMultiPoint
+ test.run("ODI?$filter=geography'SRID=0;MultiPoint((142.1 64.1),(1 2))'")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(primitiveLiteral(geographyMultipoint("
+ + "geography' fullMultipointLiteral(sridLiteral(SRID = 0 ;) multipointLiteral("
+ + "MultiPoint ( "
+ + "pointData(( positionLiteral(142.1 64.1) )) , "
+ + "pointData(( positionLiteral(1 2) )) ))) ')))))))) <EOF>)");
+ // Rule GeographyMultiPolygon
+ test.run("ODI?$filter=geography'SRID=0;MultiPolygon(((1 1,1 1),(1 1,2 2,3 3,1 1)))'")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(primitiveLiteral(geographyMultipolygon("
+ + "geography' fullmultipolygonLiteral(sridLiteral(SRID = 0 ;) multipolygonLiteral("
+ + "MultiPolygon ( polygonData(( "
+ + "ringLiteral(( positionLiteral(1 1) , positionLiteral(1 1) )) , "
+ + "ringLiteral(( positionLiteral(1 1) , positionLiteral(2 2) , "
+ + "positionLiteral(3 3) , positionLiteral(1 1) )) )) ))) ')))))))) <EOF>)");
+ // Rule GeographyPoint
+ test.run("ODI?$filter=geography'SRID=0;Point(142.1 64.1)'")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(primitiveLiteral(geographyPoint("
+ + "geography' fullpointLiteral(sridLiteral(SRID = 0 ;) pointLiteral("
+ + "Point pointData(( positionLiteral(142.1 64.1) )))) ')))))))) <EOF>)");
+ // Rule GeographyPolygon
+ test.run("ODI?$filter=geography'SRID=0;Polygon((1 1,1 1),(1 1,2 2,3 3,1 1))'")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(primitiveLiteral(geographyPolygon("
+ + "geography' fullPolygonLiteral(sridLiteral(SRID = 0 ;) polygonLiteral("
+ + "Polygon polygonData(( "
+ + "ringLiteral(( positionLiteral(1 1) , positionLiteral(1 1) )) , "
+ + "ringLiteral(( positionLiteral(1 1) , positionLiteral(2 2) , "
+ + "positionLiteral(3 3) , positionLiteral(1 1) )) )))) ')))))))) <EOF>)");
+ // Rule GeometryCollection
+ test.run("ODI?$filter=geometry'SRID=0;Collection(LineString(142.1 64.1,3.14 2.78))'")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(primitiveLiteral(geometryCollection("
+ + "geometry' fullCollectionLiteral(sridLiteral(SRID = 0 ;) collectionLiteral("
+ + "Collection ( geoLiteral(lineStringLiteral(LineString lineStringData(( "
+ + "positionLiteral(142.1 64.1) , "
+ + "positionLiteral(3.14 2.78) )))) ))) ')))))))) <EOF>)");
+ // Rule GeometryLineString
+ test.run("ODI?$filter=geometry'SRID=0;LineString(142.1 64.1,3.14 2.78)'")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(primitiveLiteral(geometryLineString("
+ + "geometry' fullLineStringLiteral(sridLiteral(SRID = 0 ;) lineStringLiteral("
+ + "LineString lineStringData(( positionLiteral(142.1 64.1) , positionLiteral(3.14 2.78) )))) '"
+ + ")))))))) <EOF>)");
+ // Rule GeometryMultiLineString
+ test.run("ODI?$filter=geometry'SRID=0;MultiLineString((142.1 64.1,3.14 2.78),(142.1 64.1,3.14 2.78))'")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(primitiveLiteral(geometryMultilineString("
+ + "geometry' fullMultilineStringLiteral(sridLiteral(SRID = 0 ;) multilineStringLiteral("
+ + "MultiLineString ( "
+ + "lineStringData(( positionLiteral(142.1 64.1) , positionLiteral(3.14 2.78) )) , "
+ + "lineStringData(( positionLiteral(142.1 64.1) , positionLiteral(3.14 2.78) )) ))) '"
+ + ")))))))) <EOF>)");
+ // Rule GeometryMultiPoint
+ test.run("ODI?$filter=geometry'SRID=0;MultiPoint()'")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(primitiveLiteral(geometryMultipoint("
+ + "geometry' fullMultipointLiteral(sridLiteral(SRID = 0 ;) multipointLiteral(MultiPoint ( ))) '"
+ + ")))))))) <EOF>)");
+ // Rule GeometryMultiPoint
+ test.run("ODI?$filter=geometry'SRID=0;MultiPoint((142.1 64.1),(1 2))'")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(primitiveLiteral(geometryMultipoint("
+ + "geometry' fullMultipointLiteral(sridLiteral(SRID = 0 ;) "
+ + "multipointLiteral(MultiPoint ( "
+ + "pointData(( positionLiteral(142.1 64.1) )) , "
+ + "pointData(( positionLiteral(1 2) )) ))) ')))))))) <EOF>)");
+ // Rule GeometryMultiPolygon
+ test.run("ODI?$filter=geometry'SRID=0;MultiPolygon(((1 1,1 1),(1 1,2 2,3 3,1 1)))'")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(primitiveLiteral(geometryMultipolygon("
+ + "geometry' fullmultipolygonLiteral(sridLiteral(SRID = 0 ;) "
+ + "multipolygonLiteral(MultiPolygon ( polygonData(( "
+ + "ringLiteral(( positionLiteral(1 1) , positionLiteral(1 1) )) , "
+ + "ringLiteral(( positionLiteral(1 1) , positionLiteral(2 2) , "
+ + "positionLiteral(3 3) , positionLiteral(1 1) )) )) ))) ')))))))) <EOF>)");
+ // Rule GeometryPoint
+ test.run("ODI?$filter=geometry'SRID=0;Point(142.1 64.1)'")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(primitiveLiteral(geometryPoint("
+ + "geometry' fullpointLiteral(sridLiteral(SRID = 0 ;) pointLiteral("
+ + "Point pointData(( positionLiteral(142.1 64.1) )))) ')))))))) <EOF>)");
+ // Rule GeometryPolygon
+ test.run("ODI?$filter=geometry'SRID=0;Polygon((1 1,1 1),(1 1,2 2,3 3,1 1))'")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(primitiveLiteral(geometryPolygon("
+ + "geometry' fullPolygonLiteral(sridLiteral(SRID = 0 ;) polygonLiteral("
+ + "Polygon polygonData(( "
+ + "ringLiteral(( positionLiteral(1 1) , positionLiteral(1 1) )) , "
+ + "ringLiteral(( positionLiteral(1 1) , positionLiteral(2 2) , "
+ + "positionLiteral(3 3) , positionLiteral(1 1) )) )))) ')))))))) <EOF>)");
+
+ // Parsing expression required in some cases a FullContextParsing and a report of a ContextSensitivity is fine
+
+ // Test commonExpr - parenthesis
+ test.aAM().aFC().aCS().run("ODI?$filter=(1) mul 2").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr("
+ + "commonExpr(( commonExpr(primitiveLiteral(1)) )) "
+ + "mul "
+ + "commonExpr(primitiveLiteral(2)))))))) <EOF>)");
+
+ test.aAM().aFC().aCS().run("ODI?$filter=((((1)))) mul 2").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(commonExpr(( commonExpr(( commonExpr(( commonExpr(( commonExpr("
+ + "primitiveLiteral(1)) )) )) )) )) "
+ + "mul commonExpr(primitiveLiteral(2)))))))) <EOF>)");
+ test.aAM().aFC().aCS().run("ODI?$filter=(1 add 2)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = commonExpr(( commonExpr(commonExpr(primitiveLiteral(1)) "
+ + "add commonExpr(primitiveLiteral(2))) ))))))) <EOF>)");
+ test.aAM().aFC().aCS().run("ODI?$filter=1 mul (2 add 3)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
+ + "mul commonExpr(( commonExpr(commonExpr(primitiveLiteral(2)) "
+ + "add commonExpr(primitiveLiteral(3))) )))))))) <EOF>)");
+
+ // Test commonExpr - methodCallExpr
+ test.run("ODI?$filter=indexof('ABCXYZ','CXY')").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "indexOfMethodCallExpr(indexof( "
+ + "commonExpr(primitiveLiteral(string('ABCXYZ'))) , "
+ + "commonExpr(primitiveLiteral(string('CXY'))) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=tolower('ABC')").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "toLowerMethodCallExpr(tolower( "
+ + "commonExpr(primitiveLiteral(string('ABC'))) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=toupper('ABC')").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "toUpperMethodCallExpr(toupper( "
+ + "commonExpr(primitiveLiteral(string('ABC'))) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=trim('%20%20%20ABC%20%20%20')").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "trimMethodCallExpr(trim( "
+ + "commonExpr(primitiveLiteral(string('%20%20%20ABC%20%20%20'))) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=substring('ABC',1)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "substringMethodCallExpr(substring( "
+ + "commonExpr(primitiveLiteral(string('ABC'))) , "
+ + "commonExpr(primitiveLiteral(1)) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=substring('ABC',1,2)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "substringMethodCallExpr(substring( "
+ + "commonExpr(primitiveLiteral(string('ABC'))) , "
+ + "commonExpr(primitiveLiteral(1)) , "
+ + "commonExpr(primitiveLiteral(2)) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=concat('ABC','XYZ')").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "concatMethodCallExpr(concat( "
+ + "commonExpr(primitiveLiteral(string('ABC'))) , "
+ + "commonExpr(primitiveLiteral(string('XYZ'))) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=length('ABC')").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "lengthMethodCallExpr(length( commonExpr(primitiveLiteral(string('ABC'))) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=year(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "yearMethodCallExpr(year( "
+ + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=month(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "monthMethodCallExpr(month( "
+ + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=day(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "dayMethodCallExpr(day( "
+ + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=hour(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "hourMethodCallExpr(hour( "
+ + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=minute(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "minuteMethodCallExpr(minute( "
+ + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=second(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "secondMethodCallExpr(second( "
+ + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=fractionalseconds(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "fractionalsecondsMethodCallExpr(fractionalseconds( "
+ + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=totalseconds(duration'PT67S')").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "totalsecondsMethodCallExpr(totalseconds( commonExpr(primitiveLiteral(duration'PT67S')) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=date(2013-11-15T13:35Z)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "dateMethodCallExpr(date( commonExpr(primitiveLiteral(2013-11-15T13:35Z)) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=time(2013-11-15T13:35Z)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "timeMethodCallExpr(time( commonExpr(primitiveLiteral(2013-11-15T13:35Z)) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=round(12.34)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "roundMethodCallExpr(round( commonExpr(primitiveLiteral(12.34)) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=floor(12.34)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "floorMethodCallExpr(floor( commonExpr(primitiveLiteral(12.34)) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=ceiling(12.34)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "ceilingMethodCallExpr(ceiling( commonExpr(primitiveLiteral(12.34)) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=geo.distance(geometry'SRID=0;Point(142.1 64.1)',geometry'SRID=0;Point(142.1 64.1)')")
+ .isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "distanceMethodCallExpr("
+ + "geo.distance( "
+ + "commonExpr(primitiveLiteral(geometryPoint(geometry' fullpointLiteral(sridLiteral(SRID = 0 ;) "
+ + "pointLiteral(Point pointData(( positionLiteral(142.1 64.1) )))) '))) , "
+ + "commonExpr(primitiveLiteral(geometryPoint(geometry' fullpointLiteral(sridLiteral(SRID = 0 ;) "
+ + "pointLiteral(Point pointData(( positionLiteral(142.1 64.1) )))) '))) ))))))))) <EOF>)");
+
+ // TODO check this
+ /*
+ * test.run("ODI?$filter=geo.length(geometry'SRID=0;LineString(142.1 64.1,3.14 2.78)')")
+ * .isText("odataRelativeUriEOF(odataRelativeUri("
+ * + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ * + "queryOption(systemQueryOption(filter($filter = commonExpr(methodCallExpr("
+ * + "geoLengthMethodCallExpr(geo.length ( commonExpr(primitiveLiteral("
+ * + "geometryLineString(geometry' fullLineStringLiteral(sridLiteral(SRID = 0 ;) lineStringLiteral("
+ * + "LineString lineStringData(( positionLiteral(142.1 64.1) , "
+ * + "positionLiteral(3.14 2.78) )))) '))) ))))))))) <EOF>)");
+ */
+ test.run("ODI?$filter=totaloffsetminutes(2013-11-15T13:35Z)")
+ .isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = commonExpr(methodCallExpr("
+ + "totalOffsetMinutesMethodCallExpr(totaloffsetminutes( commonExpr("
+ + "primitiveLiteral(2013-11-15T13:35Z)) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=mindatetime()").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr(minDateTimeMethodCallExpr(mindatetime( ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=maxdatetime()").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr(maxDateTimeMethodCallExpr(maxdatetime( ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=now()").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr(nowMethodCallExpr(now( ))))))))) <EOF>)");
+
+ // from boolean
+ test.run("ODI?$filter=isof(Model.Employee)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr(isofExpr("
+ + "isof( qualifiedtypename("
+ + "namespace(odataIdentifier(Model) .) "
+ + "odataIdentifier(Employee)) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=isof(ODI,Model.Employee)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "isofExpr(isof( commonExpr("
+ + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))) , "
+ + "qualifiedtypename(namespace(odataIdentifier(Model) .) odataIdentifier(Employee)) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=cast(Model.Employee)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "castExpr(cast( "
+ + "qualifiedtypename(namespace(odataIdentifier(Model) .) "
+ + "odataIdentifier(Employee)) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=cast(ODI,Model.Employee)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "castExpr(cast( commonExpr("
+ + "memberExpr(pathSegments(pathSegment("
+ + "odataIdentifier(ODI))))) , "
+ + "qualifiedtypename(namespace(odataIdentifier(Model) .) "
+ + "odataIdentifier(Employee)) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=endswith('ABCXYZ','YZ')").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "endsWithMethodCallExpr(endswith( "
+ + "commonExpr(primitiveLiteral(string('ABCXYZ'))) , "
+ + "commonExpr(primitiveLiteral(string('YZ'))) ))))))))) <EOF>)");
+
+ test.run("ODI?$filter=startswith('ABCXYZ','YZ')").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "startsWithMethodCallExpr(startswith( "
+ + "commonExpr(primitiveLiteral(string('ABCXYZ'))) , "
+ + "commonExpr(primitiveLiteral(string('YZ'))) ))))))))) <EOF>)");
+ test.run("ODI?$filter=contains('ABCXYZ','YZ')").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(methodCallExpr("
+ + "containsMethodCallExpr(contains( "
+ + "commonExpr(primitiveLiteral(string('ABCXYZ'))) , "
+ + "commonExpr(primitiveLiteral(string('YZ'))) ))))))))) <EOF>)");
+ /*
+ * test.run("ODI?$filter=geo.intersects("
+ * + "geometry'SRID=0;Point(142.1 64.1)',"
+ * + "geometry'SRID=0;Polygon((1 1,1 1),(1 1,2 2,3 3,1 1))')").isText("odataRelativeUriEOF(odataRelativeUri("
+ * + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ * + "queryOption(systemQueryOption("
+ * + "filter($filter = commonExpr(methodCallExpr("
+ * + "intersectsMethodCallExpr(geo.intersects ( "
+ * + "commonExpr(primitiveLiteral("
+ * + "geometryPoint(geometry' fullpointLiteral(sridLiteral(SRID = 0 ;) "
+ * + "pointLiteral(Point pointData(( positionLiteral(142.1 64.1) )))) '))) , "
+ * + "commonExpr(primitiveLiteral("
+ * + "geometryPolygon(geometry' fullPolygonLiteral(sridLiteral(SRID = 0 ;) "
+ * + "polygonLiteral(Polygon polygonData(( "
+ * + "ringLiteral(( positionLiteral(1 1) , positionLiteral(1 1) )) , "
+ * + "ringLiteral(( positionLiteral(1 1) , positionLiteral(2 2) , "
+ * + "positionLiteral(3 3) , positionLiteral(1 1) )) )))) '))) ))))))))) <EOF>)");
+ */
+ // Test commonExpr - unary
+ test.run("ODI?$filter=true").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = commonExpr("
+ + "primitiveLiteral(booleanNonCase(true)))))))) <EOF>)");
+
+ // Test commonExpr - member
+ test.run("ODI?$filter=ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr("
+ + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI)))))))))) <EOF>)");
+
+ // Test commonExpr - mathematical
+ test.aAM().aFC().aCS().run("ODI?$filter=1 mul 2").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
+ + "mul commonExpr(primitiveLiteral(2)))))))) <EOF>)");
+
+ test.aAM().aFC().aCS().run("ODI?$filter=1 div 2").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
+ + "div commonExpr(primitiveLiteral(2)))))))) <EOF>)");
+
+ test.aAM().aFC().aCS().run("ODI?$filter=1 mod 2").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
+ + "mod commonExpr(primitiveLiteral(2)))))))) <EOF>)");
+
+ test.aAM().aFC().aCS().run("ODI?$filter=1 add 2").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
+ + "add commonExpr(primitiveLiteral(2)))))))) <EOF>)");
+
+ test.aAM().aFC().aCS().run("ODI?$filter=1 sub 2").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
+ + "sub commonExpr(primitiveLiteral(2)))))))) <EOF>)");
+
+ test.aAM().aFC().aCS().run("ODI?$filter=1 gt 2").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
+ + "gt commonExpr(primitiveLiteral(2)))))))) <EOF>)");
+
+ test.aAM().aFC().aCS().run("ODI?$filter=1 ge 2").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
+ + "ge commonExpr(primitiveLiteral(2)))))))) <EOF>)");
+
+ test.aAM().aFC().aCS().run("ODI?$filter=1 lt 2").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
+ + "lt commonExpr(primitiveLiteral(2)))))))) <EOF>)");
+
+ test.aAM().aFC().aCS().run("ODI?$filter=1 le 2").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
+ + "le commonExpr(primitiveLiteral(2)))))))) <EOF>)");
+
+ test.aAM().aFC().aCS().run("ODI?$filter=ODI isof Model.Employee").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))) "
+ + "isof commonExpr(memberExpr("
+ + "pathSegments(pathSegment("
+ + "namespace(odataIdentifier(Model) .) "
+ + "odataIdentifier(Employee))))))))))) <EOF>)");
+
+ test.aAM().aFC().aCS().run("ODI?$filter=true and false").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(commonExpr(primitiveLiteral(booleanNonCase(true))) "
+ + "and commonExpr(primitiveLiteral(booleanNonCase(false))))))))) <EOF>)");
+
+ test.aAM().aFC().aCS().run("ODI?$filter=true or false").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr(commonExpr(primitiveLiteral(booleanNonCase(true))) "
+ + "or commonExpr(primitiveLiteral(booleanNonCase(false))))))))) <EOF>)");
+
+ // Test commonExpr - $root
+ test.run("ODI?$filter=$root/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr("
+ + "rootExpr($root/ pathSegments(pathSegment(odataIdentifier(ODI)))))))))) <EOF>)");
+
+ // Test concatenated parenthesis
+ test.run("ODI?$filter=not true").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = commonExpr("
+ + "unary(not) commonExpr(primitiveLiteral(booleanNonCase(true))))))))) <EOF>)");
+ }
+
+ @Test
+ public void testFragment() {
+
+ test.run("$metadata#Collection($ref)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "$metadata # contextFragment(Collection($ref))) <EOF>)");
+
+ test.run("$metadata#Collection(Edm.EntityType)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "$metadata # contextFragment(Collection(Edm.EntityType))) <EOF>)");
+
+ test.run("$metadata#Collection(Edm.ComplexType)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "$metadata # contextFragment(Collection(Edm.ComplexType))) <EOF>)");
+
+ test.run("$metadata#singletonEntity").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "$metadata # contextFragment(odataIdentifier(singletonEntity))) <EOF>)");
+
+ test.run("$metadata#NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "$metadata # contextFragment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))) <EOF>)");
+
+ test.run("$metadata#Edm.Boolean").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "$metadata # contextFragment(namespace(odataIdentifier(Edm) .) odataIdentifier(Boolean))) <EOF>)");
+
+ test.run("$metadata#ODI/$deletedEntity").isText("odataRelativeUriEOF("
+ + "odataRelativeUri($metadata # contextFragment(odataIdentifier(ODI) / $deletedEntity)) <EOF>)");
+
+ test.run("$metadata#ODI/$link").isText("odataRelativeUriEOF("
+ + "odataRelativeUri($metadata # contextFragment(odataIdentifier(ODI) / $link)) <EOF>)");
+
+ test.run("$metadata#ODI/$deletedLink").isText("odataRelativeUriEOF("
+ + "odataRelativeUri($metadata # contextFragment(odataIdentifier(ODI) / $deletedLink)) <EOF>)");
+
+ test.run("$metadata#ODI(1)/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "$metadata # contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(primitiveLiteral(1)) )) / "
+ + "odataIdentifier(ODI))) <EOF>)");
+
+ test.run("$metadata#ODI(1)/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "$metadata # contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(primitiveLiteral(1)) )) / "
+ + "namespace(odataIdentifier(NS) .) odataIdentifier(ODI))) <EOF>)");
+
+ test.run("$metadata#ODI(1)/NS.ODI/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "$metadata # contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(primitiveLiteral(1)) )) / "
+ + "namespace(odataIdentifier(NS) .) odataIdentifier(ODI) / odataIdentifier(ODI))) <EOF>)");
+
+ test.run("$metadata#NS.ODI(*)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "$metadata # contextFragment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) "
+ + "propertyList(( propertyListItem(*) )))) <EOF>)");
+
+ test.run("$metadata#ODI(1)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "$metadata # contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(primitiveLiteral(1)) )))) "
+ + "<EOF>)");
+
+ test.run("$metadata#ODI(1)/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "$metadata # contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(primitiveLiteral(1)) )) / "
+ + "odataIdentifier(ODI))) <EOF>)");
+
+ test.run("$metadata#ODI(1)/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "$metadata # contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(primitiveLiteral(1)) )) / "
+ + "namespace(odataIdentifier(NS) .) odataIdentifier(ODI))) <EOF>)");
+
+ test.run("$metadata#ODI(1)/NS.ODI/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "$metadata # contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(primitiveLiteral(1)) )) / "
+ + "namespace(odataIdentifier(NS) .) odataIdentifier(ODI) / odataIdentifier(ODI))) <EOF>)");
+
+ test.run("$metadata#ODI(1)(*)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "$metadata # contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(primitiveLiteral(1)) )) "
+ + "propertyList(( propertyListItem(*) )))) <EOF>)");
+
+ test.run("$metadata#ODI(1)(PROP)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "$metadata # contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(primitiveLiteral(1)) )) "
+ + "propertyList(( propertyListItem(propertyListProperty(odataIdentifier(PROP))) )))) <EOF>)");
+ test.run("$metadata#ODI(1)(NAVPROP+)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "$metadata # contextFragment(odataIdentifier(ODI) "
+ + "nameValueOptList(( valueOnly(primitiveLiteral(1)) )) "
+ + "propertyList(( propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) +)) )))) <EOF>)");
+ test.run("$metadata#ODI(1)(NAVPROP+(*))").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "$metadata # contextFragment(odataIdentifier(ODI) "
+ + "nameValueOptList(( valueOnly(primitiveLiteral(1)) )) "
+ + "propertyList(( "
+ + "propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) + "
+ + "propertyList(( "
+ + "propertyListItem(*) )))) )))) <EOF>)");
+ test.run("$metadata#ODI(1)(NAVPROP+(A,B,C))").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "$metadata # contextFragment(odataIdentifier(ODI) "
+ + "nameValueOptList(( valueOnly(primitiveLiteral(1)) )) "
+ + "propertyList(( "
+ + "propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) + "
+ + "propertyList(( "
+ + "propertyListItem(propertyListProperty(odataIdentifier(A))) , "
+ + "propertyListItem(propertyListProperty(odataIdentifier(B))) , "
+ + "propertyListItem(propertyListProperty(odataIdentifier(C))) )))) )))) <EOF>)");
+
+ test.run("$metadata#ODI(1)(NAVPROP+(A,B,C))/$delta").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "$metadata # contextFragment(odataIdentifier(ODI) "
+ + "nameValueOptList(( valueOnly(primitiveLiteral(1)) )) "
+ + "propertyList(( "
+ + "propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) + "
+ + "propertyList(( "
+ + "propertyListItem(propertyListProperty(odataIdentifier(A))) , "
+ + "propertyListItem(propertyListProperty(odataIdentifier(B))) , "
+ + "propertyListItem(propertyListProperty(odataIdentifier(C))) )))) )) "
+ + "/ $delta)) <EOF>)");
+
+ test.run("$metadata#ODI(1)(NAVPROP+(A,B,C))/$entity").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "$metadata # contextFragment(odataIdentifier(ODI) "
+ + "nameValueOptList(( valueOnly(primitiveLiteral(1)) )) "
+ + "propertyList(( "
+ + "propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) + "
+ + "propertyList(( "
+ + "propertyListItem(propertyListProperty(odataIdentifier(A))) , "
+ + "propertyListItem(propertyListProperty(odataIdentifier(B))) , "
+ + "propertyListItem(propertyListProperty(odataIdentifier(C))) )))) )) "
+ + "/ $entity)) <EOF>)");
+ test.run("$metadata#ODI(1)(NAVPROP+(A,B,C))/$delta/$entity").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "$metadata # contextFragment(odataIdentifier(ODI) "
+ + "nameValueOptList(( valueOnly(primitiveLiteral(1)) )) "
+ + "propertyList(( "
+ + "propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) + "
+ + "propertyList(( "
+ + "propertyListItem(propertyListProperty(odataIdentifier(A))) , "
+ + "propertyListItem(propertyListProperty(odataIdentifier(B))) , "
+ + "propertyListItem(propertyListProperty(odataIdentifier(C))) )))) )) "
+ + "/ $delta / $entity)) <EOF>)");
+
+ }
+
+ @Test
+ public void testPrecedence() {
+ // Test operator precedence
+
+ test.aFC().aCS().aAM().run("ODI?$filter=(1 add 2) mul 3").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = "
+ + "commonExpr(commonExpr(( commonExpr(commonExpr(primitiveLiteral(1)) "
+ + "add commonExpr(primitiveLiteral(2))) )) "
+ + "mul commonExpr(primitiveLiteral(3)))))))) <EOF>)");
+
+ test.aFC().aCS().aAM().run("ODI?$filter=1 add (2 mul 3)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = "
+ + "commonExpr(commonExpr(primitiveLiteral(1)) "
+ + "add commonExpr(( commonExpr(commonExpr(primitiveLiteral(2)) "
+ + "mul commonExpr(primitiveLiteral(3))) )))))))) <EOF>)");
+
+ test.aFC().aCS().aAM().run("ODI?$filter=1 add 2 add 3 add 4").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = "
+ + "commonExpr(commonExpr(commonExpr(commonExpr(primitiveLiteral(1)) "
+ + "add commonExpr(primitiveLiteral(2))) "
+ + "add commonExpr(primitiveLiteral(3))) "
+ + "add commonExpr(primitiveLiteral(4)))))))) <EOF>)");
+
+ test.aFC().aCS().aAM().run("ODI?$filter=1 add 2 add 3 mul 4").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = "
+ + "commonExpr(commonExpr(commonExpr(primitiveLiteral(1)) "
+ + "add commonExpr(primitiveLiteral(2))) "
+ + "add commonExpr(commonExpr(primitiveLiteral(3)) "
+ + "mul commonExpr(primitiveLiteral(4))))))))) <EOF>)");
+
+ test.aFC().aCS().aAM().run("ODI?$filter=1 add 2 mul 3 add 4").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = "
+ + "commonExpr(commonExpr(commonExpr(primitiveLiteral(1)) "
+ + "add commonExpr(commonExpr(primitiveLiteral(2)) "
+ + "mul commonExpr(primitiveLiteral(3)))) "
+ + "add commonExpr(primitiveLiteral(4)))))))) <EOF>)");
+
+ test.aFC().aCS().aAM().run("ODI?$filter=1 add 2 mul 3 mul 4").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = "
+ + "commonExpr(commonExpr(primitiveLiteral(1)) "
+ + "add commonExpr(commonExpr(commonExpr(primitiveLiteral(2)) "
+ + "mul commonExpr(primitiveLiteral(3))) "
+ + "mul commonExpr(primitiveLiteral(4))))))))) <EOF>)");
+ test.aFC().aCS().aAM().run("ODI?$filter=1 mul 2 add 3 add 4").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = "
+ + "commonExpr(commonExpr(commonExpr(commonExpr(primitiveLiteral(1)) "
+ + "mul commonExpr(primitiveLiteral(2))) "
+ + "add commonExpr(primitiveLiteral(3))) "
+ + "add commonExpr(primitiveLiteral(4)))))))) <EOF>)");
+
+ test.aFC().aCS().aAM().run("ODI?$filter=1 mul 2 add 3 mul 4").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = "
+ + "commonExpr(commonExpr(commonExpr(primitiveLiteral(1)) "
+ + "mul commonExpr(primitiveLiteral(2))) "
+ + "add commonExpr(commonExpr(primitiveLiteral(3)) "
+ + "mul commonExpr(primitiveLiteral(4))))))))) <EOF>)");
+
+ test.aFC().aCS().aAM().run("ODI?$filter=1 mul 2 mul 3 add 4").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = "
+ + "commonExpr(commonExpr(commonExpr(commonExpr(primitiveLiteral(1)) "
+ + "mul commonExpr(primitiveLiteral(2))) "
+ + "mul commonExpr(primitiveLiteral(3))) "
+ + "add commonExpr(primitiveLiteral(4)))))))) <EOF>)");
+
+ test.aFC().aCS().aAM().run("ODI?$filter=1 mul 2 mul 3 mul 4").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(filter($filter = "
+ + "commonExpr(commonExpr(commonExpr(commonExpr(primitiveLiteral(1)) "
+ + "mul commonExpr(primitiveLiteral(2))) "
+ + "mul commonExpr(primitiveLiteral(3))) "
+ + "mul commonExpr(primitiveLiteral(4)))))))) <EOF>)");
+
+ test.aFC().aCS().aAM().run("ODI?$filter=1 mul 2 add 3 mul 4").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption("
+ + "filter($filter = "
+ + "commonExpr(commonExpr(commonExpr(primitiveLiteral(1)) "
+ + "mul commonExpr(primitiveLiteral(2))) "
+ + "add commonExpr(commonExpr(primitiveLiteral(3)) "
+ + "mul commonExpr(primitiveLiteral(4))))))))) <EOF>)");
+
+ // Test parser rule search
+ test.aFC().aCS().aAM().run("ODI?$search=abc OR abc AND abc").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption(search("
+ + "$search searchSpecialToken(= "
+ + "searchExpr(searchExpr(searchWord(abc)) OR "
+ + "searchExpr("
+ + "searchExpr(searchWord(abc)) AND "
+ + "searchExpr(searchWord(abc)))))))))) <EOF>)");
+
+ test.aFC().aCS().aAM().run("ODI?$search=abc OR abc abc").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption(search("
+ + "$search searchSpecialToken(= "
+ + "searchExpr(searchExpr(searchWord(abc)) OR "
+ + "searchExpr("
+ + "searchExpr(searchWord(abc)) "
+ + "searchExpr(searchWord(abc)))))))))) <EOF>)");
+ }
+
+ // ;------------------------------------------------------------------------------
+ // ; 2. Query Options
+ // ;------------------------------------------------------------------------------
+
+ // ;------------------------------------------------------------------------------
+ // ; 4. Expressions
+ // ;------------------------------------------------------------------------------
+
+ // ;------------------------------------------------------------------------------
+ // ; 5. JSON format for function parameters
+ // ;------------------------------------------------------------------------------
+
+ // ;------------------------------------------------------------------------------
+ // ; 6. Names and identifiers
+ // ;------------------------------------------------------------------------------
+
+ // ;------------------------------------------------------------------------------
+ // ; 7. Literal Data Values
+ // ;------------------------------------------------------------------------------
+
+ // ;------------------------------------------------------------------------------
+ // ; 0. misc
+ //
<TRUNCATED>
[9/9] git commit: [OLINGO-63] Uri Parser: adoptions in lexer and
parser, create UriParserImpl to convert the parsetree into internal structures,
moved parser antlr part from .../olingo/producer/... to
.../olingo/odata4/producer
Posted by ko...@apache.org.
[OLINGO-63] Uri Parser: adoptions in lexer and parser, create UriParserImpl to convert the parsetree into internal structures, moved parser antlr part from .../olingo/producer/... to .../olingo/odata4/producer
Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/commit/10ac7ee3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/tree/10ac7ee3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/diff/10ac7ee3
Branch: refs/heads/master
Commit: 10ac7ee37e7ffde7c3d13c8ebbaba6426087640d
Parents: 82ae606
Author: Sven Kobler <sv...@sap.com>
Authored: Mon Dec 2 16:46:53 2013 +0100
Committer: Sven Kobler <sv...@sap.com>
Committed: Fri Dec 13 10:02:36 2013 +0100
----------------------------------------------------------------------
.../commons/api/edm/EdmStructuralType.java | 7 +
.../core/edm/provider/EdmComplexTypeImpl.java | 4 +-
.../edm/provider/EdmEntityContainerImpl.java | 1 +
.../core/edm/provider/EdmEntityTypeImpl.java | 1 +
.../edm/provider/EdmStructuralTypeImpl.java | 18 +
.../odata4/producer/api/uri/KeyPredicate.java | 45 -
.../odata4/producer/api/uri/UriInfo1.java | 54 -
.../odata4/producer/api/uri/UriInfoKind.java | 3 +-
.../producer/api/uri/UriPathInfoKind.java | 2 +-
odata4-lib/odata4-producer-core/pom.xml | 2 +-
.../odata4/producer/core/uri/antlr/UriLexer.g4 | 386 ++++
.../odata4/producer/core/uri/antlr/UriParser.g4 | 524 +++++
.../olingo/producer/core/uri/antlr/UriLexer.g4 | 385 ----
.../producer/core/uri/antlr/UriLexerPart.g4 | 438 ----
.../olingo/producer/core/uri/antlr/UriParser.g4 | 555 -----
.../odata4/producer/core/uri/ErrorHandler.java | 2 +-
.../producer/core/uri/KeyPredicateImpl.java | 61 -
.../odata4/producer/core/uri/ParserAdapter.java | 81 +
.../odata4/producer/core/uri/UriInfoImpl.java | 40 +-
.../producer/core/uri/UriInfoImplAll.java | 28 +
.../producer/core/uri/UriInfoImplBatch.java | 27 +
.../producer/core/uri/UriInfoImplCrossjoin.java | 27 +
.../producer/core/uri/UriInfoImplEntity.java | 28 +
.../producer/core/uri/UriInfoImplMetadata.java | 27 +
.../producer/core/uri/UriInfoImplPath.java | 50 +
.../producer/core/uri/UriKeyPredicateList.java | 47 +
.../producer/core/uri/UriParameterlist.java | 43 +
.../producer/core/uri/UriParserException.java | 33 +
.../odata4/producer/core/uri/UriParserImpl.java | 443 ++--
.../core/uri/UriPathInfoActionImpl.java | 44 +
.../core/uri/UriPathInfoActionImportImpl.java | 24 -
.../core/uri/UriPathInfoEntitySetImpl.java | 26 +-
.../core/uri/UriPathInfoFunctionImpl.java | 57 +
.../producer/core/uri/UriPathInfoImpl.java | 169 +-
.../core/uri/UriPathInfoImplFunctionImport.java | 48 -
.../core/uri/UriPathInfoNavEntitySet.java | 38 +
.../core/uri/UriPathInfoSigletonImpl.java | 24 -
.../core/uri/UriPathInfoSingletonImpl.java | 39 +
.../producer/core/testutil/EdmTechProvider.java | 1984 ++++++++++++++++--
.../producer/core/testutil/ParserValidator.java | 14 +-
.../core/testutil/TestErrorHandler.java | 56 +
.../producer/core/testutil/TokenValidator.java | 3 +-
.../core/testutil/TraceErrorHandler.java | 2 +-
.../core/testutil/UriResourcePathValidator.java | 164 +-
.../producer/core/uri/antlr/TestLexer.java | 429 ++++
.../producer/core/uri/antlr/TestParser.java | 1450 +++++++++++++
.../core/uri/antlr/TestUriParserImpl.java | 354 ++++
.../producer/core/uri/antlr/TestLexer.java | 424 ----
.../producer/core/uri/antlr/TestParser.java | 1448 -------------
.../core/uri/antlr/UriTreeReaderTest.java | 108 -
50 files changed, 6274 insertions(+), 3993 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmStructuralType.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmStructuralType.java b/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmStructuralType.java
index c9f5095..440c3e7 100644
--- a/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmStructuralType.java
+++ b/odata4-lib/odata4-commons-api/src/main/java/org/apache/olingo/odata4/commons/api/edm/EdmStructuralType.java
@@ -51,4 +51,11 @@ public interface EdmStructuralType extends EdmType {
* @return {@link EdmStructuralType}
*/
EdmStructuralType getBaseType();
+
+ /**
+ * Checks if this type is convertable to parameter {@link targetType}
+ *
+ * @return true if this type is compatible to the testType ( i.e. this type is a subtype of targetType )
+ */
+ boolean compatibleTo(EdmType targetType);
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmComplexTypeImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmComplexTypeImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmComplexTypeImpl.java
index eb02bac..d8c5394 100644
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmComplexTypeImpl.java
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmComplexTypeImpl.java
@@ -42,9 +42,11 @@ public class EdmComplexTypeImpl extends EdmStructuralTypeImpl implements EdmComp
if (baseTypeName != null) {
baseType = edm.getComplexType(baseTypeName);
if (baseType == null) {
- throw new EdmException("Cant find base type with name: " + baseTypeName + " for complex type: " + getName());
+ throw new EdmException("Can't find base type with name: " + baseTypeName + " for complex type: " + getName());
}
}
return baseType;
}
+
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmEntityContainerImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmEntityContainerImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmEntityContainerImpl.java
index 15b666c..2667b08 100644
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmEntityContainerImpl.java
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmEntityContainerImpl.java
@@ -36,6 +36,7 @@ import org.apache.olingo.odata4.commons.api.edm.provider.FunctionImport;
import org.apache.olingo.odata4.commons.api.edm.provider.Singleton;
import org.apache.olingo.odata4.commons.api.exception.ODataException;
+
public class EdmEntityContainerImpl extends EdmNamedImpl implements EdmEntityContainer {
private final FullQualifiedName entityContainerName;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmEntityTypeImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmEntityTypeImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmEntityTypeImpl.java
index 4ba9170..24248b7 100644
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmEntityTypeImpl.java
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmEntityTypeImpl.java
@@ -112,4 +112,5 @@ public class EdmEntityTypeImpl extends EdmStructuralTypeImpl implements EdmEntit
return baseType;
}
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmStructuralTypeImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmStructuralTypeImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmStructuralTypeImpl.java
index 10b3705..bbd2e84 100644
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmStructuralTypeImpl.java
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/provider/EdmStructuralTypeImpl.java
@@ -25,12 +25,14 @@ import java.util.Map;
import org.apache.olingo.odata4.commons.api.edm.EdmElement;
import org.apache.olingo.odata4.commons.api.edm.EdmStructuralType;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
import org.apache.olingo.odata4.commons.api.edm.constants.EdmTypeKind;
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
import org.apache.olingo.odata4.commons.api.edm.provider.NavigationProperty;
import org.apache.olingo.odata4.commons.api.edm.provider.Property;
import org.apache.olingo.odata4.commons.api.edm.provider.StructuralType;
+
public abstract class EdmStructuralTypeImpl extends EdmTypeImpl implements EdmStructuralType {
private final Map<String, EdmElement> properties = new HashMap<String, EdmElement>();
@@ -105,6 +107,22 @@ public abstract class EdmStructuralTypeImpl extends EdmTypeImpl implements EdmSt
}
return navigationPropertyNames;
}
+
+
+ @Override
+ public boolean compatibleTo(EdmType targetType) {
+ EdmStructuralType sourceType = this;
+
+ while (sourceType.getName() != targetType.getName() ||
+ sourceType.getNamespace() != targetType.getNamespace()) {
+ sourceType = sourceType.getBaseType();
+ if (sourceType == null) {
+ return false;
+ }
+ }
+
+ return true;
+ }
protected abstract EdmStructuralType buildBaseType(FullQualifiedName baseTypeName);
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/KeyPredicate.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/KeyPredicate.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/KeyPredicate.java
deleted file mode 100644
index d4dcd29..0000000
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/KeyPredicate.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * 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
- *
- * 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.
- ******************************************************************************/
-package org.apache.olingo.odata4.producer.api.uri;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
-
-/**
- * Key predicate, consisting of a simple-type property and its value as String literal
- * @org.apache.olingo.odata2.DoNotImplement
- *
- */
-public interface KeyPredicate {
-
- /**
- * <p>Gets the literal String in default representation.</p>
- * <p>The description for {@link org.apache.olingo.odata2.api.edm.EdmLiteral} has some motivation for using
- * this representation.</p>
- * @return String literal in default (<em>not</em> URI) representation
- * @see org.apache.olingo.odata2.api.edm.EdmLiteralKind
- */
- public String getLiteral();
-
- /**
- * Gets the key property.
- * @return {@link EdmProperty} simple-type property
- */
- public EdmProperty getProperty();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfo1.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfo1.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfo1.java
deleted file mode 100644
index 629e640..0000000
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfo1.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * 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
- *
- * 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.
- ******************************************************************************/
-package org.apache.olingo.odata4.producer.api.uri;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmBindingTarget;
-
-public class UriInfo1 {
- private UriType uriType;
- private EdmBindingTarget bindingTarget;
- private List<String> keyNames = Collections.emptyList();
-
- public UriType getUriType() {
- return uriType;
- }
-
- public void setUriType(final UriType uriType) {
- this.uriType = uriType;
- }
-
- public EdmBindingTarget getBindingTarget() {
- return bindingTarget;
- }
-
- public void setBindingTarget(final EdmBindingTarget bindingTarget) {
- this.bindingTarget = bindingTarget;
- }
-
- public void setKeyNames(final List<String> keyNames) {
- this.keyNames = keyNames;
- }
-
- public List<String> getKeyNames() {
- return keyNames;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoKind.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoKind.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoKind.java
index b39041b..79b676b 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoKind.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoKind.java
@@ -20,5 +20,6 @@
package org.apache.olingo.odata4.producer.api.uri;
public enum UriInfoKind {
- batch, all, crossjoin;
+ batch,entity, metadata, all, crossjoin, path;
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriPathInfoKind.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriPathInfoKind.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriPathInfoKind.java
index 50aed08..8ae5a31 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriPathInfoKind.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriPathInfoKind.java
@@ -20,5 +20,5 @@
package org.apache.olingo.odata4.producer.api.uri;
public enum UriPathInfoKind {
- entitySet, singleton, actionImport, functioncall;
+ entitySet, navEntitySet, singleton, action, function;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/pom.xml
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/pom.xml b/odata4-lib/odata4-producer-core/pom.xml
index a35164b..ca8f0b3 100644
--- a/odata4-lib/odata4-producer-core/pom.xml
+++ b/odata4-lib/odata4-producer-core/pom.xml
@@ -77,7 +77,7 @@
<visitor>true</visitor>
<!--maven antlr plugin has trouble with grammer import if the grammerfiles are
not directly inside src/main/antlr4, hence we have to set the libDirectory-->
- <libDirectory>src/main/antlr4/org/apache/olingo/producer/core/uri/antlr</libDirectory>
+ <libDirectory>src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr</libDirectory>
</configuration>
</plugin>
</plugins>
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriLexer.g4
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriLexer.g4 b/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriLexer.g4
new file mode 100644
index 0000000..68eb855
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriLexer.g4
@@ -0,0 +1,386 @@
+/*******************************************************************************
+ * 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
+ *
+ * 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.
+ ******************************************************************************/
+lexer grammar UriLexer;
+
+//;==============================================================================
+// Mode "DEFAULT_MODE": Processes everything bevor the first '?' char
+// On '?' the next mode "MODE_QUERY" is used
+// The percent encoding rules a defined in RFC3986 ABNF rule "path-rootless" apply
+//;==============================================================================
+QM : '?' -> pushMode(MODE_QUERY); //first query parameter
+AMP : '&' -> pushMode(MODE_QUERY); //more query parameters
+STRING : '\'' -> more, pushMode(MODE_STRING); //reads up to next single '
+QUOTATION_MARK : ('\u0022' | '%22') -> more, pushMode(MODE_JSON_STRING); //reads up to next unescaped "
+SEARCH_INLINE : '$search' -> pushMode(MODE_SYSTEM_QUERY_SEARCH); //
+
+GEOGRAPHY : G E O G R A P H Y SQUOTE -> pushMode(MODE_ODATA_GEO); //TODO make case insensitive
+GEOMETRY : G E O M E T R Y SQUOTE -> pushMode(MODE_ODATA_GEO);
+
+//Letters for case insensitivity
+fragment A : 'A'|'a';
+fragment B : 'B'|'b';
+fragment D : 'D'|'d';
+fragment E : 'E'|'e';
+fragment F : 'F'|'f';
+fragment G : 'G'|'g';
+fragment H : 'H'|'h';
+fragment I : 'I'|'i';
+fragment L : 'L'|'l';
+fragment M : 'M'|'m';
+fragment N : 'N'|'n';
+fragment O : 'O'|'o';
+fragment P : 'P'|'p';
+fragment R : 'R'|'r';
+fragment S : 'S'|'s';
+fragment T : 'T'|'t';
+fragment U : 'U'|'u';
+fragment Y : 'Y'|'y';
+fragment Z : 'Z'|'z';
+
+//special chars
+OPEN : '(' | '%28';
+CLOSE : ')' | '%29';
+COMMA : ',' | '%2C';
+SLASH : '/';
+POINT : '.';
+AT : '@';
+EQ : '=' ;
+STAR : '*';
+SEMI : ';';
+FRAGMENT : '#';
+COLON : ':';
+
+EQ_sq : '=' -> type(EQ);
+AMP_sq : '&' -> type(AMP), popMode;
+fragment WS : ( ' ' | '%09' | '%20' | '%09' );
+WSP : WS+;
+
+//JSON support
+BEGIN_OBJECT : WS* ( '{' / '%7B' ) WS*;
+END_OBJECT : WS* ( '}' / '%7D' ) WS*;
+
+BEGIN_ARRAY : WS* ( '[' / '%5B' ) WS*;
+END_ARRAY : WS* ( ']' / '%5D' ) WS*;
+NAME_SEPARATOR : WS* COLON WS*;
+
+//alpha stuff
+fragment ALPHA : 'a'..'z' | 'A'..'Z';
+fragment ALPHA_A_TO_F : 'a'..'f' | 'A'..'F';
+fragment DIGIT : '0'..'9';
+fragment DIGITS : DIGIT+;
+fragment HEXDIG : DIGIT | ALPHA_A_TO_F;
+fragment ODI_LEADINGCHARACTER : ALPHA | '_'; //TODO; add Unicode characters from the categories L or Nl
+fragment ODI_CHARACTER : ALPHA | '_' | DIGIT; //TODO; add Unicode characters from the categories L, Nl, Nd, Mn, Mc, Pc, or Cf
+
+//helper for date/time values
+fragment ONE_TO_NINE : '1'..'9';
+fragment ZERO_TO_FIFTYNINE : ('0'..'5') DIGIT;
+fragment FRACTIONALSECONDS : DIGIT+;
+fragment SECOND : ZERO_TO_FIFTYNINE;
+fragment MINUTE : ZERO_TO_FIFTYNINE;
+fragment HOUR : ('0' | '1') DIGIT | '2' ( '0'..'3');
+fragment DAY : '0' '1'..'9' | ('1'|'2') DIGIT | '3' ('0'|'1');
+fragment MONTH : '0' ONE_TO_NINE | '1' ( '0' | '1' | '2' );
+fragment YEAR : ('-')? ( '0' DIGIT DIGIT DIGIT | ONE_TO_NINE DIGIT DIGIT DIGIT );
+
+//tags start with $
+BATCH : '$batch';
+ENTITY : '$entity';
+METADATA : '$metadata';
+
+ALL : '$all';
+CROSSJOIN : '$crossjoin';
+
+VALUE : '$value';
+REF : '$ref';
+COUNT : '$count';
+
+//inlined query parameters ( e.g. $skip)
+SKIP_INLINE : '$skip';
+FILTER_INLINE : '$filter';
+ORDERBY_INLINE: '$orderby';
+
+
+ROOT : '$root/';
+
+
+
+//rest
+NULLVALUE : 'null';
+
+TRUE : 'true';
+FALSE : 'false';
+BOOLEAN : T R U E | F A L S E;
+PLUS : '+';
+SIGN : PLUS | '%2B' |'-';
+INT : SIGN? DIGITS;
+DECIMAL : INT '.' DIGITS ('e' SIGN? DIGITS)?;
+
+//primary types
+BINARY : B I N A R Y SQUOTE (HEXDIG HEXDIG)* SQUOTE;
+DATE : YEAR '-' MONTH '-' DAY;
+DATETIMEOFFSET : YEAR '-' MONTH '-' DAY T HOUR ':' MINUTE ( ':' SECOND ( '.' FRACTIONALSECONDS )? )? ( Z | SIGN HOUR ':' MINUTE );
+fragment DUSECONDFRAG : DIGITS ('.' DIGITS)? 'S';
+fragment DUTIMEFRAG : 'T' (
+ ( DIGITS 'H' (DIGITS 'M')? DUSECONDFRAG?)
+ | (DIGITS 'M' DUSECONDFRAG?)
+ | DUSECONDFRAG
+ );
+fragment DUDAYTIMEFRAG : DIGITS 'D' DUTIMEFRAG? | DUTIMEFRAG;
+DURATION : D U R A T I O N SQUOTE '-'? 'P' DUDAYTIMEFRAG SQUOTE;
+TIMEOFDAY : HOUR ':' MINUTE ( ':' SECOND ( '.' FRACTIONALSECONDS )? )?;
+fragment GUIDVALUE : HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG'-'
+ HEXDIG HEXDIG HEXDIG HEXDIG '-'
+ HEXDIG HEXDIG HEXDIG HEXDIG '-'
+ HEXDIG HEXDIG HEXDIG HEXDIG '-'
+ HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG;
+GUID : GUIDVALUE;
+
+//expression tokens
+ASC : 'asc';
+DESC : 'desc';
+MUL : 'mul';
+DIV : 'div';
+MOD : 'mod';
+ADD : 'add';
+SUB : 'sub';
+GT : 'gt';
+GE : 'ge';
+LT : 'lt';
+LE : 'le';
+EQ_ALPHA : 'eq';
+NE : 'ne';
+AND : 'and';
+OR : 'or';
+ISOF : 'isof';
+NOT : 'not';
+MINUS :'-';
+NANINFINITY : 'NaN' | '-INF' | 'INF';
+
+IMPLICIT_VARIABLE_EXPR : '$it';
+LEVELS : '$levels';
+
+CONTAINS_WORD : 'contains(';
+STARTSWITH_WORD : 'startswith(';
+ENDSWITH_WORD : 'endswith(';
+LENGTH_WORD : 'length(';
+INDEXOF_WORD : 'indexof(';
+SUBSTRING_WORD : 'substring(';
+TOLOWER_WORD : 'tolower(';
+TOUPPER_WORD : 'toupper(';
+TRIM_WORD : 'trim(';
+CONCAT_WORD : 'concat(';
+YEAR_WORD : 'year(';
+MONTH_WORD : 'month(';
+DAY_WORD : 'day(';
+HOUR_WORD : 'hour(';
+MINUTE_WORD : 'minute(';
+SECOND_WORD : 'second(';
+FRACTIONALSECONDS_WORD : 'fractionalseconds(';
+TOTALSECONDS_WORD : 'totalseconds(';
+DATE_WORD : 'date(';
+TIME_WORD : 'time(';
+TOTALOFFSETMINUTES_WORD : 'totaloffsetminutes(';
+
+MINDATETIME_WORD : 'mindatetime(';
+MAXDATETIME_WORD : 'maxdatetime(';
+NOW_WORD : 'now(';
+
+ROUND_WORD : 'round(';
+FLOOR_WORD : 'floor(';
+CEILING_WORD : 'ceiling(';
+
+GEO_DISTANCE_WORD : 'geo.distance(';
+GEO_LENGTH_WORD : 'geo.length(';
+GEO_INTERSECTS_WORD : 'geo.intersects(';
+ISOF_WORD : 'isof(';
+CAST_WORD : 'cast(';
+
+COLLECTION_REF : 'Collection($ref)';
+COLLECTION_ENTITY_TYPE : 'Collection(Edm.EntityType)';
+COLLECTION_COMPLEX_TYPE : 'Collection(Edm.ComplexType)';
+COLLECTION : 'Collection(' -> type(COLLECTION);
+
+//used in fragment only
+DELETED_ENTITY : '$deletedEntity';
+LINK : '$link';
+DELETED_LINK : '$deletedLink';
+DELTA : '$delta';
+
+
+LEVELSMAX : '$levels=max';
+
+
+//ODI
+ODATAIDENTIFIER : ODI_LEADINGCHARACTER (ODI_CHARACTER)*;
+
+//;==============================================================================
+// Mode "QUERY": Processes everything between the first '?' and the '#' char
+// On '?' the next mode "FRAGMENT" is used
+// The percent encoding rules a defined in RFC3986 ABNF rule "query" apply
+mode MODE_QUERY;
+//;==============================================================================
+
+FRAGMENT_q : '#' -> type(FRAGMENT);
+FILTER : '$filter' -> pushMode(DEFAULT_MODE);
+ORDERBY : '$orderby' -> pushMode(DEFAULT_MODE);
+EXPAND : '$expand' -> pushMode(DEFAULT_MODE);
+SELECT : '$select' -> pushMode(DEFAULT_MODE);
+SKIP : '$skip' -> pushMode(DEFAULT_MODE);
+SKIPTOKEN : '$skiptoken' -> pushMode(MODE_SYSTEM_QUERY_REST);
+TOP : '$top' -> pushMode(DEFAULT_MODE);
+LEVELS_q : '$levels' -> type(LEVELS), pushMode(DEFAULT_MODE);
+FORMAT : '$format' -> pushMode(MODE_SYSTEM_QUERY_PCHAR);
+COUNT_q : '$count' -> type(COUNT), pushMode(DEFAULT_MODE);
+REF_q : '$ref' -> type(REF);
+VALUE_q : '$value' -> type(VALUE);
+ID : '$id' -> pushMode(MODE_SYSTEM_QUERY_REST);
+SEARCH : '$search' -> pushMode(MODE_SYSTEM_QUERY_SEARCH);
+
+EQ_q : '=' -> type(EQ);
+AMP_q : '&' -> type(AMP);
+
+CUSTOMNAME : ~[&=@$] ~[&=]*;
+CUSTOMVALUE : ~[&=]+;
+
+//;==============================================================================
+mode MODE_SYSTEM_QUERY_PCHAR;
+//;==============================================================================
+
+AMP_sqp : '&' -> popMode,popMode;
+
+//fragment EQ_sqp : '=';
+fragment ALPHA_sqp : 'a'..'z'|'A'..'Z';
+fragment A_TO_F_sqp : 'a'..'f'|'A'..'F';
+fragment DIGIT_sqp : '0'..'9';
+fragment HEXDIG_sqp : DIGIT_sqp | A_TO_F_sqp;
+fragment PCT_ENCODED_sqp : '%' HEXDIG_sqp HEXDIG_sqp;
+fragment SUB_DELIMS_sqp : '$' | '&' | '\'' | EQ_sqp | OTHER_DELIMS_sqp;
+fragment OTHER_DELIMS_sqp : '!' | '(' | ')' | '*' | '+' | ',' | ';';
+fragment UNRESERVED_sqp : ALPHA_sqp | DIGIT_sqp | '-' |'.' | '_' | '~';
+fragment PCHAR : UNRESERVED_sqp | PCT_ENCODED_sqp | SUB_DELIMS_sqp | ':' | '@';
+fragment PCHARSTART : UNRESERVED_sqp | PCT_ENCODED_sqp | '$' | '&' | '\'' | OTHER_DELIMS_sqp | ':' | '@';
+
+
+ATOM : [Aa][Tt][Oo][Mm];
+JSON : [Jj][Ss][Oo][Nn];
+XML : [Xx][Mm][Ll];
+
+PCHARS : PCHARSTART PCHAR*;
+
+SLASH_sqp : '/' -> type(SLASH);
+EQ_sqp : '=' -> type(EQ);
+
+//;==============================================================================
+mode MODE_SYSTEM_QUERY_REST;
+// Read the remaining characters of a URI queryparameter up to an & or #
+// character.
+//;==============================================================================
+
+AMP_sqr : '&' -> type(AMP), popMode;
+FRAGMENT_sqr : '#' -> type(FRAGMENT), popMode;
+
+EQ_sqr : '=' -> type(EQ);
+REST : ~[&#=] ~[&#]*;
+
+
+
+//;==============================================================================
+mode MODE_SYSTEM_QUERY_SEARCH;
+//;==============================================================================
+
+NOT_sqc : 'NOT' -> type(NOT);
+AND_sqc : 'AND' -> type(AND);
+OR_sqc : 'OR' -> type(OR);
+EQ_sqc : '=' -> type(EQ);
+
+fragment WS_sqc : ( ' ' | '\u0009' | '%20' | '%09' );
+WSP_sqc : WS_sqc+ -> type(WSP);
+
+QUOTATION_MARK_sqc : '\u0022' | '%22';
+
+SEARCHWORD : ('a'..'z'|'A'..'Z')+;
+SEARCHPHRASE : QUOTATION_MARK_sqc ~["]* QUOTATION_MARK_sqc -> popMode;
+
+
+//;==============================================================================
+mode MODE_STRING;
+// Read the remaining characters up to an ' character.
+// An "'" character inside a string are expressed as double ''
+//;==============================================================================
+
+STRING_s : ('\'\'' | ~[\u0027] )* '\'' -> type(STRING), popMode;
+
+//;==============================================================================
+mode MODE_JSON_STRING;
+// Read the remaining characters up to an " character.
+// An "'" character inside a string are expressed excaped \"
+//;==============================================================================
+
+STRING_IN_JSON : ('\\"' | ~[\u0022] )* ('"' | '%22') -> popMode;
+
+//;==============================================================================
+mode MODE_ODATA_GEO;
+//;==============================================================================
+
+fragment C_ : 'c'|'C';
+fragment D_ : 'd'|'D';
+fragment E_ : 'e'|'E';
+fragment G_ : 'g'|'G';
+fragment H_ : 'h'|'H';
+fragment I_ : 'i'|'I';
+fragment L_ : 'l'|'L';
+fragment M_ : 'm'|'M';
+fragment N_ : 'n'|'N';
+fragment O_ : 'o'|'O';
+fragment P_ : 'p'|'P';
+fragment R_ : 'r'|'R';
+fragment S_ : 's'|'S';
+fragment T_ : 't'|'T';
+fragment U_ : 'u'|'U';
+fragment Y_ : 'y'|'Y';
+
+fragment SP_g : ' ';//'\u0020'; // a simple space
+fragment WS_g : ( ' ' | '%20' | '%09' );
+
+OPEN_g : ('(' | '%28') -> type(OPEN);
+CLOSE_g : (')' | '%29') -> type(CLOSE);
+COMMA_g : (',' | '%2C') -> type(COMMA);
+WSP_g : WS_g+ -> type(WSP);
+POINT_g : '.' -> type(POINT);
+AT_g : '@' -> type(AT);
+SEMI_g : (';' | '%3B') -> type(SEMI);
+EQ_g : '=' -> type(EQ);
+
+fragment DIGIT_g : '0'..'9';
+fragment DIGITS_g : DIGIT_g+;
+SIGN_g : ('+' | '%2B' |'-') -> type(SIGN);
+INT_g : SIGN_g? DIGITS_g -> type(INT);
+DECIMAL_g : INT_g '.' DIGITS_g ('e' SIGN_g? DIGITS_g)? -> type(DECIMAL);
+COLLECTION_g : C_ O_ L_ L_ E_ C_ T_ I_ O_ N_ -> type(COLLECTION);
+LINESTRING : L_ I_ N_ E_ S_ T_ R_ I_ N_ G_ ;
+MULTILINESTRING : M_ U_ L_ T_ I_ L_ I_ N_ E_ S_ T_ R_ I_ N_ G_;
+MULTIPOINT : M_ U_ L_ T_ I_ P_ O_ I_ N_ T_ ;
+MULTIPOLYGON : M_ U_ L_ T_ I_ P_ O_ L_ Y_ G_ O_ N_;
+GEO_POINT : P_ O_ I_ N_ T_;
+POLYGON : P_ O_ L_ Y_ G_ O_ N_ ;
+
+SRID : S_ R_ I_ D_;
+
+SQUOTE : '\'' -> popMode;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriParser.g4
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriParser.g4 b/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriParser.g4
new file mode 100644
index 0000000..24dd1a0
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriParser.g4
@@ -0,0 +1,524 @@
+/*******************************************************************************
+ * 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
+ *
+ * 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.
+ ******************************************************************************/
+
+ grammar UriParser;
+
+
+//Antlr4 (as most parsers) has a lexer for token detection and a parser which defines
+//rules based on the tokens. However its hard to define a clear lexer on the
+//ODATA URI syntax due to some reasons:
+// - the syntax is based on the URI specification and there fore contains the definition
+// of delimiters and percent encoding
+// - the syntax includes JSON
+// - the syntax includes a expression syntax which comes from ODATA itself (e.g. $filter)
+// - the syntax includes searchstring and searchword
+// - the ABNF describing syntax is not defined in a context free manner
+// so there are several kinds of "String" tokens:
+// - strings with single quotes,
+// - strings with single quotes and a special syntax within the quotes (like geometry data)
+// - strings with double quotes
+// - strings without quotes ( usually identifiers, searchstrings, searchwords, custom parameters)
+// but each with different allowed charactersets
+// Drawing a simple line between lexer and parser is not possible.
+//
+// This grammer is a compromiss we have choosen to satisfy the requirements we have
+// - the grammer is context free
+// - this makes the parser much simpler and we have a clear saparation between parsing and
+// EDM validation, but also creates a parse tree which is not semantically correct from the
+// EDM perspective ( e.g.it will not pass the EDM validation)
+// - the grammer can not be applied on a full URI string
+// - the URI should be split according the URI specification before used as input for the
+// ODATA parser
+// - while creating the grammer the antlr lexer modes where only allowed in pure lexer grammers
+// not in combined grammers, and is was not possible to include lexer grammer with a mode into
+// a combined grammar without creating JAVA errors.
+
+// see https://github.com/antlr/antlr4/issues/160 "Support importing multi-mode lexer grammars"
+
+
+//Naming convention
+// ...
+//Decoding encoding
+//- within rule "resourcePath": special chars used in EDM.Strings must still be encoded when
+// used as tokenizer input
+// e.g. .../Employees(id='Hugo%2FMueller')/EmployeeName <-- SLASH must be encoded to '%2F' in "Hugo/Mueller"
+// but it must not be encoded before the EmployeeName
+
+
+
+options {
+ language = Java;
+ tokenVocab=UriLexer;
+}
+
+
+
+
+
+//;------------------------------------------------------------------------------
+//; 0. URI
+//;------------------------------------------------------------------------------
+
+//ABNF odataUri and serviceRoot are currently not used here
+//odataUri = serviceRoot [ odataRelativeUri ]
+//
+//serviceRoot = ( "https" / "http" ) ; Note: case-insensitive
+// "://" host [ ":" port ]
+// "/" *( segment-nz "/" )
+
+
+odataRelativeUriEOF : odataRelativeUri? EOF;
+
+//QM and FRAGMENT enable next lexer mode
+//TODO add the new "ENTITYCAST"
+odataRelativeUri : BATCH # altBatch
+ | ENTITY QM eo=entityOptions # altEntity
+ | ENTITY SLASH ns=namespace? odi=odataIdentifier QM eo=entityOptions # altEntityCast
+ | METADATA ( QM format )? ( FRAGMENT contextFragment )? # altMetadata
+ | resourcePath ( QM queryOptions )? # altResourcePath
+ ;
+
+//;------------------------------------------------------------------------------
+//; 1. Resource Path
+//;------------------------------------------------------------------------------
+
+resourcePath : vAll=ALL
+ | vCJ=crossjoin
+ | vPSs=pathSegments
+ ;
+crossjoin : CROSSJOIN OPEN odi+=odataIdentifier ( COMMA odi+=odataIdentifier )* CLOSE;
+
+pathSegments : vlPS+=pathSegment (SLASH vlPS+=pathSegment)* vCS=constSegment?;
+
+pathSegment : vNS=namespace? vODI=odataIdentifier vlVPO+=nameValueOptList*;
+
+nameValueOptList : OPEN (vVO=valueOnly | vNVL=nameValueList)? CLOSE;
+valueOnly : vV=primitiveLiteral ;
+nameValueList : WSP* vNVP+=nameValuePair WSP* ( COMMA WSP* vNVP+=nameValuePair WSP*)* ;
+nameValuePair : vODI=odataIdentifier EQ (AT vALI=odataIdentifier | vVAL=primitiveLiteral /*TODO | val2=enumX*/);
+
+constSegment : SLASH (v=value | c=count | r=ref );
+
+count : COUNT;
+ref : REF;
+value : VALUE;
+//;------------------------------------------------------------------------------
+//; 2. Query Options
+//;------------------------------------------------------------------------------
+
+queryOptions : qo+=queryOption ( AMP qo+=queryOption )*;
+
+queryOption : systemQueryOption
+ | AT aliasAndValue
+ | customQueryOption
+ ;
+
+entityOptions : (eob+=entityOption AMP )* ID EQ REST ( AMP eoa+=entityOption )*;
+entityOption : ( expand | format | select )
+ | customQueryOption
+
+ ;
+
+
+
+systemQueryOption : expand
+ | filter
+ | format
+ | id
+ | inlinecount
+ | orderby
+ | search
+ | select
+ | skip
+ | skiptoken
+ | top
+ ;
+
+id : ID EQ REST;
+skiptoken : SKIPTOKEN EQ REST;
+expand : EXPAND EQ expandItemList;
+
+expandItemList : expandItem ( COMMA expandItem )*;
+
+expandItem : STAR ( SLASH ref | OPEN (LEVELS EQ INT | LEVELSMAX) CLOSE )?
+ | expandPath expandPathExtension?;
+
+expandPath : ( namespace? odataIdentifier ) ( SLASH namespace? odataIdentifier )*;
+expandPathExtension : SLASH ref ( OPEN expandRefOption ( SEMI expandRefOption )* CLOSE )?
+ | SLASH count ( OPEN expandCountOption ( SEMI expandCountOption )* CLOSE )?
+ | OPEN expandOption ( SEMI expandOption )* CLOSE
+ ;
+expandCountOption : filterInline
+ | searchInline
+ ;
+expandRefOption : expandCountOption
+ | orderbyInline
+ | skipInline
+ | top
+ | inlinecount
+ ;
+expandOption : expandRefOption
+ | select
+ | expand
+ | LEVELS;
+
+filter : FILTER EQ commonExpr;
+filterInline : FILTER_INLINE EQ commonExpr;
+
+
+
+orderby : ORDERBY EQ orderbyItem ( COMMA orderbyItem )*;
+orderbyInline : ORDERBY_INLINE EQ orderbyItem ( COMMA orderbyItem )*;
+orderbyItem : commonExpr ( WSP ( ASC | DESC ) )?;
+
+//this is completly done in lexer grammer to avoid ambiguities with odataIdentifier and STRING
+skip : SKIP EQ INT;
+skipInline : SKIP_INLINE EQ INT;
+top : TOP EQ INT;
+format : FORMAT EQ ( ATOM | JSON | XML | PCHARS ( SLASH PCHARS)?);
+
+inlinecount : COUNT EQ booleanNonCase;
+
+search : SEARCH searchSpecialToken;
+searchInline : SEARCH_INLINE searchSpecialToken;
+
+searchSpecialToken : EQ WSP? searchExpr;
+
+searchExpr : (NOT WSP) searchExpr
+ | searchExpr searchExpr
+ | searchExpr WSP searchExpr
+ | searchExpr ( WSP AND WSP) searchExpr
+ | searchExpr ( WSP OR WSP) searchExpr
+ | searchPhrase
+ | searchWord
+ ;
+
+searchPhrase : SEARCHPHRASE;
+searchWord : SEARCHWORD;
+
+select : SELECT EQ selectItem ( COMMA selectItem )*;
+selectItem : namespace? STAR
+ | (namespace? odataIdentifier nameValueOptList? ) ( SLASH namespace? odataIdentifier nameValueOptList? )*
+ ;
+
+aliasAndValue : odataIdentifier EQ parameterValue;
+parameterValue : //arrayOrObject
+ commonExpr
+ ;
+
+
+
+customQueryOption : customName ( EQ customValue)?
+ ;
+customName : CUSTOMNAME;
+customValue : CUSTOMVALUE;
+
+
+
+//;------------------------------------------------------------------------------
+//; 3. Context URL Fragments
+//;------------------------------------------------------------------------------
+//ps+=pathSegment (SLASH ps+=pathSegment)*
+//PRIMITIVETYPENAME
+contextFragment : REF
+ /*| PRIMITIVETYPENAME*/
+ | COLLECTION_REF
+ | COLLECTION_ENTITY_TYPE
+ | COLLECTION_COMPLEX_TYPE
+ | COLLECTION ( /*PRIMITIVETYPENAME |*/ namespace? odataIdentifier ) CLOSE
+ | namespace? odataIdentifier
+ ( SLASH ( DELETED_ENTITY | LINK | DELETED_LINK )
+ | nameValueOptList? ( SLASH namespace? odataIdentifier)* ( propertyList )? ( SLASH DELTA) ? (SLASH ENTITY) ?
+ )
+ ;
+
+propertyList : OPEN propertyListItem ( COMMA propertyListItem )* CLOSE;
+propertyListItem : STAR //; all structural properties
+ | propertyListProperty
+ ;
+propertyListProperty : namespace? odataIdentifier ( SLASH namespace? odataIdentifier)* ( PLUS )? ( propertyList)?
+ ;
+
+
+//;------------------------------------------------------------------------------
+//; 4. Expressions
+//;------------------------------------------------------------------------------
+
+// this expression part of the grammer is not similar to the ABNF because
+// we had to introduced operator precesence witch is not reflected in the ABNF
+
+test : test_expr EOF;
+test_expr : INT
+ //| test_expr /*WSP*/ ( '!' | '*' ) /*WSP*/ test_expr;
+ //| test_expr WSP ( '!' | '*' ) WSP test_expr;
+ | test_expr ( WSP '!' WSP | WSP '*' WSP ) test_expr;
+
+commonExpr : OPEN commonExpr CLOSE #altPharenthesis
+ | methodCallExpr #altMethod
+ | ( unary WSP ) commonExpr #altUnary
+ | memberExpr #altMember
+ | commonExpr (WSP MUL WSP | WSP DIV WSP | WSP MOD WSP ) commonExpr #altMult
+ | commonExpr (WSP ADD WSP | WSP SUB WSP) commonExpr #altAdd
+ | commonExpr (WSP GT WSP | WSP GE WSP | WSP LT WSP | WSP LE WSP | WSP ISOF WSP) commonExpr #altComparism
+ | commonExpr (WSP EQ_ALPHA WSP | WSP NE WSP) commonExpr #altEquality
+ | commonExpr (WSP AND WSP) commonExpr #altAnd
+ | commonExpr (WSP OR WSP) commonExpr #altOr
+ | rootExpr #altRoot //; $...
+ | AT odataIdentifier #altAlias // @...
+ | primitiveLiteral #altLiteral // ...
+ ;
+
+unary : (MINUS| NOT) ;
+
+rootExpr : ROOT pathSegments;
+
+memberExpr : '$it' | '$it/'? pathSegments;
+
+anyExpr : 'any' OPEN WSP /* [ lambdaVariableExpr BWS COLON BWS lambdaPredicateExpr ] WS* */ CLOSE;
+allExpr : 'all' OPEN WSP /* lambdaVariableExpr BWS COLON BWS lambdaPredicateExpr WS* */ CLOSE;
+
+methodCallExpr : indexOfMethodCallExpr
+ | toLowerMethodCallExpr
+ | toUpperMethodCallExpr
+ | trimMethodCallExpr
+ | substringMethodCallExpr
+ | concatMethodCallExpr
+ | lengthMethodCallExpr
+ | yearMethodCallExpr
+ | monthMethodCallExpr
+ | dayMethodCallExpr
+ | hourMethodCallExpr
+ | minuteMethodCallExpr
+ | secondMethodCallExpr
+ | fractionalsecondsMethodCallExpr
+ | totalsecondsMethodCallExpr
+ | dateMethodCallExpr
+ | timeMethodCallExpr
+ | roundMethodCallExpr
+ | floorMethodCallExpr
+ | ceilingMethodCallExpr
+ | distanceMethodCallExpr
+ | geoLengthMethodCallExpr
+ | totalOffsetMinutesMethodCallExpr
+ | minDateTimeMethodCallExpr
+ | maxDateTimeMethodCallExpr
+ | nowMethodCallExpr
+ //from boolean
+ | isofExpr
+ | castExpr
+ | endsWithMethodCallExpr
+ | startsWithMethodCallExpr
+ | containsMethodCallExpr
+ | intersectsMethodCallExpr
+ ;
+
+
+containsMethodCallExpr : CONTAINS_WORD WSP? commonExpr WSP? COMMA WSP? commonExpr WSP? CLOSE;
+startsWithMethodCallExpr : STARTSWITH_WORD WSP? commonExpr WSP? COMMA WSP? commonExpr WSP? CLOSE;
+endsWithMethodCallExpr : ENDSWITH_WORD WSP? commonExpr WSP? COMMA WSP? commonExpr WSP? CLOSE;
+lengthMethodCallExpr : LENGTH_WORD WSP? commonExpr WSP? CLOSE;
+indexOfMethodCallExpr : INDEXOF_WORD WSP? commonExpr WSP? COMMA WSP? commonExpr WSP? CLOSE;
+substringMethodCallExpr : SUBSTRING_WORD WSP? commonExpr WSP? COMMA WSP? commonExpr WSP? ( COMMA WSP? commonExpr WSP? )? CLOSE;
+toLowerMethodCallExpr : TOLOWER_WORD WSP? commonExpr WSP? CLOSE;
+toUpperMethodCallExpr : TOUPPER_WORD WSP? commonExpr WSP? CLOSE;
+trimMethodCallExpr : TRIM_WORD WSP? commonExpr WSP? CLOSE;
+concatMethodCallExpr : CONCAT_WORD WSP? commonExpr WSP? COMMA WSP? commonExpr WSP? CLOSE;
+
+yearMethodCallExpr : YEAR_WORD WSP? commonExpr WSP? CLOSE;
+monthMethodCallExpr : MONTH_WORD WSP? commonExpr WSP? CLOSE;
+dayMethodCallExpr : DAY_WORD WSP? commonExpr WSP? CLOSE;
+hourMethodCallExpr : HOUR_WORD WSP? commonExpr WSP? CLOSE;
+minuteMethodCallExpr : MINUTE_WORD WSP? commonExpr WSP? CLOSE;
+secondMethodCallExpr : SECOND_WORD WSP? commonExpr WSP? CLOSE;
+fractionalsecondsMethodCallExpr : FRACTIONALSECONDS_WORD WSP? commonExpr WSP? CLOSE;
+totalsecondsMethodCallExpr : TOTALSECONDS_WORD WSP? commonExpr WSP? CLOSE;
+dateMethodCallExpr : DATE_WORD WSP? commonExpr WSP? CLOSE;
+timeMethodCallExpr : TIME_WORD WSP? commonExpr WSP? CLOSE;
+totalOffsetMinutesMethodCallExpr : TOTALOFFSETMINUTES_WORD WSP? commonExpr WSP? CLOSE;
+
+minDateTimeMethodCallExpr : MINDATETIME_WORD WSP? CLOSE;
+maxDateTimeMethodCallExpr : MAXDATETIME_WORD WSP? CLOSE;
+nowMethodCallExpr : NOW_WORD WSP? CLOSE;
+
+roundMethodCallExpr : ROUND_WORD WSP? commonExpr WSP? CLOSE;
+floorMethodCallExpr : FLOOR_WORD WSP? commonExpr WSP? CLOSE;
+ceilingMethodCallExpr : CEILING_WORD WSP? commonExpr WSP? CLOSE;
+
+distanceMethodCallExpr : GEO_DISTANCE_WORD WSP? commonExpr WSP? COMMA WSP? commonExpr WSP? CLOSE;
+geoLengthMethodCallExpr : GEO_LENGTH_WORD WSP? commonExpr WSP? CLOSE;
+intersectsMethodCallExpr : GEO_INTERSECTS_WORD WSP? commonExpr WSP? COMMA WSP? commonExpr WSP? CLOSE;
+
+isofExpr : ISOF_WORD WSP? ( commonExpr WSP? COMMA WSP? )? qualifiedtypename WSP? CLOSE;
+castExpr : CAST_WORD WSP? ( commonExpr WSP? COMMA WSP? )? qualifiedtypename WSP? CLOSE;
+
+//;------------------------------------------------------------------------------
+//; 5. JSON format for function parameters
+//;------------------------------------------------------------------------------
+//; Note: the query part of a URI needs to be partially percent-decoded before
+//; applying these rules, see comment at the top of this file
+//;------------------------------------------------------------------------------
+
+arrayOrObject : json_array
+ | json_object;
+
+json_array : BEGIN_ARRAY json_value ( WSP? COMMA WSP? json_value)* END_ARRAY;
+
+json_value : jsonPrimitiv
+ | rootExpr
+ | json_object
+ | json_array;
+
+json_object : BEGIN_OBJECT
+ STRING_IN_JSON
+ NAME_SEPARATOR
+ json_value
+ END_OBJECT;
+
+
+//; JSON syntax: adapted to URI restrictions from [RFC4627]
+jsonPrimitiv : STRING_IN_JSON
+ | number_in_json
+ | TRUE
+ | FALSE
+ | 'null'
+ ;
+
+number_in_json : INT | DECIMAL;
+
+//;------------------------------------------------------------------------------
+//; 6. Names and identifiers
+//;------------------------------------------------------------------------------
+
+qualifiedtypename : namespace odataIdentifier
+ | 'collection' OPEN ( namespace odataIdentifier ) CLOSE
+ ;
+
+namespace : (odataIdentifier POINT)+;
+
+odataIdentifier : ODATAIDENTIFIER;
+
+//;------------------------------------------------------------------------------
+//; 7. Literal Data Values
+//;------------------------------------------------------------------------------
+
+
+/*TODO add missing values*/
+primitiveLiteral : nullrule
+ | booleanNonCase
+ | DECIMAL //includes double and single literals
+ | INT //includes int16/int32 and int64 literals
+ | BINARY
+ | DATE
+ | DATETIMEOFFSET
+ | DURATION
+ | GUID
+ | string
+ | TIMEOFDAY
+ | geographyCollection
+ | geographyLineString
+ | geographyMultilineString
+ | geographyMultipoint
+ | geographyMultipolygon
+ | geographyPoint
+ | geographyPolygon
+ | geometryCollection
+ | geometryLineString
+ | geometryMultilineString
+ | geometryMultipoint
+ | geometryMultipolygon
+ | geometryPoint
+ | geometryPolygon
+ | enumX
+ ;
+
+
+nullrule : NULLVALUE;// (SQUOTE qualifiedtypename SQUOTE)?;
+booleanNonCase : BOOLEAN | TRUE | FALSE;
+string : STRING;
+
+
+enumX : namespace odataIdentifier STRING /*SQUOTE enumValue SQUOTE*/;
+enumValue : singleEnumValue *( COMMA singleEnumValue );
+singleEnumValue : odataIdentifier / INT;
+
+
+geographyCollection : GEOGRAPHY fullCollectionLiteral SQUOTE;
+fullCollectionLiteral : sridLiteral collectionLiteral;
+
+collectionLiteral : (COLLECTION ) OPEN geoLiteral ( COMMA geoLiteral )* CLOSE;
+
+geoLiteral : collectionLiteral
+ | lineStringLiteral
+ | multipointLiteral
+ | multilineStringLiteral
+ | multipolygonLiteral
+ | pointLiteral
+ | polygonLiteral;
+
+geographyLineString : GEOGRAPHY fullLineStringLiteral SQUOTE;
+fullLineStringLiteral : sridLiteral lineStringLiteral;
+lineStringLiteral : LINESTRING lineStringData;
+lineStringData : OPEN positionLiteral ( COMMA positionLiteral )* CLOSE;
+
+geographyMultilineString : GEOGRAPHY fullMultilineStringLiteral SQUOTE;
+fullMultilineStringLiteral : sridLiteral multilineStringLiteral;
+multilineStringLiteral : MULTILINESTRING OPEN ( lineStringData ( COMMA lineStringData )* )? CLOSE;
+
+geographyMultipoint : GEOGRAPHY fullMultipointLiteral SQUOTE;
+fullMultipointLiteral : sridLiteral multipointLiteral;
+multipointLiteral : MULTIPOINT OPEN ( pointData ( COMMA pointData )* )? CLOSE ;
+
+geographyMultipolygon : GEOGRAPHY fullmultipolygonLiteral SQUOTE;
+fullmultipolygonLiteral : sridLiteral multipolygonLiteral;
+multipolygonLiteral : MULTIPOLYGON OPEN ( polygonData ( COMMA polygonData )* )? CLOSE;
+
+geographyPoint : GEOGRAPHY fullpointLiteral SQUOTE;
+fullpointLiteral : sridLiteral pointLiteral;
+
+pointLiteral : GEO_POINT pointData;
+pointData : OPEN positionLiteral CLOSE;
+
+positionLiteral : (DECIMAL | INT ) WSP (DECIMAL | INT ); //; longitude, then latitude
+
+
+geographyPolygon : GEOGRAPHY fullPolygonLiteral SQUOTE;
+fullPolygonLiteral : sridLiteral polygonLiteral;
+polygonLiteral : POLYGON polygonData;
+polygonData : OPEN ringLiteral ( COMMA ringLiteral )* CLOSE;
+ringLiteral : OPEN positionLiteral ( COMMA positionLiteral )* CLOSE;
+
+
+geometryCollection : GEOMETRY fullCollectionLiteral SQUOTE;
+geometryLineString : GEOMETRY fullLineStringLiteral SQUOTE;
+geometryMultilineString : GEOMETRY fullMultilineStringLiteral SQUOTE;
+geometryMultipoint : GEOMETRY fullMultipointLiteral SQUOTE;
+geometryMultipolygon : GEOMETRY fullmultipolygonLiteral SQUOTE;
+geometryPoint : GEOMETRY fullpointLiteral SQUOTE;
+geometryPolygon : GEOMETRY fullPolygonLiteral SQUOTE;
+
+sridLiteral : SRID EQ INT SEMI;
+
+
+
+
+
+/*
+mode MODEd333gh;
+
+MO12E1 : 'ASD' -> mode(DEFAULT_MODE);*/
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/producer/core/uri/antlr/UriLexer.g4
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/producer/core/uri/antlr/UriLexer.g4 b/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/producer/core/uri/antlr/UriLexer.g4
deleted file mode 100644
index 295936b..0000000
--- a/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/producer/core/uri/antlr/UriLexer.g4
+++ /dev/null
@@ -1,385 +0,0 @@
-/*******************************************************************************
- * 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
- *
- * 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.
- ******************************************************************************/
-lexer grammar UriLexer;
-
-//;==============================================================================
-// Mode "DEFAULT_MODE": Processes everything bevor the first '?' char
-// On '?' the next mode "MODE_QUERY" is used
-// The percent encoding rules a defined in RFC3986 ABNF rule "path-rootless" apply
-//;==============================================================================
-QM : '?' -> pushMode(MODE_QUERY); //first query parameter
-AMP : '&' -> pushMode(MODE_QUERY); //more query parameters
-STRING : '\'' -> more, pushMode(MODE_ODATA_STRING);
-
-GEOGRAPHY : G E O G R A P H Y SQUOTE -> pushMode(MODE_ODATA_GEO); //TODO make case insensitive
-GEOMETRY : G E O M E T R Y SQUOTE -> pushMode(MODE_ODATA_GEO);
-
-//Letters for case insensitivity
-fragment A : 'A'|'a';
-fragment B : 'B'|'b';
-fragment D : 'D'|'d';
-fragment E : 'E'|'e';
-fragment F : 'F'|'f';
-fragment G : 'G'|'g';
-fragment H : 'H'|'h';
-fragment I : 'I'|'i';
-fragment L : 'L'|'l';
-fragment M : 'M'|'m';
-fragment N : 'N'|'n';
-fragment O : 'O'|'o';
-fragment P : 'P'|'p';
-fragment R : 'R'|'r';
-fragment S : 'S'|'s';
-fragment T : 'T'|'t';
-fragment U : 'U'|'u';
-fragment Y : 'Y'|'y';
-fragment Z : 'Z'|'z';
-
-//special chars
-OPEN : '(' | '%28';
-CLOSE : ')' | '%29';
-COMMA : ',' | '%2C';
-SLASH : '/';
-POINT : '.';
-AT : '@';
-EQ : '=' ;
-STAR : '*';
-SEMI : ';';
-FRAGMENT : '#';
-
-EQ_sq : '=' -> type(EQ);
-AMP_sq : '&' -> type(AMP), popMode;
-fragment WS : ( ' ' | '%09' | '%20' | '%09' );
-WSP : WS+;
-
-//alpha stuff
-fragment ALPHA : 'a'..'z' | 'A'..'Z';
-fragment ALPHA_A_TO_F : 'a'..'f' | 'A'..'F';
-fragment DIGIT : '0'..'9';
-fragment DIGITS : DIGIT+;
-fragment HEXDIG : DIGIT | ALPHA_A_TO_F;
-fragment ODI_LEADINGCHARACTER : ALPHA | '_'; //TODO; add Unicode characters from the categories L or Nl
-fragment ODI_CHARACTER : ALPHA | '_' | DIGIT; //TODO; add Unicode characters from the categories L, Nl, Nd, Mn, Mc, Pc, or Cf
-
-//helper for date/time values
-fragment ONE_TO_NINE : '1'..'9';
-fragment ZERO_TO_FIFTYNINE : ('0'..'5') DIGIT;
-fragment FRACTIONALSECONDS : DIGIT+;
-fragment SECOND : ZERO_TO_FIFTYNINE;
-fragment MINUTE : ZERO_TO_FIFTYNINE;
-fragment HOUR : ('0' | '1') DIGIT | '2' ( '0'..'3');
-fragment DAY : '0' '1'..'9' | ('1'|'2') DIGIT | '3' ('0'|'1');
-fragment MONTH : '0' ONE_TO_NINE | '1' ( '0' | '1' | '2' );
-fragment YEAR : ('-')? ( '0' DIGIT DIGIT DIGIT | ONE_TO_NINE DIGIT DIGIT DIGIT );
-
-//tag start with $
-BATCH : '$batch';
-ENTITY : '$entity';
-METADATA : '$metadata';
-
-ALL : '$all';
-CROSSJOIN : '$crossjoin';
-
-VALUE : '$value';
-REF : '$ref';
-COUNT : '$count';
-
-//inlined query parameters ( e.g. $skip)
-SKIP_INLINE : '$skip';
-FILTER_INLINE : '$filter';
-ORDERBY_INLINE: '$orderby';
-SEARCH_INLINE : '$search'-> pushMode(MODE_SYSTEM_QUERY_SEARCH);
-
-
-
-//rest
-NULLVALUE : 'null';
-
-TRUE : 'true';
-FALSE : 'false';
-BOOLEAN : T R U E | F A L S E;
-PLUS : '+';
-SIGN : PLUS | '%2B' |'-';
-INT : SIGN? DIGITS;
-DECIMAL : INT '.' DIGITS ('e' SIGN? DIGITS)?;
-
-//primary types
-BINARY : B I N A R Y SQUOTE (HEXDIG HEXDIG)* SQUOTE;
-DATE : D A T E SQUOTE YEAR '-' MONTH '-' DAY SQUOTE;
-DATETIMEOFFSET : D A T E T I M E O F F S E T SQUOTE YEAR '-' MONTH '-' DAY T HOUR ':' MINUTE ( ':' SECOND ( '.' FRACTIONALSECONDS )? )? ( Z | SIGN HOUR ':' MINUTE ) SQUOTE;
-fragment DUSECONDFRAG : DIGITS ('.' DIGITS)? 'S';
-fragment DUTIMEFRAG : 'T' (
- ( DIGITS 'H' (DIGITS 'M')? DUSECONDFRAG?)
- | (DIGITS 'M' DUSECONDFRAG?)
- | DUSECONDFRAG
- );
-fragment DUDAYTIMEFRAG : DIGITS 'D' DUTIMEFRAG? | DUTIMEFRAG;
-DURATION : D U R A T I O N SQUOTE '-'? 'P' DUDAYTIMEFRAG SQUOTE;
-TIMEOFDAY : T I M E O F D A Y SQUOTE HOUR ':' MINUTE ( ':' SECOND ( '.' FRACTIONALSECONDS )? )? SQUOTE;
-fragment GUIDVALUE : HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG'-'
- HEXDIG HEXDIG HEXDIG HEXDIG '-'
- HEXDIG HEXDIG HEXDIG HEXDIG '-'
- HEXDIG HEXDIG HEXDIG HEXDIG '-'
- HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG;
-GUID : G U I D SQUOTE GUIDVALUE SQUOTE;
-
-//expression tokens
-ASC : 'asc';
-DESC : 'desc';
-MUL : 'mul';
-DIV : 'div';
-MOD : 'mod';
-ADD : 'add';
-SUB : 'sub';
-GT : 'gt';
-GE : 'ge';
-LT : 'lt';
-LE : 'le';
-EQ_ALPHA : 'eq';
-NE : 'ne';
-AND : 'and';
-OR : 'or';
-ISOF : 'isof';
-NOT : 'not';
-MINUS :'-';
-ROOT : '$root/';
-NANINFINITY : 'NaN' | '-INF' | 'INF';
-
-IMPLICIT_VARIABLE_EXPR : '$it';
-LEVELS : '$levels';
-
-CONTAINS_WORD : 'contains(';
-STARTSWITH_WORD : 'startswith(';
-ENDSWITH_WORD : 'endswith(';
-LENGTH_WORD : 'length(';
-INDEXOF_WORD : 'indexof(';
-SUBSTRING_WORD : 'substring(';
-TOLOWER_WORD : 'tolower(';
-TOUPPER_WORD : 'toupper(';
-TRIM_WORD : 'trim(';
-CONCAT_WORD : 'concat(';
-YEAR_WORD : 'year(';
-MONTH_WORD : 'month(';
-DAY_WORD : 'day(';
-HOUR_WORD : 'hour(';
-MINUTE_WORD : 'minute(';
-SECOND_WORD : 'second(';
-FRACTIONALSECONDS_WORD : 'fractionalseconds(';
-TOTALSECONDS_WORD : 'totalseconds(';
-DATE_WORD : 'date(';
-TIME_WORD : 'time(';
-TOTALOFFSETMINUTES_WORD : 'totaloffsetminutes(';
-
-MINDATETIME_WORD : 'mindatetime(';
-MAXDATETIME_WORD : 'maxdatetime(';
-NOW_WORD : 'now(';
-
-ROUND_WORD : 'round(';
-FLOOR_WORD : 'floor(';
-CEILING_WORD : 'ceiling(';
-
-GEO_DISTANCE_WORD : 'geo.distance(';
-GEO_LENGTH_WORD : 'geo.length(';
-GEO_INTERSECTS_WORD : 'geo.intersects(';
-ISOF_WORD : 'isof(';
-CAST_WORD : 'cast(';
-
-COLLECTION_REF : 'Collection($ref)';
-COLLECTION_ENTITY_TYPE : 'Collection(Edm.EntityType)';
-COLLECTION_COMPLEX_TYPE : 'Collection(Edm.ComplexType)';
-COLLECTION : 'Collection(' -> type(COLLECTION);
-
-//used in fragment only
-DELETED_ENTITY : '$deletedEntity';
-LINK : '$link';
-DELETED_LINK : '$deletedLink';
-DELTA : '$delta';
-//ENTITY_IN_FRAGMENT : '/$entity';
-
-
-LEVELSMAX : '$levels=max';
-
-
-//ODI
-ODATAIDENTIFIER : ODI_LEADINGCHARACTER (ODI_CHARACTER)*;
-
-//;==============================================================================
-// Mode "QUERY": Processes everything between the first '?' and the '#' char
-// On '?' the next mode "FRAGMENT" is used
-// The percent encoding rules a defined in RFC3986 ABNF rule "query" apply
-mode MODE_QUERY;
-//;==============================================================================
-
-FRAGMENT_q : '#' -> type(FRAGMENT);
-FILTER : '$filter' -> pushMode(DEFAULT_MODE);
-ORDERBY : '$orderby' -> pushMode(DEFAULT_MODE);
-EXPAND : '$expand' -> pushMode(DEFAULT_MODE);
-SELECT : '$select' -> pushMode(DEFAULT_MODE);
-SKIP : '$skip' -> pushMode(DEFAULT_MODE);
-SKIPTOKEN : '$skiptoken' -> pushMode(MODE_SYSTEM_QUERY_REST_QCHAR_NO_AMP);
-
-TOP : '$top' -> pushMode(DEFAULT_MODE);
-LEVELS_q : '$levels' -> type(LEVELS), pushMode(DEFAULT_MODE);
-FORMAT : '$format' -> pushMode(MODE_SYSTEM_QUERY_PCHAR);
-COUNT_q : '$count' -> type(COUNT), pushMode(DEFAULT_MODE);
-REF_q : '$ref' -> type(REF);
-VALUE_q : '$value' -> type(VALUE);
-
-ID : '$id'-> pushMode(MODE_SYSTEM_QUERY_REST_QCHAR_NO_AMP);
-
-SEARCH : '$search'-> pushMode(MODE_SYSTEM_QUERY_SEARCH);
-
-EQ_q : '=' -> type(EQ);
-
-AMP_q : '&' -> type(AMP);
-
-CUSTOMNAME : ~[&=@$] ~[&=]*;
-CUSTOMVALUE : ~[&=]+;
-
-//;==============================================================================
-mode MODE_SYSTEM_QUERY_PCHAR;
-//;==============================================================================
-
-AMP_sqp : '&' -> popMode,popMode;
-
-//fragment EQ_sqp : '=';
-fragment ALPHA_sqp : 'a'..'z'|'A'..'Z';
-fragment A_TO_F_sqp : 'a'..'f'|'A'..'F';
-fragment DIGIT_sqp : '0'..'9';
-fragment HEXDIG_sqp : DIGIT_sqp | A_TO_F_sqp;
-fragment PCT_ENCODED_sqp : '%' HEXDIG_sqp HEXDIG_sqp;
-fragment SUB_DELIMS_sqp : '$' | '&' | '\'' | EQ_sqp | OTHER_DELIMS_sqp;
-fragment OTHER_DELIMS_sqp : '!' | '(' | ')' | '*' | '+' | ',' | ';';
-fragment UNRESERVED_sqp : ALPHA_sqp | DIGIT_sqp | '-' |'.' | '_' | '~';
-fragment PCHAR : UNRESERVED_sqp | PCT_ENCODED_sqp | SUB_DELIMS_sqp | ':' | '@';
-fragment PCHARSTART : UNRESERVED_sqp | PCT_ENCODED_sqp | '$' | '&' | '\'' | OTHER_DELIMS_sqp | ':' | '@';
-
-
-ATOM : [Aa][Tt][Oo][Mm];
-JSON : [Jj][Ss][Oo][Nn];
-XML : [Xx][Mm][Ll];
-
-PCHARS : PCHARSTART PCHAR*;
-
-SLASH_sqp : '/' -> type(SLASH);
-EQ_sqp : '=' -> type(EQ);
-
-//;==============================================================================
-mode MODE_SYSTEM_QUERY_REST_QCHAR_NO_AMP;
-//;==============================================================================
-
-AMP_sqr : '&' -> type(AMP), popMode;
-FRAGMENT_sqr : '#' -> popMode;
-/*
-fragment ALPHA_sqr : 'a'..'z'|'A'..'Z';
-fragment A_TO_F_sqr : 'a'..'f'|'A'..'F';
-fragment DIGIT_sqr : '0'..'9';
-fragment HEXDIG_sqr : DIGIT_sqr | A_TO_F_sqr;
-fragment PCT_ENCODED_sqr : '%' HEXDIG_sqr HEXDIG_sqr;
-fragment UNRESERVED_sqr : ALPHA_sqr | DIGIT_sqr | '-' |'.' | '_' | '~';
-fragment OTHER_DELIMS_sqr : '!' | '(' | ')' | '*' | '+' | ',' | ';';
-fragment QCHAR_NO_AMP_sqr : UNRESERVED_sqr | PCT_ENCODED_sqr | OTHER_DELIMS_sqr | ':' | '@' | '/' | '?' | '$' | '\'' | '=';
-fragment QCHAR_NO_AMP_EQ_sqr : UNRESERVED_sqr | PCT_ENCODED_sqr | OTHER_DELIMS_sqr | ':' | '@' | '/' | '?' | '$' | '\'' ;
-*/
-
-EQ_sqr : '=' -> type(EQ);
-REST : ~[&#=] ~[&#]*;
-
-
-
-//;==============================================================================
-mode MODE_SYSTEM_QUERY_SEARCH;
-//;==============================================================================
-
-fragment ALPHA_sqc : 'a'..'z'|'A'..'Z';
-fragment WS_sqc : ( SP_g | HTAB_g | '%20' | '%09' );
-fragment DQUOTE : '\u0022';
-NOT_sqc : 'NOT' -> type(NOT);
-AND_sqc : 'AND' -> type(AND);
-OR_sqc : 'OR' -> type(OR);
-EQ_sqc : '=' -> type(EQ);
-
-WSP_sqc : WS_sqc+ -> type(WSP);
-
-
-QUOTATION_MARK : DQUOTE | '%22';
-
-REF_sqc : '$ref' -> type(REF);
-
-SEARCHWORD : ALPHA_sqc+;
-SEARCHPHRASE : QUOTATION_MARK /*QCHAR_NO_AMP_DQUOTE+*/ ~[&"]* QUOTATION_MARK -> popMode;
-
-
-//;==============================================================================
-mode MODE_ODATA_STRING;
-//;==============================================================================
-
-fragment SQUOTE_s : '\'';
-STRING_s : ('\'\'' | ~[\u0027] )* SQUOTE_s -> type(STRING), popMode;
-
-//;==============================================================================
-mode MODE_ODATA_GEO;
-//;==============================================================================
-
-fragment C_g : 'c'|'C';
-fragment D_g : 'd'|'D';
-fragment E_g : 'e'|'E';
-fragment G_g : 'g'|'G';
-fragment H_g : 'h'|'H';
-fragment I_g : 'i'|'I';
-fragment L_g : 'l'|'L';
-fragment M_g : 'm'|'M';
-fragment N_g : 'n'|'N';
-fragment O_g : 'o'|'O';
-fragment P_g : 'p'|'P';
-fragment R_g : 'r'|'R';
-fragment S_g : 's'|'S';
-fragment T_g : 't'|'T';
-fragment U_g : 'u'|'U';
-fragment Y_g : 'y'|'Y';
-
-fragment SP_g : ' ';//'\u0020'; // a simple space
-fragment HTAB_g : '%09';
-fragment WS_g : ( ' ' | HTAB_g | '%20' | '%09' );
-
-OPEN_g : ('(' | '%28') -> type(OPEN);
-CLOSE_g : (')' | '%29') -> type(CLOSE);
-COMMA_g : (',' | '%2C') -> type(COMMA);
-WSP_g : WS_g+ -> type(WSP);
-POINT_g : '.' -> type(POINT);
-AT_g : '@' -> type(AT);
-SEMI_g : (';' | '%3B') -> type(SEMI);
-EQ_g : '=' -> type(EQ);
-
-fragment DIGIT_g : '0'..'9';
-fragment DIGITS_g : DIGIT_g+;
-SIGN_g : ('+' | '%2B' |'-') -> type(SIGN);
-INT_g : SIGN_g? DIGITS_g -> type(INT);
-DECIMAL_g : INT_g '.' DIGITS_g ('e' SIGN_g? DIGITS_g)? -> type(DECIMAL);
-COLLECTION_g : C_g O_g L_g L_g E_g C_g T_g I_g O_g N_g -> type(COLLECTION);
-LINESTRING : L_g I_g N_g E_g S_g T_g R_g I_g N_g G_g ;
-MULTILINESTRING : M_g U_g L_g T_g I_g L_g I_g N_g E_g S_g T_g R_g I_g N_g G_g;
-MULTIPOINT : M_g U_g L_g T_g I_g P_g O_g I_g N_g T_g ;
-MULTIPOLYGON : M_g U_g L_g T_g I_g P_g O_g L_g Y_g G_g O_g N_g;
-GEO_POINT : P_g O_g I_g N_g T_g;
-POLYGON : P_g O_g L_g Y_g G_g O_g N_g ;
-
-SRID : S_g R_g I_g D_g;
-
-SQUOTE : '\'' -> popMode;
[5/9] [OLINGO-63] Uri Parser: adoptions in lexer and parser,
create UriParserImpl to convert the parsetree into internal
structures, moved parser antlr part from .../olingo/producer/... to
.../olingo/odata4/producer
Posted by ko...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParserValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParserValidator.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParserValidator.java
index 2f0ec13..115e575 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParserValidator.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParserValidator.java
@@ -40,9 +40,9 @@ import org.antlr.v4.runtime.atn.ATNConfigSet;
import org.antlr.v4.runtime.atn.PredictionMode;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.misc.Interval;
-import org.apache.olingo.producer.core.uri.antlr.UriLexer;
-import org.apache.olingo.producer.core.uri.antlr.UriParserParser;
-import org.apache.olingo.producer.core.uri.antlr.UriParserParser.OdataRelativeUriEOFContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriLexer;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.OdataRelativeUriEOFContext;
/**
* @author d039346
@@ -221,7 +221,7 @@ public class ParserValidator {
parser.addParseListener(new TokenWriter());
}
// write always a error message in case of syntax errors
- parser.addErrorListener(new TraceErrorHandler<Object>());
+ //parser.addErrorListener(new TestErrorHandler<Object>());
// check error message if whether they are allowed or not
parser.addErrorListener(new ErrorCollector(this));
@@ -229,7 +229,7 @@ public class ParserValidator {
parser.setErrorHandler(new BailErrorStrategy());
// User the faster LL parsing
- parser.getInterpreter().setPredictionMode(PredictionMode.LL);
+ parser.getInterpreter().setPredictionMode(PredictionMode.SLL);
if (logLevel > 1) {
System.out.println("Step 1 (LL)");
}
@@ -252,7 +252,7 @@ public class ParserValidator {
}
// write always a error message in case of syntax errors
- parser.addErrorListener(new TraceErrorHandler<Object>());
+ parser.addErrorListener(new TestErrorHandler<Object>());
// check error message if whether they are allowed or not
parser.addErrorListener(new ErrorCollector(this));
@@ -260,7 +260,7 @@ public class ParserValidator {
parser.setErrorHandler(new DefaultErrorStrategy());
// User the slower SLL parsing
- parser.getInterpreter().setPredictionMode(PredictionMode.SLL);
+ parser.getInterpreter().setPredictionMode(PredictionMode.LL);
if (logLevel > 1) {
System.out.println("Step 2 (SLL)");
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TestErrorHandler.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TestErrorHandler.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TestErrorHandler.java
new file mode 100644
index 0000000..625ac5d
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TestErrorHandler.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * 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
+ *
+ * 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.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.testutil;
+
+import java.util.Collections;
+import java.util.List;
+
+
+
+import org.antlr.v4.runtime.BaseErrorListener;
+import org.antlr.v4.runtime.Parser;
+import org.antlr.v4.runtime.RecognitionException;
+import org.antlr.v4.runtime.Recognizer;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriLexer;
+
+public class TestErrorHandler<T> extends BaseErrorListener {
+ @Override
+ public void syntaxError(final Recognizer<?, ?> recognizer, final Object offendingSymbol,
+ final int line, final int charPositionInLine, final String msg, final RecognitionException e) {
+ System.err.println("-");
+ // check also http://stackoverflow.com/questions/14747952/ll-exact-ambig-detection-interpetation
+ List<String> stack = ((Parser) recognizer).getRuleInvocationStack();
+ Collections.reverse(stack);
+ System.err.println("rule stack: " + stack);
+ if (e != null && e.getOffendingToken() != null) {
+
+ // String lexerTokenName =TestSuiteLexer.tokenNames[e.getOffendingToken().getType()];
+ String lexerTokenName = "";
+ try {
+ lexerTokenName = UriLexer.tokenNames[e.getOffendingToken().getType()];
+ } catch (ArrayIndexOutOfBoundsException es) {
+ lexerTokenName = "token error";
+ }
+ System.err.println("line " + line + ":" + charPositionInLine + " at " +
+ offendingSymbol + "/" + lexerTokenName + ": " + msg);
+ } else {
+ System.err.println("line " + line + ":" + charPositionInLine + " at " + offendingSymbol + ": " + msg);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TokenValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TokenValidator.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TokenValidator.java
index 32410ff..30becaf 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TokenValidator.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TokenValidator.java
@@ -34,7 +34,7 @@ import org.antlr.v4.runtime.Recognizer;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.atn.ATNConfigSet;
import org.antlr.v4.runtime.dfa.DFA;
-import org.apache.olingo.producer.core.uri.antlr.UriLexer;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriLexer;
public class TokenValidator {
private List<? extends Token> tokens = null;
@@ -56,6 +56,7 @@ public class TokenValidator {
first();
exFirst();
+ logLevel = 0;
return this;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TraceErrorHandler.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TraceErrorHandler.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TraceErrorHandler.java
index 4d218ca..76dabb5 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TraceErrorHandler.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TraceErrorHandler.java
@@ -25,7 +25,7 @@ import org.antlr.v4.runtime.BaseErrorListener;
import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.Recognizer;
-import org.apache.olingo.producer.core.uri.antlr.UriLexer;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriLexer;
public class TraceErrorHandler<T> extends BaseErrorListener {
@Override
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourcePathValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourcePathValidator.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourcePathValidator.java
index b6a45bb..f68345e 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourcePathValidator.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourcePathValidator.java
@@ -20,70 +20,184 @@ package org.apache.olingo.odata4.producer.core.testutil;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+
+
+
+
+
+
+
+
+
import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmComplexType;
+import org.apache.olingo.odata4.commons.api.edm.EdmElement;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
import org.apache.olingo.odata4.producer.api.uri.UriPathInfoKind;
import org.apache.olingo.odata4.producer.core.uri.UriInfoImpl;
+import org.apache.olingo.odata4.producer.core.uri.UriInfoImplPath;
+import org.apache.olingo.odata4.producer.core.uri.UriKeyPredicateList;
+import org.apache.olingo.odata4.producer.core.uri.UriParserException;
import org.apache.olingo.odata4.producer.core.uri.UriParserImpl;
import org.apache.olingo.odata4.producer.core.uri.UriPathInfoImpl;
+import org.apache.olingo.odata4.producer.core.uri.UriPathInfoEntitySetImpl;
+
public class UriResourcePathValidator {
- UriInfoImpl uriInfo = null;
- UriPathInfoImpl uriPathInfo = null; // last
private Edm edm;
+ private UriInfoImpl uriInfo = null;
+ private UriPathInfoImpl uriPathInfo = null;
public UriResourcePathValidator setEdm(final Edm edm) {
this.edm = edm;
return this;
}
- public UriResourcePathValidator run(final String uri) {
- uriInfo = parseUri(uri);
- last();
+
+ public UriResourcePathValidator run(String uri) {
+ try {
+ uriInfo = new UriParserImpl(edm).ParseUri(uri);
+ } catch (UriParserException e) {
+ fail("Exception occured");
+ }
+
+ uriPathInfo = null;
+ if (uriInfo instanceof UriInfoImplPath) {
+ last();
+ }
return this;
}
- public UriResourcePathValidator isUriPathInfoKind(final UriPathInfoKind infoType) {
+ public UriResourcePathValidator isUriPathInfoKind(UriPathInfoKind infoType) {
assertNotNull(uriPathInfo);
assertEquals(infoType, uriPathInfo.getKind());
return this;
}
- private UriInfoImpl parseUri(final String uri) {
- UriParserImpl reader = new UriParserImpl();
- UriInfoImpl uriInfo = reader.readUri(uri, edm);
- return uriInfo;
- }
-
public UriResourcePathValidator last() {
- // TODO implement
- // uriPathInfo = uriInfo.getLastUriPathInfo();
+ if (uriInfo instanceof UriInfoImplPath) {
+ uriPathInfo = ((UriInfoImplPath) uriInfo).getLastUriPathInfo();
+ } else {
+ fail("UriInfo not instanceof UriInfoImplPath");
+ }
+
return this;
}
- public UriResourcePathValidator at(final int index) {
- try {
- // uriPathInfo = uriInfo.getUriPathInfo(index);
- } catch (IndexOutOfBoundsException ex) {
- uriPathInfo = null;
+
+ public UriResourcePathValidator at(int index) {
+ if (uriInfo instanceof UriInfoImplPath) {
+ try {
+ uriPathInfo = ((UriInfoImplPath) uriInfo).getUriPathInfo(index);
+ } catch (IndexOutOfBoundsException ex) {
+ uriPathInfo = null;
+ }
+ } else {
+ fail("UriInfo not instanceof UriInfoImplPath");
+
}
return this;
}
public UriResourcePathValidator first() {
- try {
- // uriPathInfo = uriInfo.getUriPathInfo(0);
- } catch (IndexOutOfBoundsException ex) {
- uriPathInfo = null;
+ if (uriInfo instanceof UriInfoImplPath) {
+ try {
+ uriPathInfo = ((UriInfoImplPath) uriInfo).getUriPathInfo(0);
+ } catch (IndexOutOfBoundsException ex) {
+ uriPathInfo = null;
+ }
+ } else {
+ fail("UriInfo not instanceof UriInfoImplPath");
+ }
+ return this;
+
+ }
+
+
+ /*
+ * blic void isKind(UriInfoKind batch) {
+ * // TODO assertEquals(batch, uriInfo.getKind());
+ * }
+ */
+ public UriResourcePathValidator isKeyPredicate(int index, String name, String value) {
+ if (uriPathInfo instanceof UriPathInfoEntitySetImpl) {
+ UriPathInfoEntitySetImpl info = (UriPathInfoEntitySetImpl) uriPathInfo;
+ UriKeyPredicateList keyPredicates = info.getKeyPredicates();
+ assertEquals(name, keyPredicates.getName(index));
+ assertEquals(value, keyPredicates.getValue(index));
+ }
+ return this;
+
+ }
+
+ public UriResourcePathValidator isType(FullQualifiedName type) {
+ EdmType actualType = uriPathInfo.getType();
+ if (actualType == null ) {
+ fail("type information not set");
+ }
+ assertEquals(type, new FullQualifiedName(actualType.getNamespace(), actualType.getName()));
+ return this;
+ }
+
+ public UriResourcePathValidator isCollection(boolean isCollection) {
+ EdmType actualType = uriPathInfo.getType();
+ if (actualType == null ) {
+ fail("type information not set");
+ }
+ assertEquals(isCollection, uriPathInfo.isCollection());
+ return this;
+ }
+
+ public UriResourcePathValidator isInitialType(FullQualifiedName type) {
+ EdmType actualType = uriPathInfo.getInitialType();
+ if (actualType == null ) {
+ fail("type information not set");
+ }
+ assertEquals(type, new FullQualifiedName(actualType.getNamespace(), actualType.getName()));
+ return this;
+ }
+
+
+ public UriResourcePathValidator isProperties(List<String> asList) {
+ assertNotNull(uriPathInfo);
+
+ int index = 0;
+ while (index < asList.size()) {
+ String propertyName = uriPathInfo.getProperty(index).getName();
+ assertEquals(asList.get(index), propertyName);
+ index++;
}
+
return this;
+
+
+ }
+
+ public void isKind(UriInfoKind kind) {
+
+ assertEquals(kind, uriInfo.getKind());
}
- public void isKind(final UriInfoKind batch) {
- assertEquals(batch, uriInfo.getKind());
+ public UriResourcePathValidator isProperty(int index, String name, FullQualifiedName type) {
+ if ( index >= uriPathInfo.getPropertyCount()) {
+ fail("not enougth properties in pathinfo found");
+ }
+ EdmElement property = uriPathInfo.getProperty(index);
+
+ assertEquals(name, property.getName());
+ assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
+ return this;
+
}
+
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestLexer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestLexer.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestLexer.java
new file mode 100644
index 0000000..8ac8c56
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestLexer.java
@@ -0,0 +1,429 @@
+/*******************************************************************************
+ * 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
+ *
+ * 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.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.uri.antlr;
+
+import org.antlr.v4.runtime.Lexer;
+import org.apache.olingo.odata4.producer.core.testutil.TokenValidator;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriLexer;
+import org.junit.Test;
+
+public class TestLexer {
+
+ private TokenValidator test = null;
+
+ private static final String cPCT_ENCODED = "%45%46%47" + "%22" + "%5C";// last two chars are not in
+ // cPCT_ENCODED_UNESCAPED
+ private static final String cPCT_ENCODED_UNESCAPED = "%45%46%47";
+ private static final String cUNRESERVED = "ABCabc123-._~";
+ private static final String cOTHER_DELIMS = "!()*+,;";
+ private static final String cSUB_DELIMS = "$&'=" + cOTHER_DELIMS;
+
+ // private static final String cPCTENCODEDnoSQUOTE = "%65%66%67";
+ // private static final String cPCHARnoSQUOTE = cUNRESERVED + cPCTENCODEDnoSQUOTE + cOTHER_DELIMS + "$&=:@";
+
+ private static final String cPCHAR = cUNRESERVED + cPCT_ENCODED + cSUB_DELIMS + ":@";
+
+ private static final String cQCHAR_UNESCAPED = cUNRESERVED + cPCT_ENCODED_UNESCAPED + cOTHER_DELIMS + ":@/?$'=";
+
+ public TestLexer() {
+ test = new TokenValidator();
+ }
+
+ @Test
+ public void test() {
+
+ test.globalMode(UriLexer.DEFAULT_MODE);
+
+ //test.run("ODI?$filter=geo.distance(geometry'SRID=0;Point(142.1 64.1)',geometry'SRID=0;Point(142.1 64.1)')");
+
+ // test.log(1).run("$filter='ABC'").isText("ABC").isType(UriLexer.STRING);
+ // test.log(1).run("ODI?$filter=1 add 2 mul 3");
+ // test.log(1).run("1 + 2 + 3");
+ // test.log(1).run("ODI?$filter=geography'SRID=0;Collection(LineString(142.1 64.1,3.14 2.78))'");
+ // test.log(1).run("ODI?$filter=1 mul 2 add 3");
+ // test.globalMode(UriLexer.MODE_QUERY);
+ // test.log(1).run("$entity?$id='A'&sdf=ssdf&$id=ABC");
+ // test.run("$skiptoken=top");
+
+ /*
+ * test.log(1).run("ODI?$filter=geo.intersects("
+ * + "geometry'SRID=0;Point(142.1 64.1)',"
+ * + "geometry'SRID=0;Polygon((1 1,1 1),(1 1,2 2,3 3,1 1))')");
+ */
+ }
+
+ // ;------------------------------------------------------------------------------
+ // ; 0. URI
+ // ;------------------------------------------------------------------------------
+
+ @Test
+ public void testUriTokens() {
+ test.globalMode(UriLexer.MODE_QUERY);
+ test.run("#").isText("#").isType(UriLexer.FRAGMENT);
+ test.run("$count").isText("$count").isType(UriLexer.COUNT);
+ test.run("$ref").isText("$ref").isType(UriLexer.REF);
+ test.run("$value").isText("$value").isType(UriLexer.VALUE);
+ }
+
+ // ;------------------------------------------------------------------------------
+ // ; 2. Query Options
+ // ;------------------------------------------------------------------------------
+ @Test
+ public void testQueryOptionsTokens() {
+
+ test.globalMode(UriLexer.MODE_QUERY);
+ test.run("$skip=1").isAllText("$skip=1").isType(UriLexer.SKIP);
+ test.run("$skip=2").isAllText("$skip=2").isType(UriLexer.SKIP);
+ test.run("$skip=123").isAllText("$skip=123").isType(UriLexer.SKIP);
+
+ // TODO check and add error handling
+ // test.run("$skip=A").isExType(LexerNoViableAltException.class);
+
+ test.run("$top=1").isAllText("$top=1").isType(UriLexer.TOP);
+ test.run("$top=2").isAllText("$top=2").isType(UriLexer.TOP);
+ test.run("$top=123").isAllText("$top=123").isType(UriLexer.TOP);
+ // TODO check and add error handling
+ // test.run("$top=A").isExType(LexerNoViableAltException.class);
+
+ test.run("$levels=1").isAllText("$levels=1").isType(UriLexer.LEVELS);
+ test.run("$levels=2").isAllText("$levels=2").isType(UriLexer.LEVELS);
+ test.run("$levels=123").isAllText("$levels=123").isType(UriLexer.LEVELS);
+ test.run("$levels=max").isAllText("$levels=max").isType(UriLexer.LEVELS);
+ // TODO check and add error handling
+ // test.run("$levels=A").isExType(LexerNoViableAltException.class);
+
+ test.run("$format=atom").isAllText("$format=atom").isType(UriLexer.FORMAT);
+ test.run("$format=json").isAllText("$format=json").isType(UriLexer.FORMAT);
+ test.run("$format=xml").isAllText("$format=xml").isType(UriLexer.FORMAT);
+ test.run("$format=abc/def").isAllText("$format=abc/def").isType(UriLexer.FORMAT);
+ // TODO check and add error handling
+ // test.run("$format=abc").isExType(LexerNoViableAltException.class);
+
+ test.run("$id=123").isAllText("$id=123").isType(UriLexer.ID);
+ test.run("$id=ABC").isAllText("$id=ABC").isType(UriLexer.ID);
+
+ test.run("$skiptoken=ABC").isAllText("$skiptoken=ABC").isType(UriLexer.SKIPTOKEN);
+ test.run("$skiptoken=ABC").isAllText("$skiptoken=ABC").isType(UriLexer.SKIPTOKEN);
+
+ test.run("$search=\"ABC\"").isAllText("$search=\"ABC\"").isType(UriLexer.SEARCH);
+ test.run("$search=ABC").isAllText("$search=ABC").isType(UriLexer.SEARCH);
+ test.run("$search=\"A%20B%20C\"").isAllText("$search=\"A%20B%20C\"").isType(UriLexer.SEARCH);
+ }
+
+ // ;------------------------------------------------------------------------------
+ // ; 4. Expressions
+ // ;------------------------------------------------------------------------------
+ @Test
+ public void testQueryExpressions() {
+ test.globalMode(Lexer.DEFAULT_MODE);
+ // assertEquals("expected","actual");
+
+ test.run("$it").isText("$it").isType(UriLexer.IMPLICIT_VARIABLE_EXPR);
+ // TODO check and add error handling
+ // test.run("$itabc").isText("$it").isType(UriLexer.IMPLICIT_VARIABLE_EXPR);
+
+ test.run("$filter=contains(").at(2).isText("contains(").isType(UriLexer.CONTAINS_WORD);
+
+ test.run("$filter=containsabc").at(2).isText("containsabc")
+ .isType(UriLexer.ODATAIDENTIFIER); // test that this is a ODI
+
+ test.run("$filter=startswith(").at(2).isText("startswith(").isType(UriLexer.STARTSWITH_WORD);
+ test.run("$filter=endswith(").at(2).isText("endswith(").isType(UriLexer.ENDSWITH_WORD);
+ test.run("$filter=length(").at(2).isText("length(").isType(UriLexer.LENGTH_WORD);
+ test.run("$filter=indexof(").at(2).isText("indexof(").isType(UriLexer.INDEXOF_WORD);
+ test.run("$filter=substring(").at(2).isText("substring(").isType(UriLexer.SUBSTRING_WORD);
+ test.run("$filter=tolower(").at(2).isText("tolower(").isType(UriLexer.TOLOWER_WORD);
+ test.run("$filter=toupper(").at(2).isText("toupper(").isType(UriLexer.TOUPPER_WORD);
+ test.run("$filter=trim(").at(2).isText("trim(").isType(UriLexer.TRIM_WORD);
+ test.run("$filter=concat(").at(2).isText("concat(").isType(UriLexer.CONCAT_WORD);
+
+ }
+
+
+ // ;------------------------------------------------------------------------------
+ // ; 5. JSON format for function parameters
+ // ;------------------------------------------------------------------------------
+
+ @Test
+ public void testQueryJSON_and_otheres() {
+ // QUOTATION_MARK
+ //test.run("\"").isText("\"").isType(UriLexer.QUOTATION_MARK);
+ //test.run("%22").isText("%22").isType(UriLexer.QUOTATION_MARK);
+
+ // Lexer rule QCHAR_UNESCAPED
+ test.run("\"abc\"").isText("\"abc\"").isType(UriLexer.STRING_IN_JSON);
+
+ // Lexer rule QCHAR_JSON_SPECIAL
+ /*
+ test.run("\"" + cQCHAR_JSON_SPECIAL + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
+
+ // Lexer rule CHAR_IN_JSON
+ test.run("\"" + cQCHAR_UNESCAPED + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
+ test.run("\"" + cQCHAR_JSON_SPECIAL + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
+
+ // Lexer rule ESCAPE CHAR_IN_JSON
+ test.run("\"" + cESCAPE + cQUOTATION_MARK + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
+ test.run("\"" + cESCAPE + cESCAPE + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
+ test.run("\"" + cESCAPE + "/" + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
+ test.run("\"" + cESCAPE + "%2F" + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
+ test.run("\"" + cESCAPE + "b" + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
+ test.run("\"" + cESCAPE + "f" + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
+ test.run("\"" + cESCAPE + "n" + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
+ test.run("\"" + cESCAPE + "r" + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
+ test.run("\"" + cESCAPE + "t" + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
+ test.run("\"" + cESCAPE + "u12AB" + "\"").isInput().isType(UriLexer.STRING_IN_JSON);
+ */
+ }
+
+ // ;------------------------------------------------------------------------------
+ // ; 6. Names and identifiers
+ // ;------------------------------------------------------------------------------
+
+ @Test
+ public void testNamesAndIdentifiers() {
+ /*
+ test.run("Binary").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run("Boolean").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run("Byte").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run("Date").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run("DateTimeOffset").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run("Decimal").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run("Double").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run("Duration").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run("Guid").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run("Int16").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run("Int32").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run("Int64").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run("SByte").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run("Single").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run("Stream").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run("String").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run("TimeOfDay").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+
+ test.run("Geography").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run("Geometry").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+
+ String g = "Geography";
+ test.run(g ).isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run(g + "Collection").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run(g + "LineString").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run(g + "MultiLineString").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run(g + "MultiPoint").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run(g + "MultiPolygon").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run(g + "Point").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run(g + "LineString").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run(g + "Polygon").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+
+ g = "Geometry";
+ test.run(g ).isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run(g + "Collection").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run(g + "LineString").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run(g + "MultiLineString").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run(g + "MultiPoint").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run(g + "MultiPolygon").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run(g + "Point").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run(g + "LineString").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ test.run(g + "Polygon").isInput().isType(UriLexer.PRIMITIVETYPENAME);
+ */
+ }
+
+ @Test
+ public void testNameClaches() {
+ /*test.run("Collection").isInput().isType(UriLexer.COLLECTION_CS_FIX);
+ test.run("LineString").isInput().isType(UriLexer.LINESTRING_CS_FIX);
+ test.run("MultiLineString").isInput().isType(UriLexer.MULTILINESTRING_CS_FIX);
+ test.run("MultiPoint").isInput().isType(UriLexer.MULTIPOINT_CS_FIX);
+ test.run("MultiPolygon").isInput().isType(UriLexer.MULTIPOLYGON_CS_FIX);
+ test.run("Point").isInput().isType(UriLexer.POINT_CS_FIX);
+ test.run("Polygon").isInput().isType(UriLexer.POLYGON_CS_FIX);
+ test.run("Srid").isInput().isType(UriLexer.SRID_CS);*/
+ }
+
+ // ;------------------------------------------------------------------------------
+ // ; 7. Literal Data Values
+ // ;------------------------------------------------------------------------------
+
+ @Test
+ public void testLiteralDataValues() {
+ test.globalMode(Lexer.DEFAULT_MODE);
+ // null
+ test.run("null").isInput().isType(UriLexer.NULLVALUE);
+
+ // binary
+ test.run("binary'ABCD'").isInput().isType(UriLexer.BINARY);
+ test.run("BiNaRy'ABCD'").isInput().isType(UriLexer.BINARY);
+
+ // not a binary TODO add error handling
+ test.run("BiNaRy'ABCDA'")
+ .at(0).isText("BiNaRy").isType(UriLexer.ODATAIDENTIFIER)
+ .at(1).isText("'ABCDA'").isType(UriLexer.STRING);
+
+ // boolean
+ test.run("true").isInput().isType(UriLexer.TRUE);
+ test.run("false").isInput().isType(UriLexer.FALSE);
+ test.run("TrUe").isInput().isType(UriLexer.BOOLEAN);
+ test.run("FaLsE").isInput().isType(UriLexer.BOOLEAN);
+
+ // Lexer rule INT
+ test.run("123").isInput().isType(UriLexer.INT);
+ test.run("123456789").isInput().isType(UriLexer.INT);
+ test.run("+123").isInput().isType(UriLexer.INT);
+ test.run("+123456789").isInput().isType(UriLexer.INT);
+ test.run("-123").isInput().isType(UriLexer.INT);
+ test.run("-123456789").isInput().isType(UriLexer.INT);
+
+ // Lexer rule DECIMAL
+ test.run("0.1").isInput().isType(UriLexer.DECIMAL);
+ test.run("1.1").isInput().isType(UriLexer.DECIMAL);
+ test.run("+0.1").isInput().isType(UriLexer.DECIMAL);
+ test.run("+1.1").isInput().isType(UriLexer.DECIMAL);
+ test.run("-0.1").isInput().isType(UriLexer.DECIMAL);
+ test.run("-1.1").isInput().isType(UriLexer.DECIMAL);
+
+ // Lexer rule EXP
+ test.run("1.1e+1").isInput().isType(UriLexer.DECIMAL);
+ test.run("1.1e-1").isInput().isType(UriLexer.DECIMAL);
+
+ test.run("NaN").isInput().isType(UriLexer.NANINFINITY);
+ test.run("-INF").isInput().isType(UriLexer.NANINFINITY);
+ test.run("INF").isInput().isType(UriLexer.NANINFINITY);
+
+ // Lexer rule GUID
+ test.run("1234ABCD-12AB-23CD-45EF-123456780ABC").isInput().isType(UriLexer.GUID);
+ test.run("1234ABCD-12AB-23CD-45EF-123456780ABC").isInput().isType(UriLexer.GUID);
+
+ // Lexer rule DATE
+ test.run("2013-11-15").isInput().isType(UriLexer.DATE);
+
+ // Lexer rule DATETIMEOFFSET
+ test.run("2013-11-15T13:35Z").isInput().isType(UriLexer.DATETIMEOFFSET);
+ test.run("2013-11-15T13:35:10Z").isInput().isType(UriLexer.DATETIMEOFFSET);
+ test.run("2013-11-15T13:35:10.1234Z").isInput().isType(UriLexer.DATETIMEOFFSET);
+
+ test.run("2013-11-15T13:35:10.1234+01:30").isInput().isType(UriLexer.DATETIMEOFFSET);
+ test.run("2013-11-15T13:35:10.1234-01:12").isInput().isType(UriLexer.DATETIMEOFFSET);
+
+ test.run("2013-11-15T13:35Z").isInput().isType(UriLexer.DATETIMEOFFSET);
+
+ // Lexer rule DURATION
+ test.run("duration'PT67S'").isInput().isType(UriLexer.DURATION);
+ test.run("duration'PT67.89S'").isInput().isType(UriLexer.DURATION);
+
+ test.run("duration'PT5M'").isInput().isType(UriLexer.DURATION);
+ test.run("duration'PT5M67S'").isInput().isType(UriLexer.DURATION);
+ test.run("duration'PT5M67.89S'").isInput().isType(UriLexer.DURATION);
+
+ test.run("duration'PT4H'").isInput().isType(UriLexer.DURATION);
+ test.run("duration'PT4H67S'").isInput().isType(UriLexer.DURATION);
+ test.run("duration'PT4H67.89S'").isInput().isType(UriLexer.DURATION);
+ test.run("duration'PT4H5M'").isInput().isType(UriLexer.DURATION);
+ test.run("duration'PT4H5M67S'").isInput().isType(UriLexer.DURATION);
+ test.run("duration'PT4H5M67.89S'").isInput().isType(UriLexer.DURATION);
+
+ test.run("duration'P3D'");
+ test.run("duration'P3DT67S'").isInput().isType(UriLexer.DURATION);
+ test.run("duration'P3DT67.89S'").isInput().isType(UriLexer.DURATION);
+ test.run("duration'P3DT5M'").isInput().isType(UriLexer.DURATION);
+ test.run("duration'P3DT5M67S'").isInput().isType(UriLexer.DURATION);
+ test.run("duration'P3DT5M67.89S'").isInput().isType(UriLexer.DURATION);
+ test.run("duration'P3DT4H'").isInput().isType(UriLexer.DURATION);
+ test.run("duration'P3DT4H67S'").isInput().isType(UriLexer.DURATION);
+ test.run("duration'P3DT4H67.89S'").isInput().isType(UriLexer.DURATION);
+ test.run("duration'P3DT4H5M'").isInput().isType(UriLexer.DURATION);
+ test.run("duration'P3DT4H5M67S'").isInput().isType(UriLexer.DURATION);
+ test.run("duration'P3DT4H5M67.89S'").isInput().isType(UriLexer.DURATION);
+
+ test.run("DuRaTiOn'P3DT4H5M67.89S'").isInput().isType(UriLexer.DURATION);
+ test.run("DuRaTiOn'-P3DT4H5M67.89S'").isInput().isType(UriLexer.DURATION);
+
+ test.run("20:00").isInput().isType(UriLexer.TIMEOFDAY);
+ test.run("20:15:01").isInput().isType(UriLexer.TIMEOFDAY);
+ test.run("20:15:01.02").isInput().isType(UriLexer.TIMEOFDAY);
+
+ test.run("20:15:01.02").isInput().isType(UriLexer.TIMEOFDAY);
+
+ // String
+ test.run("'ABC'").isText("'ABC'").isType(UriLexer.STRING);
+ test.run("'A%20C'").isInput().isType(UriLexer.STRING);
+ test.run("'%20%20%20ABC'").isInput().isType(UriLexer.STRING);
+
+ }
+
+ /*
+ * // ;------------------------------------------------------------------------------
+ * // ; 0. misc
+ * // ;------------------------------------------------------------------------------
+ *
+ * @Test
+ * public void testCriticalOrder() {
+ * // Test lexer rule STRING
+ * test.run("'abc'").isInput().isType(UriLexer.STRING);
+ *
+ * // Test lexer rule SEARCHWORD
+ * test.run("abc", true).isInput().isType(UriLexer.SEARCHWORD);
+ *
+ * // Test lexer rule SEARCHPHRASE
+ * test.run("\"abc\"", true).isInput().isType(UriLexer.SEARCHPHRASE);
+ *
+ * // Test lexer rule ODATAIDENTIFIER
+ * test.run("abc").isInput().isType(UriLexer.ODATAIDENTIFIER);
+ *
+ * test.run("\"abc\"").isInput().isType(UriLexer.STRING_IN_JSON);
+ * }
+ */
+ @Test
+ public void testDelims() {
+ String reserved = "/";
+ test.globalMode(UriLexer.MODE_QUERY);
+ // Test lexer rule UNRESERVED
+ test.run("$format=A/" + cUNRESERVED).isAllInput().isType(UriLexer.FORMAT);
+ test.run("$format=A/" + cUNRESERVED + reserved).isType(UriLexer.FORMAT).at(4).isText(cUNRESERVED);
+ // Test lexer rule PCT_ENCODED
+ test.run("$format=A/" + cPCT_ENCODED).isAllInput().isType(UriLexer.FORMAT);
+ test.run("$format=A/" + cPCT_ENCODED + reserved).isType(UriLexer.FORMAT).at(4).isText(cPCT_ENCODED);
+ // Test lexer rule SUB_DELIMS
+ test.run("$format=A/" + cSUB_DELIMS).isAllInput().isType(UriLexer.FORMAT);
+ test.run("$format=A/" + cSUB_DELIMS + reserved).isType(UriLexer.FORMAT).at(4).isText(cSUB_DELIMS);
+ // Test lexer rule PCHAR rest
+ test.run("$format=A/:@").isAllText("$format=A/:@").isType(UriLexer.FORMAT);
+ test.run("$format=A/:@" + reserved).isType(UriLexer.FORMAT).at(4).isText(":@");
+ // Test lexer rule PCHAR all
+ test.run("$format=" + cPCHAR + "/" + cPCHAR).isAllInput().isType(UriLexer.FORMAT);
+ test.run("$format=" + cPCHAR + "/" + cPCHAR + reserved)
+ .isType(UriLexer.FORMAT).at(4)
+ .isText(cPCHAR);
+
+ // Test lexer rule QCHAR_NO_AMP
+ String amp = "&";
+ // Test lexer rule UNRESERVED
+ test.run("$id=" + cUNRESERVED).isAllInput().isType(UriLexer.ID);
+ test.run("$id=" + cUNRESERVED + amp).isType(UriLexer.ID).at(2).isText(cUNRESERVED);
+ // Test lexer rule PCT_ENCODED
+ test.run("$id=" + cPCT_ENCODED).isAllInput().isType(UriLexer.ID);
+ test.run("$id=" + cPCT_ENCODED + amp).isType(UriLexer.ID).at(2).isText(cPCT_ENCODED);
+ // Test lexer rule OTHER_DELIMS
+ test.run("$id=" + cOTHER_DELIMS).isAllInput().isType(UriLexer.ID);
+ test.run("$id=" + cOTHER_DELIMS + amp).isType(UriLexer.ID).at(2).isText(cOTHER_DELIMS);
+ // Lexer rule QCHAR_NO_AMP rest
+ test.run("$id=:@/?$'=").isAllText("$id=:@/?$'=").isType(UriLexer.ID);
+ test.run("$id=:@/?$'=" + amp).isType(UriLexer.ID).at(2).isText(":@/?$'=");
+
+ }
+
+}
[2/9] [OLINGO-63] Uri Parser: adoptions in lexer and parser,
create UriParserImpl to convert the parsetree into internal
structures, moved parser antlr part from .../olingo/producer/... to
.../olingo/odata4/producer
Posted by ko...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/producer/core/uri/antlr/TestParser.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/producer/core/uri/antlr/TestParser.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/producer/core/uri/antlr/TestParser.java
deleted file mode 100644
index f1385a3..0000000
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/producer/core/uri/antlr/TestParser.java
+++ /dev/null
@@ -1,1448 +0,0 @@
-/*******************************************************************************
- * 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
- *
- * 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.
- ******************************************************************************/
-package org.apache.olingo.producer.core.uri.antlr;
-
-import org.apache.olingo.odata4.producer.core.testutil.ParserValidator;
-import org.junit.Test;
-
-/**
- * The class {@link TestParser} contains regression tests which work directly on the
- * output of the parser (which is generated by ANTLR). These tests should only test the
- * parser and must NOT require any EDM in order to ensure that the parser can run in a
- * context free manner.
- * The single test cases are written according the ABNF (not the parser) since we
- * want if the parser works as defined in the ABNF.
- *
- * Ideally these test detect any (wrong) change on the grammar files
- */
-public class TestParser {
- private ParserValidator test = null;
-
- public TestParser() {
- test = new ParserValidator();
- }
-
- @Test
- public void test() {
- /*
- * test.log(2).run("ODI?$filter=geo.distance("+
- * "geometry'SRID=0;Point(142.1 64.1)',geometry'SRID=0;Point(142.1 64.1)')")
- * .isText("odataRelativeUriEOF(odataRelativeUri("
- * + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- * + "queryOption(systemQueryOption("
- * + "filter($filter = commonExpr(methodCallExpr("
- * + "distanceMethodCallExpr("
- * + "geo.distance( "
- * + "commonExpr(primitiveLiteral(geometryPoint(geometry' fullpointLiteral(sridLiteral(SRID = 0 ;) "
- * + "pointLiteral(Point pointData(( positionLiteral(142.1 64.1) )))) '))) , "
- * + "commonExpr(primitiveLiteral(geometryPoint(geometry' fullpointLiteral(sridLiteral(SRID = 0 ;) "
- * + "pointLiteral(Point pointData(( positionLiteral(142.1 64.1) )))) '))) ))))))))) <EOF>)");
- */
- }
-
- // ;------------------------------------------------------------------------------
- // ; 0. URI
- // ;------------------------------------------------------------------------------
- @Test
- public void testUri() {
- // Test parser rule odataRelativeUri
- test.run("$batch").isText("odataRelativeUriEOF(odataRelativeUri($batch) <EOF>)");
-
- // TODO do more tests on entity
- test.run("$entity?$id=ODI").isText("odataRelativeUriEOF(odataRelativeUri($entity ? "
- + "entityOptions($id = ODI)) <EOF>)");
-
- test.run("$entity?$select=*&$id=ODI").isText("odataRelativeUriEOF(odataRelativeUri($entity ? "
- + "entityOptions(entityOption("
- + "select($select = selectItem(*))) & "
- + "$id = ODI)) <EOF>)");
- test.run("$entity?$id=ODI&$select=*").isText("odataRelativeUriEOF(odataRelativeUri($entity ? "
- + "entityOptions("
- + "$id = ODI & entityOption("
- + "select($select = selectItem(*))))) <EOF>)");
- test.run("$entity?$select=*&$id=ODI&$format=json").isText("odataRelativeUriEOF(odataRelativeUri($entity ? "
- + "entityOptions(entityOption(select("
- + "$select = selectItem(*))) & "
- + "$id = ODI & entityOption(format("
- + "$format = json)))) <EOF>)");
-
- // TODO do more tests on entity
- test.run("$metadata").isText("odataRelativeUriEOF(odataRelativeUri($metadata) <EOF>)");
-
- test.run("ODI").isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment(odataIdentifier(ODI))))) <EOF>)");
-
- // Test parser rule resourcePath
- test.run("$all").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath($all)) <EOF>)");
-
- test.run("$crossjoin(ODI)").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath("
- + "crossjoin($crossjoin ( odataIdentifier(ODI) )))) <EOF>)");
-
- // Test parser rule pathSegments
- test.run("ODI/ODI").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
- + "pathSegment(odataIdentifier(ODI)) / "
- + "pathSegment(odataIdentifier(ODI))))) <EOF>)");
- test.run("NS.ODI/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
- + "pathSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
- + "pathSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))) <EOF>)");
- test.run("NS.ODI/ODI/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
- + "pathSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
- + "pathSegment(odataIdentifier(ODI)) / "
- + "pathSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))) <EOF>)");
- // Test parser rule constSegment
- test.run("ODI/$value").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
- + "pathSegment(odataIdentifier(ODI)) "
- + "constSegment(/ value($value))))) <EOF>)");
- test.run("ODI/$count").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
- + "pathSegment(odataIdentifier(ODI)) "
- + "constSegment(/ count($count))))) <EOF>)");
- test.run("ODI/$ref").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
- + "pathSegment(odataIdentifier(ODI)) "
- + "constSegment(/ ref($ref))))) <EOF>)");
-
- // Test parser rule pathSegment
- test.run("NS.ODI")
- .isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))) <EOF>)");
- test.run("ODI(1)")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI) nameValueOptList(valueOnly(( primitiveLiteral(1) ))))))) <EOF>)");
-
- test.run("ODI('ABC')")
- .isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI) "
- + "nameValueOptList(valueOnly(( primitiveLiteral(string('ABC')) ))))))) <EOF>)");
- test.run("ODI(K1=1)")
- .isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI) "
- + "nameValueOptList(nameValueList(( nameValuePair(odataIdentifier(K1) = "
- + "primitiveLiteral(1)) ))))))) <EOF>)");
-
- test.run("ODI(K1='ABC')")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI) "
- + "nameValueOptList(nameValueList(( nameValuePair(odataIdentifier(K1) = "
- + "primitiveLiteral(string('ABC'))) ))))))) <EOF>)");
-
- test.run("ODI(K1='ABC',K2=123)")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI) nameValueOptList(nameValueList(( "
- + "nameValuePair(odataIdentifier(K1) = primitiveLiteral(string('ABC'))) , "
- + "nameValuePair(odataIdentifier(K2) = primitiveLiteral(123)) ))))))) <EOF>)");
-
- test.run("ODI(K1=1)(P1=1)")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI) nameValueOptList(nameValueList(( "
- + "nameValuePair(odataIdentifier(K1) = primitiveLiteral(1)) ))) nameValueOptList(nameValueList(( "
- + "nameValuePair(odataIdentifier(P1) = primitiveLiteral(1)) ))))))) <EOF>)");
-
- test.run("ODI(K1='ABC',K2=123)(P1='ABC',P2=123)")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI) nameValueOptList(nameValueList(( "
- + "nameValuePair(odataIdentifier(K1) = primitiveLiteral(string('ABC'))) , "
- + "nameValuePair(odataIdentifier(K2) = primitiveLiteral(123)) ))) "
- + "nameValueOptList(nameValueList(( "
- + "nameValuePair(odataIdentifier(P1) = primitiveLiteral(string('ABC'))) , "
- + "nameValuePair(odataIdentifier(P2) = primitiveLiteral(123)) ))))))) <EOF>)");
-
- test.run("NS.ODI(K1='ABC',K2=123)(P1='ABC',P2=123)")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "namespace(odataIdentifier(NS) .) "
- + "odataIdentifier(ODI) nameValueOptList(nameValueList(( "
- + "nameValuePair(odataIdentifier(K1) = primitiveLiteral(string('ABC'))) , "
- + "nameValuePair(odataIdentifier(K2) = primitiveLiteral(123)) ))) "
- + "nameValueOptList(nameValueList(( "
- + "nameValuePair(odataIdentifier(P1) = primitiveLiteral(string('ABC'))) , "
- + "nameValuePair(odataIdentifier(P2) = primitiveLiteral(123)) ))))))) <EOF>)");
-
- test.run("ODI(K1=@ABC)").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
- + "pathSegment(odataIdentifier(ODI) nameValueOptList(nameValueList(( "
- + "nameValuePair(odataIdentifier(K1) = @ odataIdentifier(ABC)) ))))))) <EOF>)");
- test.run("ODI(K1=1,K2=@ABC)").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath("
- + "pathSegments(pathSegment(odataIdentifier(ODI) nameValueOptList(nameValueList(( "
- + "nameValuePair(odataIdentifier(K1) = primitiveLiteral(1)) , "
- + "nameValuePair(odataIdentifier(K2) = @ odataIdentifier(ABC)) ))))))) <EOF>)");
-
- }
-
- // TODO error testing
- @Test
- public void testUriError() {
- // test.run("$entity").isExType(InputMismatchException.class);
- // test.run("$entity").isText("");
- }
-
- // ;------------------------------------------------------------------------------
- // ; 2. Query Options
- // ;------------------------------------------------------------------------------
-
- @Test
- public void testQueryOptions() {
-
- // Test parser rule expand
- test.run("ODI?$expand=*").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "expand($expand = expandItemList(expandItem(*))))))) <EOF>)");
-
- test.run("ODI?$expand=*,*,*").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "expand($expand = expandItemList("
- + "expandItem(*) , "
- + "expandItem(*) , "
- + "expandItem(*))))))) <EOF>)");
-
- test.run("ODI?$expand=*/$ref").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "expand($expand = expandItemList("
- + "expandItem(* / ref($ref)))))))) <EOF>)");
-
- test.run("ODI?$expand=*/$ref,*,*/$ref").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "expand($expand = expandItemList(expandItem(* / ref($ref)) , "
- + "expandItem(*) , "
- + "expandItem(* / ref($ref)))))))) <EOF>)");
-
- // Test parser rules expand -> levels
- test.run("ODI?$expand=*($levels=12)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "expand($expand = expandItemList("
- + "expandItem(* ( $levels = 12 )))))))) <EOF>)");
- test.run("ODI?$expand=*($levels=max)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "expand($expand = expandItemList("
- + "expandItem(* ( $levels=max )))))))) <EOF>)");
-
- // Test parser rules expand -> expandPath
- test.run("ODI?$expand=ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "expand($expand = expandItemList(expandItem("
- + "expandPath(odataIdentifier(ODI))))))))) <EOF>)");
-
- test.run("ODI?$expand=NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "expand($expand = expandItemList(expandItem("
- + "expandPath(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))))))) <EOF>)");
-
- test.run("ODI?$expand=ODI/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "expand($expand = expandItemList(expandItem("
- + "expandPath("
- + "odataIdentifier(ODI) / "
- + "namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))))))) <EOF>)");
-
- test.run("ODI?$expand=ODI/NS.ODI/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "expand($expand = expandItemList(expandItem("
- + "expandPath("
- + "odataIdentifier(ODI) / "
- + "namespace(odataIdentifier(NS) .) odataIdentifier(ODI) / "
- + "odataIdentifier(ODI))))))))) <EOF>)");
-
- test.run("ODI?$expand=ODI/$ref").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "expand($expand = expandItemList("
- + "expandItem(expandPath(odataIdentifier(ODI)) expandPathExtension(/ ref($ref))))))))) <EOF>)");
-
- // Test options for expand items
- test.run("ODI?$expand=ODI/$ref($skip=1)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "expand($expand = expandItemList("
- + "expandItem(expandPath(odataIdentifier(ODI)) "
- + "expandPathExtension(/ ref($ref) ( expandRefOption(skipInline($skip = 1)) ))))))))) <EOF>)");
-
- test.run("ODI?$expand=ODI/$count").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "expand($expand = expandItemList("
- + "expandItem(expandPath(odataIdentifier(ODI)) "
- + "expandPathExtension(/ count($count))))))))) <EOF>)");
-
- test.run("ODI?$expand=ODI/$count($filter=1)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "expand($expand = expandItemList("
- + "expandItem(expandPath(odataIdentifier(ODI)) expandPathExtension(/ count($count) ( "
- + "expandCountOption("
- + "filterInline($filter = commonExpr(primitiveLiteral(1)))) ))))))))) <EOF>)");
-
- test.run("ODI?$expand=ODI/$count($search=\"abc\")").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "expand($expand = expandItemList("
- + "expandItem(expandPath(odataIdentifier(ODI)) expandPathExtension(/ count($count) ( "
- + "expandCountOption("
- + "searchInline($search searchSpecialToken(= searchExpr(searchPhrase(\"abc\"))))) ))))))))) <EOF>)");
-
- test.run("ODI?$expand=ODI/$ref($skip=1;$filter=true)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "expand($expand = expandItemList("
- + "expandItem(expandPath(odataIdentifier(ODI)) expandPathExtension(/ ref($ref) ( "
- + "expandRefOption(skipInline($skip = 1)) ; "
- + "expandRefOption(expandCountOption("
- + "filterInline($filter = commonExpr(primitiveLiteral(booleanNonCase(true)))))) ))))))))) <EOF>)");
-
- test.run("ODI?$expand=ODI($skip=1;$filter=true)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "expand($expand = expandItemList("
- + "expandItem(expandPath(odataIdentifier(ODI)) expandPathExtension(( "
- + "expandOption(expandRefOption(skipInline($skip = 1))) ; "
- + "expandOption(expandRefOption(expandCountOption("
- + "filterInline($filter = commonExpr(primitiveLiteral(booleanNonCase(true))))))) ))))))))) <EOF>)");
-
- // Test parser rule filter ( more filter test in method testExpressions)
- test.run("ODI?$filter=true")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(booleanNonCase(true)))))))) <EOF>)");
-
- // Test parser rule format
- test.run("ODI?$format=atom").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(format($format = atom))))) <EOF>)");
-
- test.run("ODI?$format=json").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(format($format = json))))) <EOF>)");
-
- test.run("ODI?$format=xml").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(format($format = xml))))) <EOF>)");
-
- // Test parser rule id
- test.run("ODI?$id=abc").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(id($id = abc))))) <EOF>)");
-
- // Test parser rule count
- /*
- * TODO add count to new mode based lexer
- * test.lexerlog(1).run("ODI?$count=true").isText("odataRelativeUriEOF(odataRelativeUri("
- * + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- * + "systemQueryOption("
- * + "inlinecount($count = booleanNonCase(true)))))) <EOF>)");
- */
- test.run("ODI?$count=false").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption("
- + "inlinecount($count = booleanNonCase(false)))))) <EOF>)");
-
- test.run("ODI?$count=TrUe").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption("
- + "inlinecount($count = booleanNonCase(TrUe)))))) <EOF>)");
-
- // Test parser rule orderby
- test.run("ODI?$orderby=ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(orderby($orderby = "
- + "orderbyItem(commonExpr("
- + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))))))))) <EOF>)");
-
- test.run("ODI?$orderby=ODI asc").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(orderby($orderby = "
- + "orderbyItem(commonExpr("
- + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))) asc)))))) <EOF>)");
-
- test.run("ODI?$orderby=ODI desc").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(orderby($orderby = "
- + "orderbyItem(commonExpr("
- + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))) desc)))))) <EOF>)");
-
- test.run("ODI?$orderby=ODI desc,ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(orderby($orderby = "
- + "orderbyItem(commonExpr("
- + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))) desc) , "
- + "orderbyItem(commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))))))))) <EOF>)");
-
- test.run("ODI?$orderby=ODI desc,ODI asc").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(orderby($orderby = "
- + "orderbyItem(commonExpr("
- + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))) desc) , "
- + "orderbyItem(commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))) asc)))))) <EOF>)");
-
- test.aFC().aCS().run("ODI?$orderby=3 add 4,ODI asc").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "orderby($orderby = "
- + "orderbyItem(commonExpr(commonExpr(primitiveLiteral(3)) add commonExpr(primitiveLiteral(4)))) , "
- + "orderbyItem(commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))) asc)))))) <EOF>)");
-
- // Test parser rule skiptoken
- test.run("ODI?$skiptoken=abc").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
- + "pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(skiptoken($skiptoken = abc))))) <EOF>)");
-
- // Test parser rule search
- test.run("ODI?$search=abc").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(search("
- + "$search searchSpecialToken(= searchExpr(searchWord(abc)))))))) <EOF>)");
-
- test.run("ODI?$search=NOT abc").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(search("
- + "$search searchSpecialToken(= searchExpr(NOT searchExpr(searchWord(abc))))))))) <EOF>)");
-
- test.aFC().aCS().run("ODI?$search=abc abc").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(search("
- + "$search searchSpecialToken(= searchExpr(searchExpr(searchWord(abc)) s"
- + "earchExpr(searchWord(abc))))))))) <EOF>)");
-
- test.aFC().aCS().run("ODI?$search=abc AND abc").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(search("
- + "$search searchSpecialToken(= searchExpr(searchExpr(searchWord(abc)) AND "
- + "searchExpr(searchWord(abc))))))))) <EOF>)");
-
- test.aFC().aCS().run("ODI?$search=abc OR abc").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(search($search searchSpecialToken(= searchExpr(searchExpr(searchWord(abc)) OR "
- + "searchExpr(searchWord(abc))))))))) <EOF>)");
-
- test.run("ODI?$search=\"a%20b%20c\"").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(search("
- + "$search searchSpecialToken(= searchExpr(searchPhrase(\"a%20b%20c\")))))))) <EOF>)");
-
- // Test parser rule search
- test.run("ODI?$select=*").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(select("
- + "$select = selectItem(*)))))) <EOF>)");
-
- test.run("ODI?$select=ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(select("
- + "$select = selectItem(odataIdentifier(ODI))))))) <EOF>)");
-
- test.run("ODI?$select=NS.*").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(select("
- + "$select = selectItem(namespace(odataIdentifier(NS) .) *)))))) <EOF>)");
-
- test.run("ODI?$select=NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(select("
- + "$select = selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))))) <EOF>)");
-
- test.run("ODI?$select=NS.ODI/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(select("
- + "$select = selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) "
- + "/ odataIdentifier(ODI))))))) <EOF>)");
-
- test.run("ODI?$select=NS.ODI/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(select("
- + "$select = selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) "
- + "/ namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))))) <EOF>)");
-
- test.run("ODI?$select=ODI,ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(select($select = selectItem(odataIdentifier(ODI)) , "
- + "selectItem(odataIdentifier(ODI))))))) <EOF>)");
-
- test.run("ODI?$select=NS.ODI,NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(select($select = selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) , "
- + "selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))))) <EOF>)");
-
- test.run("ODI?$select=NS.ODI/ODIm,NS.ODI/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(select($select = selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) "
- + "/ odataIdentifier(ODIm)) , selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) "
- + "/ odataIdentifier(ODI))))))) <EOF>)");
-
- test.run("ODI?$select=NS.ODI/NS.ODI,NS.ODI/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(select($select = selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) "
- + "/ namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) , "
- + "selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) "
- + "/ namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))))) <EOF>)");
-
- test.run("ODI?$skip=123").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(skip($skip = 123))))) <EOF>)");
-
- test.run("ODI?$skiptoken=abc").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(skiptoken($skiptoken = abc))))) <EOF>)");
-
- test.run("ODI?$top=123").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(top($top = 123))))) <EOF>)");
-
- // test.run("ODI?customparameter=abc");
-
- // test.run("ODI").isText("");
- };
-
- @Test
- public void testExpressions() {
- // Test parser rule commonExpr -> primitiveLiteral
- test.run("ODI?$filter=null").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? "
- + "queryOptions(queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(nullrule(null)))))))) <EOF>)");
-
- test.run("ODI?$filter=true").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(booleanNonCase(true)))))))) <EOF>)");
-
- test.run("ODI?$filter=false").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(booleanNonCase(false)))))))) <EOF>)");
-
- test.run("ODI?$filter=1").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(1))))))) <EOF>)");
-
- test.run("ODI?$filter=-1").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(-1))))))) <EOF>)");
-
- test.run("ODI?$filter=1.1").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(1.1))))))) <EOF>)");
-
- test.run("ODI?$filter=-1.2").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(-1.2))))))) <EOF>)");
-
- test.run("ODI?$filter=-1.2e3").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(-1.2e3))))))) <EOF>)");
-
- test.run("ODI?$filter=-1.2e-3").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(-1.2e-3))))))) <EOF>)");
-
- test.run("ODI?$filter=binary'12AB'").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(binary'12AB'))))))) <EOF>)");
-
- test.run("ODI?$filter=BiNaRy'12AB'").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(BiNaRy'12AB'))))))) <EOF>)");
-
- test.run("ODI?$filter=date'2013-11-15'").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(date'2013-11-15'))))))) <EOF>)");
-
- test.run("ODI?$filter=datetimeoffset'2013-11-15T13:35Z'").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(datetimeoffset'2013-11-15T13:35Z'))))))) <EOF>)");
-
- test.run("ODI?$filter=duration'PT67S'").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(duration'PT67S'))))))) <EOF>)");
-
- test.run("ODI?$filter=guid'1234ABCD-12AB-23CD-45EF-123456780ABC'").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(guid'1234ABCD-12AB-23CD-45EF-123456780ABC'))))))) <EOF>)");
-
- test.run("ODI?$filter='ABC'").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(string('ABC')))))))) <EOF>)");
-
- test.run("ODI?$filter=timeofday'20:00'").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(timeofday'20:00'))))))) <EOF>)");
-
- // Test enum
- test.run("ODI?$filter=NS.ODI'1'").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(enumX(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) '1')))))))) <EOF>)");
- test.run("ODI?$filter=NS.ODI'1,3'").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(enumX(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) '1,3')))))))) <EOF>)");
- test.run("ODI?$filter=NS.ODI'ODI,3'").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(enumX(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) 'ODI,3')))))))) <EOF>)");
-
- // Test Geometry
-
- // Rule GeographyCollection
-
- test.run("ODI?$filter=geography'SRID=0;Collection(LineString(142.1 64.1,3.14 2.78))'")
- .isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geographyCollection("
- + "geography' fullCollectionLiteral(sridLiteral(SRID = 0 ;) collectionLiteral("
- + "Collection ( geoLiteral(lineStringLiteral("
- + "LineString lineStringData(( "
- + "positionLiteral(142.1 64.1) , "
- + "positionLiteral(3.14 2.78) )))) ))) ')))))))) <EOF>)");
-
- // Rule GeographyLineString
- test.run("ODI?$filter=geography'SRID=0;LineString(142.1 64.1,3.14 2.78)'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geographyLineString("
- + "geography' fullLineStringLiteral(sridLiteral(SRID = 0 ;) lineStringLiteral("
- + "LineString lineStringData(( positionLiteral(142.1 64.1) , positionLiteral(3.14 2.78) )))) '"
- + ")))))))) <EOF>)");
-
- // Rule GeographyMultiLineString
- test.run("ODI?$filter=geography'SRID=0;MultiLineString((142.1 64.1,3.14 2.78),(142.1 64.1,3.14 2.78))'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geographyMultilineString("
- + "geography' fullMultilineStringLiteral(sridLiteral(SRID = 0 ;) multilineStringLiteral("
- + "MultiLineString ( "
- + "lineStringData(( positionLiteral(142.1 64.1) , positionLiteral(3.14 2.78) )) , "
- + "lineStringData(( positionLiteral(142.1 64.1) , positionLiteral(3.14 2.78) )) ))) '"
- + ")))))))) <EOF>)");
-
- // Rule GeographyMultiPoint
- test.run("ODI?$filter=geography'SRID=0;MultiPoint()'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geographyMultipoint("
- + "geography' fullMultipointLiteral(sridLiteral(SRID = 0 ;) multipointLiteral("
- + "MultiPoint ( ))) ')))))))) <EOF>)");
- // Rule GeographyMultiPoint
- test.run("ODI?$filter=geography'SRID=0;MultiPoint((142.1 64.1),(1 2))'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geographyMultipoint("
- + "geography' fullMultipointLiteral(sridLiteral(SRID = 0 ;) multipointLiteral("
- + "MultiPoint ( "
- + "pointData(( positionLiteral(142.1 64.1) )) , "
- + "pointData(( positionLiteral(1 2) )) ))) ')))))))) <EOF>)");
- // Rule GeographyMultiPolygon
- test.run("ODI?$filter=geography'SRID=0;MultiPolygon(((1 1,1 1),(1 1,2 2,3 3,1 1)))'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geographyMultipolygon("
- + "geography' fullmultipolygonLiteral(sridLiteral(SRID = 0 ;) multipolygonLiteral("
- + "MultiPolygon ( polygonData(( "
- + "ringLiteral(( positionLiteral(1 1) , positionLiteral(1 1) )) , "
- + "ringLiteral(( positionLiteral(1 1) , positionLiteral(2 2) , "
- + "positionLiteral(3 3) , positionLiteral(1 1) )) )) ))) ')))))))) <EOF>)");
- // Rule GeographyPoint
- test.run("ODI?$filter=geography'SRID=0;Point(142.1 64.1)'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geographyPoint("
- + "geography' fullpointLiteral(sridLiteral(SRID = 0 ;) pointLiteral("
- + "Point pointData(( positionLiteral(142.1 64.1) )))) ')))))))) <EOF>)");
- // Rule GeographyPolygon
- test.run("ODI?$filter=geography'SRID=0;Polygon((1 1,1 1),(1 1,2 2,3 3,1 1))'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geographyPolygon("
- + "geography' fullPolygonLiteral(sridLiteral(SRID = 0 ;) polygonLiteral("
- + "Polygon polygonData(( "
- + "ringLiteral(( positionLiteral(1 1) , positionLiteral(1 1) )) , "
- + "ringLiteral(( positionLiteral(1 1) , positionLiteral(2 2) , "
- + "positionLiteral(3 3) , positionLiteral(1 1) )) )))) ')))))))) <EOF>)");
- // Rule GeometryCollection
- test.run("ODI?$filter=geometry'SRID=0;Collection(LineString(142.1 64.1,3.14 2.78))'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geometryCollection("
- + "geometry' fullCollectionLiteral(sridLiteral(SRID = 0 ;) collectionLiteral("
- + "Collection ( geoLiteral(lineStringLiteral(LineString lineStringData(( "
- + "positionLiteral(142.1 64.1) , "
- + "positionLiteral(3.14 2.78) )))) ))) ')))))))) <EOF>)");
- // Rule GeometryLineString
- test.run("ODI?$filter=geometry'SRID=0;LineString(142.1 64.1,3.14 2.78)'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geometryLineString("
- + "geometry' fullLineStringLiteral(sridLiteral(SRID = 0 ;) lineStringLiteral("
- + "LineString lineStringData(( positionLiteral(142.1 64.1) , positionLiteral(3.14 2.78) )))) '"
- + ")))))))) <EOF>)");
- // Rule GeometryMultiLineString
- test.run("ODI?$filter=geometry'SRID=0;MultiLineString((142.1 64.1,3.14 2.78),(142.1 64.1,3.14 2.78))'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geometryMultilineString("
- + "geometry' fullMultilineStringLiteral(sridLiteral(SRID = 0 ;) multilineStringLiteral("
- + "MultiLineString ( "
- + "lineStringData(( positionLiteral(142.1 64.1) , positionLiteral(3.14 2.78) )) , "
- + "lineStringData(( positionLiteral(142.1 64.1) , positionLiteral(3.14 2.78) )) ))) '"
- + ")))))))) <EOF>)");
- // Rule GeometryMultiPoint
- test.run("ODI?$filter=geometry'SRID=0;MultiPoint()'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geometryMultipoint("
- + "geometry' fullMultipointLiteral(sridLiteral(SRID = 0 ;) multipointLiteral(MultiPoint ( ))) '"
- + ")))))))) <EOF>)");
- // Rule GeometryMultiPoint
- test.run("ODI?$filter=geometry'SRID=0;MultiPoint((142.1 64.1),(1 2))'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geometryMultipoint("
- + "geometry' fullMultipointLiteral(sridLiteral(SRID = 0 ;) "
- + "multipointLiteral(MultiPoint ( "
- + "pointData(( positionLiteral(142.1 64.1) )) , "
- + "pointData(( positionLiteral(1 2) )) ))) ')))))))) <EOF>)");
- // Rule GeometryMultiPolygon
- test.run("ODI?$filter=geometry'SRID=0;MultiPolygon(((1 1,1 1),(1 1,2 2,3 3,1 1)))'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geometryMultipolygon("
- + "geometry' fullmultipolygonLiteral(sridLiteral(SRID = 0 ;) "
- + "multipolygonLiteral(MultiPolygon ( polygonData(( "
- + "ringLiteral(( positionLiteral(1 1) , positionLiteral(1 1) )) , "
- + "ringLiteral(( positionLiteral(1 1) , positionLiteral(2 2) , "
- + "positionLiteral(3 3) , positionLiteral(1 1) )) )) ))) ')))))))) <EOF>)");
- // Rule GeometryPoint
- test.run("ODI?$filter=geometry'SRID=0;Point(142.1 64.1)'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geometryPoint("
- + "geometry' fullpointLiteral(sridLiteral(SRID = 0 ;) pointLiteral("
- + "Point pointData(( positionLiteral(142.1 64.1) )))) ')))))))) <EOF>)");
- // Rule GeometryPolygon
- test.run("ODI?$filter=geometry'SRID=0;Polygon((1 1,1 1),(1 1,2 2,3 3,1 1))'")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "filter($filter = commonExpr(primitiveLiteral(geometryPolygon("
- + "geometry' fullPolygonLiteral(sridLiteral(SRID = 0 ;) polygonLiteral("
- + "Polygon polygonData(( "
- + "ringLiteral(( positionLiteral(1 1) , positionLiteral(1 1) )) , "
- + "ringLiteral(( positionLiteral(1 1) , positionLiteral(2 2) , "
- + "positionLiteral(3 3) , positionLiteral(1 1) )) )))) ')))))))) <EOF>)");
-
- // Parsing expression required in some cases a FullContextParsing and a report of a ContextSensitivity is fine
-
- // Test commonExpr - parenthesis
- test.aFC().aCS().run("ODI?$filter=(1) mul 2").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr("
- + "commonExpr(( commonExpr(primitiveLiteral(1)) )) "
- + "mul "
- + "commonExpr(primitiveLiteral(2)))))))) <EOF>)");
-
- test.aFC().aCS().run("ODI?$filter=((((1)))) mul 2").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(commonExpr(( commonExpr(( commonExpr(( commonExpr(( commonExpr("
- + "primitiveLiteral(1)) )) )) )) )) "
- + "mul commonExpr(primitiveLiteral(2)))))))) <EOF>)");
- test.aFC().aCS().run("ODI?$filter=(1 add 2)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr(( commonExpr(commonExpr(primitiveLiteral(1)) "
- + "add commonExpr(primitiveLiteral(2))) ))))))) <EOF>)");
- test.aFC().aCS().run("ODI?$filter=1 mul (2 add 3)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
- + "mul commonExpr(( commonExpr(commonExpr(primitiveLiteral(2)) "
- + "add commonExpr(primitiveLiteral(3))) )))))))) <EOF>)");
-
- // Test commonExpr - methodCallExpr
- test.run("ODI?$filter=indexof('ABCXYZ','CXY')").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "indexOfMethodCallExpr(indexof( "
- + "commonExpr(primitiveLiteral(string('ABCXYZ'))) , "
- + "commonExpr(primitiveLiteral(string('CXY'))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=tolower('ABC')").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "toLowerMethodCallExpr(tolower( "
- + "commonExpr(primitiveLiteral(string('ABC'))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=toupper('ABC')").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "toUpperMethodCallExpr(toupper( "
- + "commonExpr(primitiveLiteral(string('ABC'))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=trim('%20%20%20ABC%20%20%20')").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "trimMethodCallExpr(trim( "
- + "commonExpr(primitiveLiteral(string('%20%20%20ABC%20%20%20'))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=substring('ABC',1)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "substringMethodCallExpr(substring( "
- + "commonExpr(primitiveLiteral(string('ABC'))) , "
- + "commonExpr(primitiveLiteral(1)) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=substring('ABC',1,2)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "substringMethodCallExpr(substring( "
- + "commonExpr(primitiveLiteral(string('ABC'))) , "
- + "commonExpr(primitiveLiteral(1)) , "
- + "commonExpr(primitiveLiteral(2)) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=concat('ABC','XYZ')").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "concatMethodCallExpr(concat( "
- + "commonExpr(primitiveLiteral(string('ABC'))) , "
- + "commonExpr(primitiveLiteral(string('XYZ'))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=length('ABC')").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "lengthMethodCallExpr(length( commonExpr(primitiveLiteral(string('ABC'))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=year(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "yearMethodCallExpr(year( "
- + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=month(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "monthMethodCallExpr(month( "
- + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=day(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "dayMethodCallExpr(day( "
- + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=hour(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "hourMethodCallExpr(hour( "
- + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=minute(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "minuteMethodCallExpr(minute( "
- + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=second(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "secondMethodCallExpr(second( "
- + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=fractionalseconds(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "fractionalsecondsMethodCallExpr(fractionalseconds( "
- + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=totalseconds(duration'PT67S')").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "totalsecondsMethodCallExpr(totalseconds( commonExpr(primitiveLiteral(duration'PT67S')) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=date(datetimeoffset'2013-11-15T13:35Z')").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "dateMethodCallExpr(date( commonExpr(primitiveLiteral(datetimeoffset'2013-11-15T13:35Z')) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=time(datetimeoffset'2013-11-15T13:35Z')").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "timeMethodCallExpr(time( commonExpr(primitiveLiteral(datetimeoffset'2013-11-15T13:35Z')) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=round(12.34)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "roundMethodCallExpr(round( commonExpr(primitiveLiteral(12.34)) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=floor(12.34)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "floorMethodCallExpr(floor( commonExpr(primitiveLiteral(12.34)) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=ceiling(12.34)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "ceilingMethodCallExpr(ceiling( commonExpr(primitiveLiteral(12.34)) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=geo.distance(geometry'SRID=0;Point(142.1 64.1)',geometry'SRID=0;Point(142.1 64.1)')")
- .isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "distanceMethodCallExpr("
- + "geo.distance( "
- + "commonExpr(primitiveLiteral(geometryPoint(geometry' fullpointLiteral(sridLiteral(SRID = 0 ;) "
- + "pointLiteral(Point pointData(( positionLiteral(142.1 64.1) )))) '))) , "
- + "commonExpr(primitiveLiteral(geometryPoint(geometry' fullpointLiteral(sridLiteral(SRID = 0 ;) "
- + "pointLiteral(Point pointData(( positionLiteral(142.1 64.1) )))) '))) ))))))))) <EOF>)");
-
- // TODO check this
- /*
- * test.run("ODI?$filter=geo.length(geometry'SRID=0;LineString(142.1 64.1,3.14 2.78)')")
- * .isText("odataRelativeUriEOF(odataRelativeUri("
- * + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- * + "queryOption(systemQueryOption(filter($filter = commonExpr(methodCallExpr("
- * + "geoLengthMethodCallExpr(geo.length ( commonExpr(primitiveLiteral("
- * + "geometryLineString(geometry' fullLineStringLiteral(sridLiteral(SRID = 0 ;) lineStringLiteral("
- * + "LineString lineStringData(( positionLiteral(142.1 64.1) , "
- * + "positionLiteral(3.14 2.78) )))) '))) ))))))))) <EOF>)");
- */
- test.run("ODI?$filter=totaloffsetminutes(datetimeoffset'2013-11-15T13:35Z')")
- .isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr(methodCallExpr("
- + "totalOffsetMinutesMethodCallExpr(totaloffsetminutes( commonExpr("
- + "primitiveLiteral(datetimeoffset'2013-11-15T13:35Z')) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=mindatetime()").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr(minDateTimeMethodCallExpr(mindatetime( ))))))))) <EOF>)");
-
- test.run("ODI?$filter=maxdatetime()").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr(maxDateTimeMethodCallExpr(maxdatetime( ))))))))) <EOF>)");
-
- test.run("ODI?$filter=now()").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr(nowMethodCallExpr(now( ))))))))) <EOF>)");
-
- // from boolean
- test.run("ODI?$filter=isof(Model.Employee)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr(isofExpr("
- + "isof( qualifiedtypename("
- + "namespace(odataIdentifier(Model) .) "
- + "odataIdentifier(Employee)) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=isof(ODI,Model.Employee)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "isofExpr(isof( commonExpr("
- + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))) , "
- + "qualifiedtypename(namespace(odataIdentifier(Model) .) odataIdentifier(Employee)) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=cast(Model.Employee)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "castExpr(cast( "
- + "qualifiedtypename(namespace(odataIdentifier(Model) .) "
- + "odataIdentifier(Employee)) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=cast(ODI,Model.Employee)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "castExpr(cast( commonExpr("
- + "memberExpr(pathSegments(pathSegment("
- + "odataIdentifier(ODI))))) , "
- + "qualifiedtypename(namespace(odataIdentifier(Model) .) "
- + "odataIdentifier(Employee)) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=endswith('ABCXYZ','YZ')").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "endsWithMethodCallExpr(endswith( "
- + "commonExpr(primitiveLiteral(string('ABCXYZ'))) , "
- + "commonExpr(primitiveLiteral(string('YZ'))) ))))))))) <EOF>)");
-
- test.run("ODI?$filter=startswith('ABCXYZ','YZ')").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "startsWithMethodCallExpr(startswith( "
- + "commonExpr(primitiveLiteral(string('ABCXYZ'))) , "
- + "commonExpr(primitiveLiteral(string('YZ'))) ))))))))) <EOF>)");
- test.run("ODI?$filter=contains('ABCXYZ','YZ')").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(methodCallExpr("
- + "containsMethodCallExpr(contains( "
- + "commonExpr(primitiveLiteral(string('ABCXYZ'))) , "
- + "commonExpr(primitiveLiteral(string('YZ'))) ))))))))) <EOF>)");
- /*
- * test.run("ODI?$filter=geo.intersects("
- * + "geometry'SRID=0;Point(142.1 64.1)',"
- * + "geometry'SRID=0;Polygon((1 1,1 1),(1 1,2 2,3 3,1 1))')").isText("odataRelativeUriEOF(odataRelativeUri("
- * + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- * + "queryOption(systemQueryOption("
- * + "filter($filter = commonExpr(methodCallExpr("
- * + "intersectsMethodCallExpr(geo.intersects ( "
- * + "commonExpr(primitiveLiteral("
- * + "geometryPoint(geometry' fullpointLiteral(sridLiteral(SRID = 0 ;) "
- * + "pointLiteral(Point pointData(( positionLiteral(142.1 64.1) )))) '))) , "
- * + "commonExpr(primitiveLiteral("
- * + "geometryPolygon(geometry' fullPolygonLiteral(sridLiteral(SRID = 0 ;) "
- * + "polygonLiteral(Polygon polygonData(( "
- * + "ringLiteral(( positionLiteral(1 1) , positionLiteral(1 1) )) , "
- * + "ringLiteral(( positionLiteral(1 1) , positionLiteral(2 2) , "
- * + "positionLiteral(3 3) , positionLiteral(1 1) )) )))) '))) ))))))))) <EOF>)");
- */
- // Test commonExpr - unary
- test.run("ODI?$filter=true").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = commonExpr("
- + "primitiveLiteral(booleanNonCase(true)))))))) <EOF>)");
-
- // Test commonExpr - member
- test.run("ODI?$filter=ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr("
- + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI)))))))))) <EOF>)");
-
- // Test commonExpr - mathematical
- test.aFC().aCS().run("ODI?$filter=1 mul 2").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
- + "mul commonExpr(primitiveLiteral(2)))))))) <EOF>)");
-
- test.aFC().aCS().run("ODI?$filter=1 div 2").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
- + "div commonExpr(primitiveLiteral(2)))))))) <EOF>)");
-
- test.aFC().aCS().run("ODI?$filter=1 mod 2").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
- + "mod commonExpr(primitiveLiteral(2)))))))) <EOF>)");
-
- test.aFC().aCS().run("ODI?$filter=1 add 2").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
- + "add commonExpr(primitiveLiteral(2)))))))) <EOF>)");
-
- test.aFC().aCS().run("ODI?$filter=1 sub 2").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
- + "sub commonExpr(primitiveLiteral(2)))))))) <EOF>)");
-
- test.aFC().aCS().run("ODI?$filter=1 gt 2").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
- + "gt commonExpr(primitiveLiteral(2)))))))) <EOF>)");
-
- test.aFC().aCS().run("ODI?$filter=1 ge 2").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
- + "ge commonExpr(primitiveLiteral(2)))))))) <EOF>)");
-
- test.aFC().aCS().run("ODI?$filter=1 lt 2").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
- + "lt commonExpr(primitiveLiteral(2)))))))) <EOF>)");
-
- test.aFC().aCS().run("ODI?$filter=1 le 2").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1)) "
- + "le commonExpr(primitiveLiteral(2)))))))) <EOF>)");
-
- test.aFC().aCS().run("ODI?$filter=ODI isof Model.Employee").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))) "
- + "isof commonExpr(memberExpr("
- + "pathSegments(pathSegment("
- + "namespace(odataIdentifier(Model) .) "
- + "odataIdentifier(Employee))))))))))) <EOF>)");
-
- test.aFC().aCS().run("ODI?$filter=true and false").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(commonExpr(primitiveLiteral(booleanNonCase(true))) "
- + "and commonExpr(primitiveLiteral(booleanNonCase(false))))))))) <EOF>)");
-
- test.aFC().aCS().run("ODI?$filter=true or false").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr(commonExpr(primitiveLiteral(booleanNonCase(true))) "
- + "or commonExpr(primitiveLiteral(booleanNonCase(false))))))))) <EOF>)");
-
- // Test commonExpr - $root
- test.run("ODI?$filter=$root/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr("
- + "rootExpr($root/ pathSegments(pathSegment(odataIdentifier(ODI)))))))))) <EOF>)");
-
- // Test concatenated parenthesis
- test.run("ODI?$filter=not true").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = commonExpr("
- + "unary(not) commonExpr(primitiveLiteral(booleanNonCase(true))))))))) <EOF>)");
- }
-
- @Test
- public void testFragment() {
-
- test.run("$metadata#Collection($ref)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "$metadata # contextFragment(Collection($ref))) <EOF>)");
-
- test.run("$metadata#Collection(Edm.EntityType)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "$metadata # contextFragment(Collection(Edm.EntityType))) <EOF>)");
-
- test.run("$metadata#Collection(Edm.ComplexType)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "$metadata # contextFragment(Collection(Edm.ComplexType))) <EOF>)");
-
- test.run("$metadata#singletonEntity").isText("odataRelativeUriEOF(odataRelativeUri("
- + "$metadata # contextFragment(odataIdentifier(singletonEntity))) <EOF>)");
-
- test.run("$metadata#NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "$metadata # contextFragment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))) <EOF>)");
-
- test.run("$metadata#Edm.Boolean").isText("odataRelativeUriEOF("
- + "odataRelativeUri($metadata # "
- + "contextFragment(namespace(odataIdentifier(Edm) .) odataIdentifier(Boolean))) <EOF>)");
-
- test.run("$metadata#ODI/$deletedEntity").isText("odataRelativeUriEOF("
- + "odataRelativeUri($metadata # contextFragment(odataIdentifier(ODI) / $deletedEntity)) <EOF>)");
-
- test.run("$metadata#ODI/$link").isText("odataRelativeUriEOF("
- + "odataRelativeUri($metadata # contextFragment(odataIdentifier(ODI) / $link)) <EOF>)");
-
- test.run("$metadata#ODI/$deletedLink").isText("odataRelativeUriEOF("
- + "odataRelativeUri($metadata # contextFragment(odataIdentifier(ODI) / $deletedLink)) <EOF>)");
-
- test.run("$metadata#ODI(1)/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "$metadata # contextFragment(odataIdentifier(ODI) nameValueOptList(valueOnly(( primitiveLiteral(1) ))) "
- + "/ odataIdentifier(ODI))) <EOF>)");
-
- test.run("$metadata#ODI(1)/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "$metadata # contextFragment(odataIdentifier(ODI) nameValueOptList(valueOnly(( primitiveLiteral(1) ))) "
- + "/ namespace(odataIdentifier(NS) .) odataIdentifier(ODI))) <EOF>)");
-
- test.run("$metadata#ODI(1)/NS.ODI/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "$metadata # contextFragment(odataIdentifier(ODI) "
- + "nameValueOptList(valueOnly(( primitiveLiteral(1) ))) "
- + "/ namespace(odataIdentifier(NS) .) odataIdentifier(ODI) "
- + "/ odataIdentifier(ODI))) <EOF>)");
-
- test.run("$metadata#NS.ODI(*)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "$metadata # contextFragment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) "
- + "propertyList(( propertyListItem(*) )))) <EOF>)");
-
- test.run("$metadata#ODI(1)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "$metadata # contextFragment(odataIdentifier(ODI) "
- + "nameValueOptList(valueOnly(( primitiveLiteral(1) ))))) <EOF>)");
-
- test.run("$metadata#ODI(1)/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "$metadata # contextFragment(odataIdentifier(ODI) "
- + "nameValueOptList(valueOnly(( primitiveLiteral(1) ))) "
- + "/ odataIdentifier(ODI))) <EOF>)");
-
- test.run("$metadata#ODI(1)/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "$metadata # contextFragment(odataIdentifier(ODI) "
- + "nameValueOptList(valueOnly(( primitiveLiteral(1) ))) "
- + "/ namespace(odataIdentifier(NS) .) odataIdentifier(ODI))) <EOF>)");
-
- test.run("$metadata#ODI(1)/NS.ODI/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "$metadata # contextFragment(odataIdentifier(ODI) "
- + "nameValueOptList(valueOnly(( primitiveLiteral(1) ))) "
- + "/ namespace(odataIdentifier(NS) .) odataIdentifier(ODI) / odataIdentifier(ODI))) <EOF>)");
-
- test.run("$metadata#ODI(1)(*)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "$metadata # contextFragment(odataIdentifier(ODI) "
- + "nameValueOptList(valueOnly(( primitiveLiteral(1) ))) propertyList(( propertyListItem(*) )))) <EOF>)");
-
- test.run("$metadata#ODI(1)(PROP)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "$metadata # contextFragment(odataIdentifier(ODI) "
- + "nameValueOptList(valueOnly(( primitiveLiteral(1) ))) "
- + "propertyList(( propertyListItem(propertyListProperty(odataIdentifier(PROP))) )))) <EOF>)");
- test.run("$metadata#ODI(1)(NAVPROP+)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "$metadata # contextFragment(odataIdentifier(ODI) "
- + "nameValueOptList(valueOnly(( primitiveLiteral(1) ))) "
- + "propertyList(( propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) +)) )))) <EOF>)");
- test.run("$metadata#ODI(1)(NAVPROP+(*))").isText("odataRelativeUriEOF(odataRelativeUri("
- + "$metadata # contextFragment(odataIdentifier(ODI) "
- + "nameValueOptList(valueOnly(( primitiveLiteral(1) ))) "
- + "propertyList(( "
- + "propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) + "
- + "propertyList(( "
- + "propertyListItem(*) )))) )))) <EOF>)");
- test.run("$metadata#ODI(1)(NAVPROP+(A,B,C))").isText("odataRelativeUriEOF(odataRelativeUri("
- + "$metadata # contextFragment(odataIdentifier(ODI) "
- + "nameValueOptList(valueOnly(( primitiveLiteral(1) ))) "
- + "propertyList(( "
- + "propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) + "
- + "propertyList(( "
- + "propertyListItem(propertyListProperty(odataIdentifier(A))) , "
- + "propertyListItem(propertyListProperty(odataIdentifier(B))) , "
- + "propertyListItem(propertyListProperty(odataIdentifier(C))) )))) )))) <EOF>)");
-
- test.run("$metadata#ODI(1)(NAVPROP+(A,B,C))/$delta").isText("odataRelativeUriEOF(odataRelativeUri("
- + "$metadata # contextFragment(odataIdentifier(ODI) "
- + "nameValueOptList(valueOnly(( primitiveLiteral(1) ))) "
- + "propertyList(( "
- + "propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) + "
- + "propertyList(( "
- + "propertyListItem(propertyListProperty(odataIdentifier(A))) , "
- + "propertyListItem(propertyListProperty(odataIdentifier(B))) , "
- + "propertyListItem(propertyListProperty(odataIdentifier(C))) )))) )) "
- + "/ $delta)) <EOF>)");
-
- test.run("$metadata#ODI(1)(NAVPROP+(A,B,C))/$entity").isText("odataRelativeUriEOF(odataRelativeUri("
- + "$metadata # contextFragment(odataIdentifier(ODI) "
- + "nameValueOptList(valueOnly(( primitiveLiteral(1) ))) "
- + "propertyList(( "
- + "propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) + "
- + "propertyList(( "
- + "propertyListItem(propertyListProperty(odataIdentifier(A))) , "
- + "propertyListItem(propertyListProperty(odataIdentifier(B))) , "
- + "propertyListItem(propertyListProperty(odataIdentifier(C))) )))) )) "
- + "/ $entity)) <EOF>)");
- test.run("$metadata#ODI(1)(NAVPROP+(A,B,C))/$delta/$entity").isText("odataRelativeUriEOF(odataRelativeUri("
- + "$metadata # contextFragment(odataIdentifier(ODI) "
- + "nameValueOptList(valueOnly(( primitiveLiteral(1) ))) "
- + "propertyList(( "
- + "propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) + "
- + "propertyList(( "
- + "propertyListItem(propertyListProperty(odataIdentifier(A))) , "
- + "propertyListItem(propertyListProperty(odataIdentifier(B))) , "
- + "propertyListItem(propertyListProperty(odataIdentifier(C))) )))) )) "
- + "/ $delta / $entity)) <EOF>)");
-
- }
-
- @Test
- public void testPrecedence() {
- // Test operator precedence
-
- test.aFC().aCS().aAM().run("ODI?$filter=(1 add 2) mul 3").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = "
- + "commonExpr(commonExpr(( commonExpr(commonExpr(primitiveLiteral(1)) "
- + "add commonExpr(primitiveLiteral(2))) )) "
- + "mul commonExpr(primitiveLiteral(3)))))))) <EOF>)");
-
- test.aFC().aCS().aAM().run("ODI?$filter=1 add (2 mul 3)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = "
- + "commonExpr(commonExpr(primitiveLiteral(1)) "
- + "add commonExpr(( commonExpr(commonExpr(primitiveLiteral(2)) "
- + "mul commonExpr(primitiveLiteral(3))) )))))))) <EOF>)");
-
- test.aFC().aCS().aAM().run("ODI?$filter=1 add 2 add 3 add 4").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = "
- + "commonExpr(commonExpr(commonExpr(commonExpr(primitiveLiteral(1)) "
- + "add commonExpr(primitiveLiteral(2))) "
- + "add commonExpr(primitiveLiteral(3))) "
- + "add commonExpr(primitiveLiteral(4)))))))) <EOF>)");
-
- test.aFC().aCS().aAM().run("ODI?$filter=1 add 2 add 3 mul 4").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = "
- + "commonExpr(commonExpr(commonExpr(primitiveLiteral(1)) "
- + "add commonExpr(primitiveLiteral(2))) "
- + "add commonExpr(commonExpr(primitiveLiteral(3)) "
- + "mul commonExpr(primitiveLiteral(4))))))))) <EOF>)");
-
- test.aFC().aCS().aAM().run("ODI?$filter=1 add 2 mul 3 add 4").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = "
- + "commonExpr(commonExpr(commonExpr(primitiveLiteral(1)) "
- + "add commonExpr(commonExpr(primitiveLiteral(2)) "
- + "mul commonExpr(primitiveLiteral(3)))) "
- + "add commonExpr(primitiveLiteral(4)))))))) <EOF>)");
-
- test.aFC().aCS().aAM().run("ODI?$filter=1 add 2 mul 3 mul 4").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = "
- + "commonExpr(commonExpr(primitiveLiteral(1)) "
- + "add commonExpr(commonExpr(commonExpr(primitiveLiteral(2)) "
- + "mul commonExpr(primitiveLiteral(3))) "
- + "mul commonExpr(primitiveLiteral(4))))))))) <EOF>)");
- test.aFC().aCS().aAM().run("ODI?$filter=1 mul 2 add 3 add 4").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = "
- + "commonExpr(commonExpr(commonExpr(commonExpr(primitiveLiteral(1)) "
- + "mul commonExpr(primitiveLiteral(2))) "
- + "add commonExpr(primitiveLiteral(3))) "
- + "add commonExpr(primitiveLiteral(4)))))))) <EOF>)");
-
- test.aFC().aCS().aAM().run("ODI?$filter=1 mul 2 add 3 mul 4").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = "
- + "commonExpr(commonExpr(commonExpr(primitiveLiteral(1)) "
- + "mul commonExpr(primitiveLiteral(2))) "
- + "add commonExpr(commonExpr(primitiveLiteral(3)) "
- + "mul commonExpr(primitiveLiteral(4))))))))) <EOF>)");
-
- test.aFC().aCS().aAM().run("ODI?$filter=1 mul 2 mul 3 add 4").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = "
- + "commonExpr(commonExpr(commonExpr(commonExpr(primitiveLiteral(1)) "
- + "mul commonExpr(primitiveLiteral(2))) "
- + "mul commonExpr(primitiveLiteral(3))) "
- + "add commonExpr(primitiveLiteral(4)))))))) <EOF>)");
-
- test.aFC().aCS().aAM().run("ODI?$filter=1 mul 2 mul 3 mul 4").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(filter($filter = "
- + "commonExpr(commonExpr(commonExpr(commonExpr(primitiveLiteral(1)) "
- + "mul commonExpr(primitiveLiteral(2))) "
- + "mul commonExpr(primitiveLiteral(3))) "
- + "mul commonExpr(primitiveLiteral(4)))))))) <EOF>)");
-
- test.aFC().aCS().aAM().run("ODI?$filter=1 mul 2 add 3 mul 4").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption("
- + "filter($filter = "
- + "commonExpr(commonExpr(commonExpr(primitiveLiteral(1)) "
- + "mul commonExpr(primitiveLiteral(2))) "
- + "add commonExpr(commonExpr(primitiveLiteral(3)) "
- + "mul commonExpr(primitiveLiteral(4))))))))) <EOF>)");
-
- // Test parser rule search
- test.aFC().aCS().aAM().run("ODI?$search=abc OR abc AND abc").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(search("
- + "$search searchSpecialToken(= "
- + "searchExpr(searchExpr(searchWord(abc)) OR "
- + "searchExpr("
- + "searchExpr(searchWord(abc)) AND "
- + "searchExpr(searchWord(abc)))))))))) <EOF>)");
-
- test.aFC().aCS().aAM().run("ODI?$search=abc OR abc abc").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(search("
- + "$search searchSpecialToken(= "
- + "searchExpr(searchExpr(searchWord(abc)) OR "
- + "searchExpr("
- + "searchExpr(searchWord(abc)) "
- + "searchExpr(searchWord(abc)))))))))) <EOF>)");
- }
-
- // ;------------------------------------------------------------------------------
- // ; 2. Query Options
- // ;------------------------------------------------------------------------------
-
- // ;------------------------------------------------------------------------------
- // ; 4. Expressions
- // ;------------------------------------------------------------------------------
-
- // ;------------------------------------------------------------------------------
- // ; 5. JSON format for function parameters
- // ;------------------------------------------------------------------------------
-
- // ;------------------------------------------------------------------------------
- // ; 6. Names and identifiers
- // ;------------------------------------------------------------------------------
-
- // ;------------------------------------------------------------------------------
- // ; 7. Literal Data Values
- // ;------------------------------------------------------------------------------
-
- // ;------------------------------------------------------------------------------
- // ; 0. misc
- // ;------------------------------------------------------------------------------
-
-}
[7/9] [OLINGO-63] Uri Parser: adoptions in lexer and parser,
create UriParserImpl to convert the parsetree into internal
structures, moved parser antlr part from .../olingo/producer/... to
.../olingo/odata4/producer
Posted by ko...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserImpl.java
index 737aa00..2ea0db9 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserImpl.java
@@ -16,203 +16,374 @@
* specific language governing permissions and limitations
* under the License.
******************************************************************************/
+
package org.apache.olingo.odata4.producer.core.uri;
-import org.antlr.v4.runtime.ANTLRInputStream;
-import org.antlr.v4.runtime.CommonTokenStream;
-import org.antlr.v4.runtime.DefaultErrorStrategy;
-import org.antlr.v4.runtime.atn.PredictionMode;
-import org.antlr.v4.runtime.tree.ParseTree;
+import java.util.List;
+
import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmAction;
import org.apache.olingo.odata4.commons.api.edm.EdmActionImport;
+import org.apache.olingo.odata4.commons.api.edm.EdmComplexType;
+import org.apache.olingo.odata4.commons.api.edm.EdmElement;
import org.apache.olingo.odata4.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.odata4.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+import org.apache.olingo.odata4.commons.api.edm.EdmFunction;
import org.apache.olingo.odata4.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.odata4.commons.api.edm.EdmNamed;
+import org.apache.olingo.odata4.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
import org.apache.olingo.odata4.commons.api.edm.EdmSingleton;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
-import org.apache.olingo.odata4.producer.api.uri.UriPathInfoKind;
-import org.apache.olingo.producer.core.uri.antlr.UriLexer;
-import org.apache.olingo.producer.core.uri.antlr.UriParserParser;
-import org.apache.olingo.producer.core.uri.antlr.UriParserParser.AllAltContext;
-import org.apache.olingo.producer.core.uri.antlr.UriParserParser.BatchAltContext;
-import org.apache.olingo.producer.core.uri.antlr.UriParserParser.CrossjoinAltContext;
-import org.apache.olingo.producer.core.uri.antlr.UriParserParser.EntityAltContext;
-import org.apache.olingo.producer.core.uri.antlr.UriParserParser.MetadataAltContext;
-import org.apache.olingo.producer.core.uri.antlr.UriParserParser.OdataRelativeUriContext;
-import org.apache.olingo.producer.core.uri.antlr.UriParserParser.PathSegmentContext;
-import org.apache.olingo.producer.core.uri.antlr.UriParserParser.PathSegmentsAltContext;
-import org.apache.olingo.producer.core.uri.antlr.UriParserParser.PathSegmentsContext;
-import org.apache.olingo.producer.core.uri.antlr.UriParserParser.ResourcePathAltContext;
+import org.apache.olingo.odata4.commons.api.edm.EdmStructuralType;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltBatchContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltEntityCastContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltEntityContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltMetadataContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltResourcePathContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.NameValueListContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.NameValueOptListContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.NameValuePairContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.OdataRelativeUriContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.OdataRelativeUriEOFContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.PathSegmentContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.PathSegmentsContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.QueryOptionsContext;
+import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ResourcePathContext;
public class UriParserImpl {
+ private Edm edm = null;
+ private EdmEntityContainer edmEntityContainer = null;
- private EdmEntityContainer entityContainer = null;
+ public UriParserImpl(Edm edm) {
+ this.edm = edm;
+ this.edmEntityContainer = edm.getEntityContainer(null);
+ }
- public UriInfoImpl readUri(final String uri, final Edm edm) {
- entityContainer = edm.getEntityContainer(null);// "RefScenario","Container1"
+ public UriInfoImpl ParseUri(String uri) throws UriParserException {
+ OdataRelativeUriEOFContext root = ParserAdapter.parseInput(uri);
+ return readODataRelativeUriEOF(root);
+ }
- UriInfoImpl ret = new UriInfoImpl();
- OdataRelativeUriContext root = parseUri(uri);
+ private UriInfoImpl readODataRelativeUriEOF(OdataRelativeUriEOFContext node) {
+ OdataRelativeUriContext first = (OdataRelativeUriContext) node.getChild(0);
+ return readODataRelativeUri(first);
+ }
- ret = readODataRelativeUri(root);
- return ret;
+ private UriInfoImpl readODataRelativeUri(OdataRelativeUriContext node) {
+ if (node instanceof AltBatchContext) {
+ return new UriInfoImplBatch();
+ } else if (node instanceof AltEntityContext) {
+ // TODO read the entity options
+ return new UriInfoImplEntity();
+ } else if (node instanceof AltEntityCastContext) {
+ // TODO read the entity options and the cast ns.odi
+ return new UriInfoImplEntity();
+ } else if (node instanceof AltMetadataContext) {
+ // TODO read the metadata queryparameter and fragment
+ return new UriInfoImplMetadata();
+ } else if (node instanceof AltResourcePathContext) {
+ return readAltResourcePath((AltResourcePathContext) node);
+ }
+ return null;
}
- UriInfoImpl readODataRelativeUri(final OdataRelativeUriContext root) {
- root.getChildCount();
+ private UriInfoImpl readAltResourcePath(AltResourcePathContext node) {
+ ResourcePathContext rpc = (ResourcePathContext) node.getChild(0);
+ QueryOptionsContext qoc = (QueryOptionsContext) node.getChild(2); // is null if there are no options
- if (root instanceof BatchAltContext) {
- return new UriInfoImpl().setKind(UriInfoKind.batch);
+ if (rpc.vPSs != null) {
+ return readPathSegments(rpc.vPSs);
+ } else if (rpc.vCJ != null) {
+ return new UriInfoImplCrossjoin();
+ } else if (rpc.vAll != null) {
+ return new UriInfoImplAll();
+ }
- } else if (root instanceof EntityAltContext) {
- // TODO implement
- } else if (root instanceof MetadataAltContext) {
- // TODO implement
- } else if (root instanceof ResourcePathAltContext) {
+ return null;
+ }
- return readResourcePath(root);
+ private UriInfoImpl readPathSegments(PathSegmentsContext pathSegments) {
+ int iSegment = 0;
+ UriInfoImplPath infoImpl = new UriInfoImplPath();
+ PathSegmentContext firstChild = (PathSegmentContext) pathSegments.vlPS.get(iSegment);
+ UriPathInfoImpl firstPathInfo = readFirstPathSegment(infoImpl, firstChild);
- }
+ iSegment++;
- return null;
+ UriPathInfoImpl prevPathInfo = firstPathInfo;
+
+ while (iSegment < pathSegments.vlPS.size()) {
+ PathSegmentContext nextChild = (PathSegmentContext) pathSegments.vlPS.get(iSegment);
+ prevPathInfo = readNextPathSegment(infoImpl, nextChild, prevPathInfo);
+ iSegment++;
+ }
+ return infoImpl;
}
- private UriInfoImpl readResourcePath(final OdataRelativeUriContext root) {
- ParseTree firstChild = root.getChild(0);
+ private UriPathInfoImpl readNextPathSegment(UriInfoImplPath infoImpl, PathSegmentContext pathSegment,
+ UriPathInfoImpl prevPathInfo) {
+
+ UriPathInfoImpl pathInfo = null;
+
+ String odi = pathSegment.vODI.getText(); // not optional
+
+ // check for properties
+ if (pathSegment.vNS == null) {
+
+ EdmType prevType = prevPathInfo.getType();
+ if (prevType instanceof EdmStructuralType) {
+ EdmStructuralType prevStructType = (EdmStructuralType) prevType;
+
+ EdmElement element = prevStructType.getProperty(odi);
+ if (element == null) {
+ // TODO exception property not found
+ }
+
+ if (element instanceof EdmProperty) {
+ prevPathInfo.addProperty((EdmProperty) element);
+ return prevPathInfo;
+ } else if (element instanceof EdmNavigationProperty) {
+
+ prevPathInfo.addNavigationProperty((EdmNavigationProperty) element);
+
+ UriPathInfoNavEntitySet pathInfoNav = new UriPathInfoNavEntitySet();
+ pathInfoNav.addSourceNavigationProperty((EdmNavigationProperty) element);
+ infoImpl.addPathInfo(pathInfoNav);
+ return pathInfoNav;
+
+ } else {
+
+ }
+
+ }
+
+ } else {
+ // check for namespace
+ String namespace = pathSegment.vNS.getText();
+ namespace = namespace.substring(0, namespace.length() - 1);
+
+ FullQualifiedName fullName = new FullQualifiedName(namespace, odi);
+
+ // check for typecasts
+ if (prevPathInfo.getType() instanceof EdmEntityType) {
+ EdmEntityType et = edm.getEntityType(fullName);
+ if (et != null) {
+ prevPathInfo.addTypeFilter(et);
+
+ if (pathSegment.vlVPO.size() != 0) {
+ UriKeyPredicateList keyPred = readKeyPredicateList(
+ pathSegment.vlVPO.get(0), (EdmEntityType) prevPathInfo.getType());
+ prevPathInfo.setKeyPredicates(keyPred);
+ }
+
+ return prevPathInfo;
+ }
+ } else if (prevPathInfo.getType() instanceof EdmComplexType) {
+ EdmComplexType ct = edm.getComplexType(fullName);
+ if (ct != null) {
+ prevPathInfo.addTypeFilter(ct);
+ return prevPathInfo;
+ }
+ }
- if (firstChild instanceof AllAltContext) {
- return new UriInfoImpl().setKind(UriInfoKind.all);
- } else if (firstChild instanceof CrossjoinAltContext) {
- // TODO read ODIs behind crossjoin
- return new UriInfoImpl().setKind(UriInfoKind.crossjoin);
- } else if (firstChild instanceof PathSegmentsAltContext) {
- return readPathSegments((PathSegmentsAltContext) firstChild);
+ // check for bound action
+ if (pathSegment.vlVPO == null) {
+ EdmAction action = edm.getAction(fullName, prevPathInfo.getFullType(), false);
+ pathInfo = new UriPathInfoActionImpl().setAction(action);
+ infoImpl.addPathInfo(pathInfo);
+ return pathInfo;
+ } else {
+ // check for bound functions
+ UriParameterlist parameterList = readParameterList(pathSegment.vlVPO.get(0));
+
+ EdmFunction function = edm.getFunction(fullName, prevPathInfo.getFullType(), false, parameterList.getNames());
+ if (function != null) {
+
+ UriPathInfoFunctionImpl pathInfoFunction = new UriPathInfoFunctionImpl();
+ pathInfoFunction.setFunction(function);
+ pathInfoFunction.setParameters(parameterList);
+
+ if (pathSegment.vlVPO.size() > 1) {
+ UriKeyPredicateList keyPred = readKeyPredicateList(
+ pathSegment.vlVPO.get(1), (EdmEntityType) prevPathInfo.getType());
+ pathInfoFunction.setKeyPredicates(keyPred);
+ }
+
+ infoImpl.addPathInfo(pathInfo);
+
+ return pathInfo;
+ }
+ }
+
+ // Exception unknown typeFilter/action or function
}
+
return null;
}
- private UriInfoImpl readPathSegments(final PathSegmentsAltContext pathSegmentsAlt) {
- PathSegmentsContext firstChild = (PathSegmentsContext) pathSegmentsAlt.getChild(0);
+ private UriPathInfoImpl readFirstPathSegment(UriInfoImplPath infoImpl, PathSegmentContext pathSegment) {
+ UriPathInfoImpl pathInfo = null;
- UriInfoImpl uriInfo = new UriInfoImpl();
+ // assert pathSegment.vNS = null;
+ String odi = pathSegment.vODI.getText(); // not optional
- readFirstPathSegment(uriInfo, firstChild.ps.get(0));
+ // EntitySet
+ EdmEntitySet edmES = edmEntityContainer.getEntitySet(odi);
+ if (edmES != null) {
+ pathInfo = readEntitySet(pathSegment, edmES);
+ }
- for (int i = 1; i < firstChild.ps.size(); i++) {
+ // Singleton
+ EdmSingleton edmSI = edmEntityContainer.getSingleton(odi);
+ if (edmSI != null) {
+ pathInfo = readSingleton(pathSegment, edmSI);
+ }
+ // FunctionImport
+ EdmFunctionImport edmFI = edmEntityContainer.getFunctionImport(odi);
+ if (edmFI != null) {
+ pathInfo = readFunctionImport(pathSegment, edmFI);
}
- return null;
+ // ActionImport
+ EdmActionImport edmAI = edmEntityContainer.getActionImport(odi);
+ if (edmAI != null) {
+ pathInfo = readActionImport(pathSegment, edmAI);
+ }
+
+ infoImpl.addPathInfo(pathInfo);
+
+ return pathInfo;
+ }
+
+ private UriPathInfoImpl readActionImport(PathSegmentContext pathSegment, EdmActionImport edmFI) {
+ UriPathInfoActionImpl uriPathInfo = new UriPathInfoActionImpl();
+
+ EdmAction action = edmFI.getAction();
+ uriPathInfo.setAction(action);
+
+ int num = pathSegment.vlVPO.size();
+ if (num == 2) {
+ // TODO exception action parameters not allowed
+ } else if (num == 1) {
+
+ if (uriPathInfo.isCollection() == true) {
+ if (uriPathInfo.getType() instanceof EdmEntityType) {
+ uriPathInfo.setKeyPredicates(
+ readKeyPredicateList(pathSegment.vlVPO.get(0), (EdmEntityType) uriPathInfo.getType()));
+ } else {
+ // TODO exception action keypreticates not allowed
+ }
+ } else {
+ // TODO exception action parameters not allowed
+ }
+ }
+
+ return uriPathInfo;
}
- private void readFirstPathSegment(final UriInfoImpl uriInfo, final PathSegmentContext ctx) {
- /*
- * if (ctx.ns != null) {//TODO implement
- * // Error: First pathsegment can not be qualified. Allowed is entityset|function...
- * }
- */
+ private UriPathInfoImpl readFunctionImport(PathSegmentContext pathSegment, EdmFunctionImport edmFI) {
+ UriPathInfoFunctionImpl uriPathInfo = new UriPathInfoFunctionImpl();
- /*
- * if (ctx.odi == null) {//TODO implement
- * // Error: First pathsegment must contain an odata identifier
- * }
- */
+ if (pathSegment.vlVPO == null) {
+ // TODO exception function parameters missing
+ }
- // get element "odataIdentifier" from EDM
- EdmNamed edmObject = null;// entityContainer.getElement(odataIdentifier);
+ UriParameterlist parameterList = readParameterList(pathSegment.vlVPO.get(0));
+ EdmFunction function = edmFI.getFunction(parameterList.getNames());
+ uriPathInfo.setFunction(function);
+ uriPathInfo.setParameters(parameterList);
- if (edmObject instanceof EdmEntitySet) {
+ if (pathSegment.vlVPO.size() > 1) {
- // is EdmEntitySet
+ if (!(uriPathInfo.getType() instanceof EdmEntityType)) {
+ // TODO exception illegally used keypredicates on function impored returning not an entityset
+ }
+ uriPathInfo.setKeyPredicates(
+ readKeyPredicateList(pathSegment.vlVPO.get(1), (EdmEntityType) uriPathInfo.getType()));
+ }
- EdmEntitySet entityset = (EdmEntitySet) edmObject;
- UriPathInfoEntitySetImpl pathInfo = new UriPathInfoEntitySetImpl();
- pathInfo.setKind(UriPathInfoKind.entitySet);
- pathInfo.setEntityContainer(entityContainer);
+ return null;
+ }
- pathInfo.setTargetEntityset(entityset);
- pathInfo.setTargetType(entityset.getEntityType());
- pathInfo.setCollection(true);
+ private UriPathInfoImpl readSingleton(PathSegmentContext pathSegment, EdmSingleton edmSI) {
+ UriPathInfoSingletonImpl uriPathInfo = new UriPathInfoSingletonImpl();
- // TODO check if kp may have been collected into fp
- /*
- * if (ctx.kp != null) {
- * //pathInfo.setKeyPredicates(readkeypredicates(ctx.kp, entityset.getEntityType()));
- * pathInfo.setCollection(false);
- * }
- */
- uriInfo.addUriPathInfo(pathInfo);
- return;
- } else if (edmObject instanceof EdmSingleton) {
+ uriPathInfo.setSingleton(edmSI);
+ return uriPathInfo;
+ }
- // is EdmSingleton
+ private UriPathInfoImpl readEntitySet(PathSegmentContext pathSegment, EdmEntitySet edmES) {
- EdmSingleton singleton = (EdmSingleton) edmObject;
- UriPathInfoSigletonImpl pathInfo = new UriPathInfoSigletonImpl(); // TODO change to UriPathInfoImplEntitySet
- pathInfo.setKind(UriPathInfoKind.singleton);
- pathInfo.setEntityContainer(entityContainer);
- pathInfo.setTargetType(singleton.getEntityType());
- // pathInfo.targetType = singleton.getEntityType();
- pathInfo.setCollection(false);
+ UriPathInfoEntitySetImpl uriPathInfo = new UriPathInfoEntitySetImpl();
+ uriPathInfo.setEntitSet(edmES);
- uriInfo.addUriPathInfo(pathInfo);
- return;
- } else if (edmObject instanceof EdmActionImport) {
+ // KeyPredicates
+ if (pathSegment.vlVPO != null) {
+ if (pathSegment.vlVPO.size() == 1) {
+ uriPathInfo.setKeyPredicates(readKeyPredicateList(pathSegment.vlVPO.get(0), edmES.getEntityType()));
- // is EdmActionImport
+ } else if (pathSegment.vlVPO.size() > 1) {
+ // TODO exception ( to much key predicates)
+ }
- UriPathInfoActionImportImpl pathInfo = new UriPathInfoActionImportImpl();
- pathInfo.setKind(UriPathInfoKind.actionImport);
+ }
+ return uriPathInfo;
+ }
- uriInfo.addUriPathInfo(pathInfo);
- return;
+ private UriKeyPredicateList readKeyPredicateList(NameValueOptListContext parameterList, EdmEntityType entityType) {
+ if (parameterList.vVO != null) {
+ String value = parameterList.vVO.vV.getText();
+ List<String> kp = entityType.getKeyPredicateNames();
- } else if (edmObject instanceof EdmFunctionImport) {
+ if (kp.size() != 1) {
+ // TODO exception "for using a value only keyPredicate there must be exact ONE defined keyProperty
+ }
- // is EdmFunctionImport
+ String keyName = kp.get(0); // there yhoul
- UriPathInfoImplFunctionImport pathInfo = new UriPathInfoImplFunctionImport();
- pathInfo.setKind(UriPathInfoKind.functioncall);
+ return new UriKeyPredicateList().add(keyName, value);
+ }
- /*
- * if (ctx.fp != null) {
- * pathInfo.setFunctionParameter(readFunctionParameters(uriInfo, ctx.fp));
- * }
- */
- /*
- * if (ctx.kp != null) {
- * pathInfo.setKeyPredicates(readkeypredicates(ctx.kp, fi.getReturnedEntitySet().getEntityType()));
- * }
- */
+ NameValueListContext vNVL = parameterList.vNVL;
+ if (vNVL == null) {
+ // TODO throw exception empty keypredicates not allowed
+ }
+ UriKeyPredicateList uriPrameterList1 = new UriKeyPredicateList();
- uriInfo.addUriPathInfo(pathInfo);
- return;
+ for (NameValuePairContext nvl : vNVL.vNVP) {
+ String name = nvl.vODI.getText();
+ String value = nvl.vVAL.getText();
+ uriPrameterList1.add(name, value);
}
+ return uriPrameterList1;
}
- private OdataRelativeUriContext parseUri(final String uri) {
-
- ANTLRInputStream input = new ANTLRInputStream(uri);
+ private UriParameterlist readParameterList(NameValueOptListContext parameterList) {
+ if (parameterList.vVO != null) {
+ // TODO throw error "Value Only" not allowed for function/action parameters, only in keypredicates
+ return null;
+ }
- // UriLexer lexer = new UriLexer(input);
- UriLexer lexer = new UriLexer(input);
+ NameValueListContext vNVL = parameterList.vNVL;
+ UriParameterlist uriPrameterList1 = new UriParameterlist();
- CommonTokenStream tokens = new CommonTokenStream(lexer);
- UriParserParser parser = new UriParserParser(tokens);
+ for (NameValuePairContext nvl : vNVL.vNVP) {
+ String name = nvl.vODI.getText();
+ if (nvl.vVAL != null) {
+ String value = nvl.vVAL.getText();
+ uriPrameterList1.add(name, value, null);
+ } else {
+ String alias = nvl.vALI.getText();
+ uriPrameterList1.add(name, null, alias);
+ }
- // parser.addErrorListener(new ErrorHandler());
- // if (stage == 1) {
- // //see https://github.com/antlr/antlr4/issues/192
- // parser.setErrorHandler(new BailErrorStrategy());
- // parser.getInterpreter().setPredictionMode(PredictionMode.LL);
- // } else {
- parser.setErrorHandler(new DefaultErrorStrategy());
- parser.getInterpreter().setPredictionMode(PredictionMode.SLL);
- // }
+ }
+ return uriPrameterList1;
- // parser.d
- return parser.odataRelativeUri();
}
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoActionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoActionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoActionImpl.java
new file mode 100644
index 0000000..50aa554
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoActionImpl.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * 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
+ *
+ * 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.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmAction;
+import org.apache.olingo.odata4.producer.api.uri.UriPathInfoKind;
+
+/**
+ * Covers Functionimports and BoundFunction in URI
+ */
+public class UriPathInfoActionImpl extends UriPathInfoImpl {
+
+ private EdmAction action;
+
+ public UriPathInfoActionImpl() {
+ this.setKind(UriPathInfoKind.action);
+ }
+
+ public UriPathInfoActionImpl setAction(EdmAction action) {
+
+ this.action = action;
+ this.setType(action.getReturnType().getType());
+ this.setCollection(action.getReturnType().isCollection());
+
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoActionImportImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoActionImportImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoActionImportImpl.java
deleted file mode 100644
index 23dede3..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoActionImportImpl.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * 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
- *
- * 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.
- ******************************************************************************/
-
-package org.apache.olingo.odata4.producer.core.uri;
-
-public class UriPathInfoActionImportImpl extends UriPathInfoImpl {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoEntitySetImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoEntitySetImpl.java
index 8d80e1e..f47b66f 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoEntitySetImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoEntitySetImpl.java
@@ -19,32 +19,22 @@
package org.apache.olingo.odata4.producer.core.uri;
-import java.util.List;
-
import org.apache.olingo.odata4.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.odata4.producer.api.uri.KeyPredicate;
+import org.apache.olingo.odata4.producer.api.uri.UriPathInfoKind;
public class UriPathInfoEntitySetImpl extends UriPathInfoImpl {
+ EdmEntitySet edmEntitySet = null;
- private EdmEntitySet targetEntityset;
-
- private List<KeyPredicate> keyPredicates;
-
- public EdmEntitySet getTargetEntityset() {
- return targetEntityset;
+ public UriPathInfoEntitySetImpl() {
+ this.setKind(UriPathInfoKind.entitySet);
}
- // TODO add to Interface UriPathInfoEntitySet
- public void setTargetEntityset(final EdmEntitySet targetEntityset) {
- this.targetEntityset = targetEntityset;
- }
+ public UriPathInfoEntitySetImpl setEntitSet(EdmEntitySet edmES) {
- public List<KeyPredicate> getKeyPredicates() {
- return keyPredicates;
- }
+ this.edmEntitySet = edmES;
+ this.setType(edmES.getEntityType());
- public void setKeyPredicates(final List<KeyPredicate> keyPredicates) {
- this.keyPredicates = keyPredicates;
+ return this;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoFunctionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoFunctionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoFunctionImpl.java
new file mode 100644
index 0000000..3d607bd
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoFunctionImpl.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * 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
+ *
+ * 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.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmFunction;
+import org.apache.olingo.odata4.producer.api.uri.UriPathInfoKind;
+
+/**
+ * Covers Functionimports and BoundFunction in URI
+ */
+public class UriPathInfoFunctionImpl extends UriPathInfoImpl {
+
+ private UriParameterlist parameters;
+ private EdmFunction function;
+ private UriKeyPredicateList keyPredicates;
+
+ public UriPathInfoFunctionImpl() {
+ this.setKind(UriPathInfoKind.function);
+ }
+
+ public UriPathInfoFunctionImpl setParameters(UriParameterlist parameters) {
+ this.parameters = parameters;
+ return this;
+ }
+
+ public UriParameterlist getParameters() {
+ return parameters;
+ }
+
+ public UriPathInfoFunctionImpl setFunction(EdmFunction function) {
+ this.function = function;
+ super.setType(function.getReturnType().getType());
+ super.setCollection(function.getReturnType().isCollection());
+ return this;
+ }
+
+ public UriPathInfoFunctionImpl setKeyPredicates(UriKeyPredicateList keyPredicates) {
+ this.keyPredicates = keyPredicates;
+ return this;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImpl.java
index 4a2636d..1a4f67c 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImpl.java
@@ -18,58 +18,161 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.core.uri;
-import org.apache.olingo.odata4.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
-import org.apache.olingo.odata4.producer.api.uri.UriPathInfo;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmElement;
+import org.apache.olingo.odata4.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmStructuralType;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
import org.apache.olingo.odata4.producer.api.uri.UriPathInfoKind;
-//import org.apache.olingo.api.commons.InlineCount;
-//import org.apache.olingo.api.uri.NavigationPropertySegment;
-//import org.apache.olingo.api.uri.NavigationSegment;
-//import org.apache.olingo.api.uri.SelectItem;
-//import org.apache.olingo.api.uri.expression.FilterExpression;
-//import org.apache.olingo.api.uri.expression.OrderByExpression;
-
-/**
- *
- */
-public class UriPathInfoImpl implements UriPathInfo {
+
+public abstract class UriPathInfoImpl {
+
+ private EdmType initialType = null;
+ private EdmType finalType = null;
+
private UriPathInfoKind kind;
- private EdmEntityContainer entityContainer;
+ private EdmType collectionTypeFilter = null;
+ private UriKeyPredicateList keyPredicates = null;
+ private EdmType singleTypeFilter = null;
+
+ private class PathListItem {
+ private EdmElement property; // ia EdmProperty or EdmNavigationProperty
+
+ private EdmType initialType;
+ private EdmType finalType;
+ private boolean isCollection;
+ }
+
+ private List<PathListItem> pathList = null;
private boolean isCollection;
- private EdmEntityType targetType;
- @Override
- public EdmEntityContainer getEntityContainer() {
- return entityContainer;
+ public UriPathInfoImpl setType(EdmType edmType) {
+ this.initialType = edmType;
+ this.finalType = edmType;
+ return this;
+ }
+
+ public EdmType getType() {
+ return finalType;
+ }
+
+ public EdmType getInitialType() {
+ return initialType;
}
- public void setEntityContainer(final EdmEntityContainer entityContainer) {
- this.entityContainer = entityContainer;
+ public FullQualifiedName getFullType() {
+ return new FullQualifiedName(finalType.getNamespace(), finalType.getName());
+ }
+
+ public UriPathInfoImpl setKind(UriPathInfoKind kind) {
+ this.kind = kind;
+ return this;
}
- @Override
public UriPathInfoKind getKind() {
return kind;
}
- public void setKind(final UriPathInfoKind kind) {
- this.kind = kind;
+ public UriPathInfoImpl setKeyPredicates(UriKeyPredicateList keyPredicates) {
+ if ( this.isCollection()!= true) {
+ // throw exception
+ }
+ this.keyPredicates = keyPredicates;
+ this.setCollection(false);
+ return this;
}
- @Override
- public boolean isCollection() {
- return isCollection;
+ public UriKeyPredicateList getKeyPredicates() {
+ return this.keyPredicates;
}
- public void setCollection(final boolean isCollection) {
- this.isCollection = isCollection;
+ public UriPathInfoImpl addTypeFilter(EdmStructuralType targetType) {
+ // TODO if there is a navigation path the type filter musst be applied to the last
+ if (pathList == null) {
+ if (keyPredicates == null) {
+ if (collectionTypeFilter != null) {
+ // TODO exception Type filters are not directy chainable
+ }
+ if (targetType.compatibleTo((EdmStructuralType) finalType)) {
+ collectionTypeFilter = targetType;
+ finalType = targetType;
+ } else {
+ // TODO throw exception
+ }
+ } else {
+ if (singleTypeFilter != null) {
+ // TODO exception Type filters are not directy chainable
+ }
+ if (targetType.compatibleTo((EdmStructuralType) finalType)) {
+ singleTypeFilter = targetType;
+ finalType = targetType;
+ } else {
+ // TODO throw exception
+ }
+ }
+ } else {
+ PathListItem last = pathList.get(pathList.size() - 1);
+
+ if (targetType.compatibleTo(last.finalType)) {
+ last.finalType = targetType;
+ }
+ }
+ return this;
+ }
+
+ public UriPathInfoImpl addProperty(EdmProperty property) {
+ if (pathList == null) {
+ pathList = new ArrayList<PathListItem>();
+ }
+
+ PathListItem newItem = new PathListItem();
+ newItem.property = property;
+ newItem.initialType = property.getType();
+ newItem.finalType = property.getType();
+ newItem.isCollection = property.isCollection();
+ pathList.add(newItem);
+
+ this.finalType = newItem.finalType;
+ this.isCollection = newItem.isCollection;
+ return this;
+ }
+
+ public UriPathInfoImpl addNavigationProperty(EdmNavigationProperty property) {
+ if (pathList == null) {
+ pathList = new ArrayList<PathListItem>();
+ }
+ PathListItem newItem = new PathListItem();
+ newItem.property = property;
+ newItem.initialType = property.getType();
+ newItem.finalType = property.getType();
+ newItem.isCollection = property.isCollection();
+ pathList.add(newItem);
+
+ this.finalType = newItem.finalType;
+ this.isCollection = newItem.isCollection;
+ return this;
}
- public EdmEntityType getTargetType() {
- return targetType;
+ public int getPropertyCount() {
+ return pathList.size();
}
- public void setTargetType(final EdmEntityType targetType) {
- this.targetType = targetType;
+ public EdmElement getProperty(int index) {
+ return pathList.get(index).property;
+
+ }
+
+ public UriPathInfoImpl setCollection(boolean isCollection) {
+ this.isCollection = isCollection;
+ return this;
+ }
+
+ public boolean isCollection() {
+
+ return isCollection;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImplFunctionImport.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImplFunctionImport.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImplFunctionImport.java
deleted file mode 100644
index c25b1f6..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImplFunctionImport.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * 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
- *
- * 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.
- ******************************************************************************/
-
-package org.apache.olingo.odata4.producer.core.uri;
-
-import java.util.List;
-
-import org.apache.olingo.odata4.producer.api.uri.KeyPredicate;
-
-public class UriPathInfoImplFunctionImport extends UriPathInfoImpl {
-
- // TODO change to proper Type
- private Object functionParameter;
- private List<KeyPredicate> keyPredicates;
-
- public Object getFunctionParameter() {
- return functionParameter;
- }
-
- public void setFunctionParameter(final Object functionParameter) {
- this.functionParameter = functionParameter;
- }
-
- public List<KeyPredicate> getKeyPredicates() {
- return keyPredicates;
- }
-
- public void setKeyPredicates(final List<KeyPredicate> keyPredicates) {
- this.keyPredicates = keyPredicates;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoNavEntitySet.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoNavEntitySet.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoNavEntitySet.java
new file mode 100644
index 0000000..3383e69
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoNavEntitySet.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * 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
+ *
+ * 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.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.odata4.producer.api.uri.UriPathInfoKind;
+
+public class UriPathInfoNavEntitySet extends UriPathInfoImpl {
+
+ private EdmNavigationProperty sourceNavigationProperty;
+
+ public UriPathInfoNavEntitySet() {
+ this.setKind(UriPathInfoKind.navEntitySet);
+ }
+
+ public UriPathInfoNavEntitySet addSourceNavigationProperty(EdmNavigationProperty sourceNavigationProperty) {
+ this.sourceNavigationProperty = sourceNavigationProperty;
+ this.setType(sourceNavigationProperty.getType());
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoSigletonImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoSigletonImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoSigletonImpl.java
deleted file mode 100644
index 3311a47..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoSigletonImpl.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * 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
- *
- * 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.
- ******************************************************************************/
-
-package org.apache.olingo.odata4.producer.core.uri;
-
-public class UriPathInfoSigletonImpl extends UriPathInfoImpl {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoSingletonImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoSingletonImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoSingletonImpl.java
new file mode 100644
index 0000000..c6aa2b0
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoSingletonImpl.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * 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
+ *
+ * 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.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmSingleton;
+import org.apache.olingo.odata4.producer.api.uri.UriPathInfoKind;
+
+public class UriPathInfoSingletonImpl extends UriPathInfoImpl {
+
+ private EdmSingleton singleton;
+
+ public UriPathInfoSingletonImpl() {
+ this.setKind(UriPathInfoKind.singleton);
+ }
+
+ public UriPathInfoSingletonImpl setSingleton(EdmSingleton singleton) {
+
+ this.singleton = singleton;
+ this.setType(singleton.getEntityType());
+ return this;
+ }
+
+}
[6/9] [OLINGO-63] Uri Parser: adoptions in lexer and parser,
create UriParserImpl to convert the parsetree into internal
structures, moved parser antlr part from .../olingo/producer/... to
.../olingo/odata4/producer
Posted by ko...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechProvider.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechProvider.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechProvider.java
index 1a52418..6051dbd 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechProvider.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechProvider.java
@@ -19,197 +19,1947 @@
package org.apache.olingo.odata4.producer.core.testutil;
import java.util.Arrays;
+import java.util.List;
+import org.apache.olingo.odata4.commons.api.edm.helper.EntityContainerInfo;
import org.apache.olingo.odata4.commons.api.edm.helper.FullQualifiedName;
+import org.apache.olingo.odata4.commons.api.edm.provider.ActionImport;
+import org.apache.olingo.odata4.commons.api.edm.provider.ComplexType;
import org.apache.olingo.odata4.commons.api.edm.provider.EdmProviderAdapter;
import org.apache.olingo.odata4.commons.api.edm.provider.EntitySet;
import org.apache.olingo.odata4.commons.api.edm.provider.EntityType;
+import org.apache.olingo.odata4.commons.api.edm.provider.EnumMember;
+import org.apache.olingo.odata4.commons.api.edm.provider.EnumType;
+import org.apache.olingo.odata4.commons.api.edm.provider.Function;
+import org.apache.olingo.odata4.commons.api.edm.provider.FunctionImport;
+import org.apache.olingo.odata4.commons.api.edm.provider.NavigationProperty;
+import org.apache.olingo.odata4.commons.api.edm.provider.Parameter;
import org.apache.olingo.odata4.commons.api.edm.provider.Property;
import org.apache.olingo.odata4.commons.api.edm.provider.PropertyRef;
+import org.apache.olingo.odata4.commons.api.edm.provider.ReferentialConstraint;
+import org.apache.olingo.odata4.commons.api.edm.provider.ReturnType;
+import org.apache.olingo.odata4.commons.api.edm.provider.Singleton;
+import org.apache.olingo.odata4.commons.api.edm.provider.Action;
import org.apache.olingo.odata4.commons.api.exception.ODataException;
import org.apache.olingo.odata4.commons.api.exception.ODataNotImplementedException;
import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
public class EdmTechProvider extends EdmProviderAdapter {
- Property propertyInt16NotNullable = new Property()
- .setName("PropertyInt16")
- .setType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName())
- .setNullable(false);
-//Simple typed Properties
- Property propertyBinary = new Property()
- .setName("PropertyBinary")
- .setType(EdmPrimitiveTypeKind.Binary.getFullQualifiedName());
- Property propertyBoolean = new Property()
- .setName("PropertyBoolean")
- .setType(EdmPrimitiveTypeKind.Boolean.getFullQualifiedName());
- Property propertyByte = new Property()
- .setName("PropertyByte")
- .setType(EdmPrimitiveTypeKind.Byte.getFullQualifiedName());
- Property propertyDate = new Property()
- .setName("PropertyDate")
- .setType(EdmPrimitiveTypeKind.Date.getFullQualifiedName());
- Property propertyDateTimeOffset = new Property()
- .setName("PropertyDateTimeOffset")
- .setType(EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName());
- Property propertyDecimal = new Property()
- .setName("PropertyDecimal")
- .setType(EdmPrimitiveTypeKind.Decimal.getFullQualifiedName());
- Property propertyDouble = new Property()
- .setName("PropertyDouble")
- .setType(EdmPrimitiveTypeKind.Double.getFullQualifiedName());
- Property propertyDuration = new Property()
- .setName("PropertyDuration")
- .setType(EdmPrimitiveTypeKind.Duration.getFullQualifiedName());
- Property propertyGuid = new Property()
- .setName("PropertyGuid")
- .setType(EdmPrimitiveTypeKind.Guid.getFullQualifiedName());
- Property propertyInt16 = new Property()
- .setName("PropertyInt16")
- .setType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName());
- Property propertyInt32 = new Property()
- .setName("PropertyInt32")
- .setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName());
- Property propertyInt64 = new Property()
- .setName("PropertyInt64")
- .setType(EdmPrimitiveTypeKind.Int64.getFullQualifiedName());
- Property propertySByte = new Property()
- .setName("PropertySByte")
- .setType(EdmPrimitiveTypeKind.SByte.getFullQualifiedName());
- Property propertySingle = new Property()
- .setName("PropertySingle")
- .setType(EdmPrimitiveTypeKind.Single.getFullQualifiedName());
- Property propertyString = new Property()
- .setName("PropertyString")
- .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
- Property propertyTimeOfDay = new Property()
- .setName("PropertyTimeOfDay")
- .setType(EdmPrimitiveTypeKind.TimeOfDay.getFullQualifiedName());
+ private static final String nameSpace = "com.sap.odata.test1";
+
+ private static final FullQualifiedName nameBFCCollCTPrimCompRTESAllPrim =
+ new FullQualifiedName(nameSpace, "BFCCollCTPrimCompRTESAllPrim");
+
+ private static final FullQualifiedName nameBFCCollStringRTESTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BFCCollStringRTESTwoKeyNav");
+
+ private static final FullQualifiedName nameBFCCTPrimCompRTESBaseTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BFCCTPrimCompRTESBaseTwoKeyNav");
+
+ private static final FullQualifiedName nameBFCCTPrimCompRTESTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BFCCTPrimCompRTESTwoKeyNav");
+
+ private static final FullQualifiedName nameBFCCTPrimCompRTETTwoKeyNavParam =
+ new FullQualifiedName(nameSpace, "BFCCTPrimCompRTETTwoKeyNavParam");
+
+ private static final FullQualifiedName nameBFCESAllPrimRTCTAllPrim =
+ new FullQualifiedName(nameSpace, "BFCESAllPrimRTCTAllPrim");
+
+ private static final FullQualifiedName nameBFCESBaseTwoKeyNavRTESBaseTwoKey =
+ new FullQualifiedName(nameSpace, "BFCESBaseTwoKeyNavRTESBaseTwoKey");
+
+ private static final FullQualifiedName nameBFCESKeyNavRTETKeyNav = new FullQualifiedName(nameSpace,
+ "BFCESKeyNavRTETKeyNav");
+
+ private static final FullQualifiedName nameBFCESKeyNavRTETKeyNavParam =
+ new FullQualifiedName(nameSpace, "BFCESKeyNavRTETKeyNavParam");
+
+ private static final FullQualifiedName nameBFCESTwoKeyNavRTCollCTTwoPrim =
+ new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTCollCTTwoPrim");
+
+ private static final FullQualifiedName nameBFCESTwoKeyNavRTCollString =
+ new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTCollString");
+
+ private static final FullQualifiedName nameBFCESTwoKeyNavRTCTTwoPrim =
+ new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTCTTwoPrim");
+
+ private static final FullQualifiedName nameBFCESTwoKeyNavRTESTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTESTwoKeyNav");
+
+ private static final FullQualifiedName nameBFCESTwoKeyNavRTString =
+ new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTString");
+
+ private static final FullQualifiedName nameBFCESTwoKeyNavRTStringParam =
+ new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTStringParam");
+
+ private static final FullQualifiedName nameBFCESTwoKeyNavRTTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTTwoKeyNav");
+
+ private static final FullQualifiedName nameBFCETBaseTwoKeyNavRTESBaseTwoKey =
+ new FullQualifiedName(nameSpace, "BFCETBaseTwoKeyNavRTESBaseTwoKey");
+
+ private static final FullQualifiedName nameBFCETBaseTwoKeyNavRTESTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BFCETBaseTwoKeyNavRTESTwoKeyNav");
+
+ private static final FullQualifiedName nameBFCETBaseTwoKeyNavRTETTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BFCETBaseTwoKeyNavRTETTwoKeyNav");
+
+ private static final FullQualifiedName nameBFCETKeyNavRTETKeyNav =
+ new FullQualifiedName(nameSpace, "BFCETKeyNavRTETKeyNav");
+
+ private static final FullQualifiedName nameBFCETTwoKeyNavRTCTTwoPrim =
+ new FullQualifiedName(nameSpace, "BFCETTwoKeyNavRTCTTwoPrim");
+
+ private static final FullQualifiedName nameBFCETTwoKeyNavRTESTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BFCETTwoKeyNavRTESTwoKeyNav");
+
+ private static final FullQualifiedName nameBFCETTwoKeyNavRTETTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BFCETTwoKeyNavRTETTwoKeyNav");
+
+ private static final FullQualifiedName nameBFCSINavRTESTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BFCSINavRTESTwoKeyNav");
+
+ private static final FullQualifiedName nameBFCStringRTESTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BFCStringRTESTwoKeyNav");
+
+ private static final FullQualifiedName nameBFESTwoKeyNavRTESTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BFESTwoKeyNavRTESTwoKeyNav");
+
+ private static final FullQualifiedName nameBinary = EdmPrimitiveTypeKind.Binary.getFullQualifiedName();
+
+ private static final FullQualifiedName nameBoolean = EdmPrimitiveTypeKind.Boolean.getFullQualifiedName();
+
+ public static final FullQualifiedName nameByte = EdmPrimitiveTypeKind.Byte.getFullQualifiedName();
+
+ private static final FullQualifiedName nameContainer = new FullQualifiedName(nameSpace, "Container");
+ public static final FullQualifiedName nameCTPrim = new FullQualifiedName(nameSpace, "CTPrim");
+ public static final FullQualifiedName nameCTAllPrim = new FullQualifiedName(nameSpace, "CTAllPrim");
+
+ private static final FullQualifiedName nameCTBase = new FullQualifiedName(nameSpace, "CTBase");
+
+ public static final FullQualifiedName nameCTCollAllPrim =
+ new FullQualifiedName(nameSpace, "CTCollAllPrim");
+
+ public static final FullQualifiedName nameCTCompCollComp =
+ new FullQualifiedName(nameSpace, "CTCompCollComp");
+
+ public static final FullQualifiedName nameCTCompComp = new FullQualifiedName(nameSpace, "CTCompComp");
+
+ private static final FullQualifiedName nameCTMixPrimCollComp = new FullQualifiedName(nameSpace,
+ "CTMixPrimCollComp");
+
+ public static final FullQualifiedName nameCTNavFiveProp =
+ new FullQualifiedName(nameSpace, "CTNavFiveProp");
+
+ public static final FullQualifiedName nameCTPrimComp = new FullQualifiedName(nameSpace, "CTPrimComp");
+
+ public static final FullQualifiedName nameCTPrimEnum = new FullQualifiedName(nameSpace, "CTPrimEnum");
+
+ private static final FullQualifiedName nameCTTwoBase = new FullQualifiedName(nameSpace, "CTTwoBase");
+
+ public static final FullQualifiedName nameCTTwoPrim = new FullQualifiedName(nameSpace, "CTTwoPrim");
+
+ public static final FullQualifiedName nameDate = EdmPrimitiveTypeKind.Date.getFullQualifiedName();
+
+ public static final FullQualifiedName nameDateTimeOffset =
+ EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName();
+
+ public static final FullQualifiedName nameDecimal = EdmPrimitiveTypeKind.Decimal.getFullQualifiedName();
+
+ public static final FullQualifiedName nameDouble = EdmPrimitiveTypeKind.Double.getFullQualifiedName();
+
+ public static final FullQualifiedName nameDuration = EdmPrimitiveTypeKind.Duration.getFullQualifiedName();
+
+ public static final FullQualifiedName nameENString = new FullQualifiedName(nameSpace, "ENString");
+
+ private static final FullQualifiedName nameETAllKey = new FullQualifiedName(nameSpace, "ETAllKey");
+
+ private static final FullQualifiedName nameETAllNullable = new FullQualifiedName(nameSpace, "ETAllNullable");
+
+ private static final FullQualifiedName nameETAllPrim = new FullQualifiedName(nameSpace, "ETAllPrim");
+
+ private static final FullQualifiedName nameETBase = new FullQualifiedName(nameSpace, "ETBase");
+
+ private static final FullQualifiedName nameETBaseTwoKeyNav = new FullQualifiedName(nameSpace, "ETBaseTwoKeyNav");
+
+ private static final FullQualifiedName nameETBaseTwoKeyTwoPrim = new FullQualifiedName(nameSpace,
+ "ETBaseTwoKeyTwoPrim");
+
+ public static final FullQualifiedName nameETCollAllPrim = new FullQualifiedName(nameSpace, "ETCollAllPrim");
+
+ private static final FullQualifiedName nameETCompAllPrim = new FullQualifiedName(nameSpace, "ETCompAllPrim");
+
+ private static final FullQualifiedName nameETCompCollAllPrim = new FullQualifiedName(nameSpace, "ETCompCollAllPrim");
+
+ private static final FullQualifiedName nameETCompCollComp = new FullQualifiedName(nameSpace, "ETCompCollComp");
+
+ private static final FullQualifiedName nameETCompComp = new FullQualifiedName(nameSpace, "ETCompComp");
+
+ private static final FullQualifiedName nameETCompMixPrimCollComp = new FullQualifiedName(nameSpace,
+ "ETCompMixPrimCollComp");
+
+ public static final FullQualifiedName nameETKeyNav = new FullQualifiedName(nameSpace, "ETKeyNav");
+
+ private static final FullQualifiedName nameETKeyTwoKeyComp = new FullQualifiedName(nameSpace, "ETKeyTwoKeyComp");
+
+ private static final FullQualifiedName nameETMedia = new FullQualifiedName(nameSpace, "ETMedia");
+
+ private static final FullQualifiedName nameETMixPrimCollComp = new FullQualifiedName(nameSpace, "ETMixPrimCollComp");
+
+ private static final FullQualifiedName nameETServerSidePaging =
+ new FullQualifiedName(nameSpace, "ETServerSidePaging");
+
+ private static final FullQualifiedName nameETTwoBase = new FullQualifiedName(nameSpace, "ETTwoBase");
+
+ private static final FullQualifiedName nameETTwoBaseTwoKeyTwoPrim = new FullQualifiedName(nameSpace,
+ "ETTwoBaseTwoKeyTwoPrim");
+
+ public static final FullQualifiedName nameETTwoKeyNav = new FullQualifiedName(nameSpace, "ETTwoKeyNav");
+
+ public static final FullQualifiedName nameETTwoKeyTwoPrim = new FullQualifiedName(nameSpace, "ETTwoKeyTwoPrim");
+
+ public static final FullQualifiedName nameETTwoPrim = new FullQualifiedName(nameSpace, "ETTwoPrim");
+
+ public static final FullQualifiedName nameGuit = EdmPrimitiveTypeKind.Guid.getFullQualifiedName();
+
+ public static final FullQualifiedName nameInt16 = EdmPrimitiveTypeKind.Int16.getFullQualifiedName();
+
+ public static final FullQualifiedName nameInt32 = EdmPrimitiveTypeKind.Int32.getFullQualifiedName();
+
+ public static final FullQualifiedName nameInt64 = EdmPrimitiveTypeKind.Int64.getFullQualifiedName();
+
+ public static final FullQualifiedName nameSByte = EdmPrimitiveTypeKind.SByte.getFullQualifiedName();
+
+ public static final FullQualifiedName nameSingle = EdmPrimitiveTypeKind.Single.getFullQualifiedName();
+
+ public static final FullQualifiedName nameString = EdmPrimitiveTypeKind.String.getFullQualifiedName();
+
+ public static final FullQualifiedName nameTimeOfDay = EdmPrimitiveTypeKind.TimeOfDay.getFullQualifiedName();
+
+ private static final FullQualifiedName nameUARTCompCollParam = new FullQualifiedName(nameSpace, "UARTCompCollParam");
+
+ private static final FullQualifiedName nameUARTCompParam = new FullQualifiedName(nameSpace, "UARTCompParam");
+
+ private static final FullQualifiedName nameUARTETCollAllPrimParam = new FullQualifiedName(nameSpace,
+ "UARTETCollAllPrimParam");
+
+ private static final FullQualifiedName nameUARTETParam = new FullQualifiedName(nameSpace, "UARTETParam");
+
+ private static final FullQualifiedName nameUARTPrimCollParam = new FullQualifiedName(nameSpace, "UARTPrimCollParam");
+
+ private static final FullQualifiedName nameUARTPrimParam = new FullQualifiedName(nameSpace, "UARTPrimParam");
+
+ private static final FullQualifiedName nameUFCRTCollCTTwoPrim =
+ new FullQualifiedName(nameSpace, "UFCRTCollCTTwoPrim");
+
+ private static final FullQualifiedName nameUFCRTCollString = new FullQualifiedName(nameSpace, "UFCRTCollString");
+
+ private static final FullQualifiedName nameUFCRTCollStringTwoParam = new FullQualifiedName(nameSpace,
+ "UFCRTCollStringTwoParam");
+
+ private static final FullQualifiedName nameUFCRTCTAllPrimTwoParam = new FullQualifiedName(nameSpace,
+ "UFCRTCTAllPrimTwoParam");
+
+ private static final FullQualifiedName nameUFCRTCTTwoPrim = new FullQualifiedName(nameSpace, "UFCRTCTTwoPrim");
+
+ private static final FullQualifiedName nameUFCRTCTTwoPrimParam = new FullQualifiedName(nameSpace,
+ "UFCRTCTTwoPrimParam");
+
+ private static final FullQualifiedName nameUFCRTESMixPrimCollCompTwoParam = new FullQualifiedName(nameSpace,
+ "UFCRTESMixPrimCollCompTwoParam");
+
+ private static final FullQualifiedName nameUFCRTESTwoKeyNavParam = new FullQualifiedName(nameSpace,
+ "UFCRTESTwoKeyNavParam");
+
+ private static final FullQualifiedName nameUFCRTETAllPrimTwoParam = new FullQualifiedName(nameSpace,
+ "UFCRTETAllPrimTwoParam");
+
+ private static final FullQualifiedName nameUFCRTETKeyNav = new FullQualifiedName(nameSpace, "UFCRTETKeyNav");
+
+ private static final FullQualifiedName nameUFCRTETMedia = new FullQualifiedName(nameSpace, "UFCRTETMedia");
+
+ private static final FullQualifiedName nameUFCRTETTwoKeyNavParam = new FullQualifiedName(nameSpace,
+ "UFCRTETTwoKeyNavParam");
+
+ private static final FullQualifiedName nameUFCRTETTwoKeyNavParamCTTwoPrim = new FullQualifiedName(nameSpace,
+ "UFCRTETTwoKeyNavParamCTTwoPrim");
+
+ private static final FullQualifiedName nameUFCRTString = new FullQualifiedName(nameSpace, "UFCRTString");
+
+ private static final FullQualifiedName nameUFCRTStringTwoParam = new FullQualifiedName(nameSpace,
+ "UFCRTStringTwoParam");
+
+ private static final FullQualifiedName nameUFNRTESMixPrimCollCompTwoParam = new FullQualifiedName(nameSpace,
+ "UFNRTESMixPrimCollCompTwoParam");
+
+ private static final FullQualifiedName nameUFNRTInt16 = new FullQualifiedName(nameSpace, "UFNRTInt16");
+
+ NavigationProperty collectionNavPropertyETKeyNavMany_ETKeyNav = new NavigationProperty()
+ .setName("NavPropertyETKeyNavMany")
+ .setType(nameETKeyNav)
+ .setCollection(true);
+
+ NavigationProperty collectionNavPropertyETMediaMany_ETMedia = new NavigationProperty()
+ .setName("NavPropertyETMediaMany")
+ .setType(nameETMedia)
+ .setCollection(true);
+
+ NavigationProperty collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav = new NavigationProperty()
+ .setName("NavPropertyETTwoKeyNavMany")
+ .setType(nameETTwoKeyNav)
+ .setCollection(true)
+ .setPartner("NavPropertyETKeyNavOne");
// Properties typed as collection of simple types
- Property collectionPropertyBinary = new Property()
+ Property collPropertyBinary = new Property()
.setName("CollPropertyBinary")
- .setType(EdmPrimitiveTypeKind.Binary.getFullQualifiedName())
+ .setType(nameBinary)
.setCollection(true);
- Property collectionPropertyBoolean = new Property()
+
+ Property collPropertyBoolean = new Property()
.setName("CollPropertyBoolean")
- .setType(EdmPrimitiveTypeKind.Boolean.getFullQualifiedName())
+ .setType(nameBoolean)
.setCollection(true);
- Property collectionPropertyByte = new Property()
+
+ Property collPropertyByte = new Property()
.setName("CollPropertyByte")
- .setType(EdmPrimitiveTypeKind.Byte.getFullQualifiedName())
+ .setType(nameByte)
.setCollection(true);
- Property collectionPropertyDate = new Property()
+
+ Property collPropertyComplex_CTPrimComp = new Property()
+ .setName("CollPropertyComplex")
+ .setType(nameCTPrimComp)
+ .setCollection(true);
+
+ Property collPropertyComplex_CTTwoPrim = new Property()
+ .setName("CollPropertyComplex")
+ .setType(nameCTTwoPrim)
+ .setCollection(true);
+
+ Property collPropertyDate = new Property()
.setName("CollPropertyDate")
- .setType(EdmPrimitiveTypeKind.Date.getFullQualifiedName())
+ .setType(nameDate)
.setCollection(true);
- Property collectionPropertyDateTimeOffset = new Property()
+
+ Property collPropertyDateTimeOffset = new Property()
.setName("CollPropertyDateTimeOffset")
- .setType(EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName())
+ .setType(nameDateTimeOffset)
.setCollection(true);
- Property collectionPropertyDecimal = new Property()
+
+ Property collPropertyDecimal = new Property()
.setName("CollPropertyDecimal")
- .setType(EdmPrimitiveTypeKind.Decimal.getFullQualifiedName())
+ .setType(nameDecimal)
.setCollection(true);
- Property collectionPropertyDouble = new Property()
+
+ Property collPropertyDouble = new Property()
.setName("CollPropertyDouble")
- .setType(EdmPrimitiveTypeKind.Double.getFullQualifiedName())
+ .setType(nameDouble)
.setCollection(true);
- Property collectionPropertyDuration = new Property()
+
+ Property collPropertyDuration = new Property()
.setName("CollPropertyDuration")
- .setType(EdmPrimitiveTypeKind.Duration.getFullQualifiedName())
+ .setType(nameDuration)
.setCollection(true);
- Property collectionPropertyGuid = new Property()
+
+ Property collPropertyGuid = new Property()
.setName("CollPropertyGuid")
- .setType(EdmPrimitiveTypeKind.Guid.getFullQualifiedName())
+ .setType(nameGuit)
.setCollection(true);
- Property collectionPropertyInt16 = new Property()
+
+ Property collPropertyInt16 = new Property()
.setName("CollPropertyInt16")
- .setType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName())
+ .setType(nameInt16)
.setCollection(true);
- Property collectionPropertyInt32 = new Property()
+
+ Property collPropertyInt32 = new Property()
.setName("CollPropertyInt32")
- .setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName())
+ .setType(nameInt32)
.setCollection(true);
- Property collectionPropertyInt64 = new Property()
+
+ Property collPropertyInt64 = new Property()
.setName("CollPropertyInt64")
- .setType(EdmPrimitiveTypeKind.Int64.getFullQualifiedName())
+ .setType(nameInt64)
.setCollection(true);
- Property collectionPropertySByte = new Property()
+ Property collPropertySByte = new Property()
.setName("CollPropertySByte")
- .setType(EdmPrimitiveTypeKind.SByte.getFullQualifiedName())
+ .setType(nameSByte)
.setCollection(true);
- Property collectionPropertySingle = new Property()
+ Property collPropertySingle = new Property()
.setName("CollPropertySingle")
- .setType(EdmPrimitiveTypeKind.Single.getFullQualifiedName())
+ .setType(nameSingle)
.setCollection(true);
- Property collectionPropertyString = new Property()
+ Property collPropertyString = new Property()
.setName("CollPropertyString")
- .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName())
+ .setType(nameString)
.setCollection(true);
- Property collectionPropertyTimeOfDay = new Property()
+ Property collPropertyTimeOfDay = new Property()
.setName("CollPropertyTimeOfDay")
- .setType(EdmPrimitiveTypeKind.TimeOfDay.getFullQualifiedName())
+ .setType(nameTimeOfDay)
+ .setCollection(true);
+
+ EntityContainerInfo entityContainerInfoTest1 =
+ new EntityContainerInfo().setContainerName(nameContainer);
+
+ NavigationProperty navPropertyETKeyNavOne_ETKeyNav = new NavigationProperty()
+ .setName("NavPropertyETKeyNavOne")
+ .setType(nameETKeyNav);
+ NavigationProperty navPropertyETMediaOne_ETMedia = new NavigationProperty()
+ .setName("NavPropertyETMediaOne")
+ .setType(nameETMedia);
+ NavigationProperty navPropertyETTwoKeyNavOne_ETTwoKeyNav = new NavigationProperty()
+ .setName("NavPropertyETTwoKeyNavOne")
+ .setType(nameETTwoKeyNav)
+ .setNullable(false);
+
+ Property propertyBinary = new Property()
+ .setName("PropertyBinary")
+ .setType(nameBinary);
+ Property propertyBoolean = new Property()
+ .setName("PropertyBoolean")
+ .setType(nameBoolean);
+ Property propertyByte = new Property()
+ .setName("PropertyByte")
+ .setType(nameByte);
+ Property propertyComplex_CTAllPrim = new Property()
+ .setName("PropertyComplex")
+ .setType(nameCTAllPrim);
+ Property propertyComplex_CTCollAllPrim = new Property()
+ .setName("PropertyComplex")
+ .setType(nameCTCollAllPrim);
+ Property propertyComplex_CTCompCollComp = new Property()
+ .setName("PropertyComplex")
+ .setType(nameCTCompCollComp);
+
+ /*
+ * TODO add stream property
+ * Property propertyStream = new Property()
+ * .setName("PropertyStream")
+ * .setType(EdmStream.getFullQualifiedName());
+ */
+
+ Property propertyComplex_CTCompComp = new Property()
+ .setName("PropertyComplex")
+ .setType(nameCTCompComp);
+ Property propertyComplex_CTNavFiveProp = new Property()
+ .setName("PropertyComplex")
+ .setType(nameCTNavFiveProp);
+ Property propertyComplex_CTPrimComp_NotNullable = new Property()
+ .setName("PropertyComplex")
+ .setType(nameCTPrimComp)
+ .setNullable(false);
+ Property propertyComplex_CTTwoPrim = new Property()
+ .setName("PropertyComplex")
+ .setType(nameCTTwoPrim);
+ Property propertyComplexAllPrim_CTAllPrim = new Property()
+ .setName("PropertyComplexAllPrim")
+ .setType(nameCTAllPrim);
+ Property propertyComplexComplex_CTCompComp = new Property()
+ .setName("PropertyComplexComplex")
+ .setType(nameCTCompComp);
+ Property propertyComplexEnum_CTPrimEnum_NotNullable = new Property()
+ .setName("PropertyComplexEnum")
+ .setType(nameCTPrimEnum)
+ .setNullable(false);
+ Property propertyComplexTwoPrim_CTTwoPrim = new Property()
+ .setName("PropertyComplexTwoPrim")
+ .setType(nameCTTwoPrim);
+ Property propertyDate = new Property()
+ .setName("PropertyDate")
+ .setType(nameDate);
+ Property propertyDateTimeOffset = new Property()
+ .setName("PropertyDateTimeOffset")
+ .setType(nameDateTimeOffset);
+ Property propertyDecimal = new Property()
+ .setName("PropertyDecimal")
+ .setType(nameDecimal);
+ Property propertyDouble = new Property()
+ .setName("PropertyDouble")
+ .setType(nameDouble);
+ Property propertyDuration = new Property()
+ .setName("PropertyDuration")
+ .setType(nameDuration);
+ Property propertyEnumString_ENString = new Property()
+ .setName("PropertyEnumString")
+ .setType(nameENString);
+ Property propertyGuid = new Property()
+ .setName("PropertyGuid")
+ .setType(nameGuit);
+ Property propertyInt16 = new Property()
+ .setName("PropertyInt16")
+ .setType(nameInt16);
+
+ Property propertyInt16_NotNullable = new Property()
+ .setName("PropertyInt16")
+ .setType(nameInt16)
+ .setNullable(false);
+
+ Property propertyInt32 = new Property()
+ .setName("PropertyInt32")
+ .setType(nameInt32);
+
+ Property propertyInt64 = new Property()
+ .setName("PropertyInt64")
+ .setType(nameInt64);
+
+ Property propertyMixedPrimCollComp_CTMixPrimCollComp = new Property()
+ .setName("PropertyMixedPrimCollComp")
+ .setType(nameCTMixPrimCollComp)
.setCollection(true);
-// EdmEntityContainer entityContainerTest1 = new EdmEntityContainerImpl(
-// new EntityContainerInfo()
-// .setContainerName(new FullQualifiedName("com.sap.odata.test1", "Container"))
-// );
+ Property propertySByte = new Property()
+ .setName("PropertySByte")
+ .setType(nameSByte);
+
+ Property propertySingle = new Property()
+ .setName("PropertySingle")
+ .setType(nameSingle);
+
+ Property propertyString = new Property()
+ .setName("PropertyString")
+ .setType(nameString);
+
+ Property propertyString_NotNullable = new Property()
+ .setName("PropertyString")
+ .setType(nameString)
+ .setNullable(false);
+ Property propertyTimeOfDay = new Property().setName("PropertyTimeOfDay")
+ .setType(nameTimeOfDay);
+
+ @Override
+ public List<Action> getActions(final FullQualifiedName actionName) throws ODataException {
+ if (actionName.equals(nameUARTPrimParam)) {
+ return Arrays.asList(
+ new Action().setName("UARTPrimParam")
+ .setBound(false)
+ .setReturnType(new ReturnType().setType(nameString))
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterInt16")
+ .setType(nameInt16)))
+
+ );
+ } else if (actionName.equals(nameUARTPrimCollParam)) {
+ return Arrays.asList(
+ new Action().setName("UARTPrimCollParam")
+ .setBound(false)
+ .setReturnType(
+ new ReturnType()
+ .setType(nameString).setCollection(true))
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterInt16")
+ .setType(nameInt16)))
+ );
+ } else if (actionName.equals(nameUARTCompParam)) {
+ return Arrays.asList(
+ new Action().setName("UARTCompParam")
+ .setBound(false)
+ .setReturnType(
+ new ReturnType()
+ .setType(nameCTTwoPrim))
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterInt16")
+ .setType(nameInt16)))
+ );
+ } else if (actionName.equals(nameUARTCompCollParam)) {
+ return Arrays.asList(
+ new Action().setName("UARTCompCollParam")
+ .setBound(false)
+ .setReturnType(
+ new ReturnType()
+ .setCollection(true)
+ .setType(nameCTTwoPrim))
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterInt16")
+ .setType(nameInt16)))
+ );
+ } else if (actionName.equals(nameUARTETParam)) {
+ return Arrays.asList(
+ new Action().setName("UARTCompCollParam")
+ .setBound(false)
+ .setReturnType(
+ new ReturnType()
+ .setType(nameETTwoKeyTwoPrim))
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterInt16")
+ .setType(nameInt16)))
+ );
+ } else if (actionName.equals(nameUARTETCollAllPrimParam)) {
+ return Arrays.asList(
+ new Action().setName("UARTETCollAllPrimParam")
+ .setBound(false)
+ .setReturnType(
+ new ReturnType()
+ .setType(nameETCollAllPrim)
+ .setCollection(true))
+
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterInt16")
+ .setType(nameInt16)))
+ );
+ }
+
+ // complete 20131209
+ return null;
+ }
+
+ @Override
+ public ComplexType
+ getComplexType(final FullQualifiedName
+ complexTypeName) throws
+ ODataException {
+ if (complexTypeName.equals(nameCTPrim)) {
+ return new ComplexType()
+ .setName("CTPrim")
+ .setProperties(Arrays.asList(propertyInt16));
+ } else if (complexTypeName.equals(nameCTAllPrim)) {
+ return new ComplexType()
+ .setName("CTAllPrim")
+ .setProperties(Arrays.asList(propertyString, propertyBinary, propertyBoolean,
+ propertyByte, propertyDate, propertyDateTimeOffset,
+ propertyDecimal, propertySingle, propertyDouble,
+ propertyDuration, propertyGuid, propertyInt16,
+ propertyInt32, propertyInt64, propertySByte,
+ propertyTimeOfDay/* ,TODO propertyStream */
+ ));
+
+ } else if (complexTypeName.equals(nameCTCollAllPrim)) {
+ return new ComplexType()
+ .setName("CTCollAllPrim")
+ .setProperties(Arrays.asList(collPropertyString,
+ collPropertyBoolean, collPropertyByte,
+ collPropertySByte,
+ collPropertyInt16, collPropertyInt32, collPropertyInt64,
+ collPropertySingle, collPropertyDouble,
+ collPropertyDecimal, collPropertyBinary,
+ collPropertyDate, collPropertyDateTimeOffset,
+ collPropertyDuration, collPropertyGuid,
+ collPropertyTimeOfDay /* ,TODO collectionPropertyStream */));
+ } else if (complexTypeName.equals(nameCTTwoPrim)) {
+ return new ComplexType()
+ .setName("CTTwoPrim")
+ .setProperties(Arrays.asList(propertyInt16, propertyString));
+ } else if (complexTypeName.equals(nameCTMixPrimCollComp)) {
+ return new ComplexType()
+ .setName("CTMixPrimCollComp")
+ .setProperties(Arrays.asList(propertyInt16, collPropertyString,
+ propertyComplex_CTTwoPrim, collPropertyComplex_CTTwoPrim));
+ } else if (complexTypeName.equals(nameCTBase)) {
+ return new ComplexType()
+ .setName("CTBase")
+ .setProperties(
+ Arrays.asList(new Property().setName("AdditionalPropString").setType(
+ new FullQualifiedName("Edm", "String"))));
+ } else if (complexTypeName.equals(nameCTTwoBase)) {
+ return new ComplexType()
+ .setName("CTTwoBase")
+ .setProperties(
+ Arrays.asList(new Property().setName("AdditionalPropString").setType(
+ new FullQualifiedName("Edm", "String"))));
+ } else if (complexTypeName.equals(nameCTCompComp)) {
+ return new ComplexType()
+ .setName("CTCompComp")
+ .setProperties(Arrays.asList(propertyComplex_CTTwoPrim));
+ } else if (complexTypeName.equals(nameCTCompCollComp)) {
+ return new ComplexType()
+ .setName("CTCompComp")
+ .setProperties(Arrays.asList(collPropertyComplex_CTTwoPrim));
+ } else if (complexTypeName.equals(nameCTPrimComp)) {
+ return new ComplexType()
+ .setName("CTPrimComp")
+ .setProperties(Arrays.asList(propertyInt16, propertyComplex_CTAllPrim));
+ } else if (complexTypeName.equals(nameCTNavFiveProp)) {
+ return new ComplexType()
+ .setName("CTNavFiveProp")
+ .setProperties(Arrays.asList(propertyInt16) /* TODO add nav prop */);
+ } else if (complexTypeName.equals(nameCTPrimEnum)) {
+ return new ComplexType()
+ .setName("CTPrimEnum")
+ .setProperties(Arrays.asList(propertyInt16, propertyEnumString_ENString) /* TODO add nav prop */);
+ }
+ // complete 20131205
+ return null;
+ }
+
+ @Override
+ public EntityContainerInfo getEntityContainerInfo(final FullQualifiedName entityContainerName) throws ODataException {
+ if (entityContainerName == null) {
+ return entityContainerInfoTest1;
+ } else if (entityContainerName.equals(nameContainer)) {
+ return entityContainerInfoTest1;
+ }
+ return null;
+ }
@Override
public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String name) throws ODataException {
- if (entityContainer == null) {
+ if (entityContainer == nameContainer) {
if (name.equals("ESAllPrim")) {
-
return new EntitySet()
- .setName("ETAllPrim")
- .setType(new FullQualifiedName("com.sap.odata.test1", "ESAllPrim"));
-
+ .setName("ESAllPrim")
+ .setType(nameETAllPrim);
} else if (name.equals("ESCollAllPrim")) {
-
return new EntitySet()
.setName("ESCollAllPrim")
- .setType(new FullQualifiedName("com.sap.odata.test1", "ETCollAllPrim"));
-
+ .setType(nameETCollAllPrim);
+ } else if (name.equals("ESTwoPrim")) {
+ return new EntitySet()
+ .setName("ESTwoPrim")
+ .setType(nameETTwoPrim);
+ } else if (name.equals("ESMixPrimCollComp")) {
+ return new EntitySet()
+ .setName("ESMixPrimCollComp")
+ .setType(nameETMixPrimCollComp);
+ } else if (name.equals("ESBase")) {
+ return new EntitySet()
+ .setName("ESBase")
+ .setType(nameETBase);
+ } else if (name.equals("ESTwoBase")) {
+ return new EntitySet()
+ .setName("ESTwoBase")
+ .setType(nameETTwoBase);
+ } else if (name.equals("ESTwoKeyTwoPrim")) {
+ return new EntitySet()
+ .setName("ESTwoKeyTwoPrim")
+ .setType(nameETTwoKeyTwoPrim);
+ } else if (name.equals("ESBaseTwoKeyTwoPrim")) {
+ return new EntitySet()
+ .setName("ESBaseTwoKeyTwoPrim")
+ .setType(nameETBaseTwoKeyTwoPrim);
+ } else if (name.equals("ESTwoBaseTwoKeyTwoPrim")) {
+ return new EntitySet()
+ .setName("ESTwoBaseTwoKeyTwoPrim")
+ .setType(nameETTwoBaseTwoKeyTwoPrim);
+ } else if (name.equals("ESAllKey")) {
+ return new EntitySet()
+ .setName("ESAllKey")
+ .setType(nameETAllKey);
+ } else if (name.equals("ESCompAllPrim")) {
+ return new EntitySet()
+ .setName("ESCompAllPrim")
+ .setType(nameETCompAllPrim);
+ } else if (name.equals("ESCompCollAllPrim")) {
+ return new EntitySet()
+ .setName("ESCompCollAllPrim")
+ .setType(nameETCompCollAllPrim);
+ } else if (name.equals("ESCompComp")) {
+ return new EntitySet()
+ .setName("ESCompComp")
+ .setType(nameETCompComp);
+ } else if (name.equals("ESCompCollComp")) {
+ return new EntitySet()
+ .setName("ESCompCollComp")
+ .setType(nameETCompCollComp);
+ } else if (name.equals("ESMedia")) {
+ return new EntitySet()
+ .setName("ESMedia")
+ .setType(nameETMedia)
+ .setIncludeInServiceDocument(true);
+ } else if (name.equals("ESKeyTwoKeyComp")) {
+ return new EntitySet()
+ .setName("ESKeyTwoKeyComp")
+ .setType(nameETKeyTwoKeyComp);
+ } else if (name.equals("ESInvisible")) {
+ return new EntitySet()
+ .setName("ESInvisible")
+ .setType(nameETAllPrim)
+ .setIncludeInServiceDocument(false);
+ } else if (name.equals("ESServerSidePaging")) {
+ return new EntitySet()
+ .setName("ESServerSidePaging")
+ .setType(nameETServerSidePaging);
+ } else if (name.equals("ESAllNullable")) {
+ return new EntitySet()
+ .setName("ESAllNullable")
+ .setType(nameETAllNullable);
+ } else if (name.equals("ESKeyNav")) {
+ return new EntitySet()
+ .setName("ESKeyNav")
+ .setType(nameETKeyNav);
+ } else if (name.equals("ESTwoKeyNav")) {
+ return new EntitySet()
+ .setName("ESTwoKeyNav")
+ .setType(nameETTwoKeyNav);
+ } else if (name.equals("ESBaseTwoKeyNav")) {
+ return new EntitySet()
+ .setName("ESBaseTwoKeyNav")
+ .setType(nameETBaseTwoKeyNav);
+ } else if (name.equals("ESCompMixPrimCollComp")) {
+ return new EntitySet()
+ .setName("ESCompMixPrimCollComp")
+ .setType(nameETCompMixPrimCollComp);
}
}
- throw new ODataNotImplementedException();
+ return null;
}
@Override
public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException {
+ List<PropertyRef> oneKeyPropertyInt16 = Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"));
- if (entityTypeName.equals(new FullQualifiedName("com.sap.odata.test1", "ETAllPrim"))) {
+ if (entityTypeName.equals(nameETAllPrim)) {
return new EntityType()
.setName("ETAllPrim")
+ .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyString,
+ propertyBoolean, propertyByte, propertySByte,
+ propertyInt32, propertyInt64,
+ propertySingle, propertyDouble, propertyDecimal,
+ propertyBinary, propertyDate, propertyDateTimeOffset,
+ propertyDuration, propertyGuid,
+ propertyTimeOfDay /* TODO add stream property */))
+ .setKey(oneKeyPropertyInt16);
+
+ } else if (entityTypeName.equals(nameETCollAllPrim)) {
+ return new EntityType()
+ .setName("ETCollAllPrim")
.setProperties(Arrays.asList(
- propertyBinary, propertyBoolean, propertyByte,
- propertyDate, propertyDateTimeOffset, propertyDecimal,
- propertyDouble, propertyDuration, propertyDecimal,
- propertyInt16NotNullable, propertyInt32, propertyInt64,
- propertySByte, propertySingle, propertyString,
- propertyTimeOfDay))
+ propertyInt16_NotNullable,
+ collPropertyString, collPropertyBoolean,
+ collPropertyByte, collPropertySByte,
+ collPropertyInt16, collPropertyInt32, collPropertyInt64,
+ collPropertySingle, collPropertyDouble, collPropertyDecimal,
+ collPropertyBinary, collPropertyDate, collPropertyDateTimeOffset,
+ collPropertyDuration,
+ collPropertyGuid,
+ collPropertyTimeOfDay /* TODO add stream property */))
+ .setKey(oneKeyPropertyInt16);
+ } else if (entityTypeName.equals(nameETTwoPrim)) {
+ return new EntityType()
+ .setName("ETTwoPrim")
+ .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyString))
+ .setKey(oneKeyPropertyInt16);
+ } else if (entityTypeName.equals(nameETMixPrimCollComp)) {
+ return new EntityType()
+ .setName("ETMixPrimCollComp")
+ .setProperties(Arrays.asList(propertyInt16_NotNullable, collPropertyString,
+ propertyComplex_CTTwoPrim, collPropertyComplex_CTTwoPrim))
+ .setKey(oneKeyPropertyInt16);
+ } else if (entityTypeName.equals(nameETTwoKeyTwoPrim)) {
+ return new EntityType()
+ .setName("ETTwoKeyTwoPrim")
+ .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyString))
.setKey(Arrays.asList(
- new PropertyRef().setPropertyName("PropertyInt16")));
+ new PropertyRef().setPropertyName("PropertyInt16"),
+ new PropertyRef().setPropertyName("PropertyString")));
+ } else if (entityTypeName.equals(nameETBaseTwoKeyTwoPrim)) {
+ return new EntityType()
+ .setName("ETBaseTwoKeyTwoPrim")
+ .setBaseType(nameETTwoKeyTwoPrim);
- } else if (entityTypeName.equals(new FullQualifiedName("com.sap.odata.test1", "ETCollAllPrim"))) {
+ } else if (entityTypeName.equals(nameETTwoBaseTwoKeyTwoPrim)) {
return new EntityType()
- .setName("ETCollAllPrim")
+ .setName("ETTwoBaseTwoKeyTwoPrim")
+ .setBaseType(nameETTwoKeyTwoPrim);
+ } else if (entityTypeName.equals(nameETBase)) {
+ return new EntityType()
+ .setName("ETBase")
+ .setBaseType(nameETTwoPrim)
+ .setProperties(Arrays.asList(new Property()
+ .setName("AdditionalPropertyString_5")
+ .setType(nameString)));
+ } else if (entityTypeName.equals(nameETTwoBase)) {
+ return new EntityType()
+ .setName("ETTwoBase")
+ .setProperties(Arrays.asList(new Property()
+ .setName("AdditionalPropertyString_6")
+ .setType(nameString))
+ );
+ } else if (entityTypeName.equals(nameETAllKey)) {
+ return new EntityType()
+ .setName("ETAllKey")
.setProperties(Arrays.asList(
- propertyInt16NotNullable,
- collectionPropertyBinary, collectionPropertyBoolean, collectionPropertyByte,
- collectionPropertyDate, collectionPropertyDateTimeOffset, collectionPropertyDecimal,
- collectionPropertyDouble, collectionPropertyDuration, collectionPropertyDecimal,
- collectionPropertyInt16, collectionPropertyInt32, collectionPropertyInt64,
- collectionPropertySByte, collectionPropertySingle, collectionPropertyString,
- collectionPropertyTimeOfDay))
+ propertyString, propertyBoolean,
+ propertyByte, propertySByte,
+ propertyInt16, propertyInt32, propertyInt64,
+ propertyDecimal, propertyDate,
+ propertySingle, propertyDouble, propertyDateTimeOffset,
+ propertyDuration, propertyGuid,
+ propertyTimeOfDay /* TODO add stream property */))
.setKey(Arrays.asList(
- new PropertyRef().setPropertyName("PropertyInt16")));
+ new PropertyRef().setPropertyName("PropertyString"),
+ new PropertyRef().setPropertyName("PropertyBoolean"),
+ new PropertyRef().setPropertyName("PropertyByte"),
+ new PropertyRef().setPropertyName("PropertySByte"),
+ new PropertyRef().setPropertyName("PropertyInt16"),
+ new PropertyRef().setPropertyName("PropertyInt32"),
+ new PropertyRef().setPropertyName("PropertyInt64"),
+ new PropertyRef().setPropertyName("PropertyDecimal"),
+ new PropertyRef().setPropertyName("PropertyDate"),
+ new PropertyRef().setPropertyName("PropertyDateTimeOffset"),
+ new PropertyRef().setPropertyName("PropertyDuration"),
+ new PropertyRef().setPropertyName("PropertyGuid"),
+ new PropertyRef().setPropertyName("PropertyTimeOfDay")));
+ } else if (entityTypeName.equals(nameETCompAllPrim)) {
+ return new EntityType()
+ .setName("ETCompAllPrim")
+ .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyComplex_CTAllPrim))
+ .setKey(oneKeyPropertyInt16);
+ } else if (entityTypeName.equals(nameETCompCollAllPrim)) {
+ return new EntityType()
+ .setName("ETCompAllPrim")
+ .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyComplex_CTCollAllPrim))
+ .setKey(oneKeyPropertyInt16);
+ } else if (entityTypeName.equals(nameETCompComp)) {
+ return new EntityType()
+ .setName("ETCompComp")
+ .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyComplex_CTCompComp))
+ .setKey(oneKeyPropertyInt16);
+ } else if (entityTypeName.equals(nameETCompCollComp)) {
+ return new EntityType()
+ .setName("ETCompCollComp")
+ .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyComplex_CTCompCollComp))
+ .setKey(oneKeyPropertyInt16);
+ } else if (entityTypeName.equals(nameETMedia)) {
+ return new EntityType()
+ .setName("ETCompCollComp")
+ .setProperties(Arrays.asList(propertyInt16_NotNullable))
+ .setKey(oneKeyPropertyInt16)
+ .setHasStream(true);
+ } else if (entityTypeName.equals(nameETKeyTwoKeyComp)) {
+ return new EntityType()
+ .setName("ETKeyTwoKeyComp")
+ .setProperties(
+ Arrays.asList(propertyInt16_NotNullable, propertyComplex_CTTwoPrim, propertyComplexComplex_CTCompComp))
+ .setKey(Arrays.asList(
+ new PropertyRef().setPropertyName("PropertyInt16"),
+ new PropertyRef().setPropertyName("PropertyComplex/PropertyInt16").setAlias("KeyAlias1"),
+ new PropertyRef().setPropertyName("PropertyComplex/PropertyString").setAlias("KeyAlias2"),
+ new PropertyRef().setPropertyName("PropertyComplexComplex/PropertyComplex/PropertyString")
+ .setAlias("KeyAlias3")));
+ } else if (entityTypeName.equals(nameETServerSidePaging)) {
+ return new EntityType()
+ .setName("ETKeyTwoKeyComp")
+ .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyString))
+ .setKey(oneKeyPropertyInt16);
+ } else if (entityTypeName.equals(nameETAllNullable)) {
+ return new EntityType()
+ .setName("ETAllNullable")
+ .setProperties(Arrays.asList(new Property()
+ .setName("PropertyKey").setType(nameInt16).setNullable(false),
+ propertyInt16,
+ propertyString, propertyBoolean,
+ propertyByte, propertySByte,
+ propertyInt32, propertyInt64,
+ propertySingle, propertyDouble,
+ propertyDecimal, propertyBinary, propertyDate,
+ propertyDateTimeOffset,
+ propertyDuration, propertyGuid, propertyTimeOfDay /* TODO add stream */,
+ collPropertyString, collPropertyBoolean,
+ collPropertyByte, collPropertySByte,
+ collPropertyInt16,
+ collPropertyInt32, collPropertyInt64,
+ collPropertySingle, collPropertyDouble,
+ collPropertyDecimal, collPropertyBinary, collPropertyDate,
+ collPropertyDateTimeOffset,
+ collPropertyDuration, collPropertyGuid, collPropertyTimeOfDay /* TODO add stream, */
+ ))
+ .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyKey")));
+ } else if (entityTypeName.equals(nameETKeyNav)) {
+ return new EntityType()
+ .setName("ETCollAllPrim")
+ .setProperties(
+ Arrays.asList(
+ propertyInt16_NotNullable, propertyString_NotNullable, propertyComplex_CTNavFiveProp,
+ propertyComplexAllPrim_CTAllPrim, propertyComplexTwoPrim_CTTwoPrim,
+ collPropertyString, collPropertyInt16, collPropertyComplex_CTPrimComp))
+ .setNavigationProperties(Arrays.asList(
+ navPropertyETTwoKeyNavOne_ETTwoKeyNav, collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav,
+ navPropertyETKeyNavOne_ETKeyNav, collectionNavPropertyETKeyNavMany_ETKeyNav,
+ navPropertyETMediaOne_ETMedia, collectionNavPropertyETMediaMany_ETMedia
+ ))
+ .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")));
+ } else if (entityTypeName.equals(nameETTwoKeyNav)) {
+ return new EntityType()
+ .setName("ETTwoKeyNav")
+ .setProperties(
+ Arrays.asList(propertyInt16, propertyString, propertyComplex_CTPrimComp_NotNullable,
+ propertyComplexEnum_CTPrimEnum_NotNullable,
+ collPropertyComplex_CTPrimComp,
+ collPropertyString, propertyComplexTwoPrim_CTTwoPrim,
+ propertyEnumString_ENString
+ ))
+ .setNavigationProperties(Arrays.asList(
+ new NavigationProperty()
+ .setName("NavPropertyETKeyNavOne")
+ .setType(nameETKeyNav)
+ .setReferentialConstraints(Arrays.asList(
+ new ReferentialConstraint()
+ .setProperty("PropertyInt16")
+ .setReferencedProperty("PropertyInt16"))),
+ collectionNavPropertyETKeyNavMany_ETKeyNav,
+ collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav,
+ navPropertyETTwoKeyNavOne_ETTwoKeyNav
+ ))
+ .setKey(Arrays.asList(
+ new PropertyRef().setPropertyName("PropertyInt16"),
+ new PropertyRef().setPropertyName("PropertyString")));
+ } else if (entityTypeName.equals(nameETBaseTwoKeyNav)) {
+ return new EntityType()
+ .setName("ETBaseTwoKeyNav")
+ .setProperties(Arrays.asList(propertyDate, propertyComplex_CTPrimComp_NotNullable))
+ .setNavigationProperties(Arrays.asList(
+ collectionNavPropertyETKeyNavMany_ETKeyNav,
+ navPropertyETKeyNavOne_ETKeyNav,
+ collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav,
+ navPropertyETTwoKeyNavOne_ETTwoKeyNav
+ ))
+ .setHasStream(true);
+ } else if (entityTypeName.equals(nameETCompMixPrimCollComp)) {
+ return new EntityType()
+ .setName("ETCompMixPrimCollComp")
+ .setProperties(Arrays.asList(propertyInt16, propertyMixedPrimCollComp_CTMixPrimCollComp))
+ .setKey(oneKeyPropertyInt16);
+ }
+
+ // complete 20131205
+ return null;
+ }
+
+ @Override
+ public EnumType getEnumType(final FullQualifiedName enumTypeName) throws ODataException {
+ if (enumTypeName.equals(nameENString)) {
+ return new EnumType()
+ .setName("ENString")
+ .setMembers(Arrays.asList(
+ new EnumMember().setName("String1").setValue("1"),
+ new EnumMember().setName("String2").setValue("2"),
+ new EnumMember().setName("String3").setValue("3")));
+ }
+ // complete 20131205
+ return null;
+ }
+
+ @Override
+ public List<Function> getFunctions(final FullQualifiedName functionName) throws ODataException {
+ ReturnType returnTypeString = new ReturnType()
+ .setType(nameString);
+
+ ReturnType returnTypeString_NotNullable = new ReturnType()
+ .setType(nameString)
+ .setNullable(false);
+
+ ReturnType returnTypeETTwoKeyNav_NotNullable = new ReturnType()
+ .setType(nameETTwoKeyNav)
+ .setNullable(false);
+
+ ReturnType returnTypeCollectionETTwoKeyNav_NotNullable = new ReturnType()
+ .setType(nameETTwoKeyNav)
+ .setNullable(false)
+ .setCollection(true);
+
+ if (functionName.equals(nameUFNRTInt16)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFNRTInt16")
+ .setBound(false)
+ .setReturnType(returnTypeString)
+ );
+ } else if (functionName.equals(nameUFCRTETKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTETKeyNav")
+ .setBound(true)
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType()
+ .setType(nameETKeyNav)
+ .setNullable(false))
+ );
+ } else if (functionName.equals(nameUFCRTETTwoKeyNavParam)) {
+ return Arrays.asList(
+ new Function().setName("UFCRTETTwoKeyNavParam")
+ .setBound(false)
+ .setComposable(true)
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("ParameterInt16")
+ .setType(nameInt16)
+ .setNullable(false)))
+ .setReturnType(returnTypeETTwoKeyNav_NotNullable)
+ );
+ } else if (functionName.equals(nameUFCRTETTwoKeyNavParamCTTwoPrim)) {
+ return Arrays.asList(
+ new Function().setName("UFCRTETTwoKeyNavParamCTTwoPrim")
+ .setBound(false)
+ .setComposable(true)
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("ParameterCTTwoPrim")
+ .setType(nameCTTwoPrim)
+ .setNullable(false)))
+ .setReturnType(returnTypeETTwoKeyNav_NotNullable)
+
+ );
+ } else if (functionName.equals(nameUFCRTStringTwoParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTStringTwoParam")
+ .setBound(false)
+ .setComposable(true)
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("ParameterString")
+ .setType(nameString)
+ .setNullable(false),
+ new Parameter()
+ .setName("ParameterInt16")
+ .setType(nameInt16)
+ .setNullable(false)))
+ .setReturnType(returnTypeString_NotNullable)
+
+ );
+ } else if (functionName.equals(nameUFCRTESTwoKeyNavParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTESTwoKeyNavParam")
+ .setBound(false)
+ .setComposable(true)
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("ParameterInt16")
+ .setType(nameInt16)
+ .setNullable(false)))
+ .setReturnType(
+ new ReturnType()
+ .setType(nameETTwoKeyNav)
+ .setNullable(false).setCollection(true))
+
+ );
+ } else if (functionName.equals(nameUFCRTString)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTString")
+ .setBound(true)
+ .setComposable(true)
+ .setReturnType(returnTypeString_NotNullable)
+ );
+ } else if (functionName.equals(nameUFCRTCollStringTwoParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTCollStringTwoParam")
+ .setBound(false)
+ .setComposable(true)
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("ParameterString")
+ .setType(nameString)
+ .setNullable(false),
+ new Parameter()
+ .setName("ParameterInt16")
+ .setType(nameInt16)
+ .setNullable(false)))
+ .setReturnType(
+ new ReturnType()
+ .setType(nameString)
+ .setNullable(false)
+ .setCollection(true))
+
+ );
+ } else if (functionName.equals(nameUFCRTCollString)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTCollString")
+ .setBound(false)
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType()
+ .setType(nameString)
+ .setNullable(false)
+ .setCollection(true))
+
+ );
+ } else if (functionName.equals(nameUFCRTCTAllPrimTwoParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTCTAllPrimTwoParam")
+ .setBound(false)
+ .setComposable(true)
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("ParameterString")
+ .setType(nameString)
+ .setNullable(false),
+ new Parameter()
+ .setName("ParameterInt16")
+ .setType(nameInt16)
+ .setNullable(false)))
+ .setReturnType(
+ new ReturnType()
+ .setType(nameCTAllPrim)
+ .setNullable(false))
+
+ );
+ } else if (functionName.equals(nameUFCRTCTTwoPrimParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTCTTwoPrimParam")
+ .setBound(false)
+ .setComposable(true)
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("ParameterString")
+ .setType(nameString)
+ .setNullable(false),
+ new Parameter()
+ .setName("ParameterInt16")
+ .setType(nameInt16)
+ .setNullable(false)))
+ .setReturnType(
+ new ReturnType()
+ .setType(nameCTTwoPrim)
+ .setNullable(false))
+
+ );
+ } else if (functionName.equals(nameUFCRTCTTwoPrim)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTCTTwoPrim")
+ .setBound(false)
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType()
+ .setType(nameCTTwoPrim)
+ .setNullable(false))
+ );
+ } else if (functionName.equals(nameUFCRTCollCTTwoPrim)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTCTTwoPrim")
+ .setBound(false)
+ .setReturnType(
+ new ReturnType()
+ .setType(nameCTTwoPrim)
+ .setNullable(false)
+ .setCollection(true))
+ );
+ } else if (functionName.equals(nameUFCRTETMedia)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTETMedia")
+ .setBound(false)
+ .setReturnType(
+ new ReturnType()
+ .setType(nameETMedia)
+ .setNullable(false))
+ );
+ } else if (functionName.equals(nameUFCRTString)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTString")
+ .setBound(false)
+ .setReturnType(returnTypeString_NotNullable)
+ );
+ } else if (functionName.equals(nameUFCRTCollCTTwoPrim)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTCollCTTwoPrim")
+ .setBound(false)
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType()
+ .setType(nameCTTwoPrim)
+ .setNullable(false)
+ .setCollection(true))
+ );
+ } else if (functionName.equals(nameUFNRTESMixPrimCollCompTwoParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFNRTESMixPrimCollCompTwoParam")
+ .setBound(false)
+ .setComposable(false)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("ParameterString")
+ .setType(nameString)
+ .setNullable(false),
+ new Parameter()
+ .setName("ParameterInt16")
+ .setType(nameInt16)
+ .setNullable(false)))
+ .setReturnType(
+ new ReturnType()
+ .setType(nameETMixPrimCollComp)
+ .setNullable(false)
+ .setCollection(true))
+ );
+
+ } else if (functionName.equals(nameUFCRTETAllPrimTwoParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTETAllPrimTwoParam")
+ .setBound(false)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("ParameterString")
+ .setType(nameString)
+ .setNullable(false),
+ new Parameter()
+ .setName("ParameterInt16")
+ .setType(nameInt16)
+ .setNullable(false)))
+ .setReturnType(
+ new ReturnType()
+ .setType(nameETAllPrim)
+ .setNullable(false))
+ );
+ } else if (functionName.equals(nameUFCRTESMixPrimCollCompTwoParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTESMixPrimCollCompTwoParam")
+ .setBound(false)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("ParameterString")
+ .setType(nameString)
+ .setNullable(false),
+ new Parameter()
+ .setName("ParameterInt16")
+ .setType(nameInt16)
+ .setNullable(false)))
+ .setReturnType(
+ new ReturnType()
+ .setType(nameETMixPrimCollComp)
+ .setNullable(false)
+ .setCollection(true))
+ );
+ } else if (functionName.equals(nameBFCESTwoKeyNavRTESTwoKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCESTwoKeyNavRTESTwoKeyNav")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETTwoKeyNav)
+ .setNullable(false)
+ .setCollection(false)))
+ .setReturnType(
+ new ReturnType()
+ .setType(nameETTwoKeyNav)
+ .setNullable(false)
+ .setCollection(true))
+ );
+ } else if (functionName.equals(nameBFCStringRTESTwoKeyNav)) {
+ return Arrays.asList(
+ new Function().setName("BFCStringRTESTwoKeyNav")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameString)
+ .setNullable(false)))
+ .setReturnType(returnTypeCollectionETTwoKeyNav_NotNullable)
+ );
+ } else if (functionName.equals(nameBFCETBaseTwoKeyNavRTETTwoKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCETBaseTwoKeyNavRTETTwoKeyNav")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETBaseTwoKeyNav)
+ .setNullable(false)))
+ .setReturnType(returnTypeETTwoKeyNav_NotNullable)
+ );
+ } else if (functionName.equals(nameBFCESBaseTwoKeyNavRTESBaseTwoKey)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCESBaseTwoKeyNavRTESBaseTwoKey")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETBaseTwoKeyNav)
+ .setNullable(false)
+ .setCollection(true)))
+ .setReturnType(
+ new ReturnType()
+ .setType(nameETBaseTwoKeyNav)
+ .setNullable(false)
+ .setCollection(true))
+ );
+ } else if (functionName.equals(nameBFCESAllPrimRTCTAllPrim)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCESAllPrimRTCTAllPrim")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETAllPrim)
+ .setNullable(false)
+ .setCollection(true)))
+ .setReturnType(
+ new ReturnType()
+ .setType(nameCTAllPrim)
+ .setNullable(false))
+ );
+ } else if (functionName.equals(nameBFCESTwoKeyNavRTCTTwoPrim)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCESTwoKeyNavRTCTTwoPrim")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETTwoKeyNav)
+ .setNullable(false)
+ .setCollection(true)))
+ .setReturnType(
+ new ReturnType()
+ .setType(nameCTTwoPrim)
+ .setNullable(false))
+ );
+ } else if (functionName.equals(nameBFCESTwoKeyNavRTCollCTTwoPrim)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCESTwoKeyNavRTCollCTTwoPrim")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETTwoKeyNav)
+ .setNullable(false)
+ .setCollection(true)))
+ .setReturnType(
+ new ReturnType()
+ .setType(nameCTTwoPrim)
+ .setNullable(false)
+ .setCollection(true))
+ );
+ } else if (functionName.equals(nameBFCESTwoKeyNavRTString)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCESTwoKeyNavRTString")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETTwoKeyNav)
+ .setNullable(false)
+ .setCollection(true)))
+ .setReturnType(returnTypeString_NotNullable)
+ );
+ } else if (functionName.equals(nameBFCESTwoKeyNavRTCollString)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCESTwoKeyNavRTCollString")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETTwoKeyNav)
+ .setNullable(false)))
+ .setReturnType(
+ new ReturnType()
+ .setType(nameString)
+ .setNullable(false)
+ .setCollection(true))
+ );
+ } else if (functionName.equals(nameBFCETTwoKeyNavRTESTwoKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCETTwoKeyNavRTESTwoKeyNav")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETTwoKeyNav)
+ .setNullable(false)))
+ .setReturnType(returnTypeCollectionETTwoKeyNav_NotNullable)
+ );
+ } else if (functionName.equals(nameBFCETBaseTwoKeyNavRTESTwoKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCETBaseTwoKeyNavRTESTwoKeyNav")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETBaseTwoKeyNav)
+ .setNullable(false)))
+ .setReturnType(returnTypeCollectionETTwoKeyNav_NotNullable)
+ );
+ } else if (functionName.equals(nameBFCSINavRTESTwoKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCSINavRTESTwoKeyNav")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETTwoKeyNav)
+ .setNullable(false)))
+ .setReturnType(returnTypeCollectionETTwoKeyNav_NotNullable)
+ );
+ } else if (functionName.equals(nameBFCETBaseTwoKeyNavRTESBaseTwoKey)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCETBaseTwoKeyNavRTESBaseTwoKey")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETBaseTwoKeyNav)
+ .setNullable(false)))
+ .setReturnType(
+ new ReturnType()
+ .setType(nameETBaseTwoKeyNav)
+ .setNullable(false)
+ .setCollection(true))
+ );
+ } else if (functionName.equals(nameBFCCollStringRTESTwoKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCCollStringRTESTwoKeyNav")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameString)
+ .setNullable(false)
+ .setCollection(true)))
+ .setReturnType(returnTypeETTwoKeyNav_NotNullable)
+ );
+ } else if (functionName.equals(nameBFCCTPrimCompRTESTwoKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCCTPrimCompRTESTwoKeyNav")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameCTPrimComp)
+ .setNullable(false)))
+ .setReturnType(returnTypeETTwoKeyNav_NotNullable)
+ );
+ } else if (functionName.equals(nameBFCCTPrimCompRTESBaseTwoKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCCTPrimCompRTESBaseTwoKeyNav")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameCTPrimComp)
+ .setNullable(false)))
+ .setReturnType(
+ new ReturnType()
+ .setType(nameETBaseTwoKeyNav)
+ .setNullable(false)
+ .setCollection(true))
+ );
+ } else if (functionName.equals(nameBFCCollCTPrimCompRTESAllPrim)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCCollCTPrimCompRTESAllPrim")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameCTPrimComp)
+ .setNullable(false)
+ .setCollection(true)))
+ .setReturnType(
+ new ReturnType()
+ .setType(nameETAllPrim)
+ .setNullable(false)
+ .setCollection(true))
+ );
+ } else if (functionName.equals(nameBFCESTwoKeyNavRTTwoKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCESTwoKeyNavRTTwoKeyNav")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETTwoKeyNav)
+ .setNullable(false)))
+ .setReturnType(
+ new ReturnType()
+ .setType(nameETAllPrim)
+ .setNullable(false))
+ );
+ } else if (functionName.equals(nameBFCESKeyNavRTETKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCESKeyNavRTETKeyNav")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETKeyNav)
+ .setNullable(false)
+ .setCollection(true)))
+ .setReturnType(
+ new ReturnType()
+ .setType(nameETKeyNav)
+ .setNullable(false))
+ );
+ } else if (functionName.equals(nameBFCETKeyNavRTETKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCETKeyNavRTETKeyNav")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETKeyNav)
+ .setNullable(false)))
+ .setReturnType(
+ new ReturnType()
+ .setType(nameETKeyNav)
+ .setNullable(false))
+ );
+ } else if (functionName.equals(nameBFESTwoKeyNavRTESTwoKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFESTwoKeyNavRTESTwoKeyNav")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETTwoKeyNav)
+ .setNullable(false)
+ .setCollection(true)))
+ .setReturnType(returnTypeCollectionETTwoKeyNav_NotNullable)
+ );
+ } else if (functionName.equals(nameBFCETTwoKeyNavRTETTwoKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCETTwoKeyNavRTETTwoKeyNav")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETTwoKeyNav)
+ .setNullable(false)))
+ .setReturnType(returnTypeETTwoKeyNav_NotNullable)
+ );
+ } else if (functionName.equals(nameBFCETTwoKeyNavRTCTTwoPrim)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCETTwoKeyNavRTCTTwoPrim")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETTwoKeyNav)
+ .setNullable(false)))
+ .setReturnType(
+ new ReturnType()
+ .setType(nameCTTwoPrim)
+ .setNullable(false))
+ );
+ } else if (functionName.equals(nameBFCESTwoKeyNavRTStringParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCESTwoKeyNavRTStringParam")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETTwoKeyNav)
+ .setNullable(false)
+ .setCollection(true),
+ new Parameter()
+ .setName("ParameterComplex")
+ .setType(nameCTTwoPrim)
+ .setNullable(false)))
+ .setReturnType(returnTypeString_NotNullable)
+ );
+ } else if (functionName.equals(nameBFCESKeyNavRTETKeyNavParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCESKeyNavRTETKeyNavParam")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameETKeyNav)
+ .setNullable(false)
+ .setCollection(true),
+ new Parameter()
+ .setName("ParameterString")
+ .setType(nameString)
+ .setNullable(false)))
+ .setReturnType(
+ new ReturnType()
+ .setType(nameETKeyNav)
+ .setNullable(false))
+ );
+ } else if (functionName.equals(nameBFCCTPrimCompRTETTwoKeyNavParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCCTPrimCompRTETTwoKeyNavParam")
+ .setBound(true)
+ .setComposable(true)
+ .setParameters(
+ Arrays.asList(
+ new Parameter()
+ .setName("BindingParam")
+ .setType(nameCTPrimComp)
+ .setNullable(false)
+ .setCollection(true),
+ new Parameter()
+ .setName("ParameterString")
+ .setType(nameString)
+ .setNullable(false)))
+ .setReturnType(returnTypeETTwoKeyNav_NotNullable)
+ );
+ }
+ return null;
+ // complete 20131210
+ }
+
+ @Override
+ public Singleton getSingleton(final FullQualifiedName entityContainer, final String name) throws ODataException {
+ if (entityContainer.equals(nameContainer)) {
+
+ if (name.equals("SI")) {
+ return new Singleton()
+ .setName("SI")
+ .setType(nameETTwoPrim);
+ } else if (name.equals("SINav")) {
+ return new Singleton()
+ .setName("SI")
+ .setType(nameETTwoKeyNav);
+ }
+
+ }
+ return null;
+ }
+
+ @Override
+ public ActionImport getActionImport(final FullQualifiedName entityContainer, final String name) throws ODataException
+ {
+ if (entityContainer.equals(nameContainer)) {
+ if (name.equals("AIRTPrimParam")) {
+ return new ActionImport()
+ .setName("AIRTPrimParam")
+ .setAction(nameUARTPrimParam);
+ } else if (name.equals("AIRTPrimCollParam")) {
+ return new ActionImport()
+ .setName("AIRTPrimCollParam")
+ .setAction(nameUARTPrimCollParam);
+ } else if (name.equals("AIRTCompParam")) {
+ return new ActionImport()
+ .setName("AIRTCompParam")
+ .setAction(nameUARTCompParam);
+ } else if (name.equals("AIRTCompCollParam")) {
+ return new ActionImport()
+ .setName("AIRTCompCollParam")
+ .setAction(nameUARTCompCollParam);
+ } else if (name.equals("AIRTETParam")) {
+ return new ActionImport()
+ .setName("AIRTETParam")
+ .setAction(nameUARTETParam);
+ } else if (name.equals("AIRTETCollAllPrimParam")) {
+ return new ActionImport()
+ .setName("AIRTETCollAllPrimParam")
+ .setAction(nameUARTETCollAllPrimParam);
+ }
}
+ return null;
+ }
+
+ @Override
+ public FunctionImport getFunctionImport(final FullQualifiedName entityContainer, final String name)
+ throws ODataException {
+
+ if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FINRTInt16")) {
+ return new FunctionImport()
+ .setName("FINRTInt16")
+ .setFunction(nameUFNRTInt16)
+ .setIncludeInServiceDocument(true);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FINInvisibleRTInt16")) {
+ return new FunctionImport()
+ .setName("FINInvisibleRTInt16")
+ .setFunction(nameUFNRTInt16)
+ .setIncludeInServiceDocument(false);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FINInvisible2RTInt16")) {
+ return new FunctionImport()
+ .setName("FINInvisible2RTInt16")
+ .setFunction(nameUFNRTInt16);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTETKeyNav")) {
+ return new FunctionImport()
+ .setName("FICRTETKeyNav")
+ .setFunction(nameUFCRTETKeyNav);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTETTwoKeyNavParam")) {
+ return new FunctionImport()
+ .setName("FICRTETTwoKeyNavParam")
+ .setFunction(nameUFCRTETTwoKeyNavParam)
+ .setIncludeInServiceDocument(true);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTStringTwoParam")) {
+ return new FunctionImport()
+ .setName("FICRTStringTwoParam")
+ .setFunction(nameUFCRTStringTwoParam)
+ .setIncludeInServiceDocument(true);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTCollStringTwoParam")) {
+ return new FunctionImport()
+ .setName("FICRTCollStringTwoParam")
+ .setFunction(nameUFCRTCollStringTwoParam)
+ .setIncludeInServiceDocument(true);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTCTAllPrimTwoParam")) {
+ return new FunctionImport()
+ .setName("FICRTCTAllPrimTwoParam")
+ .setFunction(nameUFCRTCTAllPrimTwoParam)
+ .setIncludeInServiceDocument(true);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTESMixPrimCollCompTwoParam")) {
+ return new FunctionImport()
+ .setName("FICRTESMixPrimCollCompTwoParam")
+ .setFunction(nameUFCRTESMixPrimCollCompTwoParam)
+ .setIncludeInServiceDocument(true);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FINRTESMixPrimCollCompTwoParam")) {
+ return new FunctionImport()
+ .setName("FINRTESMixPrimCollCompTwoParam")
+ .setFunction(nameUFNRTESMixPrimCollCompTwoParam)
+ .setIncludeInServiceDocument(true);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTCollCTTwoPrim")) {
+ return new FunctionImport()
+ .setName("FICRTCollCTTwoPrim")
+ .setFunction(nameUFCRTCollCTTwoPrim)
+ .setIncludeInServiceDocument(true);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTETMedia")) {
+ return new FunctionImport()
+ .setName("FICRTETMedia")
+ .setFunction(nameUFCRTETMedia)
+ .setIncludeInServiceDocument(true);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTCTTwoPrimParam")) {
+ return new FunctionImport()
+ .setName("FICRTCTTwoPrimParam")
+ .setFunction(nameUFCRTCTTwoPrimParam)
+ .setIncludeInServiceDocument(true);
- throw new ODataNotImplementedException();
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTCTTwoPrim")) {
+ return new FunctionImport()
+ .setName("FICRTCTTwoPrim")
+ .setFunction(nameUFCRTCTTwoPrim)
+ .setIncludeInServiceDocument(true);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTCollString")) {
+ return new FunctionImport()
+ .setName("FICRTCollString")
+ .setFunction(nameUFCRTCollString)
+ .setIncludeInServiceDocument(true);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTString")) {
+ return new FunctionImport()
+ .setName("FICRTString")
+ .setFunction(nameUFCRTString)
+ .setIncludeInServiceDocument(true);
+
+ }
+ } else if (entityContainer.equals(nameContainer)) {
+ if (name.equals("FICRTESTwoKeyNavParam")) {
+ return new FunctionImport()
+ .setName("FICRTESTwoKeyNavParam")
+ .setFunction(nameUFCRTESTwoKeyNavParam)
+ .setIncludeInServiceDocument(true);
+
+ }
+ }
+ return null;
}
}